diff options
| author | Dave Cheney <dave@cheney.net> | 2015-03-09 07:03:00 +1100 |
|---|---|---|
| committer | Dave Cheney <dave@cheney.net> | 2015-03-10 22:52:09 +0000 |
| commit | 532bc5f11ca47cdcdf96128800685f0b214f801c (patch) | |
| tree | 2d43a3e9005d8fee2d561cb12f5a1445f8bd0a4b /src/syscall/exec_linux.go | |
| parent | f00c19add5b5bd2126af689563ad24013e12faa9 (diff) | |
| download | go-532bc5f11ca47cdcdf96128800685f0b214f801c.tar.xz | |
syscall: exec_linux.go: support platforms without SYS_DUP2
Updates #9974
This change is in preparation for merging the arm64 platform.
Arm64 does not support SYS_DUP2 at all, so define a new constant to be
the minimum dup(2) version supported. This constant defaults to SYS_DUP2
on all existing platforms.
Change-Id: If405878105082c7c880f8541c1491970124c9ce4
Reviewed-on: https://go-review.googlesource.com/7123
Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
Diffstat (limited to 'src/syscall/exec_linux.go')
| -rw-r--r-- | src/syscall/exec_linux.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/syscall/exec_linux.go b/src/syscall/exec_linux.go index 03dd5c53c4..2e0577cecc 100644 --- a/src/syscall/exec_linux.go +++ b/src/syscall/exec_linux.go @@ -214,7 +214,7 @@ func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr // Pass 1: look for fd[i] < i and move those up above len(fd) // so that pass 2 won't stomp on an fd it needs later. if pipe < nextfd { - _, _, err1 = RawSyscall(SYS_DUP2, uintptr(pipe), uintptr(nextfd), 0) + _, _, err1 = RawSyscall(_SYS_dup, uintptr(pipe), uintptr(nextfd), 0) if err1 != 0 { goto childerror } @@ -224,7 +224,7 @@ func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr } for i = 0; i < len(fd); i++ { if fd[i] >= 0 && fd[i] < int(i) { - _, _, err1 = RawSyscall(SYS_DUP2, uintptr(fd[i]), uintptr(nextfd), 0) + _, _, err1 = RawSyscall(_SYS_dup, uintptr(fd[i]), uintptr(nextfd), 0) if err1 != 0 { goto childerror } @@ -254,7 +254,7 @@ func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr } // The new fd is created NOT close-on-exec, // which is exactly what we want. - _, _, err1 = RawSyscall(SYS_DUP2, uintptr(fd[i]), uintptr(i), 0) + _, _, err1 = RawSyscall(_SYS_dup, uintptr(fd[i]), uintptr(i), 0) if err1 != 0 { goto childerror } |
