]> granicus.if.org Git - strace/blobdiff - clone.c
tprint_iov*: change address argument type from unsigned long to kernel_ureg_t
[strace] / clone.c
diff --git a/clone.c b/clone.c
index 99d0da7f0ce960b73f15ffea5da497276d08ec85..3bc1e22ec7d5407d8fc82441949769f9d2f31b46 100644 (file)
--- a/clone.c
+++ b/clone.c
 #endif
 
 #include "xlat/clone_flags.h"
+#include "xlat/setns_types.h"
+#include "xlat/unshare_flags.h"
 
 #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 : 2)
-# define ARG_CTID      (tcp->scno == SYS_clone2 ? 4 : 3)
-# define ARG_TLS       (tcp->scno == SYS_clone2 ? 5 : 4)
+# define ARG_STACKSIZE (tcp->scno == __NR_clone2 ? 2 : -1)
+# define ARG_PTID      (tcp->scno == __NR_clone2 ? 3 : 2)
+# define ARG_CTID      (tcp->scno == __NR_clone2 ? 4 : 3)
+# define ARG_TLS       (tcp->scno == __NR_clone2 ? 5 : 4)
 #elif defined S390 || defined S390X || defined CRISV10 || defined CRISV32
 # define ARG_STACK     0
 # define ARG_FLAGS     1
@@ -59,7 +61,7 @@
 # define ARG_PTID      2
 # define ARG_CTID      ((current_personality != 1) ? 3 : 4)
 # define ARG_TLS       ((current_personality != 1) ? 4 : 3)
-#elif defined ALPHA || defined TILE || defined OR1K
+#elif defined ALPHA || defined TILE || defined OR1K || defined RISCV
 # define ARG_FLAGS     0
 # define ARG_STACK     1
 # define ARG_PTID      2
 # define ARG_CTID      4
 #endif
 
-#if defined I386 || defined X86_64 || defined X32
-extern void print_user_desc(struct tcb *, long);
-#endif /* I386 || X86_64 || X32 */
+static void
+print_tls_arg(struct tcb *const tcp, const kernel_ureg_t addr)
+{
+#ifdef HAVE_STRUCT_USER_DESC
+# if SUPPORTED_PERSONALITIES > 1
+       if (current_personality == 1)
+# endif
+       {
+               print_user_desc(tcp, tcp->u_arg[ARG_TLS]);
+       }
+# if SUPPORTED_PERSONALITIES > 1
+       else
+# endif
+#endif /* HAVE_STRUCT_USER_DESC */
+       {
+               printaddr(tcp->u_arg[ARG_TLS]);
+       }
+}
 
 SYS_FUNC(clone)
 {
@@ -103,22 +120,8 @@ SYS_FUNC(clone)
                        printaddr(tcp->u_arg[ARG_PTID]);
                }
                if (flags & CLONE_SETTLS) {
-#if defined I386 || defined X86_64 || defined X32
-# ifndef I386
-                       if (current_personality == 1)
-# endif
-                       {
-                               tprints(", tls=");
-                               print_user_desc(tcp, tcp->u_arg[ARG_TLS]);
-                       }
-# ifndef I386
-                       else
-# endif
-#endif /* I386 || X86_64 || X32 */
-                       {
-                               tprints(", tls=");
-                               printaddr(tcp->u_arg[ARG_TLS]);
-                       }
+                       tprints(", tls=");
+                       print_tls_arg(tcp, tcp->u_arg[ARG_TLS]);
                }
                if (flags & (CLONE_CHILD_SETTID|CLONE_CHILD_CLEARTID)) {
                        tprints(", child_tidptr=");
@@ -144,14 +147,14 @@ SYS_FUNC(setns)
 {
        printfd(tcp, tcp->u_arg[0]);
        tprints(", ");
-       printflags(clone_flags, tcp->u_arg[1], "CLONE_???");
+       printxval(setns_types, tcp->u_arg[1], "CLONE_NEW???");
 
        return RVAL_DECODED;
 }
 
 SYS_FUNC(unshare)
 {
-       printflags_long(clone_flags, tcp->u_arg[0], "CLONE_???");
+       printflags64(unshare_flags, getarg_klu(tcp, 0), "CLONE_???");
        return RVAL_DECODED;
 }