…lines 1–97 unchanged (97 lines)
98#include <netinet/in.h>
99#include <termios.h>
100#include <netinet/ip.h>
101#include <net/ip_mroute/ip_mroute.h>
102'
103
104includes_FreeBSD='
105#include <sys/capsicum.h>
106#include <sys/param.h>
107#include <sys/types.h>
108#include <sys/disk.h>
109#include <sys/event.h>
110#include <sys/sched.h>
111#include <sys/select.h>
112#include <sys/socket.h>
113#include <sys/sockio.h>
114#include <sys/stat.h>
115#include <sys/sysctl.h>
116#include <sys/mman.h>
…lines 117–132 unchanged (16 lines)
133#define SIOCAIFADDR _IOW(105, 26, struct oifaliasreq) // ifaliasreq contains if_data
134#undef SIOCSIFPHYADDR
135#define SIOCSIFPHYADDR _IOW(105, 70, struct oifaliasreq) // ifaliasreq contains if_data
136#endif
137'
138
139includes_Linux='
140#define _LARGEFILE_SOURCE
141#define _LARGEFILE64_SOURCE
142#ifndef __LP64__
143#define _FILE_OFFSET_BITS 64
144#endif
145#define _GNU_SOURCE
…lines 146–184 unchanged (39 lines)
185#include <sys/stat.h>
186#include <sys/types.h>
187#include <sys/time.h>
188#include <sys/select.h>
189#include <sys/signalfd.h>
190#include <sys/socket.h>
191#include <sys/timerfd.h>
192#include <sys/uio.h>
193#include <sys/xattr.h>
194#include <linux/bpf.h>
195#include <linux/can.h>
196#include <linux/capability.h>
197#include <linux/cryptouser.h>
198#include <linux/devlink.h>
199#include <linux/errqueue.h>
200#include <linux/falloc.h>
201#include <linux/fanotify.h>
202#include <linux/filter.h>
203#include <linux/fs.h>
204#include <linux/fscrypt.h>
205#include <linux/fsverity.h>
206#include <linux/genetlink.h>
207#include <linux/hdreg.h>
208#include <linux/icmpv6.h>
209#include <linux/if.h>
210#include <linux/if_addr.h>
211#include <linux/if_alg.h>
212#include <linux/if_arp.h>
213#include <linux/if_ether.h>
214#include <linux/if_ppp.h>
215#include <linux/if_tun.h>
216#include <linux/if_packet.h>
217#include <linux/if_xdp.h>
218#include <linux/kexec.h>
219#include <linux/keyctl.h>
220#include <linux/loop.h>
221#include <linux/magic.h>
222#include <linux/memfd.h>
223#include <linux/module.h>
224#include <linux/netfilter/nfnetlink.h>
225#include <linux/netlink.h>
226#include <linux/net_namespace.h>
227#include <linux/nsfs.h>
228#include <linux/perf_event.h>
229#include <linux/ptrace.h>
230#include <linux/random.h>
231#include <linux/reboot.h>
232#include <linux/rtc.h>
233#include <linux/rtnetlink.h>
234#include <linux/sched.h>
235#include <linux/seccomp.h>
236#include <linux/serial.h>
237#include <linux/sockios.h>
238#include <linux/taskstats.h>
239#include <linux/tipc.h>
240#include <linux/vm_sockets.h>
241#include <linux/wait.h>
242#include <linux/watchdog.h>
243
244#include <mtd/ubi-user.h>
245#include <net/route.h>
246
247#if defined(__sparc__)
248// On sparc{,64}, the kernel defines struct termios2 itself which clashes with the
249// definition in glibc. As only the error constants are needed here, include the
250// generic termibits.h (which is included by termbits.h on sparc).
251#include <asm-generic/termbits.h>
252#else
253#include <asm/termbits.h>
254#endif
255
256#ifndef MSG_FASTOPEN
257#define MSG_FASTOPEN 0x20000000
258#endif
259
260#ifndef PTRACE_GETREGS
261#define PTRACE_GETREGS 0xc
262#endif
263
264#ifndef PTRACE_SETREGS
265#define PTRACE_SETREGS 0xd
266#endif
267
268#ifndef SOL_NETLINK
269#define SOL_NETLINK 270
270#endif
271
272#ifdef SOL_BLUETOOTH
273// SPARC includes this in /usr/include/sparc64-linux-gnu/bits/socket.h
274// but it is already in bluetooth_linux.go
275#undef SOL_BLUETOOTH
276#endif
277
278// Certain constants are missing from the fs/crypto UAPI
279#define FS_KEY_DESC_PREFIX "fscrypt:"
280#define FS_KEY_DESC_PREFIX_SIZE 8
281#define FS_MAX_KEY_SIZE 64
282
283// The code generator produces -0x1 for (~0), but an unsigned value is necessary
284// for the tipc_subscr timeout __u32 field.
285#undef TIPC_WAIT_FOREVER
286#define TIPC_WAIT_FOREVER 0xffffffff
287
288// Copied from linux/l2tp.h
289// Including linux/l2tp.h here causes conflicts between linux/in.h
290// and netinet/in.h included via net/route.h above.
291#define IPPROTO_L2TP 115
292'
293
294includes_NetBSD='
295#include <sys/types.h>
296#include <sys/param.h>
297#include <sys/event.h>
298#include <sys/extattr.h>
299#include <sys/mman.h>
300#include <sys/mount.h>
301#include <sys/sched.h>
302#include <sys/select.h>
303#include <sys/socket.h>
304#include <sys/sockio.h>
305#include <sys/sysctl.h>
306#include <sys/termios.h>
307#include <sys/ttycom.h>
308#include <sys/wait.h>
…lines 309–323 unchanged (15 lines)
324#include <sys/types.h>
325#include <sys/param.h>
326#include <sys/event.h>
327#include <sys/mman.h>
328#include <sys/mount.h>
329#include <sys/select.h>
330#include <sys/sched.h>
331#include <sys/socket.h>
332#include <sys/sockio.h>
333#include <sys/stat.h>
334#include <sys/sysctl.h>
335#include <sys/termios.h>
336#include <sys/ttycom.h>
337#include <sys/unistd.h>
…lines 338–414 unchanged (77 lines)
415 echo
416 echo 'const ('
417
418 # The gcc command line prints all the #defines
419 # it encounters while processing the input
420 echo "${!indirect} $includes" | $CC -x c - -E -dM $ccflags |
421 awk '
422 $1 != "#define" || $2 ~ /\(/ || $3 == "" {next}
423
424 $2 ~ /^E([ABCD]X|[BIS]P|[SD]I|S|FL)$/ {next} # 386 registers
425 $2 ~ /^(SIGEV_|SIGSTKSZ|SIGRT(MIN|MAX))/ {next}
426 $2 ~ /^(SCM_SRCRT)$/ {next}
427 $2 ~ /^(MAP_FAILED)$/ {next}
…lines 428–480 unchanged (53 lines)
481 $2 ~ /^HW_MACHINE$/ ||
482 $2 ~ /^SYSCTL_VERS/ ||
483 $2 !~ "MNT_BITS" &&
484 $2 ~ /^(MS|MNT|UMOUNT)_/ ||
485 $2 ~ /^NS_GET_/ ||
486 $2 ~ /^TUN(SET|GET|ATTACH|DETACH)/ ||
487 $2 ~ /^(O|F|[ES]?FD|NAME|S|PTRACE|PT|TFD)_/ ||
488 $2 ~ /^KEXEC_/ ||
489 $2 ~ /^LINUX_REBOOT_CMD_/ ||
490 $2 ~ /^LINUX_REBOOT_MAGIC[12]$/ ||
491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$2 ~ /^RND/ ||
522 $2 ~ /^KEY_(SPEC|REQKEY_DEFL)_/ ||
523 $2 ~ /^KEYCTL_/ ||
524 $2 ~ /^PERF_EVENT_IOC_/ ||
…lines 525–709 unchanged (185 lines)