diff options
author | dzwdz | 2021-09-20 19:30:37 +0200 |
---|---|---|
committer | dzwdz | 2021-09-20 19:30:37 +0200 |
commit | 6371724809b057b25a4efd6c022e7d95068c42f1 (patch) | |
tree | 5cc6484ae767cd27f2ae4ccd24c0fb01e9beb163 /src/kernel/syscalls.c | |
parent | 9a08099fb7148a69b0655f0e559661b1021b17b5 (diff) |
add an offset parameter to read() and write()
Diffstat (limited to 'src/kernel/syscalls.c')
-rw-r--r-- | src/kernel/syscalls.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/kernel/syscalls.c b/src/kernel/syscalls.c index bc185bd..d321d33 100644 --- a/src/kernel/syscalls.c +++ b/src/kernel/syscalls.c @@ -136,7 +136,7 @@ fail: return -1; } -int _syscall_read(handle_t handle_num, char __user *buf, int len) { +int _syscall_read(handle_t handle_num, char __user *buf, int len, int offset) { struct handle *handle = &process_current->handles[handle_num]; if (handle_num < 0 || handle_num >= HANDLE_MAX) return -1; if (handle->type != HANDLE_FILE) return -1; @@ -147,12 +147,13 @@ int _syscall_read(handle_t handle_num, char __user *buf, int len) { .len = len, }, .id = handle->file.id, + .offset = offset, .caller = process_current, .backend = handle->file.backend, }); } -int _syscall_write(handle_t handle_num, const char __user *buf, int len) { +int _syscall_write(handle_t handle_num, const char __user *buf, int len, int offset) { struct handle *handle = &process_current->handles[handle_num]; if (handle_num < 0 || handle_num >= HANDLE_MAX) return -1; if (handle->type != HANDLE_FILE) return -1; @@ -163,6 +164,7 @@ int _syscall_write(handle_t handle_num, const char __user *buf, int len) { .len = len, }, .id = handle->file.id, + .offset = offset, .caller = process_current, .backend = handle->file.backend, }); @@ -286,9 +288,9 @@ int _syscall(int num, int a, int b, int c, int d) { case _SYSCALL_MOUNT: return _syscall_mount(a, (userptr_t)b, c); case _SYSCALL_READ: - return _syscall_read(a, (userptr_t)b, c); + return _syscall_read(a, (userptr_t)b, c, d); case _SYSCALL_WRITE: - return _syscall_write(a, (userptr_t)b, c); + return _syscall_write(a, (userptr_t)b, c, d); case _SYSCALL_CLOSE: return _syscall_close(a); case _SYSCALL_FS_CREATE: |