]> Cypherpunks.ru repositories - gostls13.git/commitdiff
syscall, os: use pipe2 syscall on DragonflyBSD instead of pipe
authorTobias Klauser <tklauser@distanz.ch>
Thu, 23 Aug 2018 14:33:53 +0000 (16:33 +0200)
committerTobias Klauser <tobias.klauser@gmail.com>
Fri, 24 Aug 2018 14:41:04 +0000 (14:41 +0000)
Follow the implementation used by the other BSDs ith os.Pipe and
syscall.forkExecPipe consisting of a single syscall instead of three.

Change-Id: I602187672f244cbd8faaa3397904d71d15452d9f
Reviewed-on: https://go-review.googlesource.com/130996
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/os/pipe2_bsd.go
src/os/pipe_bsd.go
src/syscall/forkpipe.go
src/syscall/forkpipe2.go
src/syscall/syscall_dragonfly.go
src/syscall/zsyscall_dragonfly_amd64.go
src/syscall/zsysnum_dragonfly_amd64.go

index 0ef894b476bed9386dbdc837042b3c4b869b3bd7..7d2d9e8ffd9f062458b919042c75da0ab269bbca 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// +build freebsd netbsd openbsd
+// +build dragonfly freebsd netbsd openbsd
 
 package os
 
index 9735988f324d3b84e08f5674fa73646575d8cd7e..6fd10dbc1a1f9ba6148d70466b3127c217c81972 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// +build darwin dragonfly js,wasm nacl solaris
+// +build darwin js,wasm nacl solaris
 
 package os
 
index 71890a29badcca66b15911e2c888ff7e944a0a80..55777497b1012a306a0e491430a0c6a065be0335 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// +build darwin dragonfly solaris
+// +build darwin solaris
 
 package syscall
 
index c9a0c4996e3bbbdffca63a36987ad1c50214ad35..0078f4bbabd24def3fb7b3a6182cda4080a85798 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// +build freebsd netbsd openbsd
+// +build dragonfly freebsd netbsd openbsd
 
 package syscall
 
index 3dbbe342cfbb21196f2ca03f14258efaeb873721..d59f139446e4fcf004a0c54b31f9c71b7d3bcc66 100644 (file)
@@ -72,13 +72,17 @@ func direntNamlen(buf []byte) (uint64, bool) {
        return readInt(buf, unsafe.Offsetof(Dirent{}.Namlen), unsafe.Sizeof(Dirent{}.Namlen))
 }
 
-//sysnb pipe() (r int, w int, err error)
+func Pipe(p []int) error {
+       return Pipe2(p, 0)
+}
+
+//sysnb pipe2(flags int) (r int, w int, err error)
 
-func Pipe(p []int) (err error) {
+func Pipe2(p []int, flags int) (err error) {
        if len(p) != 2 {
                return EINVAL
        }
-       p[0], p[1], err = pipe()
+       p[0], p[1], err = pipe2(flags)
        return
 }
 
index 578b5a3e9e4b9e332a77c7d956c850dae3e122b3..f9ed33aae80327acd2e07c6941f21646b90ed310 100644 (file)
@@ -261,8 +261,8 @@ 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 pipe() (r int, w int, err error) {
-       r0, r1, e1 := RawSyscall(SYS_PIPE, 0, 0, 0)
+func pipe2(flags int) (r int, w int, err error) {
+       r0, r1, e1 := RawSyscall(SYS_PIPE2, uintptr(flags), 0, 0)
        r = int(r0)
        w = int(r1)
        if e1 != 0 {
index 9ce11f5899f9f3219871c39012c6163407b12017..58582b9e7a485f7a18a9724535dc2837b1ae8b5f 100644 (file)
@@ -301,6 +301,7 @@ const (
        SYS_LPATHCONF              = 533 // { int lpathconf(char *path, int name); }
        SYS_VMM_GUEST_CTL          = 534 // { int vmm_guest_ctl(int op, struct vmm_guest_options *options); }
        SYS_VMM_GUEST_SYNC_ADDR    = 535 // { int vmm_guest_sync_addr(long *dstaddr, long *srcaddr); }
+       SYS_PIPE2                  = 538 // { int pipe2(int *fildes, int flags); }
        SYS_UTIMENSAT              = 539 // { int utimensat(int fd, const char *path, const struct timespec *ts, int flags); }
        SYS_ACCEPT4                = 541 // { int accept4(int s, caddr_t name, int *anamelen, int flags); }
 )