1 /* sysinfo.c -- input for mksysinfo.sh
3 Copyright 2009 The Go Authors. All rights reserved.
4 Use of this source code is governed by a BSD-style
5 license that can be found in the LICENSE file. */
7 /* This file is passed to GCC with the -fdump-go-spec option to
8 generate a Go version of the system information. */
12 #include <sys/types.h>
17 #include <netinet/in.h>
18 /* <netinet/tcp.h> needs u_char/u_short, but <sys/bsd_types> is only
19 included by <netinet/in.h> if _SGIAPI (i.e. _SGI_SOURCE
21 <sys/termios.h> only defines TIOCNOTTY if !_XOPEN_SOURCE, while
22 <sys/ttold.h> does so unconditionally. */
24 #include <sys/bsd_types.h>
25 #include <sys/ttold.h>
27 #include <netinet/tcp.h>
28 #if defined(HAVE_NETINET_IN_SYSTM_H)
29 #include <netinet/in_systm.h>
31 #if defined(HAVE_NETINET_IP_H)
32 #include <netinet/ip.h>
34 #if defined(HAVE_NETINET_IP_MROUTE_H)
35 #include <netinet/ip_mroute.h>
37 #if defined(HAVE_NETINET_IF_ETHER_H)
38 #include <netinet/if_ether.h>
41 #include <sys/ioctl.h>
43 #if defined(HAVE_SYSCALL_H)
46 #if defined(HAVE_SYS_SYSCALL_H)
47 #include <sys/syscall.h>
49 #if defined(HAVE_SYS_EPOLL_H)
50 #include <sys/epoll.h>
52 #if defined(HAVE_SYS_FILE_H)
55 #if defined(HAVE_SYS_MMAN_H)
58 #if defined(HAVE_SYS_PRCTL_H)
59 #include <sys/prctl.h>
61 #if defined(HAVE_SYS_PTRACE_H)
62 #include <sys/ptrace.h>
64 #include <sys/resource.h>
66 #include <sys/socket.h>
69 #include <sys/times.h>
72 #if defined(HAVE_SYS_USER_H)
75 #if defined(HAVE_SYS_UTSNAME_H)
76 #include <sys/utsname.h>
78 #if defined(HAVE_SYS_SELECT_H)
79 #include <sys/select.h>
86 #if defined(HAVE_LINUX_FILTER_H)
87 #include <linux/filter.h>
89 #if defined(HAVE_LINUX_IF_ADDR_H)
90 #include <linux/if_addr.h>
92 #if defined(HAVE_LINUX_IF_ETHER_H)
93 #include <linux/if_ether.h>
95 #if defined(HAVE_LINUX_IF_TUN_H)
96 #include <linux/if_tun.h>
98 #if defined(HAVE_LINUX_NETLINK_H)
99 #include <linux/netlink.h>
101 #if defined(HAVE_LINUX_RTNETLINK_H)
102 #include <linux/rtnetlink.h>
104 #if defined(HAVE_NET_IF_H)
107 #if defined(HAVE_NET_IF_ARP_H)
108 #include <net/if_arp.h>
110 #if defined(HAVE_NET_ROUTE_H)
111 #include <net/route.h>
113 #if defined (HAVE_NETPACKET_PACKET_H)
114 #include <netpacket/packet.h>
116 #if defined(HAVE_SYS_MOUNT_H)
117 #include <sys/mount.h>
119 #if defined(HAVE_SYS_VFS_H)
122 #if defined(HAVE_STATFS_H)
123 #include <sys/statfs.h>
125 #if defined(HAVE_SYS_TIMEX_H)
126 #include <sys/timex.h>
128 #if defined(HAVE_SYS_SYSINFO_H)
129 #include <sys/sysinfo.h>
131 #if defined(HAVE_USTAT_H)
134 #if defined(HAVE_UTIME_H)
137 #if defined(HAVE_LINUX_ETHER_H)
138 #include <linux/ether.h>
140 #if defined(HAVE_LINUX_FS_H)
141 #include <linux/fs.h>
143 #if defined(HAVE_LINUX_REBOOT_H)
144 #include <linux/reboot.h>
146 #if defined(HAVE_SYS_INOTIFY_H)
147 #include <sys/inotify.h>
149 #if defined(HAVE_NETINET_ICMP6_H)
150 #include <netinet/icmp6.h>
152 #if defined(HAVE_SCHED_H)
155 #if defined(HAVE_SEMAPHORE_H)
156 #include <semaphore.h>
159 /* Constants that may only be defined as expressions on some systems,
160 expressions too complex for -fdump-go-spec to handle. These are
161 handled specially below. */
164 TIOCGWINSZ_val
= TIOCGWINSZ
,
167 TIOCSWINSZ_val
= TIOCSWINSZ
,
170 TIOCNOTTY_val
= TIOCNOTTY
,
173 TIOCSCTTY_val
= TIOCSCTTY
,
176 TIOCGPGRP_val
= TIOCGPGRP
,
179 TIOCSPGRP_val
= TIOCSPGRP
,
182 TIOCGPTN_val
= TIOCGPTN
,
185 TIOCSPTLCK_val
= TIOCSPTLCK
,
188 TIOCGDEV_val
= TIOCGDEV
,
191 TIOCSIG_val
= TIOCSIG
,
200 TUNSETIFF_val
= TUNSETIFF
,
203 TUNSETNOCSUM_val
= TUNSETNOCSUM
,
206 TUNSETDEBUG_val
= TUNSETDEBUG
,
209 TUNSETPERSIST_val
= TUNSETPERSIST
,
212 TUNSETOWNER_val
= TUNSETOWNER
,
215 TUNSETLINK_val
= TUNSETLINK
,
218 TUNSETGROUP_val
= TUNSETGROUP
,
220 #ifdef TUNGETFEATURES
221 TUNGETFEATURES_val
= TUNGETFEATURES
,
224 TUNSETOFFLOAD_val
= TUNSETOFFLOAD
,
226 #ifdef TUNSETTXFILTER
227 TUNSETTXFILTER_val
= TUNSETTXFILTER
,
230 TUNGETIFF_val
= TUNGETIFF
,
233 TUNGETSNDBUF_val
= TUNGETSNDBUF
,
236 TUNSETSNDBUF_val
= TUNSETSNDBUF
,
238 #ifdef TUNATTACHFILTER
239 TUNATTACHFILTER_val
= TUNATTACHFILTER
,
241 #ifdef TUNDETACHFILTER
242 TUNDETACHFILTER_val
= TUNDETACHFILTER
,
244 #ifdef TUNGETVNETHDRSZ
245 TUNGETVNETHDRSZ_val
= TUNGETVNETHDRSZ
,
247 #ifdef TUNSETVNETHDRSZ
248 TUNSETVNETHDRSZ_val
= TUNSETVNETHDRSZ
,
251 TUNSETQUEUE_val
= TUNSETQUEUE
,
254 TUNSETIFINDEX_val
= TUNSETIFINDEX
,
257 TUNGETFILTER_val
= TUNGETFILTER
,
260 NLA_HDRLEN_val
= NLA_HDRLEN
,