[go] syscall: rename SysProcAttr.Unshare to Unshareflags

70 views
Skip to first unread message

Alexander Morozov (Gerrit)

unread,
May 31, 2016, 10:46:07 PM5/31/16
to Ian Lance Taylor, Rob Pike, golang-co...@googlegroups.com
Alexander Morozov uploaded a change:
https://go-review.googlesource.com/23612

syscall: rename SysProcAttr.Unshare to Unshareflags

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

Change-Id: I3d710177ca8f27c05b344407f212cbbe3435094b
---
M src/syscall/exec_linux.go
M src/syscall/exec_linux_test.go
2 files changed, 18 insertions(+), 18 deletions(-)



diff --git a/src/syscall/exec_linux.go b/src/syscall/exec_linux.go
index 5a6b204..4b8199a 100644
--- a/src/syscall/exec_linux.go
+++ b/src/syscall/exec_linux.go
@@ -20,21 +20,21 @@
}

type SysProcAttr struct {
- Chroot string // Chroot.
- Credential *Credential // Credential.
- Ptrace bool // Enable tracing.
- Setsid bool // Create session.
- Setpgid bool // Set process group ID to Pgid, or, if Pgid
== 0, to new pid.
- Setctty bool // Set controlling terminal to fd Ctty (only
meaningful if Setsid is set)
- Noctty bool // Detach fd 0 from controlling terminal
- Ctty int // Controlling TTY fd
- Foreground bool // Place child's process group in foreground.
(Implies Setpgid. Uses Ctty as fd of controlling TTY)
- Pgid int // Child's process group ID if Setpgid.
- Pdeathsig Signal // Signal that the process will get when its
parent dies (Linux only)
- Cloneflags uintptr // Flags for clone calls (Linux only)
- Unshare uintptr // Flags for unshare calls (Linux only)
- UidMappings []SysProcIDMap // User ID mappings for user namespaces.
- GidMappings []SysProcIDMap // Group ID mappings for user namespaces.
+ Chroot string // Chroot.
+ Credential *Credential // Credential.
+ Ptrace bool // Enable tracing.
+ Setsid bool // Create session.
+ Setpgid bool // Set process group ID to Pgid, or, if Pgid
== 0, to new pid.
+ Setctty bool // Set controlling terminal to fd Ctty (only
meaningful if Setsid is set)
+ Noctty bool // Detach fd 0 from controlling terminal
+ Ctty int // Controlling TTY fd
+ Foreground bool // Place child's process group in foreground.
(Implies Setpgid. Uses Ctty as fd of controlling TTY)
+ Pgid int // Child's process group ID if Setpgid.
+ Pdeathsig Signal // Signal that the process will get when its
parent dies (Linux only)
+ Cloneflags uintptr // Flags for clone calls (Linux only)
+ Unshareflags uintptr // Flags for unshare calls (Linux only)
+ UidMappings []SysProcIDMap // User ID mappings for user namespaces.
+ GidMappings []SysProcIDMap // Group ID mappings for user namespaces.
// GidMappingsEnableSetgroups enabling setgroups syscall.
// If false, then setgroups syscall will be disabled for the child
process.
// This parameter is no-op if GidMappings == nil. Otherwise for
unprivileged
@@ -196,8 +196,8 @@
}

