mirror of
https://github.com/golang/go
synced 2024-11-20 11:04:56 -07:00
syscall: use pipe instead of pipe2 on NetBSD
pipe2 is equivalent to pipe with flags set to 0. However, pipe2 was only added recently. Using pipe instead improves compatibility with NetBSD 5. R=jsing CC=golang-dev https://golang.org/cl/6268045
This commit is contained in:
parent
afeaf554aa
commit
677cdb800d
@ -118,15 +118,12 @@ func ParseDirent(buf []byte, max int, names []string) (consumed int, count int,
|
||||
return origlen - len(buf), count, names
|
||||
}
|
||||
|
||||
//sysnb pipe2(p *[2]_C_int, flags _C_int) (err error)
|
||||
//sysnb pipe() (fd1 int, fd2 int, err error)
|
||||
func Pipe(p []int) (err error) {
|
||||
if len(p) != 2 {
|
||||
return EINVAL
|
||||
}
|
||||
var pp [2]_C_int
|
||||
err = pipe2(&pp, 0)
|
||||
p[0] = int(pp[0])
|
||||
p[1] = int(pp[1])
|
||||
p[0], p[1], err = pipe()
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -253,8 +253,10 @@ func fcntl(fd int, cmd int, arg int) (val int, err error) {
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func pipe2(p *[2]_C_int, flags _C_int) (err error) {
|
||||
_, _, e1 := RawSyscall(SYS_PIPE2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0)
|
||||
func pipe() (fd1 int, fd2 int, err error) {
|
||||
r0, r1, e1 := RawSyscall(SYS_PIPE, 0, 0, 0)
|
||||
fd1 = int(r0)
|
||||
fd2 = int(r1)
|
||||
if e1 != 0 {
|
||||
err = e1
|
||||
}
|
||||
|
@ -253,8 +253,10 @@ func fcntl(fd int, cmd int, arg int) (val int, err error) {
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func pipe2(p *[2]_C_int, flags _C_int) (err error) {
|
||||
_, _, e1 := RawSyscall(SYS_PIPE2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0)
|
||||
func pipe() (fd1 int, fd2 int, err error) {
|
||||
r0, r1, e1 := RawSyscall(SYS_PIPE, 0, 0, 0)
|
||||
fd1 = int(r0)
|
||||
fd2 = int(r1)
|
||||
if e1 != 0 {
|
||||
err = e1
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user