1
0
mirror of https://github.com/rancher/os.git synced 2025-06-30 00:31:49 +00:00
os/init/one.go

29 lines
364 B
Go
Raw Normal View History

// +build linux
package init
import (
"os"
"os/signal"
"syscall"
)
func pidOne() error {
c := make(chan os.Signal)
signal.Notify(c, syscall.SIGCHLD)
var (
ws syscall.WaitStatus
rus syscall.Rusage
)
for range c {
for {
if pid, err := syscall.Wait4(-1, &ws, syscall.WNOHANG, &rus); err != nil || pid <= 0 {
break
}
}
}
return nil
}