github.com/jwhonce/docker@v0.6.7-0.20190327063223-da823cf3a5a3/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 "github.com/docker/docker/internal/test" 10 "golang.org/x/sys/unix" 11 ) 12 13 func cleanupNetworkNamespace(t testingT, execRoot string) { 14 if ht, ok := t.(test.HelperT); ok { 15 ht.Helper() 16 } 17 // Cleanup network namespaces in the exec root of this 18 // daemon because this exec root is specific to this 19 // daemon instance and has no chance of getting 20 // cleaned up when a new daemon is instantiated with a 21 // new exec root. 22 netnsPath := filepath.Join(execRoot, "netns") 23 filepath.Walk(netnsPath, func(path string, info os.FileInfo, err error) error { 24 if err := unix.Unmount(path, unix.MNT_DETACH); err != nil && err != unix.EINVAL && err != unix.ENOENT { 25 t.Logf("unmount of %s failed: %v", path, err) 26 } 27 os.Remove(path) 28 return nil 29 }) 30 } 31 32 // SignalDaemonDump sends a signal to the daemon to write a dump file 33 func SignalDaemonDump(pid int) { 34 unix.Kill(pid, unix.SIGQUIT) 35 } 36 37 func signalDaemonReload(pid int) error { 38 return unix.Kill(pid, unix.SIGHUP) 39 }