From 36d473c5b5c97123e31f91e333b6fc5db0d05b24 Mon Sep 17 00:00:00 2001 From: Dominique Martinet Date: Tue, 29 Jan 2019 12:52:15 +0900 Subject: [PATCH] pager linux_open/unlink: always use openat/unlinkat some archs do not have the simple open/unlink variants, while the *at is always available -- this is simpler than making these arch-dependent functions Change-Id: Ic16ae5683e6e375210b1744538d291585e67a2fa Fujitsu: POSTK_DEBUG_ARCH_DEP_78 --- kernel/pager.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/kernel/pager.c b/kernel/pager.c index f6b2cb0b..b06c7f02 100644 --- a/kernel/pager.c +++ b/kernel/pager.c @@ -168,12 +168,13 @@ static int linux_open(char *fname, int flag, int mode) { ihk_mc_user_context_t ctx0; - int fd; + int fd; - ihk_mc_syscall_arg0(&ctx0) = (uintptr_t) fname; - ihk_mc_syscall_arg1(&ctx0) = flag; - ihk_mc_syscall_arg2(&ctx0) = mode; - fd = syscall_generic_forwarding(__NR_open, &ctx0); + ihk_mc_syscall_arg0(&ctx0) = -100; /* dirfd = AT_FDCWD */ + ihk_mc_syscall_arg1(&ctx0) = (uintptr_t)fname; /* pathname = fname */ + ihk_mc_syscall_arg2(&ctx0) = flag; /* flags = flag */ + ihk_mc_syscall_arg3(&ctx0) = mode; /* mode = mode */ + fd = syscall_generic_forwarding(__NR_openat, &ctx0); return fd; } @@ -182,8 +183,10 @@ linux_unlink(char *fname) { ihk_mc_user_context_t ctx0; - ihk_mc_syscall_arg0(&ctx0) = (uintptr_t) fname; - return syscall_generic_forwarding(__NR_unlink, &ctx0); + ihk_mc_syscall_arg0(&ctx0) = -100; /* dirfd = AT_FDCWD */ + ihk_mc_syscall_arg1(&ctx0) = (uintptr_t)fname; /* pathname = fname */ + ihk_mc_syscall_arg2(&ctx0) = 0; /* flags = 0 */ + return syscall_generic_forwarding(__NR_unlinkat, &ctx0); } static ssize_t