github.com/code-reading/golang@v0.0.0-20220303082512-ba5bc0e589a3/go/src/syscall/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 also mkerrors.sh and mkall.sh 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 syscall 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 <limits.h> 27 #include <signal.h> 28 #include <termios.h> 29 #include <stdio.h> 30 #include <unistd.h> 31 #include <sys/mman.h> 32 #include <sys/mount.h> 33 #include <sys/param.h> 34 #include <sys/resource.h> 35 #include <sys/select.h> 36 #include <sys/signal.h> 37 #include <sys/socket.h> 38 #include <sys/stat.h> 39 #include <sys/time.h> 40 #include <sys/types.h> 41 #include <sys/un.h> 42 #include <sys/wait.h> 43 #include <net/bpf.h> 44 #include <net/if.h> 45 #include <net/if_dl.h> 46 #include <net/route.h> 47 #include <netinet/in.h> 48 #include <netinet/icmp6.h> 49 #include <netinet/tcp.h> 50 51 enum { 52 sizeofPtr = sizeof(void*), 53 }; 54 55 union sockaddr_all { 56 struct sockaddr s1; // this one gets used for fields 57 struct sockaddr_in s2; // these pad it out 58 struct sockaddr_in6 s3; 59 struct sockaddr_un s4; 60 struct sockaddr_dl s5; 61 }; 62 63 struct sockaddr_any { 64 struct sockaddr addr; 65 char pad[sizeof(union sockaddr_all) - sizeof(struct sockaddr)]; 66 }; 67 68 */ 69 import "C" 70 71 // Machine characteristics; for internal use. 72 73 const ( 74 sizeofPtr = C.sizeofPtr 75 sizeofShort = C.sizeof_short 76 sizeofInt = C.sizeof_int 77 sizeofLong = C.sizeof_long 78 sizeofLongLong = C.sizeof_longlong 79 PathMax = C.PATH_MAX 80 ) 81 82 // Basic types 83 84 type ( 85 _C_short C.short 86 _C_int C.int 87 _C_long C.long 88 _C_long_long C.longlong 89 ) 90 91 // Time 92 93 type Timespec C.struct_timespec 94 95 type Timeval C.struct_timeval 96 97 type Timeval32 C.struct_timeval32 98 99 // Processes 100 101 type Rusage C.struct_rusage 102 103 type Rlimit C.struct_rlimit 104 105 type _Pid_t C.pid_t 106 107 type _Gid_t C.gid_t 108 109 // Files 110 111 const ( // Directory mode bits 112 S_IFMT = C.S_IFMT 113 S_IFIFO = C.S_IFIFO 114 S_IFCHR = C.S_IFCHR 115 S_IFDIR = C.S_IFDIR 116 S_IFBLK = C.S_IFBLK 117 S_IFREG = C.S_IFREG 118 S_IFLNK = C.S_IFLNK 119 S_IFSOCK = C.S_IFSOCK 120 S_ISUID = C.S_ISUID 121 S_ISGID = C.S_ISGID 122 S_ISVTX = C.S_ISVTX 123 S_IRUSR = C.S_IRUSR 124 S_IWUSR = C.S_IWUSR 125 S_IXUSR = C.S_IXUSR 126 S_IRWXG = C.S_IRWXG 127 S_IRWXO = C.S_IRWXO 128 ) 129 130 type Stat_t C.struct_stat 131 132 type Flock_t C.struct_flock 133 134 type Dirent C.struct_dirent 135 136 // Sockets 137 138 type RawSockaddrInet4 C.struct_sockaddr_in 139 140 type RawSockaddrInet6 C.struct_sockaddr_in6 141 142 type RawSockaddrUnix C.struct_sockaddr_un 143 144 type RawSockaddrDatalink C.struct_sockaddr_dl 145 146 type RawSockaddr C.struct_sockaddr 147 148 type RawSockaddrAny C.struct_sockaddr_any 149 150 type _Socklen C.socklen_t 151 152 type Linger C.struct_linger 153 154 type Iovec C.struct_iovec 155 156 type IPMreq C.struct_ip_mreq 157 158 type IPv6Mreq C.struct_ipv6_mreq 159 160 type Msghdr C.struct_msghdr 161 162 type Cmsghdr C.struct_cmsghdr 163 164 type Inet6Pktinfo C.struct_in6_pktinfo 165 166 type IPv6MTUInfo C.struct_ip6_mtuinfo 167 168 type ICMPv6Filter C.struct_icmp6_filter 169 170 const ( 171 SizeofSockaddrInet4 = C.sizeof_struct_sockaddr_in 172 SizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6 173 SizeofSockaddrAny = C.sizeof_struct_sockaddr_any 174 SizeofSockaddrUnix = C.sizeof_struct_sockaddr_un 175 SizeofSockaddrDatalink = C.sizeof_struct_sockaddr_dl 176 SizeofLinger = C.sizeof_struct_linger 177 SizeofIPMreq = C.sizeof_struct_ip_mreq 178 SizeofIPv6Mreq = C.sizeof_struct_ipv6_mreq 179 SizeofMsghdr = C.sizeof_struct_msghdr 180 SizeofCmsghdr = C.sizeof_struct_cmsghdr 181 SizeofInet6Pktinfo = C.sizeof_struct_in6_pktinfo 182 SizeofIPv6MTUInfo = C.sizeof_struct_ip6_mtuinfo 183 SizeofICMPv6Filter = C.sizeof_struct_icmp6_filter 184 ) 185 186 // Select 187 188 type FdSet C.fd_set 189 190 // Routing and interface messages 191 192 const ( 193 SizeofIfMsghdr = C.sizeof_struct_if_msghdr 194 SizeofIfData = C.sizeof_struct_if_data 195 SizeofIfaMsghdr = C.sizeof_struct_ifa_msghdr 196 SizeofRtMsghdr = C.sizeof_struct_rt_msghdr 197 SizeofRtMetrics = C.sizeof_struct_rt_metrics 198 ) 199 200 type IfMsghdr C.struct_if_msghdr 201 202 type IfData C.struct_if_data 203 204 type IfaMsghdr C.struct_ifa_msghdr 205 206 type RtMsghdr C.struct_rt_msghdr 207 208 type RtMetrics C.struct_rt_metrics 209 210 // Berkeley packet filter 211 212 const ( 213 SizeofBpfVersion = C.sizeof_struct_bpf_version 214 SizeofBpfStat = C.sizeof_struct_bpf_stat 215 SizeofBpfProgram = C.sizeof_struct_bpf_program 216 SizeofBpfInsn = C.sizeof_struct_bpf_insn 217 SizeofBpfHdr = C.sizeof_struct_bpf_hdr 218 ) 219 220 type BpfVersion C.struct_bpf_version 221 222 type BpfStat C.struct_bpf_stat 223 224 type BpfProgram C.struct_bpf_program 225 226 type BpfInsn C.struct_bpf_insn 227 228 type BpfTimeval C.struct_bpf_timeval 229 230 type BpfHdr C.struct_bpf_hdr 231 232 // Misc 233 234 const ( 235 _AT_FDCWD = C.AT_FDCWD 236 ) 237 238 // Terminal handling 239 240 type Termios C.struct_termios