diff mbox series

[v7,66/74] linux-user: Split out getrusage

Message ID 20190519203726.20729-67-richard.henderson@linaro.org
State New
Headers show
Series linux-user: Split do_syscall | expand

Commit Message

Richard Henderson May 19, 2019, 8:37 p.m. UTC
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

---
 linux-user/syscall-defs.h     |  1 +
 linux-user/syscall-proc.inc.c | 12 ++++++++++++
 linux-user/syscall.c          |  9 ---------
 linux-user/strace.list        |  3 ---
 4 files changed, 13 insertions(+), 12 deletions(-)

-- 
2.17.1
diff mbox series

Patch

diff --git a/linux-user/syscall-defs.h b/linux-user/syscall-defs.h
index 34426a2e23..446175af84 100644
--- a/linux-user/syscall-defs.h
+++ b/linux-user/syscall-defs.h
@@ -75,6 +75,7 @@  SYSCALL_DEF(getppid);
 #ifdef TARGET_NR_getrlimit
 SYSCALL_DEF(getrlimit, ARG_DEC, ARG_PTR);
 #endif
+SYSCALL_DEF(getrusage, ARG_DEC, ARG_PTR);
 SYSCALL_DEF(getsid, ARG_DEC);
 #ifdef TARGET_NR_getxpid
 SYSCALL_DEF(getxpid);
diff --git a/linux-user/syscall-proc.inc.c b/linux-user/syscall-proc.inc.c
index 1238b08191..bf9e278bf0 100644
--- a/linux-user/syscall-proc.inc.c
+++ b/linux-user/syscall-proc.inc.c
@@ -499,6 +499,18 @@  SYSCALL_IMPL(getrlimit)
     return ret;
 }
 #endif
+
+SYSCALL_IMPL(getrusage)
+{
+    struct rusage rusage;
+    abi_long ret = get_errno(getrusage(arg1, &rusage));
+
+    if (!is_error(ret)) {
+        ret = host_to_target_rusage(arg2, &rusage);
+    }
+    return ret;
+}
+
 SYSCALL_IMPL(getsid)
 {
     return get_errno(getsid(arg1));
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 401450b0e3..5fe52c775d 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -4240,15 +4240,6 @@  static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,
     void *p;
 
     switch(num) {
-    case TARGET_NR_getrusage:
-        {
-            struct rusage rusage;
-            ret = get_errno(getrusage(arg1, &rusage));
-            if (!is_error(ret)) {
-                ret = host_to_target_rusage(arg2, &rusage);
-            }
-        }
-        return ret;
     case TARGET_NR_gettimeofday:
         {
             struct timeval tv;
diff --git a/linux-user/strace.list b/linux-user/strace.list
index 711ad9c0aa..00a32bc616 100644
--- a/linux-user/strace.list
+++ b/linux-user/strace.list
@@ -283,9 +283,6 @@ 
 #ifdef TARGET_NR_get_robust_list
 { TARGET_NR_get_robust_list, "get_robust_list" , NULL, NULL, NULL },
 #endif
-#ifdef TARGET_NR_getrusage
-{ TARGET_NR_getrusage, "getrusage" , NULL, NULL, NULL },
-#endif
 #ifdef TARGET_NR_getsockname
 { TARGET_NR_getsockname, "getsockname" , NULL, NULL, NULL },
 #endif