1
2
3
4
5
6 package unix
7
8 import (
9 "unsafe"
10 )
11
12
13
14
15
16
17
18
19
20
21
22
23
24 var (
25 procreadv,
26 procpreadv,
27 procwritev,
28 procpwritev,
29 procaccept4 syscallFunc
30 )
31
32
33
34 func readv(fd int, iovs []Iovec) (n int, err error) {
35 var _p0 *Iovec
36 if len(iovs) > 0 {
37 _p0 = &iovs[0]
38 }
39 r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procreadv)), 3, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(len(iovs)), 0, 0, 0)
40 n = int(r0)
41 if e1 != 0 {
42 err = errnoErr(e1)
43 }
44 return
45 }
46
47
48
49 func preadv(fd int, iovs []Iovec, off int64) (n int, err error) {
50 var _p0 *Iovec
51 if len(iovs) > 0 {
52 _p0 = &iovs[0]
53 }
54 r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procpreadv)), 4, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(len(iovs)), uintptr(off), 0, 0)
55 n = int(r0)
56 if e1 != 0 {
57 err = errnoErr(e1)
58 }
59 return
60 }
61
62
63
64 func writev(fd int, iovs []Iovec) (n int, err error) {
65 var _p0 *Iovec
66 if len(iovs) > 0 {
67 _p0 = &iovs[0]
68 }
69 r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procwritev)), 3, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(len(iovs)), 0, 0, 0)
70 n = int(r0)
71 if e1 != 0 {
72 err = errnoErr(e1)
73 }
74 return
75 }
76
77
78
79 func pwritev(fd int, iovs []Iovec, off int64) (n int, err error) {
80 var _p0 *Iovec
81 if len(iovs) > 0 {
82 _p0 = &iovs[0]
83 }
84 r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procpwritev)), 4, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(len(iovs)), uintptr(off), 0, 0)
85 n = int(r0)
86 if e1 != 0 {
87 err = errnoErr(e1)
88 }
89 return
90 }
91
92
93
94 func accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error) {
95 r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procaccept4)), 4, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), uintptr(flags), 0, 0)
96 fd = int(r0)
97 if e1 != 0 {
98 err = errnoErr(e1)
99 }
100 return
101 }
102
View as plain text