blob: 155c2e692b45eb9f4416eaa6fe5ad50c4ea655a1 [file] [log] [blame]
Kent Hagerman6379e092020-02-18 18:05:57 -05001// 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// +build ignore
6
7/*
8Input 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
14package unix
15
16/*
17#define __DARWIN_UNIX03 0
18#define KERNEL
19#define _DARWIN_USE_64_BIT_INODE
20#include <dirent.h>
21#include <fcntl.h>
22#include <poll.h>
23#include <signal.h>
24#include <termios.h>
25#include <unistd.h>
26#include <mach/mach.h>
27#include <mach/message.h>
28#include <sys/event.h>
29#include <sys/mman.h>
30#include <sys/mount.h>
31#include <sys/param.h>
32#include <sys/ptrace.h>
33#include <sys/resource.h>
34#include <sys/select.h>
35#include <sys/signal.h>
36#include <sys/socket.h>
37#include <sys/stat.h>
38#include <sys/time.h>
39#include <sys/types.h>
40#include <sys/uio.h>
41#include <sys/un.h>
42#include <sys/utsname.h>
43#include <sys/wait.h>
44#include <net/bpf.h>
45#include <net/if.h>
46#include <net/if_dl.h>
47#include <net/if_var.h>
48#include <net/route.h>
49#include <netinet/in.h>
50#include <netinet/icmp6.h>
51#include <netinet/tcp.h>
52
53enum {
54 sizeofPtr = sizeof(void*),
55};
56
57union sockaddr_all {
58 struct sockaddr s1; // this one gets used for fields
59 struct sockaddr_in s2; // these pad it out
60 struct sockaddr_in6 s3;
61 struct sockaddr_un s4;
62 struct sockaddr_dl s5;
63};
64
65struct sockaddr_any {
66 struct sockaddr addr;
67 char pad[sizeof(union sockaddr_all) - sizeof(struct sockaddr)];
68};
69
70*/
71import "C"
72
73// Machine characteristics
74
75const (
76 SizeofPtr = C.sizeofPtr
77 SizeofShort = C.sizeof_short
78 SizeofInt = C.sizeof_int
79 SizeofLong = C.sizeof_long
80 SizeofLongLong = C.sizeof_longlong
81)
82
83// Basic types
84
85type (
86 _C_short C.short
87 _C_int C.int
88 _C_long C.long
89 _C_long_long C.longlong
90)
91
92// Time
93
94type Timespec C.struct_timespec
95
96type Timeval C.struct_timeval
97
98type Timeval32 C.struct_timeval32
99
100// Processes
101
102type Rusage C.struct_rusage
103
104type Rlimit C.struct_rlimit
105
106type _Gid_t C.gid_t
107
108// Files
109
110type Stat_t C.struct_stat64
111
112type Statfs_t C.struct_statfs64
113
114type Flock_t C.struct_flock
115
116type Fstore_t C.struct_fstore
117
118type Radvisory_t C.struct_radvisory
119
120type Fbootstraptransfer_t C.struct_fbootstraptransfer
121
122type Log2phys_t C.struct_log2phys
123
124type Fsid C.struct_fsid
125
126type Dirent C.struct_dirent
127
128// Sockets
129
130type RawSockaddrInet4 C.struct_sockaddr_in
131
132type RawSockaddrInet6 C.struct_sockaddr_in6
133
134type RawSockaddrUnix C.struct_sockaddr_un
135
136type RawSockaddrDatalink C.struct_sockaddr_dl
137
138type RawSockaddr C.struct_sockaddr
139
140type RawSockaddrAny C.struct_sockaddr_any
141
142type _Socklen C.socklen_t
143
144type Linger C.struct_linger
145
146type Iovec C.struct_iovec
147
148type IPMreq C.struct_ip_mreq
149
150type IPv6Mreq C.struct_ipv6_mreq
151
152type Msghdr C.struct_msghdr
153
154type Cmsghdr C.struct_cmsghdr
155
156type Inet4Pktinfo C.struct_in_pktinfo
157
158type Inet6Pktinfo C.struct_in6_pktinfo
159
160type IPv6MTUInfo C.struct_ip6_mtuinfo
161
162type ICMPv6Filter C.struct_icmp6_filter
163
164const (
165 SizeofSockaddrInet4 = C.sizeof_struct_sockaddr_in
166 SizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6
167 SizeofSockaddrAny = C.sizeof_struct_sockaddr_any
168 SizeofSockaddrUnix = C.sizeof_struct_sockaddr_un
169 SizeofSockaddrDatalink = C.sizeof_struct_sockaddr_dl
170 SizeofLinger = C.sizeof_struct_linger
171 SizeofIPMreq = C.sizeof_struct_ip_mreq
172 SizeofIPv6Mreq = C.sizeof_struct_ipv6_mreq
173 SizeofMsghdr = C.sizeof_struct_msghdr
174 SizeofCmsghdr = C.sizeof_struct_cmsghdr
175 SizeofInet4Pktinfo = C.sizeof_struct_in_pktinfo
176 SizeofInet6Pktinfo = C.sizeof_struct_in6_pktinfo
177 SizeofIPv6MTUInfo = C.sizeof_struct_ip6_mtuinfo
178 SizeofICMPv6Filter = C.sizeof_struct_icmp6_filter
179)
180
181// Ptrace requests
182
183const (
184 PTRACE_TRACEME = C.PT_TRACE_ME
185 PTRACE_CONT = C.PT_CONTINUE
186 PTRACE_KILL = C.PT_KILL
187)
188
189// Events (kqueue, kevent)
190
191type Kevent_t C.struct_kevent
192
193// Select
194
195type FdSet C.fd_set
196
197// Routing and interface messages
198
199const (
200 SizeofIfMsghdr = C.sizeof_struct_if_msghdr
201 SizeofIfData = C.sizeof_struct_if_data
202 SizeofIfaMsghdr = C.sizeof_struct_ifa_msghdr
203 SizeofIfmaMsghdr = C.sizeof_struct_ifma_msghdr
204 SizeofIfmaMsghdr2 = C.sizeof_struct_ifma_msghdr2
205 SizeofRtMsghdr = C.sizeof_struct_rt_msghdr
206 SizeofRtMetrics = C.sizeof_struct_rt_metrics
207)
208
209type IfMsghdr C.struct_if_msghdr
210
211type IfData C.struct_if_data
212
213type IfaMsghdr C.struct_ifa_msghdr
214
215type IfmaMsghdr C.struct_ifma_msghdr
216
217type IfmaMsghdr2 C.struct_ifma_msghdr2
218
219type RtMsghdr C.struct_rt_msghdr
220
221type RtMetrics C.struct_rt_metrics
222
223// Berkeley packet filter
224
225const (
226 SizeofBpfVersion = C.sizeof_struct_bpf_version
227 SizeofBpfStat = C.sizeof_struct_bpf_stat
228 SizeofBpfProgram = C.sizeof_struct_bpf_program
229 SizeofBpfInsn = C.sizeof_struct_bpf_insn
230 SizeofBpfHdr = C.sizeof_struct_bpf_hdr
231)
232
233type BpfVersion C.struct_bpf_version
234
235type BpfStat C.struct_bpf_stat
236
237type BpfProgram C.struct_bpf_program
238
239type BpfInsn C.struct_bpf_insn
240
241type BpfHdr C.struct_bpf_hdr
242
243// Terminal handling
244
245type Termios C.struct_termios
246
247type Winsize C.struct_winsize
248
249// fchmodat-like syscalls.
250
251const (
252 AT_FDCWD = C.AT_FDCWD
253 AT_REMOVEDIR = C.AT_REMOVEDIR
254 AT_SYMLINK_FOLLOW = C.AT_SYMLINK_FOLLOW
255 AT_SYMLINK_NOFOLLOW = C.AT_SYMLINK_NOFOLLOW
256)
257
258// poll
259
260type PollFd C.struct_pollfd
261
262const (
263 POLLERR = C.POLLERR
264 POLLHUP = C.POLLHUP
265 POLLIN = C.POLLIN
266 POLLNVAL = C.POLLNVAL
267 POLLOUT = C.POLLOUT
268 POLLPRI = C.POLLPRI
269 POLLRDBAND = C.POLLRDBAND
270 POLLRDNORM = C.POLLRDNORM
271 POLLWRBAND = C.POLLWRBAND
272 POLLWRNORM = C.POLLWRNORM
273)
274
275// uname
276
277type Utsname C.struct_utsname
278
279// Clockinfo
280
281const SizeofClockinfo = C.sizeof_struct_clockinfo
282
283type Clockinfo C.struct_clockinfo