github.com/rish1988/moby@v25.0.2+incompatible/testutil/daemon/daemon_unix.go (about) 1 //go:build !windows 2 3 package daemon // import "github.com/docker/docker/testutil/daemon" 4 5 import ( 6 "os/exec" 7 "syscall" 8 "testing" 9 10 "github.com/moby/sys/mount" 11 "golang.org/x/sys/unix" 12 ) 13 14 // cleanupMount unmounts the daemon root directory, or logs a message if 15 // unmounting failed. 16 func cleanupMount(t testing.TB, d *Daemon) { 17 t.Helper() 18 if err := mount.Unmount(d.Root); err != nil { 19 d.log.Logf("[%s] unable to unmount daemon root (%s): %v", d.id, d.Root, err) 20 } 21 } 22 23 // SignalDaemonDump sends a signal to the daemon to write a dump file 24 func SignalDaemonDump(pid int) { 25 unix.Kill(pid, unix.SIGQUIT) 26 } 27 28 func signalDaemonReload(pid int) error { 29 return unix.Kill(pid, unix.SIGHUP) 30 } 31 32 func setsid(cmd *exec.Cmd) { 33 if cmd.SysProcAttr == nil { 34 cmd.SysProcAttr = &syscall.SysProcAttr{} 35 } 36 cmd.SysProcAttr.Setsid = true 37 }