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.
8 Input to cgo -godefs. See README.md
11 // +godefs map struct_in_addr [4]byte /* in_addr */
12 // +godefs map struct_in6_addr [16]byte /* in6_addr */
24 #include <sys/capability.h>
25 #include <sys/event.h>
27 #include <sys/mount.h>
28 #include <sys/param.h>
29 #include <sys/ptrace.h>
30 #include <sys/resource.h>
31 #include <sys/select.h>
32 #include <sys/signal.h>
33 #include <sys/socket.h>
36 #include <sys/types.h>
41 #include <net/if_dl.h>
42 #include <net/route.h>
43 #include <netinet/in.h>
44 #include <netinet/icmp6.h>
45 #include <netinet/tcp.h>
48 sizeofPtr = sizeof(void*),
52 struct sockaddr s1; // this one gets used for fields
53 struct sockaddr_in s2; // these pad it out
54 struct sockaddr_in6 s3;
55 struct sockaddr_un s4;
56 struct sockaddr_dl s5;
61 char pad[sizeof(union sockaddr_all) - sizeof(struct sockaddr)];
64 // This structure is a duplicate of stat on FreeBSD 8-STABLE.
65 // See /usr/include/sys/stat.h.
67 #undef st_atimespec st_atim
68 #undef st_mtimespec st_mtim
69 #undef st_ctimespec st_ctim
70 #undef st_birthtimespec st_birthtim
79 struct timespec st_atimespec;
80 struct timespec st_mtimespec;
81 struct timespec st_ctimespec;
97 struct timespec st_birthtimespec;
98 unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec));
99 unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec));
102 long st_birthtimensec;
103 unsigned int :(8 / 2) * (16 - (int)sizeof(struct __timespec));
104 unsigned int :(8 / 2) * (16 - (int)sizeof(struct __timespec));
108 // This structure is a duplicate of if_data on FreeBSD 8-STABLE.
109 // See /usr/include/net/if.h.
115 u_char ifi_link_state;
116 u_char ifi_spare_char1;
117 u_char ifi_spare_char2;
126 u_long ifi_collisions;
134 // FIXME: these are now unions, so maybe need to change definitions?
137 #undef ifi_lastchange
138 struct timeval ifi_lastchange;
141 // This structure is a duplicate of if_msghdr on FreeBSD 8-STABLE.
142 // See /usr/include/net/if.h.
150 struct if_data8 ifm_data;
155 // Machine characteristics; for internal use.
158 sizeofPtr = C.sizeofPtr
159 sizeofShort = C.sizeof_short
160 sizeofInt = C.sizeof_int
161 sizeofLong = C.sizeof_long
162 sizeofLongLong = C.sizeof_longlong
171 _C_long_long C.longlong
176 type Timespec C.struct_timespec
178 type Timeval C.struct_timeval
182 type Rusage C.struct_rusage
184 type Rlimit C.struct_rlimit
190 const ( // Directory mode bits
198 S_IFSOCK = C.S_IFSOCK
207 type Stat_t C.struct_stat8
209 type Statfs_t C.struct_statfs
211 type Flock_t C.struct_flock
213 type Dirent C.struct_dirent
215 type Fsid C.struct_fsid
220 FADV_NORMAL = C.POSIX_FADV_NORMAL
221 FADV_RANDOM = C.POSIX_FADV_RANDOM
222 FADV_SEQUENTIAL = C.POSIX_FADV_SEQUENTIAL
223 FADV_WILLNEED = C.POSIX_FADV_WILLNEED
224 FADV_DONTNEED = C.POSIX_FADV_DONTNEED
225 FADV_NOREUSE = C.POSIX_FADV_NOREUSE
230 type RawSockaddrInet4 C.struct_sockaddr_in
232 type RawSockaddrInet6 C.struct_sockaddr_in6
234 type RawSockaddrUnix C.struct_sockaddr_un
236 type RawSockaddrDatalink C.struct_sockaddr_dl
238 type RawSockaddr C.struct_sockaddr
240 type RawSockaddrAny C.struct_sockaddr_any
242 type _Socklen C.socklen_t
244 type Linger C.struct_linger
246 type Iovec C.struct_iovec
248 type IPMreq C.struct_ip_mreq
250 type IPMreqn C.struct_ip_mreqn
252 type IPv6Mreq C.struct_ipv6_mreq
254 type Msghdr C.struct_msghdr
256 type Cmsghdr C.struct_cmsghdr
258 type Inet6Pktinfo C.struct_in6_pktinfo
260 type IPv6MTUInfo C.struct_ip6_mtuinfo
262 type ICMPv6Filter C.struct_icmp6_filter
265 SizeofSockaddrInet4 = C.sizeof_struct_sockaddr_in
266 SizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6
267 SizeofSockaddrAny = C.sizeof_struct_sockaddr_any
268 SizeofSockaddrUnix = C.sizeof_struct_sockaddr_un
269 SizeofSockaddrDatalink = C.sizeof_struct_sockaddr_dl
270 SizeofLinger = C.sizeof_struct_linger
271 SizeofIPMreq = C.sizeof_struct_ip_mreq
272 SizeofIPMreqn = C.sizeof_struct_ip_mreqn
273 SizeofIPv6Mreq = C.sizeof_struct_ipv6_mreq
274 SizeofMsghdr = C.sizeof_struct_msghdr
275 SizeofCmsghdr = C.sizeof_struct_cmsghdr
276 SizeofInet6Pktinfo = C.sizeof_struct_in6_pktinfo
277 SizeofIPv6MTUInfo = C.sizeof_struct_ip6_mtuinfo
278 SizeofICMPv6Filter = C.sizeof_struct_icmp6_filter
284 PTRACE_TRACEME = C.PT_TRACE_ME
285 PTRACE_CONT = C.PT_CONTINUE
286 PTRACE_KILL = C.PT_KILL
289 // Events (kqueue, kevent)
291 type Kevent_t C.struct_kevent
297 // Routing and interface messages
300 sizeofIfMsghdr = C.sizeof_struct_if_msghdr
301 SizeofIfMsghdr = C.sizeof_struct_if_msghdr8
302 sizeofIfData = C.sizeof_struct_if_data
303 SizeofIfData = C.sizeof_struct_if_data8
304 SizeofIfaMsghdr = C.sizeof_struct_ifa_msghdr
305 SizeofIfmaMsghdr = C.sizeof_struct_ifma_msghdr
306 SizeofIfAnnounceMsghdr = C.sizeof_struct_if_announcemsghdr
307 SizeofRtMsghdr = C.sizeof_struct_rt_msghdr
308 SizeofRtMetrics = C.sizeof_struct_rt_metrics
311 type ifMsghdr C.struct_if_msghdr
313 type IfMsghdr C.struct_if_msghdr8
315 type ifData C.struct_if_data
317 type IfData C.struct_if_data8
319 type IfaMsghdr C.struct_ifa_msghdr
321 type IfmaMsghdr C.struct_ifma_msghdr
323 type IfAnnounceMsghdr C.struct_if_announcemsghdr
325 type RtMsghdr C.struct_rt_msghdr
327 type RtMetrics C.struct_rt_metrics
329 // Berkeley packet filter
332 SizeofBpfVersion = C.sizeof_struct_bpf_version
333 SizeofBpfStat = C.sizeof_struct_bpf_stat
334 SizeofBpfZbuf = C.sizeof_struct_bpf_zbuf
335 SizeofBpfProgram = C.sizeof_struct_bpf_program
336 SizeofBpfInsn = C.sizeof_struct_bpf_insn
337 SizeofBpfHdr = C.sizeof_struct_bpf_hdr
338 SizeofBpfZbufHeader = C.sizeof_struct_bpf_zbuf_header
341 type BpfVersion C.struct_bpf_version
343 type BpfStat C.struct_bpf_stat
345 type BpfZbuf C.struct_bpf_zbuf
347 type BpfProgram C.struct_bpf_program
349 type BpfInsn C.struct_bpf_insn
351 type BpfHdr C.struct_bpf_hdr
353 type BpfZbufHeader C.struct_bpf_zbuf_header
357 type Termios C.struct_termios
359 type Winsize C.struct_winsize
361 // fchmodat-like syscalls.
364 AT_FDCWD = C.AT_FDCWD
365 AT_REMOVEDIR = C.AT_REMOVEDIR
366 AT_SYMLINK_FOLLOW = C.AT_SYMLINK_FOLLOW
367 AT_SYMLINK_NOFOLLOW = C.AT_SYMLINK_NOFOLLOW
372 type CapRights C.struct_cap_rights