Rename DR_ALIGNED_TO to DR_OFFSET_ALIGNMENT
[official-gcc.git] / libgo / sysinfo.c
blob1ba27b1a0936c5d51575a70d39faca501ab6a1d8
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 /* Avoid https://sourceware.org/bugzilla/show_bug.cgi?id=762 . */
107 #define ia64_fpreg pt_ia64_fpreg
108 #define pt_all_user_regs pt_ia64_all_user_regs
109 #include <linux/ptrace.h>
110 #undef ia64_fpreg
111 #undef pt_all_user_regs
112 #endif
113 #if defined(HAVE_LINUX_RTNETLINK_H)
114 #include <linux/rtnetlink.h>
115 #endif
116 #if defined(HAVE_NET_IF_H)
117 #include <net/if.h>
118 #endif
119 #if defined(HAVE_NET_IF_ARP_H)
120 #include <net/if_arp.h>
121 #endif
122 #if defined(HAVE_NET_ROUTE_H)
123 #include <net/route.h>
124 #endif
125 #if defined (HAVE_NETPACKET_PACKET_H)
126 #include <netpacket/packet.h>
127 #endif
128 #if defined(HAVE_SYS_MOUNT_H)
129 #include <sys/mount.h>
130 #endif
131 #if defined(HAVE_SYS_VFS_H)
132 #include <sys/vfs.h>
133 #endif
134 #if defined(HAVE_STATFS_H)
135 #include <sys/statfs.h>
136 #endif
137 #if defined(HAVE_SYS_TIMEX_H)
138 #include <sys/timex.h>
139 #endif
140 #if defined(HAVE_SYS_SYSINFO_H)
141 #include <sys/sysinfo.h>
142 #endif
143 #if defined(HAVE_USTAT_H)
144 #include <ustat.h>
145 #endif
146 #if defined(HAVE_UTIME_H)
147 #include <utime.h>
148 #endif
149 #if defined(HAVE_LINUX_ETHER_H)
150 #include <linux/ether.h>
151 #endif
152 #if defined(HAVE_LINUX_FS_H)
153 #include <linux/fs.h>
154 #endif
155 #if defined(HAVE_LINUX_REBOOT_H)
156 #include <linux/reboot.h>
157 #endif
158 #if defined(HAVE_SYS_INOTIFY_H)
159 #include <sys/inotify.h>
160 #endif
161 #if defined(HAVE_NETINET_ICMP6_H)
162 #include <netinet/icmp6.h>
163 #endif
164 #if defined(HAVE_SCHED_H)
165 #include <sched.h>
166 #endif
167 #if defined(HAVE_SEMAPHORE_H)
168 #include <semaphore.h>
169 #endif
170 #if defined(HAVE_PORT_H)
171 #include <port.h>
172 #endif
174 #ifdef USE_LIBFFI
175 #include "ffi.h"
176 #endif
178 /* Constants that may only be defined as expressions on some systems,
179 expressions too complex for -fdump-go-spec to handle. These are
180 handled specially below. */
181 enum {
182 #ifdef TIOCGWINSZ
183 TIOCGWINSZ_val = TIOCGWINSZ,
184 #endif
185 #ifdef TIOCSWINSZ
186 TIOCSWINSZ_val = TIOCSWINSZ,
187 #endif
188 #ifdef TIOCNOTTY
189 TIOCNOTTY_val = TIOCNOTTY,
190 #endif
191 #ifdef TIOCSCTTY
192 TIOCSCTTY_val = TIOCSCTTY,
193 #endif
194 #ifdef TIOCGPGRP
195 TIOCGPGRP_val = TIOCGPGRP,
196 #endif
197 #ifdef TIOCSPGRP
198 TIOCSPGRP_val = TIOCSPGRP,
199 #endif
200 #ifdef TIOCGPTN
201 TIOCGPTN_val = TIOCGPTN,
202 #endif
203 #ifdef TIOCSPTLCK
204 TIOCSPTLCK_val = TIOCSPTLCK,
205 #endif
206 #ifdef TIOCGDEV
207 TIOCGDEV_val = TIOCGDEV,
208 #endif
209 #ifdef TIOCSIG
210 TIOCSIG_val = TIOCSIG,
211 #endif
212 #ifdef TCGETS
213 TCGETS_val = TCGETS,
214 #endif
215 #ifdef TCSETS
216 TCSETS_val = TCSETS,
217 #endif
218 #ifdef TUNSETIFF
219 TUNSETIFF_val = TUNSETIFF,
220 #endif
221 #ifdef TUNSETNOCSUM
222 TUNSETNOCSUM_val = TUNSETNOCSUM,
223 #endif
224 #ifdef TUNSETDEBUG
225 TUNSETDEBUG_val = TUNSETDEBUG,
226 #endif
227 #ifdef TUNSETPERSIST
228 TUNSETPERSIST_val = TUNSETPERSIST,
229 #endif
230 #ifdef TUNSETOWNER
231 TUNSETOWNER_val = TUNSETOWNER,
232 #endif
233 #ifdef TUNSETLINK
234 TUNSETLINK_val = TUNSETLINK,
235 #endif
236 #ifdef TUNSETGROUP
237 TUNSETGROUP_val = TUNSETGROUP,
238 #endif
239 #ifdef TUNGETFEATURES
240 TUNGETFEATURES_val = TUNGETFEATURES,
241 #endif
242 #ifdef TUNSETOFFLOAD
243 TUNSETOFFLOAD_val = TUNSETOFFLOAD,
244 #endif
245 #ifdef TUNSETTXFILTER
246 TUNSETTXFILTER_val = TUNSETTXFILTER,
247 #endif
248 #ifdef TUNGETIFF
249 TUNGETIFF_val = TUNGETIFF,
250 #endif
251 #ifdef TUNGETSNDBUF
252 TUNGETSNDBUF_val = TUNGETSNDBUF,
253 #endif
254 #ifdef TUNSETSNDBUF
255 TUNSETSNDBUF_val = TUNSETSNDBUF,
256 #endif
257 #ifdef TUNATTACHFILTER
258 TUNATTACHFILTER_val = TUNATTACHFILTER,
259 #endif
260 #ifdef TUNDETACHFILTER
261 TUNDETACHFILTER_val = TUNDETACHFILTER,
262 #endif
263 #ifdef TUNGETVNETHDRSZ
264 TUNGETVNETHDRSZ_val = TUNGETVNETHDRSZ,
265 #endif
266 #ifdef TUNSETVNETHDRSZ
267 TUNSETVNETHDRSZ_val = TUNSETVNETHDRSZ,
268 #endif
269 #ifdef TUNSETQUEUE
270 TUNSETQUEUE_val = TUNSETQUEUE,
271 #endif
272 #ifdef TUNSETIFINDEX
273 TUNSETIFINDEX_val = TUNSETIFINDEX,
274 #endif
275 #ifdef TUNGETFILTER
276 TUNGETFILTER_val = TUNGETFILTER,
277 #endif
278 #ifdef NLA_HDRLEN
279 NLA_HDRLEN_val = NLA_HDRLEN,
280 #endif
283 #if defined(HAVE_SYS_EPOLL_H)
284 enum {
285 epoll_data_offset = offsetof(struct epoll_event, data)
287 #endif