github.com/Kalvelign/golang-windows-sys-lib@v0.0.0-20221121121202-63da651435e1/unix/types_solaris.go (about) 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 //go:build ignore 6 // +build ignore 7 8 /* 9 Input to cgo -godefs. See README.md 10 */ 11 12 // +godefs map struct_in_addr [4]byte /* in_addr */ 13 // +godefs map struct_in6_addr [16]byte /* in6_addr */ 14 15 package unix 16 17 /* 18 #define KERNEL 19 // These defines ensure that builds done on newer versions of Solaris are 20 // backwards-compatible with older versions of Solaris and 21 // OpenSolaris-based derivatives. 22 #define __USE_SUNOS_SOCKETS__ // msghdr 23 #define __USE_LEGACY_PROTOTYPES__ // iovec 24 #include <dirent.h> 25 #include <fcntl.h> 26 #include <netdb.h> 27 #include <limits.h> 28 #include <poll.h> 29 #include <signal.h> 30 #include <termios.h> 31 #include <termio.h> 32 #include <stdio.h> 33 #include <unistd.h> 34 #include <sys/mman.h> 35 #include <sys/mount.h> 36 #include <sys/param.h> 37 #include <sys/port.h> 38 #include <sys/resource.h> 39 #include <sys/select.h> 40 #include <sys/signal.h> 41 #include <sys/socket.h> 42 #include <sys/sockio.h> 43 #include <sys/stat.h> 44 #include <sys/statvfs.h> 45 #include <sys/stropts.h> 46 #include <sys/time.h> 47 #include <sys/times.h> 48 #include <sys/types.h> 49 #include <sys/utsname.h> 50 #include <sys/un.h> 51 #include <sys/wait.h> 52 #include <net/bpf.h> 53 #include <net/if.h> 54 #include <net/if_dl.h> 55 #include <net/route.h> 56 #include <netinet/in.h> 57 #include <netinet/icmp6.h> 58 #include <netinet/tcp.h> 59 #include <ustat.h> 60 #include <utime.h> 61 62 enum { 63 sizeofPtr = sizeof(void*), 64 }; 65 66 union sockaddr_all { 67 struct sockaddr s1; // this one gets used for fields 68 struct sockaddr_in s2; // these pad it out 69 struct sockaddr_in6 s3; 70 struct sockaddr_un s4; 71 struct sockaddr_dl s5; 72 }; 73 74 struct sockaddr_any { 75 struct sockaddr addr; 76 char pad[sizeof(union sockaddr_all) - sizeof(struct sockaddr)]; 77 }; 78 79 // go_iovec is used to get *byte as the base address for Iovec. 80 struct goIovec { 81 void* iov_base; 82 size_t iov_len; 83 }; 84 85 // Solaris and the major illumos distributions ship a 3rd party tun/tap driver 86 // from https://github.com/kaizawa/tuntap 87 // It supports a pair of IOCTLs defined at 88 // https://github.com/kaizawa/tuntap/blob/master/if_tun.h#L91-L93 89 #define TUNNEWPPA (('T'<<16) | 0x0001) 90 #define TUNSETPPA (('T'<<16) | 0x0002) 91 */ 92 import "C" 93 94 // Machine characteristics 95 96 const ( 97 SizeofPtr = C.sizeofPtr 98 SizeofShort = C.sizeof_short 99 SizeofInt = C.sizeof_int 100 SizeofLong = C.sizeof_long 101 SizeofLongLong = C.sizeof_longlong 102 PathMax = C.PATH_MAX 103 MaxHostNameLen = C.MAXHOSTNAMELEN 104 ) 105 106 // Basic types 107 108 type ( 109 _C_short C.short 110 _C_int C.int 111 _C_long C.long 112 _C_long_long C.longlong 113 ) 114 115 // Time 116 117 type Timespec C.struct_timespec 118 119 type Timeval C.struct_timeval 120 121 type Timeval32 C.struct_timeval32 122 123 type Tms C.struct_tms 124 125 type Utimbuf C.struct_utimbuf 126 127 // Processes 128 129 type Rusage C.struct_rusage 130 131 type Rlimit C.struct_rlimit 132 133 type _Gid_t C.gid_t 134 135 // Files 136 137 type Stat_t C.struct_stat 138 139 type Flock_t C.struct_flock 140 141 type Dirent C.struct_dirent 142 143 // Filesystems 144 145 type _Fsblkcnt_t C.fsblkcnt_t 146 147 type Statvfs_t C.struct_statvfs 148 149 // Sockets 150 151 type RawSockaddrInet4 C.struct_sockaddr_in 152 153 type RawSockaddrInet6 C.struct_sockaddr_in6 154 155 type RawSockaddrUnix C.struct_sockaddr_un 156 157 type RawSockaddrDatalink C.struct_sockaddr_dl 158 159 type RawSockaddr C.struct_sockaddr 160 161 type RawSockaddrAny C.struct_sockaddr_any 162 163 type _Socklen C.socklen_t 164 165 type Linger C.struct_linger 166 167 type Iovec C.struct_goIovec 168 169 type IPMreq C.struct_ip_mreq 170 171 type IPv6Mreq C.struct_ipv6_mreq 172 173 type Msghdr C.struct_msghdr 174 175 type Cmsghdr C.struct_cmsghdr 176 177 type Inet4Pktinfo C.struct_in_pktinfo 178 179 type Inet6Pktinfo C.struct_in6_pktinfo 180 181 type IPv6MTUInfo C.struct_ip6_mtuinfo 182 183 type ICMPv6Filter C.struct_icmp6_filter 184 185 const ( 186 SizeofSockaddrInet4 = C.sizeof_struct_sockaddr_in 187 SizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6 188 SizeofSockaddrAny = C.sizeof_struct_sockaddr_any 189 SizeofSockaddrUnix = C.sizeof_struct_sockaddr_un 190 SizeofSockaddrDatalink = C.sizeof_struct_sockaddr_dl 191 SizeofLinger = C.sizeof_struct_linger 192 SizeofIovec = C.sizeof_struct_iovec 193 SizeofIPMreq = C.sizeof_struct_ip_mreq 194 SizeofIPv6Mreq = C.sizeof_struct_ipv6_mreq 195 SizeofMsghdr = C.sizeof_struct_msghdr 196 SizeofCmsghdr = C.sizeof_struct_cmsghdr 197 SizeofInet4Pktinfo = C.sizeof_struct_in_pktinfo 198 SizeofInet6Pktinfo = C.sizeof_struct_in6_pktinfo 199 SizeofIPv6MTUInfo = C.sizeof_struct_ip6_mtuinfo 200 SizeofICMPv6Filter = C.sizeof_struct_icmp6_filter 201 ) 202 203 // Select 204 205 type FdSet C.fd_set 206 207 // Misc 208 209 type Utsname C.struct_utsname 210 211 type Ustat_t C.struct_ustat 212 213 const ( 214 AT_FDCWD = C.AT_FDCWD 215 AT_SYMLINK_NOFOLLOW = C.AT_SYMLINK_NOFOLLOW 216 AT_SYMLINK_FOLLOW = C.AT_SYMLINK_FOLLOW 217 AT_REMOVEDIR = C.AT_REMOVEDIR 218 AT_EACCESS = C.AT_EACCESS 219 ) 220 221 // Routing and interface messages 222 223 const ( 224 SizeofIfMsghdr = C.sizeof_struct_if_msghdr 225 SizeofIfData = C.sizeof_struct_if_data 226 SizeofIfaMsghdr = C.sizeof_struct_ifa_msghdr 227 SizeofRtMsghdr = C.sizeof_struct_rt_msghdr 228 SizeofRtMetrics = C.sizeof_struct_rt_metrics 229 ) 230 231 type IfMsghdr C.struct_if_msghdr 232 233 type IfData C.struct_if_data 234 235 type IfaMsghdr C.struct_ifa_msghdr 236 237 type RtMsghdr C.struct_rt_msghdr 238 239 type RtMetrics C.struct_rt_metrics 240 241 // Berkeley packet filter 242 243 const ( 244 SizeofBpfVersion = C.sizeof_struct_bpf_version 245 SizeofBpfStat = C.sizeof_struct_bpf_stat 246 SizeofBpfProgram = C.sizeof_struct_bpf_program 247 SizeofBpfInsn = C.sizeof_struct_bpf_insn 248 SizeofBpfHdr = C.sizeof_struct_bpf_hdr 249 ) 250 251 type BpfVersion C.struct_bpf_version 252 253 type BpfStat C.struct_bpf_stat 254 255 type BpfProgram C.struct_bpf_program 256 257 type BpfInsn C.struct_bpf_insn 258 259 type BpfTimeval C.struct_bpf_timeval 260 261 type BpfHdr C.struct_bpf_hdr 262 263 // Terminal handling 264 265 type Termios C.struct_termios 266 267 type Termio C.struct_termio 268 269 type Winsize C.struct_winsize 270 271 // poll 272 273 type PollFd C.struct_pollfd 274 275 const ( 276 POLLERR = C.POLLERR 277 POLLHUP = C.POLLHUP 278 POLLIN = C.POLLIN 279 POLLNVAL = C.POLLNVAL 280 POLLOUT = C.POLLOUT 281 POLLPRI = C.POLLPRI 282 POLLRDBAND = C.POLLRDBAND 283 POLLRDNORM = C.POLLRDNORM 284 POLLWRBAND = C.POLLWRBAND 285 POLLWRNORM = C.POLLWRNORM 286 ) 287 288 // Event Ports 289 290 type fileObj C.struct_file_obj 291 292 type portEvent C.struct_port_event 293 294 const ( 295 PORT_SOURCE_AIO = C.PORT_SOURCE_AIO 296 PORT_SOURCE_TIMER = C.PORT_SOURCE_TIMER 297 PORT_SOURCE_USER = C.PORT_SOURCE_USER 298 PORT_SOURCE_FD = C.PORT_SOURCE_FD 299 PORT_SOURCE_ALERT = C.PORT_SOURCE_ALERT 300 PORT_SOURCE_MQ = C.PORT_SOURCE_MQ 301 PORT_SOURCE_FILE = C.PORT_SOURCE_FILE 302 PORT_ALERT_SET = C.PORT_ALERT_SET 303 PORT_ALERT_UPDATE = C.PORT_ALERT_UPDATE 304 PORT_ALERT_INVALID = C.PORT_ALERT_INVALID 305 FILE_ACCESS = C.FILE_ACCESS 306 FILE_MODIFIED = C.FILE_MODIFIED 307 FILE_ATTRIB = C.FILE_ATTRIB 308 FILE_TRUNC = C.FILE_TRUNC 309 FILE_NOFOLLOW = C.FILE_NOFOLLOW 310 FILE_DELETE = C.FILE_DELETE 311 FILE_RENAME_TO = C.FILE_RENAME_TO 312 FILE_RENAME_FROM = C.FILE_RENAME_FROM 313 UNMOUNTED = C.UNMOUNTED 314 MOUNTEDOVER = C.MOUNTEDOVER 315 FILE_EXCEPTION = C.FILE_EXCEPTION 316 ) 317 318 // STREAMS and Tun 319 320 const ( 321 TUNNEWPPA = C.TUNNEWPPA 322 TUNSETPPA = C.TUNSETPPA 323 324 // sys/stropts.h: 325 I_STR = C.I_STR 326 I_POP = C.I_POP 327 I_PUSH = C.I_PUSH 328 I_LINK = C.I_LINK 329 I_UNLINK = C.I_UNLINK 330 I_PLINK = C.I_PLINK 331 I_PUNLINK = C.I_PUNLINK 332 333 // sys/sockio.h: 334 IF_UNITSEL = C.IF_UNITSEL 335 ) 336 337 type strbuf C.struct_strbuf 338 339 type Strioctl C.struct_strioctl 340 341 type Lifreq C.struct_lifreq