summaryrefslogtreecommitdiff
path: root/src/kernel/syscalls.c
diff options
context:
space:
mode:
authordzwdz2022-07-29 18:45:47 +0200
committerdzwdz2022-07-29 18:45:47 +0200
commita658e1068eb2f849736931d2b99bcb6290c7ec0a (patch)
treefd2f6d31cf74799aa7318524bea7c707767e6b0e /src/kernel/syscalls.c
parentc6424fbc55298399f133ca1ede11e1f0b4a5c824 (diff)
syscall: up the max argument count to 5; make write accept flags
Diffstat (limited to 'src/kernel/syscalls.c')
-rw-r--r--src/kernel/syscalls.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/kernel/syscalls.c b/src/kernel/syscalls.c
index 9c4e2fa..0dec4c5 100644
--- a/src/kernel/syscalls.c
+++ b/src/kernel/syscalls.c
@@ -1,3 +1,4 @@
+#include <camellia/errno.h>
#include <camellia/flags.h>
#include <camellia/syscalls.h>
#include <kernel/arch/generic.h>
@@ -229,9 +230,11 @@ long _syscall_read(handle_t handle_num, void __user *buf, size_t len, long offse
return -1; // dummy
}
-long _syscall_write(handle_t handle_num, const void __user *buf, size_t len, long offset) {
+long _syscall_write(handle_t handle_num, const void __user *buf, size_t len, long offset, int flags) {
struct handle *h = process_handle_get(process_current, handle_num);
if (!h) SYSCALL_RETURN(-1);
+ if (flags != 0)
+ SYSCALL_RETURN(-ENOSYS);
switch (h->type) {
case HANDLE_FILE:
vfsreq_create((struct vfs_request) {
@@ -244,6 +247,7 @@ long _syscall_write(handle_t handle_num, const void __user *buf, size_t len, lon
.offset = offset,
.caller = process_current,
.backend = h->backend,
+ .flags = flags
});
break;
case HANDLE_PIPE:
@@ -387,7 +391,7 @@ void _syscall_debug_klog(const void __user *buf, size_t len) {
// kprintf("[klog] %x\t%s\n", process_current->id, kbuf);
}
-long _syscall(long num, long a, long b, long c, long d) {
+long _syscall(long num, long a, long b, long c, long d, long e) {
/* note: this isn't the only place where syscalls get called from!
* see execbuf */
switch (num) {
@@ -413,7 +417,7 @@ long _syscall(long num, long a, long b, long c, long d) {
_syscall_read(a, (userptr_t)b, c, d);
break;
case _SYSCALL_WRITE:
- _syscall_write(a, (userptr_t)b, c, d);
+ _syscall_write(a, (userptr_t)b, c, d, e);
break;
case _SYSCALL_CLOSE:
_syscall_close(a);