* c-c++-common/ubsan/sanitize-recover-7.c (dg-options): Add -w.
[official-gcc.git] / libgo / sysinfo.c
bloba1afc7d119c56bd9a6ba4d356a0d423e83fcdeb4
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. */
10 #include "config.h"
12 #include <stddef.h>
13 #include <sys/types.h>
14 #include <dirent.h>
15 #include <errno.h>
16 #include <fcntl.h>
17 #include <ucontext.h>
18 #include <netinet/in.h>
19 /* <netinet/tcp.h> needs u_char/u_short, but <sys/bsd_types> is only
20 included by <netinet/in.h> if _SGIAPI (i.e. _SGI_SOURCE
21 && !_XOPEN_SOURCE.
22 <sys/termios.h> only defines TIOCNOTTY if !_XOPEN_SOURCE, while
23 <sys/ttold.h> does so unconditionally. */
24 #ifdef __sgi__
25 #include <sys/bsd_types.h>
26 #include <sys/ttold.h>
27 #endif
28 #include <netinet/tcp.h>
29 #if defined(HAVE_NETINET_IN_SYSTM_H)
30 #include <netinet/in_systm.h>
31 #endif
32 #if defined(HAVE_NETINET_IP_H)
33 #include <netinet/ip.h>
34 #endif
35 #if defined(HAVE_NETINET_IP_MROUTE_H)
36 #include <netinet/ip_mroute.h>
37 #endif
38 #if defined(HAVE_NETINET_IF_ETHER_H)
39 #include <netinet/if_ether.h>
40 #endif
41 #include <signal.h>
42 #include <sys/ioctl.h>
43 #include <termios.h>
44 #if defined(HAVE_SYSCALL_H)
45 #include <syscall.h>
46 #endif
47 #if defined(HAVE_SYS_SYSCALL_H)
48 #include <sys/syscall.h>
49 #endif
50 #if defined(HAVE_SYS_EPOLL_H)
51 #include <sys/epoll.h>
52 #endif
53 #if defined(HAVE_SYS_EVENT_H)
54 #include <sys/event.h>
55 #endif
56 #if defined(HAVE_SYS_FILE_H)
57 #include <sys/file.h>
58 #endif
59 #if defined(HAVE_SYS_MMAN_H)
60 #include <sys/mman.h>
61 #endif
62 #if defined(HAVE_SYS_PRCTL_H)
63 #include <sys/prctl.h>
64 #endif
65 #if defined(HAVE_SYS_PTRACE_H)
66 #include <sys/ptrace.h>
67 #endif
68 #include <sys/resource.h>
69 #include <sys/uio.h>
70 #include <sys/socket.h>
71 #include <sys/stat.h>
72 #include <sys/time.h>
73 #include <sys/times.h>
74 #include <sys/wait.h>
75 #include <sys/un.h>
76 #if defined(HAVE_SYS_USER_H)
77 #include <sys/user.h>
78 #endif
79 #if defined(HAVE_SYS_UTSNAME_H)
80 #include <sys/utsname.h>
81 #endif
82 #if defined(HAVE_SYS_SELECT_H)
83 #include <sys/select.h>
84 #endif
85 #include <time.h>
86 #include <unistd.h>
87 #include <netdb.h>
88 #include <pwd.h>
89 #include <grp.h>
90 #if defined(HAVE_LINUX_FILTER_H)
91 #include <linux/filter.h>
92 #endif
93 #if defined(HAVE_LINUX_IF_ADDR_H)
94 #include <linux/if_addr.h>
95 #endif
96 #if defined(HAVE_LINUX_IF_ETHER_H)
97 #include <linux/if_ether.h>
98 #endif
99 #if defined(HAVE_LINUX_IF_TUN_H)
100 #include <linux/if_tun.h>
101 #endif
102 #if defined(HAVE_LINUX_NETLINK_H)
103 #include <linux/netlink.h>
104 #endif
105 #if defined(HAVE_LINUX_PTRACE_H)
106 #include <linux/ptrace.h>
107 #endif
108 #if defined(HAVE_LINUX_RTNETLINK_H)
109 #include <linux/rtnetlink.h>
110 #endif
111 #if defined(HAVE_NET_IF_H)
112 #include <net/if.h>
113 #endif
114 #if defined(HAVE_NET_IF_ARP_H)
115 #include <net/if_arp.h>
116 #endif
117 #if defined(HAVE_NET_ROUTE_H)
118 #include <net/route.h>
119 #endif
120 #if defined (HAVE_NETPACKET_PACKET_H)
121 #include <netpacket/packet.h>
122 #endif
123 #if defined(HAVE_SYS_MOUNT_H)
124 #include <sys/mount.h>
125 #endif
126 #if defined(HAVE_SYS_VFS_H)
127 #include <sys/vfs.h>
128 #endif
129 #if defined(HAVE_STATFS_H)
130 #include <sys/statfs.h>
131 #endif
132 #if defined(HAVE_SYS_TIMEX_H)
133 #include <sys/timex.h>
134 #endif
135 #if defined(HAVE_SYS_SYSINFO_H)
136 #include <sys/sysinfo.h>
137 #endif
138 #if defined(HAVE_USTAT_H)
139 #include <ustat.h>
140 #endif
141 #if defined(HAVE_UTIME_H)
142 #include <utime.h>
143 #endif
144 #if defined(HAVE_LINUX_ETHER_H)
145 #include <linux/ether.h>
146 #endif
147 #if defined(HAVE_LINUX_FS_H)
148 #include <linux/fs.h>
149 #endif
150 #if defined(HAVE_LINUX_REBOOT_H)
151 #include <linux/reboot.h>
152 #endif
153 #if defined(HAVE_SYS_INOTIFY_H)
154 #include <sys/inotify.h>
155 #endif
156 #if defined(HAVE_NETINET_ICMP6_H)
157 #include <netinet/icmp6.h>
158 #endif
159 #if defined(HAVE_SCHED_H)
160 #include <sched.h>
161 #endif
162 #if defined(HAVE_SEMAPHORE_H)
163 #include <semaphore.h>
164 #endif
165 #if defined(HAVE_PORT_H)
166 #include <port.h>
167 #endif
169 #ifdef USE_LIBFFI
170 #include "ffi.h"
171 #endif
173 /* Constants that may only be defined as expressions on some systems,
174 expressions too complex for -fdump-go-spec to handle. These are
175 handled specially below. */
176 enum {
177 #ifdef TIOCGWINSZ
178 TIOCGWINSZ_val = TIOCGWINSZ,
179 #endif
180 #ifdef TIOCSWINSZ
181 TIOCSWINSZ_val = TIOCSWINSZ,
182 #endif
183 #ifdef TIOCNOTTY
184 TIOCNOTTY_val = TIOCNOTTY,
185 #endif
186 #ifdef TIOCSCTTY
187 TIOCSCTTY_val = TIOCSCTTY,
188 #endif
189 #ifdef TIOCGPGRP
190 TIOCGPGRP_val = TIOCGPGRP,
191 #endif
192 #ifdef TIOCSPGRP
193 TIOCSPGRP_val = TIOCSPGRP,
194 #endif
195 #ifdef TIOCGPTN
196 TIOCGPTN_val = TIOCGPTN,
197 #endif
198 #ifdef TIOCSPTLCK
199 TIOCSPTLCK_val = TIOCSPTLCK,
200 #endif
201 #ifdef TIOCGDEV
202 TIOCGDEV_val = TIOCGDEV,
203 #endif
204 #ifdef TIOCSIG
205 TIOCSIG_val = TIOCSIG,
206 #endif
207 #ifdef TCGETS
208 TCGETS_val = TCGETS,
209 #endif
210 #ifdef TCSETS
211 TCSETS_val = TCSETS,
212 #endif
213 #ifdef TUNSETIFF
214 TUNSETIFF_val = TUNSETIFF,
215 #endif
216 #ifdef TUNSETNOCSUM
217 TUNSETNOCSUM_val = TUNSETNOCSUM,
218 #endif
219 #ifdef TUNSETDEBUG
220 TUNSETDEBUG_val = TUNSETDEBUG,
221 #endif
222 #ifdef TUNSETPERSIST
223 TUNSETPERSIST_val = TUNSETPERSIST,
224 #endif
225 #ifdef TUNSETOWNER
226 TUNSETOWNER_val = TUNSETOWNER,
227 #endif
228 #ifdef TUNSETLINK
229 TUNSETLINK_val = TUNSETLINK,
230 #endif
231 #ifdef TUNSETGROUP
232 TUNSETGROUP_val = TUNSETGROUP,
233 #endif
234 #ifdef TUNGETFEATURES
235 TUNGETFEATURES_val = TUNGETFEATURES,
236 #endif
237 #ifdef TUNSETOFFLOAD
238 TUNSETOFFLOAD_val = TUNSETOFFLOAD,
239 #endif
240 #ifdef TUNSETTXFILTER
241 TUNSETTXFILTER_val = TUNSETTXFILTER,
242 #endif
243 #ifdef TUNGETIFF
244 TUNGETIFF_val = TUNGETIFF,
245 #endif
246 #ifdef TUNGETSNDBUF
247 TUNGETSNDBUF_val = TUNGETSNDBUF,
248 #endif
249 #ifdef TUNSETSNDBUF
250 TUNSETSNDBUF_val = TUNSETSNDBUF,
251 #endif
252 #ifdef TUNATTACHFILTER
253 TUNATTACHFILTER_val = TUNATTACHFILTER,
254 #endif
255 #ifdef TUNDETACHFILTER
256 TUNDETACHFILTER_val = TUNDETACHFILTER,
257 #endif
258 #ifdef TUNGETVNETHDRSZ
259 TUNGETVNETHDRSZ_val = TUNGETVNETHDRSZ,
260 #endif
261 #ifdef TUNSETVNETHDRSZ
262 TUNSETVNETHDRSZ_val = TUNSETVNETHDRSZ,
263 #endif
264 #ifdef TUNSETQUEUE
265 TUNSETQUEUE_val = TUNSETQUEUE,
266 #endif
267 #ifdef TUNSETIFINDEX
268 TUNSETIFINDEX_val = TUNSETIFINDEX,
269 #endif
270 #ifdef TUNGETFILTER
271 TUNGETFILTER_val = TUNGETFILTER,
272 #endif
273 #ifdef NLA_HDRLEN
274 NLA_HDRLEN_val = NLA_HDRLEN,
275 #endif
278 #if defined(HAVE_SYS_EPOLL_H)
279 enum {
280 epoll_data_offset = offsetof(struct epoll_event, data)
282 #endif