13 pid_thread (void *arg)
17 printf ("pid wrong in thread: should be %d, is %d\n",
18 (int) pid, (int) getpid ());
31 int ret = pthread_create (&thr, NULL, pid_thread, NULL);
34 printf ("pthread_create failed: %d\n", ret);
39 ret = pthread_join (thr, &thr_ret);
42 printf ("pthread_create failed: %d\n", ret);
47 printf ("thread getpid failed\n");
51 pid_t child = fork ();
54 printf ("fork failed: %m\n");
61 puts ("pid did not change after fork");
66 ret = pthread_create (&thr, NULL, pid_thread, NULL);
69 printf ("pthread_create failed: %d\n", ret);
73 ret = pthread_join (thr, &thr_ret);
76 printf ("pthread_create failed: %d\n", ret);
81 printf ("thread getpid failed\n");
89 if (TEMP_FAILURE_RETRY (waitpid (child, &status, 0)) != child)
91 puts ("waitpid failed");
92 kill (child, SIGKILL);
96 if (!WIFEXITED (status))
98 if (WIFSIGNALED (status))
99 printf ("died from signal %s\n", strsignal (WTERMSIG (status)));
101 puts ("did not terminate correctly");
104 if (WEXITSTATUS (status) != 0)
106 printf ("exit code %d\n", WEXITSTATUS (status));
113 #define TEST_FUNCTION do_test ()
114 #include "../test-skeleton.c"