syscall: rename SysProcAttr.Unshare to Unshareflags

For symmetry with Cloneflags and it looks slightly weird because there
is syscall.Unshare method.

Change-Id: I3d710177ca8f27c05b344407f212cbbe3435094b
Reviewed-on: https://go-review.googlesource.com/23612
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
This commit is contained in:
Alexander Morozov 2016-05-31 19:44:48 -07:00 committed by Ian Lance Taylor
parent 2885e07c25
commit 88ae6495d0
2 changed files with 18 additions and 18 deletions

View file

@ -32,7 +32,7 @@ type SysProcAttr struct {
Pgid int // Child's process group ID if Setpgid. Pgid int // Child's process group ID if Setpgid.
Pdeathsig Signal // Signal that the process will get when its parent dies (Linux only) Pdeathsig Signal // Signal that the process will get when its parent dies (Linux only)
Cloneflags uintptr // Flags for clone calls (Linux only) Cloneflags uintptr // Flags for clone calls (Linux only)
Unshare uintptr // Flags for unshare calls (Linux only) Unshareflags uintptr // Flags for unshare calls (Linux only)
UidMappings []SysProcIDMap // User ID mappings for user namespaces. UidMappings []SysProcIDMap // User ID mappings for user namespaces.
GidMappings []SysProcIDMap // Group ID mappings for user namespaces. GidMappings []SysProcIDMap // Group ID mappings for user namespaces.
// GidMappingsEnableSetgroups enabling setgroups syscall. // GidMappingsEnableSetgroups enabling setgroups syscall.
@ -196,8 +196,8 @@ func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr
} }
// Unshare // Unshare
if sys.Unshare != 0 { if sys.Unshareflags != 0 {
_, _, err1 = RawSyscall(SYS_UNSHARE, sys.Unshare, 0, 0) _, _, err1 = RawSyscall(SYS_UNSHARE, sys.Unshareflags, 0, 0)
if err1 != 0 { if err1 != 0 {
goto childerror goto childerror
} }

View file

@ -143,7 +143,7 @@ func TestUnshare(t *testing.T) {
cmd := exec.Command("cat", "/proc/net/dev") cmd := exec.Command("cat", "/proc/net/dev")
cmd.SysProcAttr = &syscall.SysProcAttr{ cmd.SysProcAttr = &syscall.SysProcAttr{
Unshare: syscall.CLONE_NEWNET, Unshareflags: syscall.CLONE_NEWNET,
} }
out, err := cmd.CombinedOutput() out, err := cmd.CombinedOutput()
if err != nil { if err != nil {