mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
069fdc8a08
Changes most references of syscall to golang.org/x/sys/
Ones aren't changes include, Errno, Signal and SysProcAttr
as they haven't been implemented in /x/sys/.
Signed-off-by: Christopher Jones <tophj@linux.vnet.ibm.com>
[s390x] switch utsname from unsigned to signed
per 33267e036f
char in s390x in the /x/sys/unix package is now signed, so
change the buildtags
Signed-off-by: Christopher Jones <tophj@linux.vnet.ibm.com>
36 lines
907 B
Go
36 lines
907 B
Go
// +build !windows
|
|
|
|
package daemon
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
|
|
"github.com/go-check/check"
|
|
"golang.org/x/sys/unix"
|
|
)
|
|
|
|
func cleanupExecRoot(c *check.C, execRoot string) {
|
|
// Cleanup network namespaces in the exec root of this
|
|
// daemon because this exec root is specific to this
|
|
// daemon instance and has no chance of getting
|
|
// cleaned up when a new daemon is instantiated with a
|
|
// new exec root.
|
|
netnsPath := filepath.Join(execRoot, "netns")
|
|
filepath.Walk(netnsPath, func(path string, info os.FileInfo, err error) error {
|
|
if err := unix.Unmount(path, unix.MNT_FORCE); err != nil {
|
|
c.Logf("unmount of %s failed: %v", path, err)
|
|
}
|
|
os.Remove(path)
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// 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)
|
|
}
|