From dbad9cb7cb7ae8e5e3281f626a0a48c77f739a69 Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Tue, 15 Sep 2020 13:29:21 +0200 Subject: [PATCH] unix: add Pipe2 on illumos Change-Id: Ib8d259c16b2ea4081f5ee8d927ef8658315268b8 Reviewed-on: https://go-review.googlesource.com/c/sys/+/254979 Trust: Tobias Klauser Run-TryBot: Tobias Klauser TryBot-Result: Go Bot Reviewed-by: Matt Layher Reviewed-by: Ian Lance Taylor --- unix/syscall_illumos.go | 13 +++++++++++++ unix/zsyscall_illumos_amd64.go | 15 ++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/unix/syscall_illumos.go b/unix/syscall_illumos.go index f3d5149f..16e40091 100644 --- a/unix/syscall_illumos.go +++ b/unix/syscall_illumos.go @@ -75,3 +75,16 @@ func Accept4(fd int, flags int) (nfd int, sa Sockaddr, err error) { } return } + +//sysnb pipe2(p *[2]_C_int, flags int) (err error) + +func Pipe2(p []int, flags int) error { + if len(p) != 2 { + return EINVAL + } + var pp [2]_C_int + err := pipe2(&pp, flags) + p[0] = int(pp[0]) + p[1] = int(pp[1]) + return err +} diff --git a/unix/zsyscall_illumos_amd64.go b/unix/zsyscall_illumos_amd64.go index d885ef38..8b329c45 100644 --- a/unix/zsyscall_illumos_amd64.go +++ b/unix/zsyscall_illumos_amd64.go @@ -14,19 +14,22 @@ import ( //go:cgo_import_dynamic libc_writev writev "libc.so" //go:cgo_import_dynamic libc_pwritev pwritev "libc.so" //go:cgo_import_dynamic libc_accept4 accept4 "libc.so" +//go:cgo_import_dynamic libc_pipe2 pipe2 "libc.so" //go:linkname procreadv libc_readv //go:linkname procpreadv libc_preadv //go:linkname procwritev libc_writev //go:linkname procpwritev libc_pwritev //go:linkname procaccept4 libc_accept4 +//go:linkname procpipe2 libc_pipe2 var ( procreadv, procpreadv, procwritev, procpwritev, - procaccept4 syscallFunc + procaccept4, + procpipe2 syscallFunc ) // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -99,3 +102,13 @@ func accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, } return } + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func pipe2(p *[2]_C_int, flags int) (err error) { + _, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procpipe2)), 2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0, 0, 0, 0) + if e1 != 0 { + err = e1 + } + return +}