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