mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
05b611574f
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
31 lines
617 B
Go
31 lines
617 B
Go
// +build linux
|
|
|
|
package mount
|
|
|
|
import (
|
|
"github.com/dotcloud/docker/pkg/system"
|
|
"syscall"
|
|
)
|
|
|
|
func RemountProc() error {
|
|
if err := system.Unmount("/proc", syscall.MNT_DETACH); err != nil {
|
|
return err
|
|
}
|
|
if err := system.Mount("proc", "/proc", "proc", uintptr(defaultMountFlags), ""); err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func RemountSys() error {
|
|
if err := system.Unmount("/sys", syscall.MNT_DETACH); err != nil {
|
|
if err != syscall.EINVAL {
|
|
return err
|
|
}
|
|
} else {
|
|
if err := system.Mount("sysfs", "/sys", "sysfs", uintptr(defaultMountFlags), ""); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
return nil
|
|
}
|