mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
This package was originally internal, but was moved out when BuildKit used it for its integration tests. That's no longer the case, so we can make it internal again. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
38 lines
778 B
Go
38 lines
778 B
Go
//go:build !windows
|
|
|
|
package daemon
|
|
|
|
import (
|
|
"os/exec"
|
|
"syscall"
|
|
"testing"
|
|
|
|
"github.com/moby/sys/mount"
|
|
"golang.org/x/sys/unix"
|
|
)
|
|
|
|
// cleanupMount unmounts the daemon root directory, or logs a message if
|
|
// unmounting failed.
|
|
func cleanupMount(t testing.TB, d *Daemon) {
|
|
t.Helper()
|
|
if err := mount.Unmount(d.Root); err != nil {
|
|
d.log.Logf("[%s] unable to unmount daemon root (%s): %v", d.id, d.Root, err)
|
|
}
|
|
}
|
|
|
|
// SignalDaemonDump sends a signal to the daemon to write a dump file
|
|
func SignalDaemonDump(pid int) {
|
|
_ = unix.Kill(pid, unix.SIGQUIT)
|
|
}
|
|
|
|
func signalDaemonReload(pid int) error {
|
|
return unix.Kill(pid, unix.SIGHUP)
|
|
}
|
|
|
|
func setsid(cmd *exec.Cmd) {
|
|
if cmd.SysProcAttr == nil {
|
|
cmd.SysProcAttr = &syscall.SysProcAttr{}
|
|
}
|
|
cmd.SysProcAttr.Setsid = true
|
|
}
|