EFAULT = C.EFAULT
EBUSY = C.EBUSY
EAGAIN = C.EAGAIN
+ ENOSYS = C.ENOSYS
+
+ O_NONBLOCK = C.O_NONBLOCK
+ O_CLOEXEC = C.O_CLOEXEC
PROT_NONE = C.PROT_NONE
PROT_READ = C.PROT_READ
_EFAULT = 0xe
_EBUSY = 0x10
_EAGAIN = 0x23
+ _ENOSYS = 0x4e
+
+ _O_NONBLOCK = 0x4
+ _O_CLOEXEC = 0x20000
_PROT_NONE = 0x0
_PROT_READ = 0x1
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-//go:build freebsd || linux || netbsd || openbsd || solaris
-// +build freebsd linux netbsd openbsd solaris
+//go:build dragonfly || freebsd || linux || netbsd || openbsd || solaris
+// +build dragonfly freebsd linux netbsd openbsd solaris
package runtime
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-//go:build aix || darwin || dragonfly
-// +build aix darwin dragonfly
+//go:build aix || darwin
+// +build aix darwin
package runtime
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-//go:build aix || darwin || dragonfly
-// +build aix darwin dragonfly
+//go:build aix || darwin
+// +build aix darwin
package runtime
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-//go:build freebsd || linux || netbsd || openbsd || solaris
-// +build freebsd linux netbsd openbsd solaris
+//go:build dragonfly || freebsd || linux || netbsd || openbsd || solaris
+// +build dragonfly freebsd linux netbsd openbsd solaris
package runtime
//go:noescape
func kevent(kq int32, ch *keventt, nch int32, ev *keventt, nev int32, ts *timespec) int32
-func closeonexec(fd int32)
-func setNonblock(fd int32)
func pipe() (r, w int32, errno int32)
+func pipe2(flags int32) (r, w int32, errno int32)
+func closeonexec(fd int32)
+func setNonblock(fd int32)
// From DragonFly's <sys/sysctl.h>
const (
MOVL $0, errno+8(FP)
RET
+// func pipe2(flags int32) (r, w int32, errno int32)
+TEXT runtime·pipe2(SB),NOSPLIT,$0-20
+ MOVL $0, DI
+ // dragonfly expects flags as the 2nd argument
+ MOVL flags+0(FP), SI
+ MOVL $538, AX
+ SYSCALL
+ JCC pipe2ok
+ MOVL $-1,r+8(FP)
+ MOVL $-1,w+12(FP)
+ MOVL AX, errno+16(FP)
+ RET
+pipe2ok:
+ MOVL AX, r+8(FP)
+ MOVL DX, w+12(FP)
+ MOVL $0, errno+16(FP)
+ RET
+
TEXT runtime·write1(SB),NOSPLIT,$-8
MOVQ fd+0(FP), DI // arg 1 fd
MOVQ p+8(FP), SI // arg 2 buf