s/qmail
3.3.23
Next generation secure email transport
sqmail-3.3.23
src
wait_pid.c
Go to the documentation of this file.
1
#include <sys/types.h>
2
#include <sys/wait.h>
3
#include "
error.h
"
4
#include "haswaitp.h"
5
6
#ifdef HASWAITPID
7
8
int
wait_pid
(
int
*wstat,
int
pid)
9
{
10
int
r;
11
12
do
13
r = waitpid(pid,wstat,0);
14
while
((r == -1) && (
errno
==
error_intr
));
15
return
r;
16
}
17
18
#else
19
20
/* XXX untested */
21
/* XXX breaks down with more than two children */
22
static
int
oldpid = 0;
23
static
int
oldwstat;
/* defined if(oldpid) */
24
25
int
wait_pid
(
int
*wstat,
int
pid)
26
{
27
int
r;
28
29
if
(pid == oldpid) { *wstat = oldwstat; oldpid = 0;
return
pid; }
30
31
do
{
32
r = wait(wstat);
33
if
((r != pid) && (r != -1)) { oldwstat = *wstat; oldpid = r;
continue
; }
34
}
35
while
((r == -1) && (
errno
==
error_intr
));
36
return
r;
37
}
38
39
#endif
wait_pid
int wait_pid(int *wstat, int pid)
Definition:
wait_pid.c:25
error.h
errno
int errno
error_intr
int error_intr
Definition:
error.c:6
Generated on Sat Jan 12 2019 23:42:28 for s/qmail by
1.8.13