diff mbox series

[v2,076/108] linux-user: Split out setfsgid, setfsuid, setgid, setuid

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

Commit Message

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

---
 linux-user/syscall.c | 33 ++++++++++++++++++++++++---------
 1 file changed, 24 insertions(+), 9 deletions(-)

-- 
2.17.1
diff mbox series

Patch

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index c55c414239..76a66b56fe 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -10533,6 +10533,21 @@  IMPL(setdomainname)
     return ret;
 }
 
+IMPL(setfsgid)
+{
+    return get_errno(setfsgid(arg1));
+}
+
+IMPL(setfsuid)
+{
+    return get_errno(setfsuid(arg1));
+}
+
+IMPL(setgid)
+{
+    return get_errno(sys_setgid(low2highgid(arg1)));
+}
+
 IMPL(setgroups)
 {
     int gidsetsize = arg1;
@@ -10668,6 +10683,11 @@  IMPL(setsid)
     return get_errno(setsid());
 }
 
+IMPL(setuid)
+{
+    return get_errno(sys_setuid(low2highuid(arg1)));
+}
+
 #ifdef TARGET_NR_sigaction
 IMPL(sigaction)
 {
@@ -11594,15 +11614,6 @@  static abi_long do_syscall1(void *cpu_env, unsigned num, abi_long arg1,
     void *p;
 
     switch(num) {
-    case TARGET_NR_setuid:
-        return get_errno(sys_setuid(low2highuid(arg1)));
-    case TARGET_NR_setgid:
-        return get_errno(sys_setgid(low2highgid(arg1)));
-    case TARGET_NR_setfsuid:
-        return get_errno(setfsuid(arg1));
-    case TARGET_NR_setfsgid:
-        return get_errno(setfsgid(arg1));
-
 #ifdef TARGET_NR_lchown32
     case TARGET_NR_lchown32:
         if (!(p = lock_user_string(arg1)))
@@ -13406,6 +13417,9 @@  static impl_fn *syscall_table(unsigned num)
         SYSCALL(sendto);
 #endif
         SYSCALL(setdomainname);
+        SYSCALL(setfsgid);
+        SYSCALL(setfsuid);
+        SYSCALL(setgid);
         SYSCALL(setgroups);
         SYSCALL(sethostname);
         SYSCALL(setitimer);
@@ -13425,6 +13439,7 @@  static impl_fn *syscall_table(unsigned num)
 #endif
         SYSCALL(settimeofday);
         SYSCALL(setsid);
+        SYSCALL(setuid);
 #ifdef TARGET_NR_sigaction
         SYSCALL(sigaction);
 #endif