github.com/hxx258456/ccgo@v0.0.5-0.20230213014102-48b35f46f66f/internal/syscall/unix/writev_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 //go:build illumos 6 // +build illumos 7 8 package unix 9 10 import ( 11 "syscall" 12 "unsafe" 13 ) 14 15 //go:cgo_import_dynamic libc_writev writev "libc.so" 16 17 //go:linkname procwritev libc_writev 18 19 var procwritev uintptr 20 21 func Writev(fd int, iovs []syscall.Iovec) (uintptr, error) { 22 var p *syscall.Iovec 23 if len(iovs) > 0 { 24 p = &iovs[0] 25 } 26 n, _, errno := syscall6(uintptr(unsafe.Pointer(&procwritev)), 3, uintptr(fd), uintptr(unsafe.Pointer(p)), uintptr(len(iovs)), 0, 0, 0) 27 if errno != 0 { 28 return 0, errno 29 } 30 return n, nil 31 }