Debian Codegraph @

unix/types_solaris.go

raw
1 // Copyright 2009 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 ignore
6
7 /*
8 Input to cgo -godefs. See README.md
9 */
10
11 // +godefs map struct_in_addr [4]byte /* in_addr */
12 // +godefs map struct_in6_addr [16]byte /* in6_addr */
13
14 package unix
15
16 /*
17 #define KERNEL
18 // These defines ensure that builds done on newer versions of Solaris are
19 // backwards-compatible with older versions of Solaris and
20 // OpenSolaris-based derivatives.
21 #define __USE_SUNOS_SOCKETS__ // msghdr
22 #define __USE_LEGACY_PROTOTYPES__ // iovec
23 #include <dirent.h>
24 #include <fcntl.h>
25 #include <netdb.h>
26 #include <limits.h>
27 #include <poll.h>
28 #include <signal.h>
29 #include <termios.h>
30 #include <termio.h>
31 #include <stdio.h>
32 #include <unistd.h>
33 #include <sys/mman.h>
34 #include <sys/mount.h>
35 #include <sys/param.h>
36 #include <sys/port.h>
37 #include <sys/resource.h>
38 #include <sys/select.h>
39 #include <sys/signal.h>
40 #include <sys/socket.h>
41 #include <sys/sockio.h>
42 #include <sys/stat.h>
43 #include <sys/statvfs.h>
44 #include <sys/stropts.h>
45 #include <sys/time.h>
46 #include <sys/times.h>
47 #include <sys/types.h>
48 #include <sys/utsname.h>
49 #include <sys/un.h>
50 #include <sys/wait.h>
51 #include <net/bpf.h>
52 #include <net/if.h>
53 #include <net/if_dl.h>
54 #include <net/route.h>
55 #include <netinet/in.h>
56 #include <netinet/icmp6.h>
57 #include <netinet/tcp.h>
58 #include <ustat.h>
59 #include <utime.h>
60
61 enum {
62 sizeofPtr = sizeof(void*),
63 };
64
65 union sockaddr_all {
66 struct sockaddr s1; // this one gets used for fields
67 struct sockaddr_in s2; // these pad it out
68 struct sockaddr_in6 s3;
69 struct sockaddr_un s4;
70 struct sockaddr_dl s5;
71 };
72
73 struct sockaddr_any {
74 struct sockaddr addr;
75 char pad[sizeof(union sockaddr_all) - sizeof(struct sockaddr)];
76 };
77
78 // Solaris and the major illumos distributions ship a 3rd party tun/tap driver
79 // from https://github.com/kaizawa/tuntap
80 // It supports a pair of IOCTLs defined at
81 // https://github.com/kaizawa/tuntap/blob/master/if_tun.h#L91-L93
82 #define TUNNEWPPA (('T'<<16) | 0x0001)
83 #define TUNSETPPA (('T'<<16) | 0x0002)
84 */
85 import "C"
86
87 // Machine characteristics
88
89 const (
90 SizeofPtr = C.sizeofPtr
91 SizeofShort = C.sizeof_short
92 SizeofInt = C.sizeof_int
93 SizeofLong = C.sizeof_long
94 SizeofLongLong = C.sizeof_longlong
95 PathMax = C.PATH_MAX
96 MaxHostNameLen = C.MAXHOSTNAMELEN
97 )
98
99 // Basic types
100
101 type (
102 _C_short C.short
103 _C_int C.int
104 _C_long C.long
105 _C_long_long C.longlong
106 )
107
108 // Time
109
110 type Timespec C.struct_timespec
111
112 type Timeval C.struct_timeval
113
114 type Timeval32 C.struct_timeval32
115
116 type Tms C.struct_tms
117
118 type Utimbuf C.struct_utimbuf
119
120 // Processes
121
122 type Rusage C.struct_rusage
123
124 type Rlimit C.struct_rlimit
125
126 type _Gid_t C.gid_t
127
128 // Files
129
130 type Stat_t C.struct_stat
131
132 type Flock_t C.struct_flock
133
134 type Dirent C.struct_dirent
135
136 // Filesystems
137
138 type _Fsblkcnt_t C.fsblkcnt_t
139
140 type Statvfs_t C.struct_statvfs
141
142 // Sockets
143
144 type RawSockaddrInet4 C.struct_sockaddr_in
145
146 type RawSockaddrInet6 C.struct_sockaddr_in6
147
148 type RawSockaddrUnix C.struct_sockaddr_un
149
150 type RawSockaddrDatalink C.struct_sockaddr_dl
151
152 type RawSockaddr C.struct_sockaddr
153
154 type RawSockaddrAny C.struct_sockaddr_any
155
156 type _Socklen C.socklen_t
157
158 type Linger C.struct_linger
159
160 type Iovec C.struct_iovec
161
162 type IPMreq C.struct_ip_mreq
163
164 type IPv6Mreq C.struct_ipv6_mreq
165
166 type Msghdr C.struct_msghdr
167
168 type Cmsghdr C.struct_cmsghdr
169
170 type Inet4Pktinfo C.struct_in_pktinfo
171
172 type Inet6Pktinfo C.struct_in6_pktinfo
173
174 type IPv6MTUInfo C.struct_ip6_mtuinfo
175
176 type ICMPv6Filter C.struct_icmp6_filter
177
178 const (
179 SizeofSockaddrInet4 = C.sizeof_struct_sockaddr_in
180 SizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6
181 SizeofSockaddrAny = C.sizeof_struct_sockaddr_any
182 SizeofSockaddrUnix = C.sizeof_struct_sockaddr_un
183 SizeofSockaddrDatalink = C.sizeof_struct_sockaddr_dl
184 SizeofLinger = C.sizeof_struct_linger
185 SizeofIovec = C.sizeof_struct_iovec
186 SizeofIPMreq = C.sizeof_struct_ip_mreq
187 SizeofIPv6Mreq = C.sizeof_struct_ipv6_mreq
188 SizeofMsghdr = C.sizeof_struct_msghdr
189 SizeofCmsghdr = C.sizeof_struct_cmsghdr
190 SizeofInet4Pktinfo = C.sizeof_struct_in_pktinfo
191 SizeofInet6Pktinfo = C.sizeof_struct_in6_pktinfo
192 SizeofIPv6MTUInfo = C.sizeof_struct_ip6_mtuinfo
193 SizeofICMPv6Filter = C.sizeof_struct_icmp6_filter
194 )
195
196 // Select
197
198 type FdSet C.fd_set
199
200 // Misc
201
202 type Utsname C.struct_utsname
203
204 type Ustat_t C.struct_ustat
205
206 const (
207 AT_FDCWD = C.AT_FDCWD
208 AT_SYMLINK_NOFOLLOW = C.AT_SYMLINK_NOFOLLOW
209 AT_SYMLINK_FOLLOW = C.AT_SYMLINK_FOLLOW
210 AT_REMOVEDIR = C.AT_REMOVEDIR
211 AT_EACCESS = C.AT_EACCESS
212 )
213
214 // Routing and interface messages
215
216 const (
217 SizeofIfMsghdr = C.sizeof_struct_if_msghdr
218 SizeofIfData = C.sizeof_struct_if_data
219 SizeofIfaMsghdr = C.sizeof_struct_ifa_msghdr
220 SizeofRtMsghdr = C.sizeof_struct_rt_msghdr
221 SizeofRtMetrics = C.sizeof_struct_rt_metrics
222 )
223
224 type IfMsghdr C.struct_if_msghdr
225
226 type IfData C.struct_if_data
227
228 type IfaMsghdr C.struct_ifa_msghdr
229
230 type RtMsghdr C.struct_rt_msghdr
231
232 type RtMetrics C.struct_rt_metrics
233
234 // Berkeley packet filter
235
236 const (
237 SizeofBpfVersion = C.sizeof_struct_bpf_version
238 SizeofBpfStat = C.sizeof_struct_bpf_stat
239 SizeofBpfProgram = C.sizeof_struct_bpf_program
240 SizeofBpfInsn = C.sizeof_struct_bpf_insn
241 SizeofBpfHdr = C.sizeof_struct_bpf_hdr
242 )
243
244 type BpfVersion C.struct_bpf_version
245
246 type BpfStat C.struct_bpf_stat
247
248 type BpfProgram C.struct_bpf_program
249
250 type BpfInsn C.struct_bpf_insn
251
252 type BpfTimeval C.struct_bpf_timeval
253
254 type BpfHdr C.struct_bpf_hdr
255
256 // Terminal handling
257
258 type Termios C.struct_termios
259
260 type Termio C.struct_termio
261
262 type Winsize C.struct_winsize
263
264 // poll
265
266 type PollFd C.struct_pollfd
267
268 const (
269 POLLERR = C.POLLERR
270 POLLHUP = C.POLLHUP
271 POLLIN = C.POLLIN
272 POLLNVAL = C.POLLNVAL
273 POLLOUT = C.POLLOUT
274 POLLPRI = C.POLLPRI
275 POLLRDBAND = C.POLLRDBAND
276 POLLRDNORM = C.POLLRDNORM
277 POLLWRBAND = C.POLLWRBAND
278 POLLWRNORM = C.POLLWRNORM
279 )
280
281 // Event Ports
282
283 type fileObj C.struct_file_obj
284
285 type portEvent C.struct_port_event
286
287 const (
288 PORT_SOURCE_AIO = C.PORT_SOURCE_AIO
289 PORT_SOURCE_TIMER = C.PORT_SOURCE_TIMER
290 PORT_SOURCE_USER = C.PORT_SOURCE_USER
291 PORT_SOURCE_FD = C.PORT_SOURCE_FD
292 PORT_SOURCE_ALERT = C.PORT_SOURCE_ALERT
293 PORT_SOURCE_MQ = C.PORT_SOURCE_MQ
294 PORT_SOURCE_FILE = C.PORT_SOURCE_FILE
295 PORT_ALERT_SET = C.PORT_ALERT_SET
296 PORT_ALERT_UPDATE = C.PORT_ALERT_UPDATE
297 PORT_ALERT_INVALID = C.PORT_ALERT_INVALID
298 FILE_ACCESS = C.FILE_ACCESS
299 FILE_MODIFIED = C.FILE_MODIFIED
300 FILE_ATTRIB = C.FILE_ATTRIB
301 FILE_TRUNC = C.FILE_TRUNC
302 FILE_NOFOLLOW = C.FILE_NOFOLLOW
303 FILE_DELETE = C.FILE_DELETE
304 FILE_RENAME_TO = C.FILE_RENAME_TO
305 FILE_RENAME_FROM = C.FILE_RENAME_FROM
306 UNMOUNTED = C.UNMOUNTED
307 MOUNTEDOVER = C.MOUNTEDOVER
308 FILE_EXCEPTION = C.FILE_EXCEPTION
309 )
310
311 // STREAMS and Tun
312
313 const (
314 TUNNEWPPA = C.TUNNEWPPA
315 TUNSETPPA = C.TUNSETPPA
316
317 // sys/stropts.h:
318 I_STR = C.I_STR
319 I_POP = C.I_POP
320 I_PUSH = C.I_PUSH
321 I_LINK = C.I_LINK
322 I_UNLINK = C.I_UNLINK
323 I_PLINK = C.I_PLINK
324 I_PUNLINK = C.I_PUNLINK
325
326 // sys/sockio.h:
327 IF_UNITSEL = C.IF_UNITSEL
328 )
329
330 type strbuf C.struct_strbuf
331
332 type Strioctl C.struct_strioctl
333
334 type Lifreq C.struct_lifreq