in pkg/pid1/pid1.go [80:99]
func sigchld(firstborn int) (bool, syscall.WaitStatus, error) {
// Loop to handle multiple child processes.
for {
var status syscall.WaitStatus
pid, err := syscall.Wait4(-1, &status, syscall.WNOHANG, nil)
if err != nil {
return false, 0, fmt.Errorf("wait4(): %v\n", err)
}
if pid == firstborn {
return true, status, nil
}
if pid <= 0 {
// No more children to reap.
break
}
// Must have found one, see if there are more.
}
return false, 0, nil
}