diff mbox series

[29/33] linux-user: Split out getpgrp, getppid, setsid

Message ID 20180601073050.8054-30-richard.henderson@linaro.org
State New
Headers show
Series linux-user: Begin splitting do_syscall | expand

Commit Message

Richard Henderson June 1, 2018, 7:30 a.m. UTC
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

---
 linux-user/syscall.c | 36 ++++++++++++++++++++++++++----------
 1 file changed, 26 insertions(+), 10 deletions(-)

-- 
2.17.0
diff mbox series

Patch

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 4d9b9cad6e..3dfb77ac11 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -8182,6 +8182,13 @@  IMPL(futimesat)
 }
 #endif
 
+#ifdef TARGET_NR_getpgrp
+IMPL(getpgrp)
+{
+    return get_errno(getpgrp());
+}
+#endif
+
 #ifdef TARGET_NR_getpid
 IMPL(getpid)
 {
@@ -8189,6 +8196,13 @@  IMPL(getpid)
 }
 #endif
 
+#ifdef TARGET_NR_getppid
+IMPL(getppid)
+{
+    return get_errno(getppid());
+}
+#endif
+
 #if defined(TARGET_NR_getxpid) && defined(TARGET_ALPHA)
 IMPL(getxpid)
 {
@@ -8721,6 +8735,11 @@  IMPL(setpgid)
     return get_errno(setpgid(arg1, arg2));
 }
 
+IMPL(setsid)
+{
+    return get_errno(setsid());
+}
+
 #ifdef TARGET_NR_stime
 IMPL(stime)
 {
@@ -8972,16 +8991,6 @@  IMPL(everything_else)
     char *fn;
 
     switch(num) {
-#ifdef TARGET_NR_getppid /* not on alpha */
-    case TARGET_NR_getppid:
-        return get_errno(getppid());
-#endif
-#ifdef TARGET_NR_getpgrp
-    case TARGET_NR_getpgrp:
-        return get_errno(getpgrp());
-#endif
-    case TARGET_NR_setsid:
-        return get_errno(setsid());
 #ifdef TARGET_NR_sigaction
     case TARGET_NR_sigaction:
         {
@@ -13020,9 +13029,15 @@  static impl_fn * const syscall_table[] = {
 #ifdef TARGET_NR_futimesat
     [TARGET_NR_futimesat] = impl_futimesat,
 #endif
+#ifdef TARGET_NR_getpgrp
+    [TARGET_NR_getpgrp] = impl_getpgrp,
+#endif
 #ifdef TARGET_NR_getpid
     [TARGET_NR_getpid] = impl_getpid,
 #endif
+#ifdef TARGET_NR_getppid
+    [TARGET_NR_getppid] = impl_getppid,
+#endif
 #if defined(TARGET_NR_getxpid) && defined(TARGET_ALPHA)
     [TARGET_NR_getxpid] = impl_getxpid,
 #endif
@@ -13084,6 +13099,7 @@  static impl_fn * const syscall_table[] = {
     [TARGET_NR_rmdir] = impl_rmdir,
 #endif
     [TARGET_NR_setpgid] = impl_setpgid,
+    [TARGET_NR_setsid] = impl_setsid,
 #ifdef TARGET_NR_stime
     [TARGET_NR_stime] = impl_stime,
 #endif