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/* 9Input 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 15package 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/stat.h> 43#include <sys/statvfs.h> 44#include <sys/time.h> 45#include <sys/times.h> 46#include <sys/types.h> 47#include <sys/utsname.h> 48#include <sys/un.h> 49#include <sys/wait.h> 50#include <net/bpf.h> 51#include <net/if.h> 52#include <net/if_dl.h> 53#include <net/route.h> 54#include <netinet/in.h> 55#include <netinet/icmp6.h> 56#include <netinet/tcp.h> 57#include <ustat.h> 58#include <utime.h> 59 60enum { 61 sizeofPtr = sizeof(void*), 62}; 63 64union sockaddr_all { 65 struct sockaddr s1; // this one gets used for fields 66 struct sockaddr_in s2; // these pad it out 67 struct sockaddr_in6 s3; 68 struct sockaddr_un s4; 69 struct sockaddr_dl s5; 70}; 71 72struct sockaddr_any { 73 struct sockaddr addr; 74 char pad[sizeof(union sockaddr_all) - sizeof(struct sockaddr)]; 75}; 76 77*/ 78import "C" 79 80// Machine characteristics 81 82const ( 83 SizeofPtr = C.sizeofPtr 84 SizeofShort = C.sizeof_short 85 SizeofInt = C.sizeof_int 86 SizeofLong = C.sizeof_long 87 SizeofLongLong = C.sizeof_longlong 88 PathMax = C.PATH_MAX 89 MaxHostNameLen = C.MAXHOSTNAMELEN 90) 91 92// Basic types 93 94type ( 95 _C_short C.short 96 _C_int C.int 97 _C_long C.long 98 _C_long_long C.longlong 99) 100 101// Time 102 103type Timespec C.struct_timespec 104 105type Timeval C.struct_timeval 106 107type Timeval32 C.struct_timeval32 108 109type Tms C.struct_tms 110 111type Utimbuf C.struct_utimbuf 112 113// Processes 114 115type Rusage C.struct_rusage 116 117type Rlimit C.struct_rlimit 118 119type _Gid_t C.gid_t 120 121// Files 122 123type Stat_t C.struct_stat 124 125type Flock_t C.struct_flock 126 127type Dirent C.struct_dirent 128 129// Filesystems 130 131type _Fsblkcnt_t C.fsblkcnt_t 132 133type Statvfs_t C.struct_statvfs 134 135// Sockets 136 137type RawSockaddrInet4 C.struct_sockaddr_in 138 139type RawSockaddrInet6 C.struct_sockaddr_in6 140 141type RawSockaddrUnix C.struct_sockaddr_un 142 143type RawSockaddrDatalink C.struct_sockaddr_dl 144 145type RawSockaddr C.struct_sockaddr 146 147type RawSockaddrAny C.struct_sockaddr_any 148 149type _Socklen C.socklen_t 150 151type Linger C.struct_linger 152 153type Iovec C.struct_iovec 154 155type IPMreq C.struct_ip_mreq 156 157type IPv6Mreq C.struct_ipv6_mreq 158 159type Msghdr C.struct_msghdr 160 161type Cmsghdr C.struct_cmsghdr 162 163type Inet4Pktinfo C.struct_in_pktinfo 164 165type Inet6Pktinfo C.struct_in6_pktinfo 166 167type IPv6MTUInfo C.struct_ip6_mtuinfo 168 169type ICMPv6Filter C.struct_icmp6_filter 170 171const ( 172 SizeofSockaddrInet4 = C.sizeof_struct_sockaddr_in 173 SizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6 174 SizeofSockaddrAny = C.sizeof_struct_sockaddr_any 175 SizeofSockaddrUnix = C.sizeof_struct_sockaddr_un 176 SizeofSockaddrDatalink = C.sizeof_struct_sockaddr_dl 177 SizeofLinger = C.sizeof_struct_linger 178 SizeofIovec = C.sizeof_struct_iovec 179 SizeofIPMreq = C.sizeof_struct_ip_mreq 180 SizeofIPv6Mreq = C.sizeof_struct_ipv6_mreq 181 SizeofMsghdr = C.sizeof_struct_msghdr 182 SizeofCmsghdr = C.sizeof_struct_cmsghdr 183 SizeofInet4Pktinfo = C.sizeof_struct_in_pktinfo 184 SizeofInet6Pktinfo = C.sizeof_struct_in6_pktinfo 185 SizeofIPv6MTUInfo = C.sizeof_struct_ip6_mtuinfo 186 SizeofICMPv6Filter = C.sizeof_struct_icmp6_filter 187) 188 189// Select 190 191type FdSet C.fd_set 192 193// Misc 194 195type Utsname C.struct_utsname 196 197type Ustat_t C.struct_ustat 198 199const ( 200 AT_FDCWD = C.AT_FDCWD 201 AT_SYMLINK_NOFOLLOW = C.AT_SYMLINK_NOFOLLOW 202 AT_SYMLINK_FOLLOW = C.AT_SYMLINK_FOLLOW 203 AT_REMOVEDIR = C.AT_REMOVEDIR 204 AT_EACCESS = C.AT_EACCESS 205) 206 207// Routing and interface messages 208 209const ( 210 SizeofIfMsghdr = C.sizeof_struct_if_msghdr 211 SizeofIfData = C.sizeof_struct_if_data 212 SizeofIfaMsghdr = C.sizeof_struct_ifa_msghdr 213 SizeofRtMsghdr = C.sizeof_struct_rt_msghdr 214 SizeofRtMetrics = C.sizeof_struct_rt_metrics 215) 216 217type IfMsghdr C.struct_if_msghdr 218 219type IfData C.struct_if_data 220 221type IfaMsghdr C.struct_ifa_msghdr 222 223type RtMsghdr C.struct_rt_msghdr 224 225type RtMetrics C.struct_rt_metrics 226 227// Berkeley packet filter 228 229const ( 230 SizeofBpfVersion = C.sizeof_struct_bpf_version 231 SizeofBpfStat = C.sizeof_struct_bpf_stat 232 SizeofBpfProgram = C.sizeof_struct_bpf_program 233 SizeofBpfInsn = C.sizeof_struct_bpf_insn 234 SizeofBpfHdr = C.sizeof_struct_bpf_hdr 235) 236 237type BpfVersion C.struct_bpf_version 238 239type BpfStat C.struct_bpf_stat 240 241type BpfProgram C.struct_bpf_program 242 243type BpfInsn C.struct_bpf_insn 244 245type BpfTimeval C.struct_bpf_timeval 246 247type BpfHdr C.struct_bpf_hdr 248 249// Terminal handling 250 251type Termios C.struct_termios 252 253type Termio C.struct_termio 254 255type Winsize C.struct_winsize 256 257// poll 258 259type PollFd C.struct_pollfd 260 261const ( 262 POLLERR = C.POLLERR 263 POLLHUP = C.POLLHUP 264 POLLIN = C.POLLIN 265 POLLNVAL = C.POLLNVAL 266 POLLOUT = C.POLLOUT 267 POLLPRI = C.POLLPRI 268 POLLRDBAND = C.POLLRDBAND 269 POLLRDNORM = C.POLLRDNORM 270 POLLWRBAND = C.POLLWRBAND 271 POLLWRNORM = C.POLLWRNORM 272) 273 274// Event Ports 275 276type fileObj C.struct_file_obj 277 278type portEvent C.struct_port_event 279 280const ( 281 PORT_SOURCE_AIO = C.PORT_SOURCE_AIO 282 PORT_SOURCE_TIMER = C.PORT_SOURCE_TIMER 283 PORT_SOURCE_USER = C.PORT_SOURCE_USER 284 PORT_SOURCE_FD = C.PORT_SOURCE_FD 285 PORT_SOURCE_ALERT = C.PORT_SOURCE_ALERT 286 PORT_SOURCE_MQ = C.PORT_SOURCE_MQ 287 PORT_SOURCE_FILE = C.PORT_SOURCE_FILE 288 PORT_ALERT_SET = C.PORT_ALERT_SET 289 PORT_ALERT_UPDATE = C.PORT_ALERT_UPDATE 290 PORT_ALERT_INVALID = C.PORT_ALERT_INVALID 291 FILE_ACCESS = C.FILE_ACCESS 292 FILE_MODIFIED = C.FILE_MODIFIED 293 FILE_ATTRIB = C.FILE_ATTRIB 294 FILE_TRUNC = C.FILE_TRUNC 295 FILE_NOFOLLOW = C.FILE_NOFOLLOW 296 FILE_DELETE = C.FILE_DELETE 297 FILE_RENAME_TO = C.FILE_RENAME_TO 298 FILE_RENAME_FROM = C.FILE_RENAME_FROM 299 UNMOUNTED = C.UNMOUNTED 300 MOUNTEDOVER = C.MOUNTEDOVER 301 FILE_EXCEPTION = C.FILE_EXCEPTION 302) 303