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