git.samba.org
/
tridge
/
junkcode.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
fixes for Power64
[tridge/junkcode.git]
/
waitpid.c
1
#include <sys/types.h>
2
#include <sys/wait.h>
3
#include <stdio.h>
4
5
x_waitpid(pid_t pid, int *status, int options)
6
{
7
8
}
9
10
main()
11
{
12
pid_t pid1;
13
14
if ((pid1=fork()) == 0) {
15
/* first child */
16
sleep(5);
17
exit(3);
18
}
19
20
21
if (fork() == 0) {
22
int status = 0;
23
pid_t pid;
24
/* second child */
25
pid = waitpid(-getpgrp(), &status, 0);
26
printf("got exit status %d from child %d pid1=%d\n",
27
WEXITSTATUS(status), pid, pid1);
28
exit(0);
29
}
30
sleep(10);
31
}