github.com/SandwichDev/go-internals@v0.0.0-20210605002614-12311ac6b2c5/syscall/unix/pipe2_illumos.go (about) 1 // Copyright 2020 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 // +build illumos 6 7 package unix 8 9 import ( 10 "syscall" 11 "unsafe" 12 ) 13 14 //go:cgo_import_dynamic libc_pipe2 pipe2 "libc.so" 15 16 //go:linkname procpipe2 libc_pipe2 17 18 var procpipe2 uintptr 19 20 type _C_int int32 21 22 func Pipe2(p []int, flags int) error { 23 if len(p) != 2 { 24 return syscall.EINVAL 25 } 26 var pp [2]_C_int 27 _, _, errno := syscall6(uintptr(unsafe.Pointer(&procpipe2)), 2, uintptr(unsafe.Pointer(&pp)), uintptr(flags), 0, 0, 0, 0) 28 if errno != 0 { 29 return errno 30 } 31 p[0] = int(pp[0]) 32 p[1] = int(pp[1]) 33 return nil 34 }