// so that pass 2 won't stomp on an fd it needs later.
if pipe < nextfd {
_, _, err1 = RawSyscall(SYS_DUP3, uintptr(pipe), uintptr(nextfd), O_CLOEXEC)
- if _SYS_dup != SYS_DUP3 && err1 == ENOSYS {
- _, _, err1 = RawSyscall(_SYS_dup, uintptr(pipe), uintptr(nextfd), 0)
- if err1 != 0 {
- goto childerror
- }
- RawSyscall(fcntl64Syscall, uintptr(nextfd), F_SETFD, FD_CLOEXEC)
- } else if err1 != 0 {
+ if err1 != 0 {
goto childerror
}
pipe = nextfd
nextfd++
}
_, _, err1 = RawSyscall(SYS_DUP3, uintptr(fd[i]), uintptr(nextfd), O_CLOEXEC)
- if _SYS_dup != SYS_DUP3 && err1 == ENOSYS {
- _, _, err1 = RawSyscall(_SYS_dup, uintptr(fd[i]), uintptr(nextfd), 0)
- if err1 != 0 {
- goto childerror
- }
- RawSyscall(fcntl64Syscall, uintptr(nextfd), F_SETFD, FD_CLOEXEC)
- } else if err1 != 0 {
+ if err1 != 0 {
goto childerror
}
fd[i] = nextfd
}
// The new fd is created NOT close-on-exec,
// which is exactly what we want.
- _, _, err1 = RawSyscall(_SYS_dup, uintptr(fd[i]), uintptr(i), 0)
+ _, _, err1 = RawSyscall(SYS_DUP3, uintptr(fd[i]), uintptr(i), 0)
if err1 != 0 {
goto childerror
}
+++ /dev/null
-// Copyright 2020 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-//go:build !android && (386 || amd64 || arm || mips || mipsle || mips64 || mips64le || ppc64 || ppc64le || s390x)
-// +build !android
-// +build 386 amd64 arm mips mipsle mips64 mips64le ppc64 ppc64le s390x
-
-package syscall
-
-const _SYS_dup = SYS_DUP2
+++ /dev/null
-// Copyright 2020 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-//go:build android || arm64 || riscv64
-// +build android arm64 riscv64
-
-package syscall
-
-const _SYS_dup = SYS_DUP3