Aram Hăvărneanu | 1c98619 | 2014-02-25 21:12:10 +1100 | [diff] [blame] | 1 | // Copyright 2009 The Go Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style |
| 3 | // license that can be found in the LICENSE file. |
| 4 | |
| 5 | // +build ignore |
| 6 | |
| 7 | /* |
| 8 | Input to cgo -godefs. See also mkerrors.sh and mkall.sh |
| 9 | */ |
| 10 | |
| 11 | // +godefs map struct_in_addr [4]byte /* in_addr */ |
| 12 | // +godefs map struct_in6_addr [16]byte /* in6_addr */ |
| 13 | |
| 14 | package syscall |
| 15 | |
| 16 | /* |
| 17 | #define KERNEL |
Shawn Walker-Salas | af7c9a4 | 2015-09-04 16:53:19 -0700 | [diff] [blame] | 18 | // These defines ensure that builds done on newer versions of Solaris are |
| 19 | // backwards-compatible with older versions of Solaris and |
| 20 | // OpenSolaris-based derivatives. |
| 21 | #define __USE_SUNOS_SOCKETS__ // msghdr |
| 22 | #define __USE_LEGACY_PROTOTYPES__ // iovec |
Aram Hăvărneanu | 1c98619 | 2014-02-25 21:12:10 +1100 | [diff] [blame] | 23 | #include <dirent.h> |
| 24 | #include <fcntl.h> |
Shawn Walker-Salas | af7c9a4 | 2015-09-04 16:53:19 -0700 | [diff] [blame] | 25 | #include <limits.h> |
Aram Hăvărneanu | 1c98619 | 2014-02-25 21:12:10 +1100 | [diff] [blame] | 26 | #include <signal.h> |
| 27 | #include <termios.h> |
| 28 | #include <stdio.h> |
| 29 | #include <unistd.h> |
| 30 | #include <sys/mman.h> |
| 31 | #include <sys/mount.h> |
| 32 | #include <sys/param.h> |
| 33 | #include <sys/resource.h> |
| 34 | #include <sys/select.h> |
| 35 | #include <sys/signal.h> |
| 36 | #include <sys/socket.h> |
| 37 | #include <sys/stat.h> |
| 38 | #include <sys/time.h> |
| 39 | #include <sys/types.h> |
| 40 | #include <sys/un.h> |
| 41 | #include <sys/wait.h> |
| 42 | #include <net/bpf.h> |
| 43 | #include <net/if.h> |
| 44 | #include <net/if_dl.h> |
| 45 | #include <net/route.h> |
| 46 | #include <netinet/in.h> |
| 47 | #include <netinet/icmp6.h> |
| 48 | #include <netinet/tcp.h> |
| 49 | |
| 50 | enum { |
| 51 | sizeofPtr = sizeof(void*), |
| 52 | }; |
| 53 | |
| 54 | union sockaddr_all { |
| 55 | struct sockaddr s1; // this one gets used for fields |
| 56 | struct sockaddr_in s2; // these pad it out |
| 57 | struct sockaddr_in6 s3; |
| 58 | struct sockaddr_un s4; |
| 59 | struct sockaddr_dl s5; |
| 60 | }; |
| 61 | |
| 62 | struct sockaddr_any { |
| 63 | struct sockaddr addr; |
| 64 | char pad[sizeof(union sockaddr_all) - sizeof(struct sockaddr)]; |
| 65 | }; |
| 66 | |
| 67 | */ |
| 68 | import "C" |
| 69 | |
| 70 | // Machine characteristics; for internal use. |
| 71 | |
| 72 | const ( |
| 73 | sizeofPtr = C.sizeofPtr |
| 74 | sizeofShort = C.sizeof_short |
| 75 | sizeofInt = C.sizeof_int |
| 76 | sizeofLong = C.sizeof_long |
| 77 | sizeofLongLong = C.sizeof_longlong |
Shawn Walker-Salas | af7c9a4 | 2015-09-04 16:53:19 -0700 | [diff] [blame] | 78 | PathMax = C.PATH_MAX |
Aram Hăvărneanu | 1c98619 | 2014-02-25 21:12:10 +1100 | [diff] [blame] | 79 | ) |
| 80 | |
| 81 | // Basic types |
| 82 | |
| 83 | type ( |
| 84 | _C_short C.short |
| 85 | _C_int C.int |
| 86 | _C_long C.long |
| 87 | _C_long_long C.longlong |
| 88 | ) |
| 89 | |
| 90 | // Time |
| 91 | |
| 92 | type Timespec C.struct_timespec |
| 93 | |
| 94 | type Timeval C.struct_timeval |
| 95 | |
| 96 | type Timeval32 C.struct_timeval32 |
| 97 | |
| 98 | // Processes |
| 99 | |
| 100 | type Rusage C.struct_rusage |
| 101 | |
| 102 | type Rlimit C.struct_rlimit |
| 103 | |
| 104 | type _Gid_t C.gid_t |
| 105 | |
| 106 | // Files |
| 107 | |
| 108 | const ( // Directory mode bits |
| 109 | S_IFMT = C.S_IFMT |
| 110 | S_IFIFO = C.S_IFIFO |
| 111 | S_IFCHR = C.S_IFCHR |
| 112 | S_IFDIR = C.S_IFDIR |
| 113 | S_IFBLK = C.S_IFBLK |
| 114 | S_IFREG = C.S_IFREG |
| 115 | S_IFLNK = C.S_IFLNK |
| 116 | S_IFSOCK = C.S_IFSOCK |
| 117 | S_ISUID = C.S_ISUID |
| 118 | S_ISGID = C.S_ISGID |
| 119 | S_ISVTX = C.S_ISVTX |
| 120 | S_IRUSR = C.S_IRUSR |
| 121 | S_IWUSR = C.S_IWUSR |
| 122 | S_IXUSR = C.S_IXUSR |
| 123 | ) |
| 124 | |
| 125 | type Stat_t C.struct_stat |
| 126 | |
| 127 | type Flock_t C.struct_flock |
| 128 | |
| 129 | type Dirent C.struct_dirent |
| 130 | |
| 131 | // Sockets |
| 132 | |
| 133 | type RawSockaddrInet4 C.struct_sockaddr_in |
| 134 | |
| 135 | type RawSockaddrInet6 C.struct_sockaddr_in6 |
| 136 | |
| 137 | type RawSockaddrUnix C.struct_sockaddr_un |
| 138 | |
| 139 | type RawSockaddrDatalink C.struct_sockaddr_dl |
| 140 | |
| 141 | type RawSockaddr C.struct_sockaddr |
| 142 | |
| 143 | type RawSockaddrAny C.struct_sockaddr_any |
| 144 | |
| 145 | type _Socklen C.socklen_t |
| 146 | |
| 147 | type Linger C.struct_linger |
| 148 | |
| 149 | type Iovec C.struct_iovec |
| 150 | |
| 151 | type IPMreq C.struct_ip_mreq |
| 152 | |
| 153 | type IPv6Mreq C.struct_ipv6_mreq |
| 154 | |
| 155 | type Msghdr C.struct_msghdr |
| 156 | |
| 157 | type Cmsghdr C.struct_cmsghdr |
| 158 | |
| 159 | type Inet6Pktinfo C.struct_in6_pktinfo |
| 160 | |
| 161 | type IPv6MTUInfo C.struct_ip6_mtuinfo |
| 162 | |
| 163 | type ICMPv6Filter C.struct_icmp6_filter |
| 164 | |
| 165 | const ( |
| 166 | SizeofSockaddrInet4 = C.sizeof_struct_sockaddr_in |
| 167 | SizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6 |
| 168 | SizeofSockaddrAny = C.sizeof_struct_sockaddr_any |
| 169 | SizeofSockaddrUnix = C.sizeof_struct_sockaddr_un |
| 170 | SizeofSockaddrDatalink = C.sizeof_struct_sockaddr_dl |
| 171 | SizeofLinger = C.sizeof_struct_linger |
| 172 | SizeofIPMreq = C.sizeof_struct_ip_mreq |
| 173 | SizeofIPv6Mreq = C.sizeof_struct_ipv6_mreq |
| 174 | SizeofMsghdr = C.sizeof_struct_msghdr |
| 175 | SizeofCmsghdr = C.sizeof_struct_cmsghdr |
| 176 | SizeofInet6Pktinfo = C.sizeof_struct_in6_pktinfo |
| 177 | SizeofIPv6MTUInfo = C.sizeof_struct_ip6_mtuinfo |
| 178 | SizeofICMPv6Filter = C.sizeof_struct_icmp6_filter |
| 179 | ) |
| 180 | |
| 181 | // Select |
| 182 | |
| 183 | type FdSet C.fd_set |
| 184 | |
| 185 | // Routing and interface messages |
| 186 | |
| 187 | const ( |
| 188 | SizeofIfMsghdr = C.sizeof_struct_if_msghdr |
| 189 | SizeofIfData = C.sizeof_struct_if_data |
| 190 | SizeofIfaMsghdr = C.sizeof_struct_ifa_msghdr |
| 191 | SizeofRtMsghdr = C.sizeof_struct_rt_msghdr |
| 192 | SizeofRtMetrics = C.sizeof_struct_rt_metrics |
| 193 | ) |
| 194 | |
| 195 | type IfMsghdr C.struct_if_msghdr |
| 196 | |
| 197 | type IfData C.struct_if_data |
| 198 | |
| 199 | type IfaMsghdr C.struct_ifa_msghdr |
| 200 | |
| 201 | type RtMsghdr C.struct_rt_msghdr |
| 202 | |
| 203 | type RtMetrics C.struct_rt_metrics |
| 204 | |
| 205 | // Berkeley packet filter |
| 206 | |
| 207 | const ( |
| 208 | SizeofBpfVersion = C.sizeof_struct_bpf_version |
| 209 | SizeofBpfStat = C.sizeof_struct_bpf_stat |
| 210 | SizeofBpfProgram = C.sizeof_struct_bpf_program |
| 211 | SizeofBpfInsn = C.sizeof_struct_bpf_insn |
| 212 | SizeofBpfHdr = C.sizeof_struct_bpf_hdr |
| 213 | ) |
| 214 | |
| 215 | type BpfVersion C.struct_bpf_version |
| 216 | |
| 217 | type BpfStat C.struct_bpf_stat |
| 218 | |
| 219 | type BpfProgram C.struct_bpf_program |
| 220 | |
| 221 | type BpfInsn C.struct_bpf_insn |
| 222 | |
| 223 | type BpfTimeval C.struct_bpf_timeval |
| 224 | |
| 225 | type BpfHdr C.struct_bpf_hdr |
| 226 | |
Tobias Klauser | 67c3605 | 2017-08-11 16:49:01 +0200 | [diff] [blame] | 227 | // Misc |
| 228 | |
| 229 | const ( |
| 230 | _AT_FDCWD = C.AT_FDCWD |
| 231 | ) |
| 232 | |
Aram Hăvărneanu | 1c98619 | 2014-02-25 21:12:10 +1100 | [diff] [blame] | 233 | // Terminal handling |
| 234 | |
| 235 | type Termios C.struct_termios |