Tizen_4.0 base
[platform/upstream/docker-engine.git] / integration-cli / daemon / daemon_unix.go
1 // +build !windows
2
3 package daemon
4
5 import (
6         "os"
7         "path/filepath"
8         "syscall"
9
10         "github.com/go-check/check"
11 )
12
13 func cleanupExecRoot(c *check.C, execRoot string) {
14         // Cleanup network namespaces in the exec root of this
15         // daemon because this exec root is specific to this
16         // daemon instance and has no chance of getting
17         // cleaned up when a new daemon is instantiated with a
18         // new exec root.
19         netnsPath := filepath.Join(execRoot, "netns")
20         filepath.Walk(netnsPath, func(path string, info os.FileInfo, err error) error {
21                 if err := syscall.Unmount(path, syscall.MNT_FORCE); err != nil {
22                         c.Logf("unmount of %s failed: %v", path, err)
23                 }
24                 os.Remove(path)
25                 return nil
26         })
27 }
28
29 // SignalDaemonDump sends a signal to the daemon to write a dump file
30 func SignalDaemonDump(pid int) {
31         syscall.Kill(pid, syscall.SIGQUIT)
32 }
33
34 func signalDaemonReload(pid int) error {
35         return syscall.Kill(pid, syscall.SIGHUP)
36 }