blob: 005638b06f2adf4d581607def7c28470b70b5243 [file] [log] [blame]
Colin Cross1371fe42019-03-19 21:08:48 -07001// 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
Dan Willemsenb8ef64a2023-04-04 01:48:15 -04005//go:build dragonfly || freebsd || linux || netbsd || (openbsd && mips64)
Colin Cross1371fe42019-03-19 21:08:48 -07006
7package poll
8
9import (
10 "syscall"
11 "unsafe"
12)
13
14func writev(fd int, iovecs []syscall.Iovec) (uintptr, error) {
Patrice Arruda7f4776e2020-06-25 11:55:41 -070015 var (
16 r uintptr
17 e syscall.Errno
18 )
19 for {
20 r, _, e = syscall.Syscall(syscall.SYS_WRITEV, uintptr(fd), uintptr(unsafe.Pointer(&iovecs[0])), uintptr(len(iovecs)))
21 if e != syscall.EINTR {
22 break
23 }
24 }
Colin Cross1371fe42019-03-19 21:08:48 -070025 if e != 0 {
Patrice Arruda7f4776e2020-06-25 11:55:41 -070026 return r, e
Colin Cross1371fe42019-03-19 21:08:48 -070027 }
28 return r, nil
29}