diff options
author | dzwdz | 2021-08-25 11:29:44 +0200 |
---|---|---|
committer | dzwdz | 2021-08-25 11:29:44 +0200 |
commit | 75fc5c8f30b0a5dd5837df35948fc92861f30552 (patch) | |
tree | 548c596bb82bc78c552192f0cebd9d8c0772af3b /src/kernel/syscalls.c | |
parent | df3c01060a5dbeeb3b2ca75e371fa3c480a09f86 (diff) |
use a tagged union for the fdop args
Diffstat (limited to 'src/kernel/syscalls.c')
-rw-r--r-- | src/kernel/syscalls.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/kernel/syscalls.c b/src/kernel/syscalls.c index e0fb08b..bf17fd3 100644 --- a/src/kernel/syscalls.c +++ b/src/kernel/syscalls.c @@ -133,17 +133,28 @@ fail: int _syscall_fd_read(fd_t fd, user_ptr buf, int len) { if (fd < 0 || fd >= FD_MAX) return -1; - return fdop_dispatch(FDOP_READ, &process_current->fds[fd], buf, len); + return fdop_dispatch((struct fdop_args){ + .type = FDOP_READ, + .fd = &process_current->fds[fd], + .rw = {buf, len} + }); } int _syscall_fd_write(fd_t fd, user_ptr buf, int len) { if (fd < 0 || fd >= FD_MAX) return -1; - return fdop_dispatch(FDOP_WRITE, &process_current->fds[fd], buf, len); + return fdop_dispatch((struct fdop_args){ + .type = FDOP_WRITE, + .fd = &process_current->fds[fd], + .rw = {buf, len} + }); } int _syscall_fd_close(fd_t fd) { if (fd < 0 || fd >= FD_MAX) return -1; - return fdop_dispatch(FDOP_CLOSE, &process_current->fds[fd], 0, 0); + return fdop_dispatch((struct fdop_args){ + .type = FDOP_CLOSE, + .fd = &process_current->fds[fd], + }); } int syscall_handler(int num, int a, int b, int c) { |