Welcome to mirror list, hosted at ThFree Co, Russian Federation.

waitpid.c « winsup.api « testsuite « winsup - cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 9845cd1a40ed1ba1651263bf613c6c7060b20269 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <stdio.h>
#include <sys/wait.h>
#include <errno.h>

int
main (int argc, char **argv)
{
  int pid, n;
  if ((pid = fork ()) == 0)
    exit (0);
  sleep (2);
  if ((n = waitpid (pid, NULL, 0)) != pid)
    {
      printf ("wait pid failed, pid %d, n %d, errno %d\n", pid, n, errno);
      exit(1);
    }
  else
    {
      printf ("wait pid succeeded, pid %d, n %d, errno %d\n", pid, n, errno);
      exit (0);
    }
}