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: ee2925c4c647fabbaef1bc9517ada3e13b730c32 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <stdio.h>
#include <sys/wait.h>
#include <errno.h>
#include <unistd.h>
#include <stdlib.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);
    }
}