mirror of
https://github.com/golang/sys.git
synced 2026-02-08 19:56:04 +03:00
unix: fix Pipe2 on dragonfly
The pipe2 on dragonfly still expects an fds array as an argument, but does not use it to return the file descriptors. Just pass the argument but ignore its value. This way the flags argument will be respected correctly. Change-Id: Id340653040999f31074eae01e9be4ea2088abae5 Reviewed-on: https://go-review.googlesource.com/c/sys/+/295870 Trust: Tobias Klauser <tobias.klauser@gmail.com> Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
committed by
Tobias Klauser
parent
8e9945a547
commit
2738c018e2
@@ -105,13 +105,16 @@ func Pipe(p []int) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
//sysnb pipe2(flags int) (r int, w int, err error)
|
||||
//sysnb pipe2(p *[2]_C_int, flags int) (r int, w int, err error)
|
||||
|
||||
func Pipe2(p []int, flags int) (err error) {
|
||||
if len(p) != 2 {
|
||||
return EINVAL
|
||||
}
|
||||
p[0], p[1], err = pipe2(flags)
|
||||
var pp [2]_C_int
|
||||
// pipe2 on dragonfly takes an fds array as an argument, but still
|
||||
// returns the file descriptors.
|
||||
p[0], p[1], err = pipe2(&pp, flags)
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
@@ -363,8 +363,8 @@ func pipe() (r int, w int, err error) {
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func pipe2(flags int) (r int, w int, err error) {
|
||||
r0, r1, e1 := RawSyscall(SYS_PIPE2, uintptr(flags), 0, 0)
|
||||
func pipe2(p *[2]_C_int, flags int) (r int, w int, err error) {
|
||||
r0, r1, e1 := RawSyscall(SYS_PIPE2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0)
|
||||
r = int(r0)
|
||||
w = int(r1)
|
||||
if e1 != 0 {
|
||||
|
||||
Reference in New Issue
Block a user