]> Cypherpunks repositories - gostls13.git/commitdiff
syscall: rename SysProcAttr.Unshare to Unshareflags
authorAlexander Morozov <lk4d4math@gmail.com>
Wed, 1 Jun 2016 02:44:48 +0000 (19:44 -0700)
committerIan Lance Taylor <iant@golang.org>
Wed, 1 Jun 2016 04:27:28 +0000 (04:27 +0000)
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>
src/syscall/exec_linux.go
src/syscall/exec_linux_test.go

index 5a6b2049970901165ab500b2606699ed03386763..4b8199a2e5f279e95c14b7fc3f1fe8bbdff3ba3c 100644 (file)
@@ -20,21 +20,21 @@ type SysProcIDMap struct {
 }
 
 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 @@ func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr
        }
 
        // 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
                }
index 099756328c9cb4f539d4ca8fba4d3ebc62bdfd95..395dd99039673cd0479bcbac0d9b2f3e1e1c1202 100644 (file)
@@ -143,7 +143,7 @@ func TestUnshare(t *testing.T) {
 
        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 {