github.com/opsramp/moby@v1.13.1/integration-cli/daemon_unix.go (about)

     1  // +build !windows
     2  
     3  package main
     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  func signalDaemonDump(pid int) {
    30  	syscall.Kill(pid, syscall.SIGQUIT)
    31  }
    32  
    33  func signalDaemonReload(pid int) error {
    34  	return syscall.Kill(pid, syscall.SIGHUP)
    35  }