From 6992b829a0544d3e96b0320ba3a77609a322ba15 Mon Sep 17 00:00:00 2001 From: NAKAMURA Gou Date: Wed, 8 Jan 2014 12:52:37 +0900 Subject: [PATCH] delegate the open(2) with the generic forwarding. This commit solves a problem that causes getpwnam()/getpwuid() to return NULL. --- arch/x86/kernel/include/syscall_list.h | 2 +- executer/user/mcexec.c | 12 ++++-------- kernel/syscall.c | 9 --------- 3 files changed, 5 insertions(+), 18 deletions(-) diff --git a/arch/x86/kernel/include/syscall_list.h b/arch/x86/kernel/include/syscall_list.h index 89749c3c..af5f543c 100644 --- a/arch/x86/kernel/include/syscall_list.h +++ b/arch/x86/kernel/include/syscall_list.h @@ -22,7 +22,7 @@ SYSCALL_DELEGATED(0, read) SYSCALL_DELEGATED(1, write) -SYSCALL_HANDLED(2, open) +SYSCALL_DELEGATED(2, open) SYSCALL_DELEGATED(3, close) SYSCALL_DELEGATED(4, stat) SYSCALL_DELEGATED(5, fstat) diff --git a/executer/user/mcexec.c b/executer/user/mcexec.c index 4ab30576..437cb0fa 100644 --- a/executer/user/mcexec.c +++ b/executer/user/mcexec.c @@ -924,15 +924,11 @@ int main_loop(int fd, int cpu, pthread_mutex_t *lock) switch (w.sr.number) { case __NR_open: - dma_buf[256] = 0; - - do_syscall_load(fd, cpu, (unsigned long)dma_buf, w.sr.args[0], 256); - /* - while (!dma_buf[256]) { - asm volatile ("" : : : "memory"); + ret = do_strncpy_from_user(fd, dma_buf, (void *)w.sr.args[0], PIN_SIZE); + if (ret < 0) { + do_syscall_return(fd, cpu, ret, 0, 0, 0, 0); + break; } - */ - __dprintf("open: %s\n", dma_buf); fn = (char *)dma_buf; diff --git a/kernel/syscall.c b/kernel/syscall.c index 311237e7..30b301f7 100644 --- a/kernel/syscall.c +++ b/kernel/syscall.c @@ -214,15 +214,6 @@ long syscall_generic_forwarding(int n, ihk_mc_user_context_t *ctx) SYSCALL_FOOTER; } -SYSCALL_DECLARE(open) -{ - - SYSCALL_HEADER; - dkprintf("open: %s\n", (char*)ihk_mc_syscall_arg0(ctx)); - SYSCALL_ARGS_3(MI, D, D); - SYSCALL_FOOTER; -} - void terminate(int rc, int sig, ihk_mc_user_context_t *ctx) {