From 3a976c607e0bfc743a182447a688316594727197 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Wed, 27 Mar 2024 19:30:39 -0400 Subject: kernel: Implement lseek() Signed-off-by: Ian Moffett --- sys/include/sys/filedesc.h | 7 ++++++- sys/include/sys/syscall.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'sys/include') diff --git a/sys/include/sys/filedesc.h b/sys/include/sys/filedesc.h index 70b297d..83c32ee 100644 --- a/sys/include/sys/filedesc.h +++ b/sys/include/sys/filedesc.h @@ -39,6 +39,10 @@ #define O_WRONLY 0x00001 #define O_RDWR 0x00002 +#define SEEK_SET 0 +#define SEEK_CUR 1 +#define SEEK_END 2 + struct proc; struct filedesc { @@ -56,11 +60,12 @@ void fd_close_fdnum(struct proc *td, int fdno); ssize_t write(int fd, const void *buf, size_t count); int open(const char *pathname, int oflag); int read(int fd, void *buf, size_t count); +off_t lseek(int fd, off_t offset, int whence); uint64_t sys_write(struct syscall_args *args); uint64_t sys_open(struct syscall_args *args); uint64_t sys_close(struct syscall_args *args); uint64_t sys_read(struct syscall_args *args); +uint64_t sys_lseek(struct syscall_args *args); #endif - #endif diff --git a/sys/include/sys/syscall.h b/sys/include/sys/syscall.h index ae2438f..8ebc2da 100644 --- a/sys/include/sys/syscall.h +++ b/sys/include/sys/syscall.h @@ -42,6 +42,7 @@ enum { SYS_open, SYS_close, SYS_read, + SYS_lseek, __MAX_SYSCALLS }; -- cgit v1.2.3