// so that pass 2 won't stomp on an fd it needs later.
if pipe < nextfd {
switch runtime.GOOS {
- case "illumos":
+ case "illumos", "solaris":
_, err1 = fcntl1(uintptr(pipe), _F_DUP2FD_CLOEXEC, uintptr(nextfd))
default:
_, err1 = dup2child(uintptr(pipe), uintptr(nextfd))
nextfd++
}
switch runtime.GOOS {
- case "illumos":
+ case "illumos", "solaris":
_, err1 = fcntl1(uintptr(fd[i]), _F_DUP2FD_CLOEXEC, uintptr(nextfd))
default:
_, err1 = dup2child(uintptr(fd[i]), uintptr(nextfd))
//go:build illumos
-// Illumos system calls not present on Solaris.
-
package syscall
import "unsafe"
+// F_DUP2FD_CLOEXEC has different values on Solaris and Illumos.
+const F_DUP2FD_CLOEXEC = 0x24
+
//go:cgo_import_dynamic libc_flock flock "libc.so"
//go:linkname procFlock libc_flock
import "unsafe"
+const _F_DUP2FD_CLOEXEC = F_DUP2FD_CLOEXEC
+
func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno)
func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno)
func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno)
func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno)
-const _F_DUP2FD_CLOEXEC = F_DUP2FD_CLOEXEC
-
// Implemented in asm_solaris_amd64.s.
func rawSysvicall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno)
func sysvicall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno)
--- /dev/null
+// Copyright 2022 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 solaris && !illumos
+
+package syscall
+
+// F_DUP2FD_CLOEXEC has different values on Solaris and Illumos.
+const F_DUP2FD_CLOEXEC = 0x30