Added the syscalls for sys_read_dir(), and sys_rewind_dir().

sys_read_dir() now has a parameter for the maximum number of dirents that
are handled by the upper layer - which is currently 1.
Added a comment in fd.h to ease the location of the sys|user prototypes
of the corresponding functions in fd.c.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@58 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2002-07-10 21:46:34 +00:00
parent 48894e06d7
commit f8d7610714
4 changed files with 9 additions and 6 deletions
+1 -3
View File
@@ -21,11 +21,9 @@ typedef struct dirent {
char d_name[1]; char d_name[1];
} dirent_t; } dirent_t;
// ToDo: this structure is still incompatible with BeOS
typedef struct { typedef struct {
int fd; int fd;
struct dirent *ent; struct dirent ent;
struct dirent me;
} DIR; } DIR;
#ifndef MAXNAMLEN #ifndef MAXNAMLEN
+2
View File
@@ -73,6 +73,8 @@ void put_fd(struct file_descriptor *);
void free_fd(struct file_descriptor *); void free_fd(struct file_descriptor *);
static struct io_context *get_current_io_context(bool kernel); static struct io_context *get_current_io_context(bool kernel);
/* The prototypes of the (sys|user)_ functions are currently defined in vfs.h */
/* Inlines */ /* Inlines */
+4 -1
View File
@@ -2,6 +2,7 @@
** Copyright 2001-2002, Travis Geiselbrecht. All rights reserved. ** Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
** Distributed under the terms of the NewOS License. ** Distributed under the terms of the NewOS License.
*/ */
#include <types.h> #include <types.h>
#ifndef _KERNEL_SYSCALLS_H #ifndef _KERNEL_SYSCALLS_H
#define _KERNEL_SYSCALLS_H #define _KERNEL_SYSCALLS_H
@@ -81,7 +82,9 @@ enum {
SYSCALL_SYSCTL, SYSCALL_SYSCTL,
SYSCALL_SOCKET, SYSCALL_SOCKET,
SYSCALL_GETDTABLESIZE, SYSCALL_GETDTABLESIZE,
SYSCALL_FSTAT SYSCALL_FSTAT,
SYSCALL_READ_DIR,
SYSCALL_REWIND_DIR,
}; };
int syscall_dispatcher(unsigned long call_num, void *arg_buffer, uint64 *call_ret); int syscall_dispatcher(unsigned long call_num, void *arg_buffer, uint64 *call_ret);
+2 -2
View File
@@ -147,7 +147,7 @@ int user_dup2(int ofd, int nfd);
extern ssize_t sys_read(int fd, void *buf, off_t pos, size_t len); extern ssize_t sys_read(int fd, void *buf, off_t pos, size_t len);
extern ssize_t sys_write(int fd, const void *buf, off_t pos, size_t len); extern ssize_t sys_write(int fd, const void *buf, off_t pos, size_t len);
extern int sys_ioctl(int fd, ulong cmd, void *data, size_t length); extern int sys_ioctl(int fd, ulong cmd, void *data, size_t length);
extern ssize_t sys_read_dir(int fd, struct dirent *buffer, size_t bufferSize); extern ssize_t sys_read_dir(int fd, struct dirent *buffer, size_t bufferSize, uint32 maxCount);
extern status_t sys_rewind_dir(int fd); extern status_t sys_rewind_dir(int fd);
extern int sys_rstat(const char *path, struct stat *stat); extern int sys_rstat(const char *path, struct stat *stat);
extern int sys_close(int fd); extern int sys_close(int fd);
@@ -157,7 +157,7 @@ extern int sys_close(int fd);
extern ssize_t user_read(int fd, void *buf, off_t pos, size_t len); extern ssize_t user_read(int fd, void *buf, off_t pos, size_t len);
extern ssize_t user_write(int fd, const void *buf, off_t pos, size_t len); extern ssize_t user_write(int fd, const void *buf, off_t pos, size_t len);
extern int user_ioctl(int fd, ulong cmd, void *data, size_t length); extern int user_ioctl(int fd, ulong cmd, void *data, size_t length);
extern ssize_t user_read_dir(int fd, struct dirent *buffer, size_t bufferSize); extern ssize_t user_read_dir(int fd, struct dirent *buffer, size_t bufferSize, uint32 maxCount);
extern status_t user_rewind_dir(int fd); extern status_t user_rewind_dir(int fd);
extern int user_fstat(int, struct stat *); extern int user_fstat(int, struct stat *);
extern int user_close(int fd); extern int user_close(int fd);