gitee.com/ks-custle/core-gm@v0.0.0-20230922171213-b83bdd97b62c/internal/poll/fd_writev_unix.go (about) 1 // Copyright 2018 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 dragonfly || freebsd || linux || netbsd || openbsd 6 // +build dragonfly freebsd linux netbsd openbsd 7 8 package poll 9 10 import ( 11 "syscall" 12 "unsafe" 13 ) 14 15 func writev(fd int, iovecs []syscall.Iovec) (uintptr, error) { 16 var ( 17 r uintptr 18 e syscall.Errno 19 ) 20 for { 21 r, _, e = syscall.Syscall(syscall.SYS_WRITEV, uintptr(fd), uintptr(unsafe.Pointer(&iovecs[0])), uintptr(len(iovecs))) 22 if e != syscall.EINTR { 23 break 24 } 25 } 26 if e != 0 { 27 return r, e 28 } 29 return r, nil 30 }