1
0
mirror of https://github.com/rancher/os.git synced 2025-04-28 03:20:50 +00:00
os/pkg/init/one/one.go
2018-09-19 17:18:49 +08:00

25 lines
312 B
Go

// +build linux
package one
import (
"os"
"os/signal"
"syscall"
)
func PidOne() error {
c := make(chan os.Signal, 2048)
signal.Notify(c, syscall.SIGCHLD)
for range c {
for {
if pid, err := syscall.Wait4(-1, nil, syscall.WNOHANG, nil); err != nil || pid <= 0 {
break
}
}
}
return nil
}