mirror of
https://github.com/rancher/os.git
synced 2025-09-24 20:09:21 +00:00
Move around code for better clarity
This commit is contained in:
committed by
niusmallnan
parent
2f50b7b178
commit
1f50386828
24
pkg/init/one/one.go
Normal file
24
pkg/init/one/one.go
Normal file
@@ -0,0 +1,24 @@
|
||||
// +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
|
||||
}
|
Reference in New Issue
Block a user