// Unshare
- if sys.Unshare != 0 {
- _, _, err1 = RawSyscall(SYS_UNSHARE, sys.Unshare, 0, 0)
+ if sys.Unshareflags != 0 {
+ _, _, err1 = RawSyscall(SYS_UNSHARE, sys.Unshareflags, 0, 0)
if err1 != 0 {
goto childerror
}
diff --git a/src/syscall/exec_linux_test.go b/src/syscall/exec_linux_test.go
index 0997563..395dd99 100644
--- a/src/syscall/exec_linux_test.go
+++ b/src/syscall/exec_linux_test.go
@@ -143,7 +143,7 @@

cmd := exec.Command("cat", "/proc/net/dev")
cmd.SysProcAttr = &syscall.SysProcAttr{
- Unshare: syscall.CLONE_NEWNET,
+ Unshareflags: syscall.CLONE_NEWNET,
}
out, err := cmd.CombinedOutput()
if err != nil {

--
https://go-review.googlesource.com/23612

Ian Lance Taylor (Gerrit)

unread,
May 31, 2016, 11:36:01 PM5/31/16
to Alexander Morozov, golang-co...@googlegroups.com
Ian Lance Taylor has posted comments on this change.

syscall: rename SysProcAttr.Unshare to Unshareflags

Patch Set 1: Run-TryBot+1 Code-Review+2

--
https://go-review.googlesource.com/23612
Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
Gerrit-HasComments: No

Gobot Gobot (Gerrit)

unread,
May 31, 2016, 11:36:55 PM5/31/16
to Alexander Morozov, Ian Lance Taylor, golang-co...@googlegroups.com
Gobot Gobot has posted comments on this change.

syscall: rename SysProcAttr.Unshare to Unshareflags

Patch Set 1:

TryBots beginning. Status page: http://farmer.golang.org/try?commit=25127c64

--
https://go-review.googlesource.com/23612
Gerrit-Reviewer: Gobot Gobot <go...@golang.org>

Gobot Gobot (Gerrit)

unread,
May 31, 2016, 11:55:35 PM5/31/16
to Alexander Morozov, Ian Lance Taylor, golang-co...@googlegroups.com
Gobot Gobot has posted comments on this change.

syscall: rename SysProcAttr.Unshare to Unshareflags

Patch Set 1: TryBot-Result+1

TryBots are happy.

Rob Pike (Gerrit)

unread,
May 31, 2016, 11:59:21 PM5/31/16
to Alexander Morozov, Rob Pike, Gobot Gobot, Ian Lance Taylor, golang-co...@googlegroups.com
Rob Pike has posted comments on this change.

syscall: rename SysProcAttr.Unshare to Unshareflags

Patch Set 1:

This is an API change. When did Unshare go in?

--
https://go-review.googlesource.com/23612
Gerrit-Reviewer: Gobot Gobot <go...@golang.org>
Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
Gerrit-Reviewer: Rob Pike <r...@golang.org>
Gerrit-HasComments: No

Alexander Morozov (Gerrit)

unread,
Jun 1, 2016, 12:00:53 AM6/1/16
to Rob Pike, Gobot Gobot, Ian Lance Taylor, golang-co...@googlegroups.com
Alexander Morozov has posted comments on this change.

syscall: rename SysProcAttr.Unshare to Unshareflags

Patch Set 1:

> This is an API change. When did Unshare go in?

It will be only in 1.7

--
https://go-review.googlesource.com/23612
Gerrit-Reviewer: Alexander Morozov <lk4d...@gmail.com>

Rob Pike (Gerrit)

unread,
Jun 1, 2016, 12:05:49 AM6/1/16
to Alexander Morozov, Gobot Gobot, Ian Lance Taylor, Rob Pike, golang-co...@googlegroups.com
Rob Pike has posted comments on this change.

syscall: rename SysProcAttr.Unshare to Unshareflags

Patch Set 1: Code-Review+2

Ian Lance Taylor (Gerrit)

unread,
Jun 1, 2016, 12:27:32 AM6/1/16
to Alexander Morozov, golang-...@googlegroups.com, Gobot Gobot, Rob Pike, golang-co...@googlegroups.com
Ian Lance Taylor has submitted this change and it was merged.

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 <ia...@golang.org>
Run-TryBot: Ian Lance Taylor <ia...@golang.org>
TryBot-Result: Gobot Gobot <go...@golang.org>
Reviewed-by: Rob Pike <r...@golang.org>
---
M src/syscall/exec_linux.go
M src/syscall/exec_linux_test.go
2 files changed, 18 insertions(+), 18 deletions(-)

Approvals:
Ian Lance Taylor: Looks good to me, approved; Run TryBots
Rob Pike: Looks good to me, approved
Gobot Gobot: TryBots succeeded
Reply all
Reply to author
Forward
0 new messages