diff options
author | dzwdz | 2022-05-02 18:08:54 +0200 |
---|---|---|
committer | dzwdz | 2022-05-02 18:08:54 +0200 |
commit | 5abfbff30588e70efb5fc414f32b4bbda333f3f8 (patch) | |
tree | 54879171161802e56f95ec6f53a128905f982b46 /src/kernel | |
parent | 5f6767972f1550c54dd6f28267dc3d882f67d7ed (diff) |
kernel/syscall: implement _syscall_close()
Diffstat (limited to 'src/kernel')
-rw-r--r-- | src/kernel/syscalls.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/kernel/syscalls.c b/src/kernel/syscalls.c index 285ce58..ffacdbc 100644 --- a/src/kernel/syscalls.c +++ b/src/kernel/syscalls.c @@ -155,9 +155,13 @@ int _syscall_write(handle_t handle_num, const void __user *buf, size_t len, int }); } -int _syscall_close(handle_t handle) { - if (handle < 0 || handle >= HANDLE_MAX) return -1; - return -1; +int _syscall_close(handle_t hid) { + if (hid < 0 || hid >= HANDLE_MAX) return -1; + struct handle **h = &process_current->handles[hid]; + if (!*h) return -1; + handle_close(*h); + *h = NULL; + return 0; } handle_t _syscall_fs_fork2(void) { |