github.com/kardianos/nomad@v0.1.3-0.20151022182107-b13df73ee850/client/allocdir/alloc_dir_linux.go (about)

     1  package allocdir
     2  
     3  import (
     4  	"os"
     5  	"syscall"
     6  )
     7  
     8  // Bind mounts the shared directory into the task directory. Must be root to
     9  // run.
    10  func (d *AllocDir) mountSharedDir(taskDir string) error {
    11  	if err := os.Mkdir(taskDir, 0777); err != nil {
    12  		return err
    13  	}
    14  
    15  	return syscall.Mount(d.SharedDir, taskDir, "", syscall.MS_BIND, "")
    16  }
    17  
    18  func (d *AllocDir) unmountSharedDir(dir string) error {
    19  	return syscall.Unmount(dir, 0)
    20  }