8 static int rc_wait(int *);
10 typedef struct Pid Pid
;
18 extern int rc_fork() {
40 extern int rc_wait4(int pid
, int *stat
, bool nointr
) {
43 /* first look for a child which may already have exited */
44 again
: for (r
= plist
, prev
= NULL
; r
!= NULL
; prev
= r
, r
= r
->n
)
48 errno
= ECHILD
; /* no children */
50 *stat
= 0x100; /* exit(1) */
54 while (pid
!= (ret
= rc_wait(stat
))) {
61 for (q
= plist
; q
!= NULL
; q
= q
->n
)
71 plist
= r
->n
; /* remove element from head of list */
78 extern List
*sgetapids() {
81 for (r
= NULL
, p
= plist
; p
!= NULL
; p
= p
->n
) {
86 q
->w
= nprint("%d", p
->pid
);
94 extern void waitforall() {
96 while (plist
!= NULL
) {
97 int pid
= rc_wait4(plist
->pid
, &stat
, FALSE
);
107 rc_wait: a wait() wrapper that interfaces wait() w/rc signals.
108 Note that the signal queue is not checked in this fn; someone
109 may want to resume the wait() without delivering any signals.
112 static int rc_wait(int *stat
) {
114 interrupt_happened
= FALSE
;
115 if (!setjmp(slowbuf
.j
)) {
117 if (!interrupt_happened
)