summaryrefslogtreecommitdiff
path: root/src/kernel/syscalls.c
diff options
context:
space:
mode:
authordzwdz2022-08-04 23:06:57 +0200
committerdzwdz2022-08-04 23:06:57 +0200
commitce00d1677d7a419b427e7f11963eee982a55a231 (patch)
tree2662c3861226f6909b83d57ff8b6ac3b2ba5ec8d /src/kernel/syscalls.c
parent26dc784103914b9d6ba36e0a96fa4b3af977626f (diff)
do some simple TODOs, organize the rest; general code maintainance
Diffstat (limited to 'src/kernel/syscalls.c')
-rw-r--r--src/kernel/syscalls.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/kernel/syscalls.c b/src/kernel/syscalls.c
index ceba528..0ab6106 100644
--- a/src/kernel/syscalls.c
+++ b/src/kernel/syscalls.c
@@ -1,4 +1,5 @@
#include <camellia/errno.h>
+#include <camellia/execbuf.h>
#include <camellia/flags.h>
#include <camellia/syscalls.h>
#include <kernel/arch/generic.h>
@@ -32,7 +33,7 @@ long _syscall_await(void) {
{
if (iter->noreap) continue;
has_children = true;
- if (iter->state == PS_DEAD) // TODO this path used to crash, still untested
+ if (iter->state == PS_DEAD)
SYSCALL_RETURN(process_try2collect(iter));
}
@@ -276,10 +277,9 @@ long _syscall_fs_wait(char __user *buf, long max_len, struct fs_wait_response __
if (!backend) SYSCALL_RETURN(-1);
process_transition(process_current, PS_WAITS4REQUEST);
- assert(!backend->user.handler); // TODO allow multiple processes to wait on the same backend
+ if (backend->user.handler)
+ panic_unimplemented();
backend->user.handler = process_current;
- /* checking the validity of those pointers here would make
- * vfs_backend_accept simpler. TODO? */
process_current->awaited_req.buf = buf;
process_current->awaited_req.max_len = max_len;
process_current->awaited_req.res = res;
@@ -370,11 +370,11 @@ void _syscall_sleep(long ms) {
long _syscall_execbuf(void __user *ubuf, size_t len) {
if (len == 0) SYSCALL_RETURN(0);
- if (len > sizeof(uint64_t) * 6 * 4) // TODO specify max size somewhere
+ if (len > EXECBUF_MAX_LEN)
SYSCALL_RETURN(-1);
if (process_current->execbuf.buf)
- SYSCALL_RETURN(-1); /* no nesting */
- // actually TODO, nesting makes sense for infinite loops. maybe
+ SYSCALL_RETURN(-1);
+ // TODO consider supporting nesting execbufs
char *kbuf = kmalloc(len);
if (!virt_cpy_from(process_current->pages, kbuf, ubuf, len)) {