| 1 |
// Copyright 2018 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 && aix |
| 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 unix |
| 15 |
|
| 16 |
/* |
| 17 |
#include <sys/types.h> |
| 18 |
#include <sys/time.h> |
| 19 |
#include <sys/limits.h> |
| 20 |
#include <sys/un.h> |
| 21 |
#include <utime.h> |
| 22 |
#include <sys/utsname.h> |
| 23 |
#include <sys/poll.h> |
| 24 |
#include <sys/resource.h> |
| 25 |
#include <sys/stat.h> |
| 26 |
#include <sys/statfs.h> |
| 27 |
#include <sys/termio.h> |
| 28 |
#include <sys/ioctl.h> |
| 29 |
|
| 30 |
#include <termios.h> |
| 31 |
|
| 32 |
#include <net/if.h> |
| 33 |
#include <net/if_dl.h> |
| 34 |
#include <netinet/in.h> |
| 35 |
#include <netinet/icmp6.h> |
| 36 |
|
| 37 |
|
| 38 |
#include <dirent.h> |
| 39 |
#include <fcntl.h> |
| 40 |
|
| 41 |
enum { |
| 42 |
sizeofPtr = sizeof(void*), |
| 43 |
}; |
| 44 |
|
| 45 |
union sockaddr_all { |
| 46 |
struct sockaddr s1; // this one gets used for fields |
| 47 |
struct sockaddr_in s2; // these pad it out |
| 48 |
struct sockaddr_in6 s3; |
| 49 |
struct sockaddr_un s4; |
| 50 |
struct sockaddr_dl s5; |
| 51 |
}; |
| 52 |
|
| 53 |
struct sockaddr_any { |
| 54 |
struct sockaddr addr; |
| 55 |
char pad[sizeof(union sockaddr_all) - sizeof(struct sockaddr)]; |
| 56 |
}; |
| 57 |
|
| 58 |
*/ |
| 59 |
import "C" |
| 60 |
|
| 61 |
// Machine characteristics |
| 62 |
|
| 63 |
const ( |
| 64 |
SizeofPtr = C.sizeofPtr |
| 65 |
SizeofShort = C.sizeof_short |
| 66 |
SizeofInt = C.sizeof_int |
| 67 |
SizeofLong = C.sizeof_long |
| 68 |
SizeofLongLong = C.sizeof_longlong |
| 69 |
PathMax = C.PATH_MAX |
| 70 |
) |
| 71 |
|
| 72 |
// Basic types |
| 73 |
|
| 74 |
type ( |
| 75 |
_C_short C.short |
| 76 |
_C_int C.int |
| 77 |
_C_long C.long |
| 78 |
_C_long_long C.longlong |
| 79 |
) |
| 80 |
|
| 81 |
type off64 C.off64_t |
| 82 |
type off C.off_t |
| 83 |
type Mode_t C.mode_t |
| 84 |
|
| 85 |
// Time |
| 86 |
|
| 87 |
type Timespec C.struct_timespec |
| 88 |
|
| 89 |
type Timeval C.struct_timeval |
| 90 |
|
| 91 |
type Timeval32 C.struct_timeval32 |
| 92 |
|
| 93 |
type Timex C.struct_timex |
| 94 |
|
| 95 |
type Time_t C.time_t |
| 96 |
|
| 97 |
type Tms C.struct_tms |
| 98 |
|
| 99 |
type Utimbuf C.struct_utimbuf |
| 100 |
|
| 101 |
type Timezone C.struct_timezone |
| 102 |
|
| 103 |
// Processes |
| 104 |
|
| 105 |
type Rusage C.struct_rusage |
| 106 |
|
| 107 |
type Rlimit C.struct_rlimit64 |
| 108 |
|
| 109 |
type Pid_t C.pid_t |
| 110 |
|
| 111 |
type _Gid_t C.gid_t |
| 112 |
|
| 113 |
type dev_t C.dev_t |
| 114 |
|
| 115 |
// Files |
| 116 |
|
| 117 |
type Stat_t C.struct_stat |
| 118 |
|
| 119 |
type StatxTimestamp C.struct_statx_timestamp |
| 120 |
|
| 121 |
type Statx_t C.struct_statx |
| 122 |
|
| 123 |
type Dirent C.struct_dirent |
| 124 |
|
| 125 |
// Sockets |
| 126 |
|
| 127 |
type RawSockaddrInet4 C.struct_sockaddr_in |
| 128 |
|
| 129 |
type RawSockaddrInet6 C.struct_sockaddr_in6 |
| 130 |
|
| 131 |
type RawSockaddrUnix C.struct_sockaddr_un |
| 132 |
|
| 133 |
type RawSockaddrDatalink C.struct_sockaddr_dl |
| 134 |
|
| 135 |
type RawSockaddr C.struct_sockaddr |
| 136 |
|
| 137 |
type RawSockaddrAny C.struct_sockaddr_any |
| 138 |
|
| 139 |
type _Socklen C.socklen_t |
| 140 |
|
| 141 |
type Cmsghdr C.struct_cmsghdr |
| 142 |
|
| 143 |
type ICMPv6Filter C.struct_icmp6_filter |
| 144 |
|
| 145 |
type Iovec C.struct_iovec |
| 146 |
|
| 147 |
type IPMreq C.struct_ip_mreq |
| 148 |
|
| 149 |
type IPv6Mreq C.struct_ipv6_mreq |
| 150 |
|
| 151 |
type IPv6MTUInfo C.struct_ip6_mtuinfo |
| 152 |
|
| 153 |
type Linger C.struct_linger |
| 154 |
|
| 155 |
type Msghdr C.struct_msghdr |
| 156 |
|
| 157 |
const ( |
| 158 |
SizeofSockaddrInet4 = C.sizeof_struct_sockaddr_in |
| 159 |
SizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6 |
| 160 |
SizeofSockaddrAny = C.sizeof_struct_sockaddr_any |
| 161 |
SizeofSockaddrUnix = C.sizeof_struct_sockaddr_un |
| 162 |
SizeofSockaddrDatalink = C.sizeof_struct_sockaddr_dl |
| 163 |
SizeofLinger = C.sizeof_struct_linger |
| 164 |
SizeofIovec = C.sizeof_struct_iovec |
| 165 |
SizeofIPMreq = C.sizeof_struct_ip_mreq |
| 166 |
SizeofIPv6Mreq = C.sizeof_struct_ipv6_mreq |
| 167 |
SizeofIPv6MTUInfo = C.sizeof_struct_ip6_mtuinfo |
| 168 |
SizeofMsghdr = C.sizeof_struct_msghdr |
| 169 |
SizeofCmsghdr = C.sizeof_struct_cmsghdr |
| 170 |
SizeofICMPv6Filter = C.sizeof_struct_icmp6_filter |
| 171 |
) |
| 172 |
|
| 173 |
// Routing and interface messages |
| 174 |
|
| 175 |
const ( |
| 176 |
SizeofIfMsghdr = C.sizeof_struct_if_msghdr |
| 177 |
) |
| 178 |
|
| 179 |
type IfMsgHdr C.struct_if_msghdr |
| 180 |
|
| 181 |
// Misc |
| 182 |
|
| 183 |
type FdSet C.fd_set |
| 184 |
|
| 185 |
type Utsname C.struct_utsname |
| 186 |
|
| 187 |
type Ustat_t C.struct_ustat |
| 188 |
|
| 189 |
type Sigset_t C.sigset_t |
| 190 |
|
| 191 |
const ( |
| 192 |
AT_FDCWD = C.AT_FDCWD |
| 193 |
AT_REMOVEDIR = C.AT_REMOVEDIR |
| 194 |
AT_SYMLINK_NOFOLLOW = C.AT_SYMLINK_NOFOLLOW |
| 195 |
) |
| 196 |
|
| 197 |
// Terminal handling |
| 198 |
|
| 199 |
type Termios C.struct_termios |
| 200 |
|
| 201 |
type Termio C.struct_termio |
| 202 |
|
| 203 |
type Winsize C.struct_winsize |
| 204 |
|
| 205 |
//poll |
| 206 |
|
| 207 |
type PollFd struct { |
| 208 |
Fd int32 |
| 209 |
Events uint16 |
| 210 |
Revents uint16 |
| 211 |
} |
| 212 |
|
| 213 |
const ( |
| 214 |
POLLERR = C.POLLERR |
| 215 |
POLLHUP = C.POLLHUP |
| 216 |
POLLIN = C.POLLIN |
| 217 |
POLLNVAL = C.POLLNVAL |
| 218 |
POLLOUT = C.POLLOUT |
| 219 |
POLLPRI = C.POLLPRI |
| 220 |
POLLRDBAND = C.POLLRDBAND |
| 221 |
POLLRDNORM = C.POLLRDNORM |
| 222 |
POLLWRBAND = C.POLLWRBAND |
| 223 |
POLLWRNORM = C.POLLWRNORM |
| 224 |
) |
| 225 |
|
| 226 |
//flock_t |
| 227 |
|
| 228 |
type Flock_t C.struct_flock64 |
| 229 |
|
| 230 |
// Statfs |
| 231 |
|
| 232 |
type Fsid_t C.struct_fsid_t |
| 233 |
type Fsid64_t C.struct_fsid64_t |
| 234 |
|
| 235 |
type Statfs_t C.struct_statfs |
| 236 |
|
| 237 |
const RNDGETENTCNT = 0x80045200 |