diff options
Diffstat (limited to 'src/sys/include')
-rw-r--r-- | src/sys/include/compat/unix/syscall.h | 8 | ||||
-rw-r--r-- | src/sys/include/os/filedesc.h | 12 | ||||
-rw-r--r-- | src/sys/include/sys/syscall.h | 1 |
3 files changed, 20 insertions, 1 deletions
diff --git a/src/sys/include/compat/unix/syscall.h b/src/sys/include/compat/unix/syscall.h index 8b7e7d7..be351e8 100644 --- a/src/sys/include/compat/unix/syscall.h +++ b/src/sys/include/compat/unix/syscall.h @@ -63,6 +63,11 @@ scret_t sys_query(struct syscall_args *scargs); */ scret_t sys_open(struct syscall_args *scargs); +/* + * Read a file + */ +scret_t sys_read(struct syscall_args *scargs); + #ifdef _NEED_UNIX_SCTAB scret_t(*g_unix_sctab[])(struct syscall_args *) = { [SYS_none] = NULL, @@ -77,7 +82,8 @@ scret_t(*g_unix_sctab[])(struct syscall_args *) = { [SYS_getargv] = sys_getargv, [SYS_reboot] = sys_reboot, [SYS_waitpid] = sys_waitpid, - [SYS_dmsio] = sys_dmsio + [SYS_dmsio] = sys_dmsio, + [SYS_read] = sys_read }; #endif /* !_NEED_UNIX_SCTAB */ diff --git a/src/sys/include/os/filedesc.h b/src/sys/include/os/filedesc.h index 0023526..8cdf161 100644 --- a/src/sys/include/os/filedesc.h +++ b/src/sys/include/os/filedesc.h @@ -93,4 +93,16 @@ int fd_open(const char *path, mode_t mode); */ ssize_t write(int fd, const void *buf, size_t count); +/* + * Read a file descriptor + * + * @fd: File descriptor to read from + * @buf: Buffer to read into + * @count: Number of bytes to read + * + * Returns the number of bytes read on success, otherwise a less + * than zero value on error. + */ +ssize_t read(int fd, void *buf, size_t count); + #endif /* !_OS_FILEDESC_H_ */ diff --git a/src/sys/include/sys/syscall.h b/src/sys/include/sys/syscall.h index 2ff6087..1138029 100644 --- a/src/sys/include/sys/syscall.h +++ b/src/sys/include/sys/syscall.h @@ -56,6 +56,7 @@ #define SYS_reboot 0x0B /* reboot the system */ #define SYS_waitpid 0x0C /* wait for child to exit */ #define SYS_dmsio 0x0D /* DMS I/O */ +#define SYS_read 0x0E /* read a file descriptor */ typedef __ssize_t scret_t; typedef __ssize_t scarg_t; |