]> granicus.if.org Git - strace/commitdiff
2003-03-12 Roland McGrath <roland@redhat.com>
authorRoland McGrath <roland@redhat.com>
Wed, 12 Mar 2003 09:54:36 +0000 (09:54 +0000)
committerRoland McGrath <roland@redhat.com>
Wed, 12 Mar 2003 09:54:36 +0000 (09:54 +0000)
* linux/ia64/syscallent.h: Fix arg counts for clone and clone2.
Use sys_clone for clone2.
* linux/syscall.h: Don't declare sys_clone2.
* process.c (sys_clone): Rewritten to handle both flavors,
print all extra args depending on flag bits.
(sys_clone2): Function removed.

linux/ia64/syscallent.h
linux/syscall.h
process.c

index 9c289e2d357d6e61971108301304270bc21078a2..5ee5088ceee698bd0fd7b822c4155513f10d6f0c 100644 (file)
        { 5,    0,      printargs,              "vm86"          }, /* 1125 */
        { 4,    TP,     sys_wait4,              "wait4"         }, /* 1126 */
        { 1,    0,      sys_sysinfo,            "sysinfo"       }, /* 1127 */
-       { 2,    TP,     sys_clone,              "clone"         }, /* 1128 */
+       { 4,    TP,     sys_clone,              "clone"         }, /* 1128 */
        { 2,    0,      sys_setdomainname,      "setdomainname" }, /* 1129 */
        { 1,    0,      sys_uname,              "uname"         }, /* 1130 */
        { 1,    0,      sys_adjtimex,           "adjtimex"      }, /* 1131 */
        { 2,    TF,     sys_stat,               "stat"          }, /* 1210 */
        { 2,    0,      sys_lstat,              "lstat"         }, /* 1211 */
        { 2,    TF,     sys_fstat,              "fstat"         }, /* 1212 */
-       { 2,    TP,     sys_clone2,             "clone2"        }, /* 1213 */
+       { 6,    TP,     sys_clone,              "clone2"        }, /* 1213 */
        { 3,    0,      printargs,              "getdents64"    }, /* 1214 */
        { 2,    0,      printargs,              "getunwind"     }, /* 1215 */
        { 4,    0,      sys_readahead,          "readahead"     }, /* 1216 */
index 51d0139edbb98b6d4ba252d5ee9f29a3beca1c96..f9266ed9298508dc47f96a76d73206282eeea69b 100644 (file)
@@ -83,7 +83,7 @@ int sys_rt_sigpending(), sys_rt_sigsuspend(), sys_rt_sigqueueinfo();
 int sys_rt_sigtimedwait(), sys_prctl(), sys_poll(), sys_vfork();
 int sys_sendfile(), sys_old_mmap(), sys_stat64(), sys_lstat64(), sys_fstat64();
 int sys_truncate64(), sys_ftruncate64(), sys_pivotroot();
-int sys_getdents64(), sys_clone2();
+int sys_getdents64();
 int sys_getpmsg(), sys_putpmsg(), sys_readahead(), sys_sendfile64();
 int sys_setxattr(), sys_fsetxattr(), sys_getxattr(), sys_fgetxattr();
 int sys_listxattr(), sys_flistxattr(), sys_removexattr(), sys_fremovexattr();
