From c16d956c0dd3d69748f7208e09bb69a6df8c6483 Mon Sep 17 00:00:00 2001 From: dzwdz Date: Fri, 2 Sep 2022 14:44:52 +0200 Subject: kernel/proc: introduce child ids for telling children apart --- src/kernel/syscalls.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/kernel/syscalls.c') diff --git a/src/kernel/syscalls.c b/src/kernel/syscalls.c index 37a0ce3..62acf5f 100644 --- a/src/kernel/syscalls.c +++ b/src/kernel/syscalls.c @@ -76,7 +76,7 @@ long _syscall_fork(int flags, handle_t __user *fs_front) { virt_cpy_to(process_current->pages, fs_front, &hid, sizeof hid); } } - SYSCALL_RETURN(1); + SYSCALL_RETURN(child->cid); } handle_t _syscall_open(const char __user *path, long len, int flags) { @@ -379,12 +379,13 @@ long _syscall_execbuf(void __user *ubuf, size_t len) { } void _syscall_debug_klog(const void __user *buf, size_t len) { - (void)buf; (void)len; - // static char kbuf[256]; - // if (len >= sizeof(kbuf)) len = sizeof(kbuf) - 1; - // virt_cpy_from(process_current->pages, kbuf, buf, len); - // kbuf[len] = '\0'; - // kprintf("[klog] %x\t%s\n", process_current->id, kbuf); + if (false) { + static char kbuf[256]; + if (len >= sizeof(kbuf)) len = sizeof(kbuf) - 1; + virt_cpy_from(process_current->pages, kbuf, buf, len); + kbuf[len] = '\0'; + kprintf("[klog] %x\t%s\n", process_current->globalid, kbuf); + } } long _syscall(long num, long a, long b, long c, long d, long e) { -- cgit v1.2.3