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