]> granicus.if.org Git - strace/commitdiff
Enhance decoding of CLONE_PARENT_SETTID flag of clone syscall
authorDmitry V. Levin <ldv@altlinux.org>
Thu, 20 Jun 2019 09:49:27 +0000 (09:49 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Thu, 20 Jun 2019 09:49:27 +0000 (09:49 +0000)
* clone.c (SYS_FUNC(clone)): Print the parent_tid returned by the kernel
instead of its address when CLONE_PARENT_SETTID flag is set.
* tests/clone-flags.c (main): Check it.

clone.c
tests/clone-flags.c

diff --git a/clone.c b/clone.c
index f43431ae67e2a8b8e375da2cde3db092e9c9395c..66be1645ae83ba2a4b05e0bf7586ddb58e2329ce 100644 (file)
--- a/clone.c
+++ b/clone.c
@@ -121,8 +121,8 @@ SYS_FUNC(clone)
                        return RVAL_DECODED;
        } else {
                if (flags & CLONE_PARENT_SETTID) {
-                       tprints(", parent_tidptr=");
-                       printaddr(tcp->u_arg[ARG_PTID]);
+                       tprints(", parent_tid=");
+                       printnum_int(tcp, tcp->u_arg[ARG_PTID], "%u");
                }
                if (flags & CLONE_SETTLS) {
                        tprints(", tls=");
index 49cdbb49943913e7bedddcbd1df23f252d0c2768..c6fb49be292f3880a7304827beef190cb668dd61 100644 (file)
@@ -116,5 +116,13 @@ main(void)
               SYSCALL_NAME, child_stack_printed, STACK_SIZE_ARG
               "CLONE_FS|SIGCHLD", pid);
 
+       TAIL_ALLOC_OBJECT_CONST_PTR(pid_t, ptid);
+       pid = do_clone(child, child_stack, child_stack_size,
+                      CLONE_PARENT_SETTID|SIGCHLD, 0, ptid);
+       printf("%s(child_stack=%#lx" STACK_SIZE_FMT ", flags=%s"
+              ", parent_tid=[%u]) = %d\n",
+              SYSCALL_NAME, child_stack_printed, STACK_SIZE_ARG
+              "CLONE_PARENT_SETTID|SIGCHLD", *ptid, pid);
+
        return 0;
 }