Debian Codegraph @

unix/types_darwin.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 __DARWIN_UNIX03 0
18 #define KERNEL 1
19 #define _DARWIN_USE_64_BIT_INODE
20 #include <dirent.h>
21 #include <fcntl.h>
22 #include <poll.h>
23 #include <stdint.h>
24 #include <signal.h>
25 #include <termios.h>
26 #include <unistd.h>
27 #include <mach/mach.h>
28 #include <mach/message.h>
29 #include <sys/event.h>
30 #include <sys/ipc.h>
31 #include <sys/kern_control.h>
32 #include <sys/mman.h>
33 #include <sys/mount.h>
34 #include <sys/param.h>
35 #include <sys/ptrace.h>
36 #include <sys/resource.h>
37 #include <sys/select.h>
38 #include <sys/shm.h>
39 #include <sys/signal.h>
40 #include <sys/socket.h>
41 #include <sys/stat.h>
42 #include <sys/sysctl.h>
43 #include <sys/time.h>
44 #include <sys/types.h>
45 #include <sys/ucred.h>
46 #include <sys/uio.h>
47 #include <sys/un.h>
48 #include <sys/utsname.h>
49 #include <sys/wait.h>
50 #include <sys/vsock.h>
51 #include <net/bpf.h>
52 #include <net/if.h>
53 #include <net/if_dl.h>
54 #include <net/if_var.h>
55 #include <net/route.h>
56 #include <netinet/in.h>
57 #include <netinet/icmp6.h>
58 #include <netinet/tcp.h>
59
60 enum {
61 sizeofPtr = sizeof(void*),
62 };
63
64 union sockaddr_all {
65 struct sockaddr s1; // this one gets used for fields
66 struct sockaddr_in s2; // these pad it out
67 struct sockaddr_in6 s3;
68 struct sockaddr_un s4;
69 struct sockaddr_dl s5;
70 };
71
72 struct sockaddr_any {
73 struct sockaddr addr;
74 char pad[sizeof(union sockaddr_all) - sizeof(struct sockaddr)];
75 };
76
77 #if defined(__x86_64__)
78 typedef struct stat64 stat_t;
79 typedef struct statfs64 statfs_t;
80 #else // __arm__
81 typedef struct stat stat_t;
82 typedef struct statfs statfs_t;
83 #endif
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 )
96
97 // Basic types
98
99 type (
100 _C_short C.short
101 _C_int C.int
102 _C_long C.long
103 _C_long_long C.longlong
104 )
105
106 // Time
107
108 type Timespec C.struct_timespec
109
110 type Timeval C.struct_timeval
111
112 type Timeval32 C.struct_timeval32
113
114 // Processes
115
116 type Rusage C.struct_rusage
117
118 type Rlimit C.struct_rlimit
119
120 type _Gid_t C.gid_t
121
122 // Files
123
124 type Stat_t C.stat_t
125
126 type Statfs_t C.statfs_t
127
128 type Flock_t C.struct_flock
129
130 type Fstore_t C.struct_fstore
131
132 type Radvisory_t C.struct_radvisory
133
134 type Fbootstraptransfer_t C.struct_fbootstraptransfer
135
136 type Log2phys_t C.struct_log2phys
137
138 type Fsid C.struct_fsid
139
140 type Dirent C.struct_dirent
141
142 type Attrlist C.struct_attrlist
143
144 // File system limits
145
146 const (
147 PathMax = C.PATH_MAX
148 )
149
150 // Sockets
151
152 type RawSockaddrInet4 C.struct_sockaddr_in
153
154 type RawSockaddrInet6 C.struct_sockaddr_in6
155
156 type RawSockaddrUnix C.struct_sockaddr_un
157
158 type RawSockaddrDatalink C.struct_sockaddr_dl
159
160 type RawSockaddr C.struct_sockaddr
161
162 type RawSockaddrAny C.struct_sockaddr_any
163
164 type RawSockaddrCtl C.struct_sockaddr_ctl
165
166 type RawSockaddrVM C.struct_sockaddr_vm
167
168 type XVSockPCB C.struct_xvsockpcb
169
170 type XSocket C.struct_xsocket
171
172 type XSocket64 C.struct_xsocket64
173
174 type XSockbuf C.struct_xsockbuf
175
176 type XVSockPgen C.struct_xvsockpgen
177
178 type _Socklen C.socklen_t
179
180 type SaeAssocID C.sae_associd_t
181
182 type SaeConnID C.sae_connid_t
183
184 type SaEndpoints C.struct_sa_endpoints
185
186 type Xucred C.struct_xucred
187
188 type Linger C.struct_linger
189
190 type Iovec C.struct_iovec
191
192 type IPMreq C.struct_ip_mreq
193
194 type IPMreqn C.struct_ip_mreqn
195
196 type IPv6Mreq C.struct_ipv6_mreq
197
198 type Msghdr C.struct_msghdr
199
200 type Cmsghdr C.struct_cmsghdr
201
202 type Inet4Pktinfo C.struct_in_pktinfo
203
204 type Inet6Pktinfo C.struct_in6_pktinfo
205
206 type IPv6MTUInfo C.struct_ip6_mtuinfo
207
208 type ICMPv6Filter C.struct_icmp6_filter
209
210 type TCPConnectionInfo C.struct_tcp_connection_info
211
212 const (
213 SizeofSockaddrInet4 = C.sizeof_struct_sockaddr_in
214 SizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6
215 SizeofSockaddrAny = C.sizeof_struct_sockaddr_any
216 SizeofSockaddrUnix = C.sizeof_struct_sockaddr_un
217 SizeofSockaddrDatalink = C.sizeof_struct_sockaddr_dl
218 SizeofSockaddrCtl = C.sizeof_struct_sockaddr_ctl
219 SizeofSockaddrVM = C.sizeof_struct_sockaddr_vm
220 SizeofXvsockpcb = C.sizeof_struct_xvsockpcb
221 SizeofXSocket = C.sizeof_struct_xsocket
222 SizeofXSockbuf = C.sizeof_struct_xsockbuf
223 SizeofXVSockPgen = C.sizeof_struct_xvsockpgen
224 SizeofXucred = C.sizeof_struct_xucred
225 SizeofLinger = C.sizeof_struct_linger
226 SizeofIovec = C.sizeof_struct_iovec
227 SizeofIPMreq = C.sizeof_struct_ip_mreq
228 SizeofIPMreqn = C.sizeof_struct_ip_mreqn
229 SizeofIPv6Mreq = C.sizeof_struct_ipv6_mreq
230 SizeofMsghdr = C.sizeof_struct_msghdr
231 SizeofCmsghdr = C.sizeof_struct_cmsghdr
232 SizeofInet4Pktinfo = C.sizeof_struct_in_pktinfo
233 SizeofInet6Pktinfo = C.sizeof_struct_in6_pktinfo
234 SizeofIPv6MTUInfo = C.sizeof_struct_ip6_mtuinfo
235 SizeofICMPv6Filter = C.sizeof_struct_icmp6_filter
236 SizeofTCPConnectionInfo = C.sizeof_struct_tcp_connection_info
237 )
238
239 // Ptrace requests
240
241 const (
242 PTRACE_TRACEME = C.PT_TRACE_ME
243 PTRACE_CONT = C.PT_CONTINUE
244 PTRACE_KILL = C.PT_KILL
245 )
246
247 // Events (kqueue, kevent)
248
249 type Kevent_t C.struct_kevent
250
251 // Select
252
253 type FdSet C.fd_set
254
255 // Routing and interface messages
256
257 const (
258 SizeofIfMsghdr = C.sizeof_struct_if_msghdr
259 SizeofIfMsghdr2 = C.sizeof_struct_if_msghdr2
260 SizeofIfData = C.sizeof_struct_if_data
261 SizeofIfData64 = C.sizeof_struct_if_data64
262 SizeofIfaMsghdr = C.sizeof_struct_ifa_msghdr
263 SizeofIfmaMsghdr = C.sizeof_struct_ifma_msghdr
264 SizeofIfmaMsghdr2 = C.sizeof_struct_ifma_msghdr2
265 SizeofRtMsghdr = C.sizeof_struct_rt_msghdr
266 SizeofRtMsghdr2 = C.sizeof_struct_rt_msghdr2
267 SizeofRtMetrics = C.sizeof_struct_rt_metrics
268 )
269
270 type IfMsghdr C.struct_if_msghdr
271
272 type IfMsghdr2 C.struct_if_msghdr2
273
274 type IfData C.struct_if_data
275
276 type IfData64 C.struct_if_data64
277
278 type IfaMsghdr C.struct_ifa_msghdr
279
280 type IfmaMsghdr C.struct_ifma_msghdr
281
282 type IfmaMsghdr2 C.struct_ifma_msghdr2
283
284 type RtMsghdr C.struct_rt_msghdr
285
286 type RtMsghdr2 C.struct_rt_msghdr2
287
288 type RtMetrics C.struct_rt_metrics
289
290 // Berkeley packet filter
291
292 const (
293 SizeofBpfVersion = C.sizeof_struct_bpf_version
294 SizeofBpfStat = C.sizeof_struct_bpf_stat
295 SizeofBpfProgram = C.sizeof_struct_bpf_program
296 SizeofBpfInsn = C.sizeof_struct_bpf_insn
297 SizeofBpfHdr = C.sizeof_struct_bpf_hdr
298 )
299
300 type BpfVersion C.struct_bpf_version
301
302 type BpfStat C.struct_bpf_stat
303
304 type BpfProgram C.struct_bpf_program
305
306 type BpfInsn C.struct_bpf_insn
307
308 type BpfHdr C.struct_bpf_hdr
309
310 // Terminal handling
311
312 type Termios C.struct_termios
313
314 type Winsize C.struct_winsize
315
316 // fchmodat-like syscalls.
317
318 const (
319 AT_FDCWD = C.AT_FDCWD
320 AT_REMOVEDIR = C.AT_REMOVEDIR
321 AT_SYMLINK_FOLLOW = C.AT_SYMLINK_FOLLOW
322 AT_SYMLINK_NOFOLLOW = C.AT_SYMLINK_NOFOLLOW
323 AT_EACCESS = C.AT_EACCESS
324 )
325
326 // poll
327
328 type PollFd C.struct_pollfd
329
330 const (
331 POLLERR = C.POLLERR
332 POLLHUP = C.POLLHUP
333 POLLIN = C.POLLIN
334 POLLNVAL = C.POLLNVAL
335 POLLOUT = C.POLLOUT
336 POLLPRI = C.POLLPRI
337 POLLRDBAND = C.POLLRDBAND
338 POLLRDNORM = C.POLLRDNORM
339 POLLWRBAND = C.POLLWRBAND
340 POLLWRNORM = C.POLLWRNORM
341 )
342
343 // uname
344
345 type Utsname C.struct_utsname
346
347 // Clockinfo
348
349 const SizeofClockinfo = C.sizeof_struct_clockinfo
350
351 type Clockinfo C.struct_clockinfo
352
353 // ctl_info
354
355 type CtlInfo C.struct_ctl_info
356
357 // KinfoProc
358
359 const SizeofKinfoProc = C.sizeof_struct_kinfo_proc
360
361 type Eproc C.struct_eproc
362
363 type ExternProc C.struct_extern_proc
364
365 type Itimerval C.struct_itimerval
366
367 type KinfoProc C.struct_kinfo_proc
368
369 type Vmspace C.struct_vmspace
370
371 type Pcred C.struct__pcred
372
373 type Ucred C.struct__ucred
374
375 // shm
376
377 type SysvIpcPerm C.struct_ipc_perm
378 type SysvShmDesc C.struct_shmid_ds
379
380 const (
381 IPC_CREAT = C.IPC_CREAT
382 IPC_EXCL = C.IPC_EXCL
383 IPC_NOWAIT = C.IPC_NOWAIT
384 IPC_PRIVATE = C.IPC_PRIVATE
385 )
386
387 const (
388 IPC_RMID = C.IPC_RMID
389 IPC_SET = C.IPC_SET
390 IPC_STAT = C.IPC_STAT
391 )
392
393 const (
394 SHM_RDONLY = C.SHM_RDONLY
395 SHM_RND = C.SHM_RND
396 )