]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
After a clone system call there are two threads of control running so we
authorTom Hughes <tom@compton.nu>
Mon, 15 Nov 2004 15:35:49 +0000 (15:35 +0000)
committerTom Hughes <tom@compton.nu>
Mon, 15 Nov 2004 15:35:49 +0000 (15:35 +0000)
need to make sure the child exits or we will get two copies of the output
from each test which follows. Also some older systems do not define the
CLONE_PARENT_SETTID flag.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3007

memcheck/tests/scalar.c

index dd369c3d7e4c81def331436be9c103897a823d84..09ec13087d0f4937182f5a3860435792001b59e3 100644 (file)
@@ -507,9 +507,15 @@ int main(void)
    // __NR_clone 120
    #include <sched.h>
    #include <signal.h>
+#ifndef CLONE_PARENT_SETTID
+#define CLONE_PARENT_SETTID    0x00100000
+#endif
    // XXX: should really be "4s 2m"?  Not sure... (see PRE(sys_clone))
    GO(__NR_clone, "4s 0m");
-   SY(__NR_clone, x0|CLONE_PARENT_SETTID|SIGCHLD, x0, x0, x0);
+   if (SY(__NR_clone, x0|CLONE_PARENT_SETTID|SIGCHLD, x0, x0, x0) == 0)
+   {
+      SY(__NR_exit, 0);
+   }
 
    // __NR_setdomainname 121
    GO(__NR_setdomainname, "n/a");