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