index d691f10bd0bc07f4637be51961bae62afaeed42d..a1fc3475f5a37902ce7c2d3b8e77f80276931e85 100644 (file)
--- a/process.c
+++ b/process.c
@@ -525,39 +525,57 @@ static struct xlat clone_flags[] = {
 extern void print_ldt_entry();
 # endif
 
+# if defined IA64
+#  define ARG_FLAGS    0
+#  define ARG_STACK    1
+#  define ARG_STACKSIZE        (tcp->scno == SYS_clone2 ? 2 : -1)
+#  define ARG_PTID     (tcp->scno == SYS_clone2 ? 3 : -1)
+#  define ARG_CTID     (tcp->scno == SYS_clone2 ? 4 : 2)
+#  define ARG_TLS      (tcp->scno == SYS_clone2 ? 5 : 3)
+# elif defined S390
+#  define ARG_STACK    0
+#  define ARG_FLAGS    1
+#  define ARG_PTID     2
+#  define ARG_TLS      3
+#  define ARG_CTID     4
+# else
+#  define ARG_FLAGS    0
+#  define ARG_STACK    1
+#  define ARG_PTID     2
+#  define ARG_TLS      3
+#  define ARG_CTID     4
+# endif
+
 int
 sys_clone(tcp)
 struct tcb *tcp;
 {
        if (exiting(tcp)) {
-               long flags, stack;
-# if defined S390 || defined S390X
-               /* For some reason, S390 has the stack argument first.  */
-               stack = tcp->u_arg[0];
-               flags = tcp->u_arg[1];
-# else
-               flags = tcp->u_arg[0];
-               stack = tcp->u_arg[1];
+               unsigned long flags = tcp->u_arg[ARG_FLAGS];
+               tprintf("child_stack=%#lx, ", tcp->u_arg[ARG_STACK]);
+# ifdef ARG_STACKSIZE
+               if (ARG_STACKSIZE != -1)
+                       tprintf("stack_size=%#lx, ",
+                               tcp->u_arg[ARG_STACKSIZE]);
 # endif
-               tprintf("child_stack=%#lx, flags=", stack);
+               tprintf("flags=");
                if (printflags(clone_flags, flags) == 0)
                        tprintf("0");
                if ((flags & (CLONE_PARENT_SETTID|CLONE_CHILD_SETTID
-                                     |CLONE_SETTLS)) == 0)
+                             |CLONE_CHILD_CLEARTID|CLONE_SETTLS)) == 0)
                        return 0;
                if (flags & CLONE_PARENT_SETTID) {
                        int pid;
-                       if (umove(tcp, tcp->u_arg[2], &pid) == 0)
-                               tprintf(", [%d]", pid);
+                       if (umove(tcp, tcp->u_arg[ARG_PTID], &pid) == 0)
+                               tprintf(", parent_tidptr=[%d]", pid);
                        else
-                               tprintf(", %#lx", tcp->u_arg[2]);
+                               tprintf(", parent_tidptr=%#lx",
+                                       tcp->u_arg[ARG_PTID]);
                }
-               else
-                       tprintf(", <ignored>");
-#ifdef I386
                if (flags & CLONE_SETTLS) {
+# ifdef I386
                        struct modify_ldt_ldt_s copy;
-                       if (umove(tcp, tcp->u_arg[3], &copy) != -1) {
+                       if (umove(tcp, tcp->u_arg[ARG_TLS], &copy) != -1) {
                                tprintf(", {entry_number:%d, ",
                                        copy.entry_number);
                                if (!verbose(tcp))
@@ -566,34 +584,14 @@ struct tcb *tcp;
                                        print_ldt_entry(&copy);
                        }
                        else
-                               tprintf(", %#lx", tcp->u_arg[3]);
+# endif
+                               tprintf(", %#lx", tcp->u_arg[ARG_TLS]);
                }
-               else
-                       tprintf(", <ignored>");
-# define TIDARG 4
-#else
-# define TIDARG 3
-#endif
-               if (flags & CLONE_CHILD_SETTID)
-                       tprintf(", %#lx", tcp->u_arg[TIDARG]);
-#undef TIDARG
+               if (flags & (CLONE_CHILD_SETTID|CLONE_CHILD_CLEARTID))
+                       tprintf(", child_tidptr=%#lx", tcp->u_arg[ARG_CTID]);
        }
        return 0;
 }
-
-int
-sys_clone2(tcp)
-struct tcb *tcp;
-{
-       if (exiting(tcp)) {
-               tprintf("child_stack=%#lx, stack_size=%#lx, flags=",
-                       tcp->u_arg[1], tcp->u_arg[2]);
-               if (printflags(clone_flags, tcp->u_arg[0]) == 0)
-                       tprintf("0");
-       }
-       return 0;
-}
-
 #endif
 
 int