Ian Lance Taylor | 14cda8a | 2016-09-27 21:32:50 +0000 | [diff] [blame] | 1 | /* sysinfo.c -- input for mksysinfo.sh |
| 2 | |
| 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. */ |
| 6 | |
| 7 | /* This file is passed to GCC with the -fdump-go-spec option to |
| 8 | generate a Go version of the system information. */ |
| 9 | |
| 10 | #include "config.h" |
| 11 | |
Ian Lance Taylor | 812ba63 | 2016-10-18 14:38:29 +0000 | [diff] [blame] | 12 | #include <stddef.h> |
Nikhil Benesch | 0cdde1e | 2020-10-26 18:42:08 +0000 | [diff] [blame] | 13 | #include <stdlib.h> |
Nikhil Benesch | 9bac663 | 2020-12-16 08:41:20 -0500 | [diff] [blame] | 14 | #include <stdio.h> |
Ian Lance Taylor | 14cda8a | 2016-09-27 21:32:50 +0000 | [diff] [blame] | 15 | #include <sys/types.h> |
| 16 | #include <dirent.h> |
| 17 | #include <errno.h> |
| 18 | #include <fcntl.h> |
| 19 | #include <ucontext.h> |
| 20 | #include <netinet/in.h> |
| 21 | /* <netinet/tcp.h> needs u_char/u_short, but <sys/bsd_types> is only |
| 22 | included by <netinet/in.h> if _SGIAPI (i.e. _SGI_SOURCE |
| 23 | && !_XOPEN_SOURCE. |
| 24 | <sys/termios.h> only defines TIOCNOTTY if !_XOPEN_SOURCE, while |
| 25 | <sys/ttold.h> does so unconditionally. */ |
| 26 | #ifdef __sgi__ |
| 27 | #include <sys/bsd_types.h> |
| 28 | #include <sys/ttold.h> |
| 29 | #endif |
| 30 | #include <netinet/tcp.h> |
| 31 | #if defined(HAVE_NETINET_IN_SYSTM_H) |
| 32 | #include <netinet/in_systm.h> |
| 33 | #endif |
| 34 | #if defined(HAVE_NETINET_IP_H) |
| 35 | #include <netinet/ip.h> |
| 36 | #endif |
| 37 | #if defined(HAVE_NETINET_IP_MROUTE_H) |
| 38 | #include <netinet/ip_mroute.h> |
| 39 | #endif |
| 40 | #if defined(HAVE_NETINET_IF_ETHER_H) |
| 41 | #include <netinet/if_ether.h> |
| 42 | #endif |
| 43 | #include <signal.h> |
| 44 | #include <sys/ioctl.h> |
| 45 | #include <termios.h> |
| 46 | #if defined(HAVE_SYSCALL_H) |
| 47 | #include <syscall.h> |
| 48 | #endif |
| 49 | #if defined(HAVE_SYS_SYSCALL_H) |
| 50 | #include <sys/syscall.h> |
| 51 | #endif |
Nikhil Benesch | dc57070 | 2020-10-13 06:36:43 +0000 | [diff] [blame] | 52 | #if defined(HAVE_SYS_SYSCTL_H) |
| 53 | #include <sys/sysctl.h> |
| 54 | #endif |
Ian Lance Taylor | 14cda8a | 2016-09-27 21:32:50 +0000 | [diff] [blame] | 55 | #if defined(HAVE_SYS_EPOLL_H) |
| 56 | #include <sys/epoll.h> |
| 57 | #endif |
Ian Lance Taylor | 812ba63 | 2016-10-18 14:38:29 +0000 | [diff] [blame] | 58 | #if defined(HAVE_SYS_EVENT_H) |
| 59 | #include <sys/event.h> |
| 60 | #endif |
Ian Lance Taylor | 14cda8a | 2016-09-27 21:32:50 +0000 | [diff] [blame] | 61 | #if defined(HAVE_SYS_FILE_H) |
| 62 | #include <sys/file.h> |
| 63 | #endif |
| 64 | #if defined(HAVE_SYS_MMAN_H) |
| 65 | #include <sys/mman.h> |
| 66 | #endif |
| 67 | #if defined(HAVE_SYS_PRCTL_H) |
| 68 | #include <sys/prctl.h> |
| 69 | #endif |
| 70 | #if defined(HAVE_SYS_PTRACE_H) |
| 71 | #include <sys/ptrace.h> |
| 72 | #endif |
| 73 | #include <sys/resource.h> |
| 74 | #include <sys/uio.h> |
| 75 | #include <sys/socket.h> |
| 76 | #include <sys/stat.h> |
| 77 | #include <sys/time.h> |
| 78 | #include <sys/times.h> |
| 79 | #include <sys/wait.h> |
| 80 | #include <sys/un.h> |
| 81 | #if defined(HAVE_SYS_USER_H) |
| 82 | #include <sys/user.h> |
| 83 | #endif |
| 84 | #if defined(HAVE_SYS_UTSNAME_H) |
| 85 | #include <sys/utsname.h> |
| 86 | #endif |
| 87 | #if defined(HAVE_SYS_SELECT_H) |
| 88 | #include <sys/select.h> |
| 89 | #endif |
| 90 | #include <time.h> |
| 91 | #include <unistd.h> |
| 92 | #include <netdb.h> |
| 93 | #include <pwd.h> |
| 94 | #include <grp.h> |
| 95 | #if defined(HAVE_LINUX_FILTER_H) |
| 96 | #include <linux/filter.h> |
| 97 | #endif |
| 98 | #if defined(HAVE_LINUX_IF_ADDR_H) |
| 99 | #include <linux/if_addr.h> |
| 100 | #endif |
| 101 | #if defined(HAVE_LINUX_IF_ETHER_H) |
| 102 | #include <linux/if_ether.h> |
| 103 | #endif |
| 104 | #if defined(HAVE_LINUX_IF_TUN_H) |
| 105 | #include <linux/if_tun.h> |
| 106 | #endif |
| 107 | #if defined(HAVE_LINUX_NETLINK_H) |
| 108 | #include <linux/netlink.h> |
| 109 | #endif |
Ian Lance Taylor | 8d4b68a | 2017-06-21 21:42:41 +0000 | [diff] [blame] | 110 | #if defined(HAVE_LINUX_PTRACE_H) |
Ian Lance Taylor | 0bcce674 | 2017-06-26 17:56:14 +0000 | [diff] [blame] | 111 | /* Avoid https://sourceware.org/bugzilla/show_bug.cgi?id=762 . */ |
| 112 | #define ia64_fpreg pt_ia64_fpreg |
| 113 | #define pt_all_user_regs pt_ia64_all_user_regs |
Ian Lance Taylor | eb80664 | 2017-07-18 22:06:31 +0000 | [diff] [blame] | 114 | /* Avoid redefinition of ptrace_peeksiginfo from <sys/ptrace.h>. |
| 115 | https://gcc.gnu.org/PR81324 . */ |
| 116 | #define ptrace_peeksiginfo_args ignore_ptrace_peeksiginfo_args |
Ian Lance Taylor | 8d4b68a | 2017-06-21 21:42:41 +0000 | [diff] [blame] | 117 | #include <linux/ptrace.h> |
Ian Lance Taylor | 0bcce674 | 2017-06-26 17:56:14 +0000 | [diff] [blame] | 118 | #undef ia64_fpreg |
| 119 | #undef pt_all_user_regs |
Ian Lance Taylor | eb80664 | 2017-07-18 22:06:31 +0000 | [diff] [blame] | 120 | #undef ptrace_peeksiginfo_args |
Ian Lance Taylor | 8d4b68a | 2017-06-21 21:42:41 +0000 | [diff] [blame] | 121 | #endif |
Ian Lance Taylor | 14cda8a | 2016-09-27 21:32:50 +0000 | [diff] [blame] | 122 | #if defined(HAVE_LINUX_RTNETLINK_H) |
| 123 | #include <linux/rtnetlink.h> |
| 124 | #endif |
Nikhil Benesch | dc57070 | 2020-10-13 06:36:43 +0000 | [diff] [blame] | 125 | #if defined(HAVE_NET_BPF_H) |
| 126 | #include <net/bpf.h> |
| 127 | #endif |
Ian Lance Taylor | 14cda8a | 2016-09-27 21:32:50 +0000 | [diff] [blame] | 128 | #if defined(HAVE_NET_IF_H) |
| 129 | #include <net/if.h> |
| 130 | #endif |
| 131 | #if defined(HAVE_NET_IF_ARP_H) |
| 132 | #include <net/if_arp.h> |
| 133 | #endif |
| 134 | #if defined(HAVE_NET_ROUTE_H) |
| 135 | #include <net/route.h> |
| 136 | #endif |
| 137 | #if defined (HAVE_NETPACKET_PACKET_H) |
| 138 | #include <netpacket/packet.h> |
| 139 | #endif |
| 140 | #if defined(HAVE_SYS_MOUNT_H) |
| 141 | #include <sys/mount.h> |
| 142 | #endif |
| 143 | #if defined(HAVE_SYS_VFS_H) |
| 144 | #include <sys/vfs.h> |
| 145 | #endif |
| 146 | #if defined(HAVE_STATFS_H) |
| 147 | #include <sys/statfs.h> |
| 148 | #endif |
| 149 | #if defined(HAVE_SYS_TIMEX_H) |
| 150 | #include <sys/timex.h> |
| 151 | #endif |
| 152 | #if defined(HAVE_SYS_SYSINFO_H) |
| 153 | #include <sys/sysinfo.h> |
| 154 | #endif |
Ian Lance Taylor | 14cda8a | 2016-09-27 21:32:50 +0000 | [diff] [blame] | 155 | #if defined(HAVE_UTIME_H) |
| 156 | #include <utime.h> |
| 157 | #endif |
| 158 | #if defined(HAVE_LINUX_ETHER_H) |
| 159 | #include <linux/ether.h> |
| 160 | #endif |
Ian Lance Taylor | 14cda8a | 2016-09-27 21:32:50 +0000 | [diff] [blame] | 161 | #if defined(HAVE_LINUX_REBOOT_H) |
| 162 | #include <linux/reboot.h> |
| 163 | #endif |
| 164 | #if defined(HAVE_SYS_INOTIFY_H) |
| 165 | #include <sys/inotify.h> |
| 166 | #endif |
| 167 | #if defined(HAVE_NETINET_ICMP6_H) |
| 168 | #include <netinet/icmp6.h> |
| 169 | #endif |
| 170 | #if defined(HAVE_SCHED_H) |
| 171 | #include <sched.h> |
| 172 | #endif |
Ian Lance Taylor | c0401cf | 2016-09-30 13:45:08 +0000 | [diff] [blame] | 173 | #if defined(HAVE_SEMAPHORE_H) |
| 174 | #include <semaphore.h> |
| 175 | #endif |
Ian Lance Taylor | 812ba63 | 2016-10-18 14:38:29 +0000 | [diff] [blame] | 176 | #if defined(HAVE_PORT_H) |
| 177 | #include <port.h> |
| 178 | #endif |
Nikhil Benesch | 0cdde1e | 2020-10-26 18:42:08 +0000 | [diff] [blame] | 179 | #if defined(HAVE_LWP_H) |
| 180 | #include <lwp.h> |
| 181 | #endif |
Ian Lance Taylor | 14cda8a | 2016-09-27 21:32:50 +0000 | [diff] [blame] | 182 | |
Ian Lance Taylor | 5302cd0 | 2016-11-18 00:15:38 +0000 | [diff] [blame] | 183 | #ifdef USE_LIBFFI |
| 184 | #include "ffi.h" |
| 185 | #endif |
| 186 | |
Ian Lance Taylor | 14cda8a | 2016-09-27 21:32:50 +0000 | [diff] [blame] | 187 | /* Constants that may only be defined as expressions on some systems, |
| 188 | expressions too complex for -fdump-go-spec to handle. These are |
| 189 | handled specially below. */ |
| 190 | enum { |
| 191 | #ifdef TIOCGWINSZ |
| 192 | TIOCGWINSZ_val = TIOCGWINSZ, |
| 193 | #endif |
| 194 | #ifdef TIOCSWINSZ |
| 195 | TIOCSWINSZ_val = TIOCSWINSZ, |
| 196 | #endif |
| 197 | #ifdef TIOCNOTTY |
| 198 | TIOCNOTTY_val = TIOCNOTTY, |
| 199 | #endif |
| 200 | #ifdef TIOCSCTTY |
| 201 | TIOCSCTTY_val = TIOCSCTTY, |
| 202 | #endif |
| 203 | #ifdef TIOCGPGRP |
| 204 | TIOCGPGRP_val = TIOCGPGRP, |
| 205 | #endif |
| 206 | #ifdef TIOCSPGRP |
| 207 | TIOCSPGRP_val = TIOCSPGRP, |
| 208 | #endif |
| 209 | #ifdef TIOCGPTN |
| 210 | TIOCGPTN_val = TIOCGPTN, |
| 211 | #endif |
| 212 | #ifdef TIOCSPTLCK |
| 213 | TIOCSPTLCK_val = TIOCSPTLCK, |
| 214 | #endif |
| 215 | #ifdef TIOCGDEV |
| 216 | TIOCGDEV_val = TIOCGDEV, |
| 217 | #endif |
| 218 | #ifdef TIOCSIG |
| 219 | TIOCSIG_val = TIOCSIG, |
| 220 | #endif |
| 221 | #ifdef TCGETS |
| 222 | TCGETS_val = TCGETS, |
| 223 | #endif |
| 224 | #ifdef TCSETS |
| 225 | TCSETS_val = TCSETS, |
| 226 | #endif |
| 227 | #ifdef TUNSETIFF |
| 228 | TUNSETIFF_val = TUNSETIFF, |
| 229 | #endif |
| 230 | #ifdef TUNSETNOCSUM |
| 231 | TUNSETNOCSUM_val = TUNSETNOCSUM, |
| 232 | #endif |
| 233 | #ifdef TUNSETDEBUG |
| 234 | TUNSETDEBUG_val = TUNSETDEBUG, |
| 235 | #endif |
| 236 | #ifdef TUNSETPERSIST |
| 237 | TUNSETPERSIST_val = TUNSETPERSIST, |
| 238 | #endif |
| 239 | #ifdef TUNSETOWNER |
| 240 | TUNSETOWNER_val = TUNSETOWNER, |
| 241 | #endif |
| 242 | #ifdef TUNSETLINK |
| 243 | TUNSETLINK_val = TUNSETLINK, |
| 244 | #endif |
| 245 | #ifdef TUNSETGROUP |
| 246 | TUNSETGROUP_val = TUNSETGROUP, |
| 247 | #endif |
| 248 | #ifdef TUNGETFEATURES |
| 249 | TUNGETFEATURES_val = TUNGETFEATURES, |
| 250 | #endif |
| 251 | #ifdef TUNSETOFFLOAD |
| 252 | TUNSETOFFLOAD_val = TUNSETOFFLOAD, |
| 253 | #endif |
| 254 | #ifdef TUNSETTXFILTER |
| 255 | TUNSETTXFILTER_val = TUNSETTXFILTER, |
| 256 | #endif |
| 257 | #ifdef TUNGETIFF |
| 258 | TUNGETIFF_val = TUNGETIFF, |
| 259 | #endif |
| 260 | #ifdef TUNGETSNDBUF |
| 261 | TUNGETSNDBUF_val = TUNGETSNDBUF, |
| 262 | #endif |
| 263 | #ifdef TUNSETSNDBUF |
| 264 | TUNSETSNDBUF_val = TUNSETSNDBUF, |
| 265 | #endif |
| 266 | #ifdef TUNATTACHFILTER |
| 267 | TUNATTACHFILTER_val = TUNATTACHFILTER, |
| 268 | #endif |
| 269 | #ifdef TUNDETACHFILTER |
| 270 | TUNDETACHFILTER_val = TUNDETACHFILTER, |
| 271 | #endif |
| 272 | #ifdef TUNGETVNETHDRSZ |
| 273 | TUNGETVNETHDRSZ_val = TUNGETVNETHDRSZ, |
| 274 | #endif |
| 275 | #ifdef TUNSETVNETHDRSZ |
| 276 | TUNSETVNETHDRSZ_val = TUNSETVNETHDRSZ, |
| 277 | #endif |
| 278 | #ifdef TUNSETQUEUE |
| 279 | TUNSETQUEUE_val = TUNSETQUEUE, |
| 280 | #endif |
| 281 | #ifdef TUNSETIFINDEX |
| 282 | TUNSETIFINDEX_val = TUNSETIFINDEX, |
| 283 | #endif |
| 284 | #ifdef TUNGETFILTER |
| 285 | TUNGETFILTER_val = TUNGETFILTER, |
| 286 | #endif |
| 287 | #ifdef NLA_HDRLEN |
| 288 | NLA_HDRLEN_val = NLA_HDRLEN, |
| 289 | #endif |
Nikhil Benesch | dc57070 | 2020-10-13 06:36:43 +0000 | [diff] [blame] | 290 | #ifdef BIOCFLUSH |
| 291 | BIOCFLUSH_val = BIOCFLUSH, |
| 292 | #endif |
| 293 | #ifdef BIOCGBLEN |
| 294 | BIOCGBLEN_val = BIOCGBLEN, |
| 295 | #endif |
| 296 | #ifdef BIOCGDLT |
| 297 | BIOCGDLT_val = BIOCGDLT, |
| 298 | #endif |
| 299 | #ifdef BIOCGETIF |
| 300 | BIOCGETIF_val = BIOCGETIF, |
| 301 | #endif |
| 302 | #ifdef BIOCGHDRCMPLT |
| 303 | BIOCGHDRCMPLT_val = BIOCGHDRCMPLT, |
| 304 | #endif |
| 305 | #ifdef BIOCGRTIMEOUT |
| 306 | BIOCGRTIMEOUT_val = BIOCGRTIMEOUT, |
| 307 | #endif |
| 308 | #ifdef BIOCGSTATS |
| 309 | BIOCGSTATS_val = BIOCGSTATS, |
| 310 | #endif |
| 311 | #ifdef BIOCIMMEDIATE |
| 312 | BIOCIMMEDIATE_val = BIOCIMMEDIATE, |
| 313 | #endif |
| 314 | #ifdef BIOCPROMISC |
| 315 | BIOCPROMISC_val = BIOCPROMISC, |
| 316 | #endif |
| 317 | #ifdef BIOCSBLEN |
| 318 | BIOCSBLEN_val = BIOCSBLEN, |
| 319 | #endif |
| 320 | #ifdef BIOCSDLT |
| 321 | BIOCSDLT_val = BIOCSDLT, |
| 322 | #endif |
| 323 | #ifdef BIOCSETF |
| 324 | BIOCSETF_val = BIOCSETF, |
| 325 | #endif |
| 326 | #ifdef BIOCSETIF |
| 327 | BIOCSETIF_val = BIOCSETIF, |
| 328 | #endif |
| 329 | #ifdef BIOCSHDRCMPLT |
| 330 | BIOCSHDRCMPLT_val = BIOCSHDRCMPLT, |
| 331 | #endif |
| 332 | #ifdef BIOCSRTIMEOUT |
| 333 | BIOCSRTIMEOUT_val = BIOCSRTIMEOUT, |
| 334 | #endif |
| 335 | #ifdef BIOCVERSION |
| 336 | BIOCVERSION_val = BIOCVERSION, |
| 337 | #endif |
Ian Lance Taylor | e848a83 | 2020-11-29 10:16:27 -0800 | [diff] [blame] | 338 | #ifdef SO_RCVTIMEO |
| 339 | SO_RCVTIMEO_val = SO_RCVTIMEO, |
| 340 | #endif |
Ian Lance Taylor | 14cda8a | 2016-09-27 21:32:50 +0000 | [diff] [blame] | 341 | }; |
Ian Lance Taylor | 812ba63 | 2016-10-18 14:38:29 +0000 | [diff] [blame] | 342 | |
Clément Chigot | 63cd53d | 2020-05-26 11:31:37 +0200 | [diff] [blame] | 343 | // SIOCGIFMTU can't be added in the above enum as it might |
| 344 | // be signed in some OSes. |
| 345 | #ifdef SIOCGIFMTU |
| 346 | enum { |
| 347 | SIOCGIFMTU_val = SIOCGIFMTU, |
| 348 | }; |
| 349 | #endif |
| 350 | |
Ian Lance Taylor | 812ba63 | 2016-10-18 14:38:29 +0000 | [diff] [blame] | 351 | #if defined(HAVE_SYS_EPOLL_H) |
| 352 | enum { |
| 353 | epoll_data_offset = offsetof(struct epoll_event, data) |
| 354 | }; |
| 355 | #endif |
Ian Lance Taylor | fbf2f19 | 2018-05-02 22:32:23 +0000 | [diff] [blame] | 356 | |
Ian Lance Taylor | a63b99f | 2022-07-30 07:29:28 -0700 | [diff] [blame] | 357 | #if !defined(SYS_timer_settime) && defined(SYS_timer_settime32) |
| 358 | // musl defines SYS_timer_settim32 on 32-bit systems. |
| 359 | #define SYS_timer_settime SYS_timer_settime32 |
| 360 | #endif |
| 361 | |
Ian Lance Taylor | 7f195a2 | 2022-06-14 11:33:42 -0700 | [diff] [blame] | 362 | #if defined(HAVE_LOFF_T) |
| 363 | // loff_t can be defined as a macro; for -fgo-dump-spec make sure we |
| 364 | // see a typedef. |
| 365 | typedef loff_t libgo_loff_t_type; |
| 366 | #endif |
| 367 | |
| 368 | #if defined(HAVE_OFF64_T) |
| 369 | typedef off64_t libgo_off_t_type; |
| 370 | #else |
| 371 | typedef off_t libgo_off_t_type; |
| 372 | #endif |
| 373 | |
Ian Lance Taylor | fbf2f19 | 2018-05-02 22:32:23 +0000 | [diff] [blame] | 374 | // The following section introduces explicit references to types and |
| 375 | // constants of interest to support bootstrapping libgo using a |
| 376 | // compiler that doesn't support -fdump-go-spec (e.g., clang), via |
| 377 | // DWARF-based tools. This process is made more difficult due to the |
| 378 | // fact that clang tries hard to omit types/constants from DWARF if it |
| 379 | // can't find explicit references to them, so here we make sure that |
| 380 | // key items are mentioned in ways that will force them into the |
| 381 | // generated DWARF. |
| 382 | |
| 383 | #if defined(__clang__) |
| 384 | |
| 385 | // Make a reference to a type |
| 386 | #define TREF(typ) typ typ ## ref |
| 387 | |
| 388 | // Make a reference to an opaque type |
| 389 | #define OTREF(typ) typ *typ ## ref |
| 390 | |
| 391 | // Make a reference to a struct tag |
| 392 | #define SREF(stag) struct stag stag ## ref |
| 393 | |
| 394 | // Make a reference to an enum literal |
| 395 | #define EREF(elit) unsigned elit ## fn(unsigned x) { return x == elit ? 1 : 0; } |
| 396 | |
| 397 | //...................................................................... |
| 398 | |
| 399 | // From dirent.h |
| 400 | SREF(dirent); |
| 401 | SREF(dirent64); |
| 402 | OTREF(DIR); |
Than McIntosh | 1d7d3f9 | 2020-09-15 08:31:30 -0400 | [diff] [blame] | 403 | EREF(DT_UNKNOWN); |
Ian Lance Taylor | fbf2f19 | 2018-05-02 22:32:23 +0000 | [diff] [blame] | 404 | |
| 405 | // From fcntl.h |
| 406 | SREF(flock); |
| 407 | SREF(flock64); |
| 408 | |
| 409 | // From ffi headers |
| 410 | SREF(_ffi_type); |
| 411 | TREF(ffi_cif); |
| 412 | TREF(ffi_abi); |
| 413 | TREF(ffi_status); |
| 414 | EREF(FFI_OK); |
| 415 | |
| 416 | // From grp.h |
| 417 | SREF(group); |
| 418 | |
| 419 | #if defined(HAVE_LINUX_FILTER_H) |
| 420 | // From linux/filter.h |
| 421 | SREF(sock_filter); |
| 422 | SREF(sock_fprog); |
| 423 | #endif |
| 424 | |
| 425 | // From linux/if.h |
| 426 | EREF(IFF_UP); |
| 427 | |
| 428 | #if defined(HAVE_LINUX_IF_ADDR_H) |
| 429 | // From linux/if_addr.h |
| 430 | SREF(ifaddrmsg); |
| 431 | EREF(IFA_ADDRESS); |
| 432 | #endif |
| 433 | |
| 434 | #if defined(HAVE_LINUX_RTNETLINK_H) |
| 435 | // From linux/if_link.h |
| 436 | EREF(IFLA_ADDRESS); |
| 437 | #endif |
| 438 | |
| 439 | // From in.h, in6.h, icmp6.h |
| 440 | SREF(ip_mreq); |
| 441 | SREF(ip_mreqn); |
| 442 | SREF(ipv6_mreq); |
| 443 | SREF(ip6_mtuinfo); |
| 444 | SREF(icmp6_filter); |
| 445 | SREF(in_pktinfo); |
| 446 | EREF(IPPROTO_TCP); |
| 447 | |
| 448 | #if defined(HAVE_LINUX_RTNETLINK_H) |
| 449 | // From linux/rtnetlink.h |
| 450 | SREF(rtgenmsg); |
| 451 | SREF(rtmsg); |
| 452 | SREF(ifinfomsg); |
| 453 | SREF(rtattr); |
| 454 | SREF(rtnexthop); |
| 455 | EREF(RTM_BASE); |
| 456 | EREF(RTN_UNSPEC); |
| 457 | #endif |
| 458 | |
| 459 | // From netdb.h |
| 460 | SREF(addrinfo); |
| 461 | |
| 462 | // From netlink.h |
| 463 | SREF(nlattr); |
| 464 | SREF(nlmsgerr); |
| 465 | |
| 466 | // From pthread.h and related |
| 467 | TREF(pthread_attr_t); |
| 468 | TREF(pthread_t); |
| 469 | TREF(pthread_mutex_t); |
| 470 | TREF(pthread_mutexattr_t); |
| 471 | |
| 472 | // From pwd.h |
| 473 | SREF(passwd); |
| 474 | |
| 475 | // From signal.h and related |
| 476 | TREF(sigset_t); |
| 477 | TREF(siginfo_t); |
| 478 | TREF(stack_t); |
| 479 | SREF(sigaction); |
| 480 | SREF(sigstack); |
| 481 | EREF(SI_USER); |
| 482 | EREF(FPE_INTOVF); |
| 483 | EREF(BUS_ADRALN); |
| 484 | EREF(SS_ONSTACK); |
| 485 | EREF(SEGV_MAPERR); |
| 486 | |
| 487 | // From stat.h |
| 488 | SREF(stat64); |
| 489 | |
| 490 | // From statfs.h |
| 491 | SREF(statfs); |
| 492 | SREF(statfs64); |
| 493 | |
| 494 | // From sysinfo.h |
| 495 | SREF(sysinfo); |
| 496 | |
| 497 | // From <sys/epoll.h> |
| 498 | #if defined(HAVE_SYS_EPOLL_H) |
| 499 | SREF(epoll_event); |
| 500 | EREF(EPOLLIN); |
| 501 | EREF(epoll_data_offset); |
| 502 | #endif |
| 503 | |
| 504 | #if defined(HAVE_SYS_MOUNT_H) |
| 505 | // From sys/mount.h |
| 506 | EREF(MS_PRIVATE); |
| 507 | EREF(MNT_FORCE); |
| 508 | #endif |
| 509 | |
| 510 | #if defined(HAVE_SYS_PTRACE_H) |
| 511 | // From <sys/ptrace.h> |
Ian Lance Taylor | ab2d47a | 2019-09-19 00:03:25 +0000 | [diff] [blame] | 512 | #if defined (__aarch64__) |
| 513 | SREF(user_pt_regs); |
| 514 | #else |
Ian Lance Taylor | fbf2f19 | 2018-05-02 22:32:23 +0000 | [diff] [blame] | 515 | SREF(pt_regs); |
Ian Lance Taylor | ab2d47a | 2019-09-19 00:03:25 +0000 | [diff] [blame] | 516 | #endif |
Ian Lance Taylor | fbf2f19 | 2018-05-02 22:32:23 +0000 | [diff] [blame] | 517 | EREF(PTRACE_PEEKTEXT); |
| 518 | #endif |
| 519 | |
| 520 | // From sys/resource.h |
| 521 | SREF(rusage); |
| 522 | SREF(rlimit64); |
| 523 | EREF(RLIMIT_NOFILE); |
| 524 | EREF(PRIO_USER); |
Than McIntosh | 1d7d3f9 | 2020-09-15 08:31:30 -0400 | [diff] [blame] | 525 | EREF(RUSAGE_SELF); |
Ian Lance Taylor | fbf2f19 | 2018-05-02 22:32:23 +0000 | [diff] [blame] | 526 | |
| 527 | // From sys/select.h |
| 528 | TREF(fd_set); |
| 529 | |
| 530 | // From sys/socket.h |
| 531 | SREF(msghdr); |
| 532 | SREF(cmsghdr); |
| 533 | SREF(ucred); |
| 534 | EREF(MSG_OOB); |
| 535 | EREF(SCM_RIGHTS); |
| 536 | EREF(SOCK_RAW); |
| 537 | EREF(SHUT_RD); |
| 538 | |
| 539 | // From sys/time.h and sys/times.h |
| 540 | SREF(timespec); |
| 541 | SREF(timeval); |
| 542 | SREF(itimerval); |
| 543 | SREF(tms); |
| 544 | EREF(ITIMER_PROF); |
| 545 | |
| 546 | #if defined(HAVE_SYS_TIMEX_H) |
| 547 | // From sys/timex.h |
| 548 | SREF(timex); |
| 549 | #endif |
| 550 | |
| 551 | // From sys/types.h |
| 552 | TREF(pid_t); |
| 553 | TREF(off_t); |
Ian Lance Taylor | 7f195a2 | 2022-06-14 11:33:42 -0700 | [diff] [blame] | 554 | TREF(libgo_loff_t_type); |
| 555 | TREF(libgo_off_t_type); |
Ian Lance Taylor | fbf2f19 | 2018-05-02 22:32:23 +0000 | [diff] [blame] | 556 | TREF(size_t); |
| 557 | TREF(ssize_t); |
| 558 | TREF(mode_t); |
| 559 | TREF(dev_t); |
| 560 | TREF(time_t); |
| 561 | |
| 562 | // From sys/ucontext.h |
| 563 | TREF(ucontext_t); |
| 564 | |
| 565 | #if defined(HAVE_SYS_USER_H) |
| 566 | // From sys/user.h |
| 567 | SREF(user_regs_struct); |
| 568 | #endif |
| 569 | |
| 570 | #if defined(HAVE_SYS_UTSNAME_H) |
| 571 | // From sys/utsname.h |
| 572 | SREF(utsname); |
| 573 | #endif |
| 574 | |
| 575 | // From termios.h |
| 576 | SREF(termios); |
| 577 | |
| 578 | // From uio.h |
| 579 | SREF(iovec); |
| 580 | |
| 581 | // From utime.h |
| 582 | SREF(utimbuf); |
| 583 | |
| 584 | // From unistd.h |
| 585 | EREF(_PC_NAME_MAX); |
| 586 | EREF(_SC_GETPW_R_SIZE_MAX); |
| 587 | |
| 588 | #endif // clang |