[v2,079/108] linux-user: Split out getegid32, geteuid32, getgid32, setregid32, setreuid32

Message ID 20180610030220.3777-80-richard.henderson@linaro.org
State New
Headers show
Series
  • linux-user: Split do_syscall
Related show

Commit Message

Richard Henderson June 10, 2018, 3:01 a.m.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

---
 linux-user/syscall.c | 70 +++++++++++++++++++++++++++++++-------------
 1 file changed, 50 insertions(+), 20 deletions(-)

-- 
2.17.1

Patch

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index ae591a6523..c8bd13092e 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -8482,6 +8482,13 @@  IMPL(getegid)
 }
 #endif
 
+#ifdef TARGET_NR_getegid32
+IMPL(getegid32)
+{
+    return get_errno(getegid());
+}
+#endif
+
 #ifdef TARGET_NR_geteuid
 IMPL(geteuid)
 {
@@ -8489,6 +8496,13 @@  IMPL(geteuid)
 }
 #endif
 
+#ifdef TARGET_NR_geteuid32
+IMPL(geteuid32)
+{
+    return get_errno(geteuid());
+}
+#endif
+
 #ifdef TARGET_NR_getgid
 IMPL(getgid)
 {
@@ -8496,6 +8510,13 @@  IMPL(getgid)
 }
 #endif
 
+#ifdef TARGET_NR_getgid32
+IMPL(getgid32)
+{
+    return get_errno(getgid());
+}
+#endif
+
 IMPL(getgroups)
 {
     int gidsetsize = arg1;
@@ -10812,6 +10833,13 @@  IMPL(setregid)
     return get_errno(setregid(low2highgid(arg1), low2highgid(arg2)));
 }
 
+#ifdef TARGET_NR_setregid32
+IMPL(setregid32)
+{
+    return get_errno(setregid(arg1, arg2));
+}
+#endif
+
 #ifdef TARGET_NR_setresgid
 IMPL(setresgid)
 {
@@ -10833,6 +10861,13 @@  IMPL(setreuid)
     return get_errno(setreuid(low2highuid(arg1), low2highuid(arg2)));
 }
 
+#ifdef TARGET_NR_setreuid32
+IMPL(setreuid32)
+{
+    return get_errno(setreuid(arg1, arg2));
+}
+#endif
+
 IMPL(setrlimit)
 {
     int resource = target_to_host_resource(arg1);
@@ -11805,26 +11840,6 @@  static abi_long do_syscall1(void *cpu_env, unsigned num, abi_long arg1,
     void *p;
 
     switch(num) {
-#ifdef TARGET_NR_getgid32
-    case TARGET_NR_getgid32:
-        return get_errno(getgid());
-#endif
-#ifdef TARGET_NR_geteuid32
-    case TARGET_NR_geteuid32:
-        return get_errno(geteuid());
-#endif
-#ifdef TARGET_NR_getegid32
-    case TARGET_NR_getegid32:
-        return get_errno(getegid());
-#endif
-#ifdef TARGET_NR_setreuid32
-    case TARGET_NR_setreuid32:
-        return get_errno(setreuid(arg1, arg2));
-#endif
-#ifdef TARGET_NR_setregid32
-    case TARGET_NR_setregid32:
-        return get_errno(setregid(arg1, arg2));
-#endif
 #ifdef TARGET_NR_getgroups32
     case TARGET_NR_getgroups32:
         {
@@ -13168,11 +13183,20 @@  static impl_fn *syscall_table(unsigned num)
 #ifdef TARGET_NR_getegid
         SYSCALL(getegid);
 #endif
+#ifdef TARGET_NR_getegid32
+        SYSCALL(getegid32);
+#endif
 #ifdef TARGET_NR_geteuid
         SYSCALL(geteuid);
 #endif
+#ifdef TARGET_NR_geteuid32
+        SYSCALL(geteuid32);
+#endif
 #ifdef TARGET_NR_getgid
         SYSCALL(getgid);
+#endif
+#ifdef TARGET_NR_getgid32
+        SYSCALL(getgid32);
 #endif
         SYSCALL(getgroups);
         SYSCALL(getitimer);
@@ -13447,10 +13471,16 @@  static impl_fn *syscall_table(unsigned num)
 #ifdef TARGET_NR_setresgid
         SYSCALL(setresgid);
 #endif
+#ifdef TARGET_NR_setregid32
+        SYSCALL(setregid32);
+#endif
 #ifdef TARGET_NR_setresuid
         SYSCALL(setresuid);
 #endif
         SYSCALL(setreuid);
+#ifdef TARGET_NR_setreuid32
+        SYSCALL(setreuid32);
+#endif
         SYSCALL(setrlimit);
 #ifdef TARGET_NR_setsockopt
         SYSCALL(setsockopt);