@@ -279,6 +279,8 @@ SYSCALL_DEF(ssetmask, ARG_HEX);
#ifdef TARGET_NR_stime
SYSCALL_DEF(stime, ARG_PTR);
#endif
+SYSCALL_DEF(swapoff, ARG_STR);
+SYSCALL_DEF(swapon, ARG_STR, ARG_HEX);
#ifdef TARGET_NR_symlink
SYSCALL_DEF(symlink, ARG_STR, ARG_STR);
#endif
@@ -1254,6 +1254,32 @@ SYSCALL_IMPL(select)
}
#endif
+SYSCALL_IMPL(swapoff)
+{
+ char *p = lock_user_string(arg1);
+ abi_long ret;
+
+ if (!p) {
+ return -TARGET_EFAULT;
+ }
+ ret = get_errno(swapoff(p));
+ unlock_user(p, arg1, 0);
+ return ret;
+}
+
+SYSCALL_IMPL(swapon)
+{
+ char *p = lock_user_string(arg1);
+ abi_long ret;
+
+ if (!p) {
+ return -TARGET_EFAULT;
+ }
+ ret = get_errno(swapon(p, arg2));
+ unlock_user(p, arg1, 0);
+ return ret;
+}
+
static abi_long do_symlinkat(abi_ulong guest_target, int dirfd,
abi_ulong guest_path)
{
@@ -4158,14 +4158,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,
void *p;
switch(num) {
-#ifdef TARGET_NR_swapon
- case TARGET_NR_swapon:
- if (!(p = lock_user_string(arg1)))
- return -TARGET_EFAULT;
- ret = get_errno(swapon(p, arg2));
- unlock_user(p, arg1, 0);
- return ret;
-#endif
case TARGET_NR_reboot:
if (arg3 == LINUX_REBOOT_CMD_RESTART2) {
/* arg4 must be ignored in all other cases */
@@ -4503,14 +4495,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,
case TARGET_NR_syscall:
return do_syscall(cpu_env, arg1 & 0xffff, arg2, arg3, arg4, arg5,
arg6, arg7, arg8, 0);
-#endif
-#ifdef TARGET_NR_swapoff
- case TARGET_NR_swapoff:
- if (!(p = lock_user_string(arg1)))
- return -TARGET_EFAULT;
- ret = get_errno(swapoff(p));
- unlock_user(p, arg1, 0);
- return ret;
#endif
case TARGET_NR_sysinfo:
{
@@ -1116,12 +1116,6 @@
#ifdef TARGET_NR_swapcontext
{ TARGET_NR_swapcontext, "swapcontext" , NULL, NULL, NULL },
#endif
-#ifdef TARGET_NR_swapoff
-{ TARGET_NR_swapoff, "swapoff" , NULL, NULL, NULL },
-#endif
-#ifdef TARGET_NR_swapon
-{ TARGET_NR_swapon, "swapon" , NULL, NULL, NULL },
-#endif
#ifdef TARGET_NR_syscall
{ TARGET_NR_syscall, "syscall" , NULL, NULL, NULL },
#endif
Signed-off-by: Richard Henderson <richard.henderson@linaro.org> --- linux-user/syscall-defs.h | 2 ++ linux-user/syscall-file.inc.c | 26 ++++++++++++++++++++++++++ linux-user/syscall.c | 16 ---------------- linux-user/strace.list | 6 ------ 4 files changed, 28 insertions(+), 22 deletions(-) -- 2.17.1