github.com/LazyboyChen7/engine@v17.12.1-ce-rc2+incompatible/integration-cli/daemon/daemon_unix.go (about) 1 // +build !windows 2 3 package daemon 4 5 import ( 6 "os" 7 "path/filepath" 8 9 "github.com/go-check/check" 10 "golang.org/x/sys/unix" 11 ) 12 13 func cleanupExecRoot(c *check.C, execRoot string) { 14 // Cleanup network namespaces in the exec root of this 15 // daemon because this exec root is specific to this 16 // daemon instance and has no chance of getting 17 // cleaned up when a new daemon is instantiated with a 18 // new exec root. 19 netnsPath := filepath.Join(execRoot, "netns") 20 filepath.Walk(netnsPath, func(path string, info os.FileInfo, err error) error { 21 if err := unix.Unmount(path, unix.MNT_FORCE); err != nil { 22 c.Logf("unmount of %s failed: %v", path, err) 23 } 24 os.Remove(path) 25 return nil 26 }) 27 } 28 29 // SignalDaemonDump sends a signal to the daemon to write a dump file 30 func SignalDaemonDump(pid int) { 31 unix.Kill(pid, unix.SIGQUIT) 32 } 33 34 func signalDaemonReload(pid int) error { 35 return unix.Kill(pid, unix.SIGHUP) 36 }