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// +build ignore
6
7/*
8Input 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
14package unix
15
16/*
17#define KERNEL
18// These defines ensure that builds done on newer versions of Solaris are
19// backwards-compatible with older versions of Solaris and
20// OpenSolaris-based derivatives.
21#define __USE_SUNOS_SOCKETS__          // msghdr
22#define __USE_LEGACY_PROTOTYPES__      // iovec
23#include <dirent.h>
24#include <fcntl.h>
25#include <limits.h>
26#include <signal.h>
27#include <termios.h>
28#include <termio.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/times.h>
41#include <sys/types.h>
42#include <sys/utsname.h>
43#include <sys/un.h>
44#include <sys/wait.h>
45#include <net/bpf.h>
46#include <net/if.h>
47#include <net/if_dl.h>
48#include <net/route.h>
49#include <netinet/in.h>
50#include <netinet/icmp6.h>
51#include <netinet/tcp.h>
52#include <ustat.h>
53#include <utime.h>
54
55enum {
56	sizeofPtr = sizeof(void*),
57};
58
59union sockaddr_all {
60	struct sockaddr s1;	// this one gets used for fields
61	struct sockaddr_in s2;	// these pad it out
62	struct sockaddr_in6 s3;
63	struct sockaddr_un s4;
64	struct sockaddr_dl s5;
65};
66
67struct sockaddr_any {
68	struct sockaddr addr;
69	char pad[sizeof(union sockaddr_all) - sizeof(struct sockaddr)];
70};
71
72*/
73import "C"
74
75// Machine characteristics; for internal use.
76
77const (
78	sizeofPtr      = C.sizeofPtr
79	sizeofShort    = C.sizeof_short
80	sizeofInt      = C.sizeof_int
81	sizeofLong     = C.sizeof_long
82	sizeofLongLong = C.sizeof_longlong
83	PathMax        = C.PATH_MAX
84)
85
86// Basic types
87
88type (
89	_C_short     C.short
90	_C_int       C.int
91	_C_long      C.long
92	_C_long_long C.longlong
93)
94
95// Time
96
97type Timespec C.struct_timespec
98
99type Timeval C.struct_timeval
100
101type Timeval32 C.struct_timeval32
102
103type Tms C.struct_tms
104
105type Utimbuf C.struct_utimbuf
106
107// Processes
108
109type Rusage C.struct_rusage
110
111type Rlimit C.struct_rlimit
112
113type _Gid_t C.gid_t
114
115// Files
116
117const ( // Directory mode bits
118	S_IFMT   = C.S_IFMT
119	S_IFIFO  = C.S_IFIFO
120	S_IFCHR  = C.S_IFCHR
121	S_IFDIR  = C.S_IFDIR
122	S_IFBLK  = C.S_IFBLK
123	S_IFREG  = C.S_IFREG
124	S_IFLNK  = C.S_IFLNK
125	S_IFSOCK = C.S_IFSOCK
126	S_ISUID  = C.S_ISUID
127	S_ISGID  = C.S_ISGID
128	S_ISVTX  = C.S_ISVTX
129	S_IRUSR  = C.S_IRUSR
130	S_IWUSR  = C.S_IWUSR
131	S_IXUSR  = C.S_IXUSR
132)
133
134type Stat_t C.struct_stat
135
136type Flock_t C.struct_flock
137
138type Dirent C.struct_dirent
139
140// Sockets
141
142type RawSockaddrInet4 C.struct_sockaddr_in
143
144type RawSockaddrInet6 C.struct_sockaddr_in6
145
146type RawSockaddrUnix C.struct_sockaddr_un
147
148type RawSockaddrDatalink C.struct_sockaddr_dl
149
150type RawSockaddr C.struct_sockaddr
151
152type RawSockaddrAny C.struct_sockaddr_any
153
154type _Socklen C.socklen_t
155
156type Linger C.struct_linger
157
158type Iovec C.struct_iovec
159
160type IPMreq C.struct_ip_mreq
161
162type IPv6Mreq C.struct_ipv6_mreq
163
164type Msghdr C.struct_msghdr
165
166type Cmsghdr C.struct_cmsghdr
167
168type Inet6Pktinfo C.struct_in6_pktinfo
169
170type IPv6MTUInfo C.struct_ip6_mtuinfo
171
172type ICMPv6Filter C.struct_icmp6_filter
173
174const (
175	SizeofSockaddrInet4    = C.sizeof_struct_sockaddr_in
176	SizeofSockaddrInet6    = C.sizeof_struct_sockaddr_in6
177	SizeofSockaddrAny      = C.sizeof_struct_sockaddr_any
178	SizeofSockaddrUnix     = C.sizeof_struct_sockaddr_un
179	SizeofSockaddrDatalink = C.sizeof_struct_sockaddr_dl
180	SizeofLinger           = C.sizeof_struct_linger
181	SizeofIPMreq           = C.sizeof_struct_ip_mreq
182	SizeofIPv6Mreq         = C.sizeof_struct_ipv6_mreq
183	SizeofMsghdr           = C.sizeof_struct_msghdr
184	SizeofCmsghdr          = C.sizeof_struct_cmsghdr
185	SizeofInet6Pktinfo     = C.sizeof_struct_in6_pktinfo
186	SizeofIPv6MTUInfo      = C.sizeof_struct_ip6_mtuinfo
187	SizeofICMPv6Filter     = C.sizeof_struct_icmp6_filter
188)
189
190// Select
191
192type FdSet C.fd_set
193
194// Misc
195
196type Utsname C.struct_utsname
197
198type Ustat_t C.struct_ustat
199
200const (
201	AT_FDCWD            = C.AT_FDCWD
202	AT_SYMLINK_NOFOLLOW = C.AT_SYMLINK_NOFOLLOW
203	AT_SYMLINK_FOLLOW   = C.AT_SYMLINK_FOLLOW
204	AT_REMOVEDIR        = C.AT_REMOVEDIR
205	AT_EACCESS          = C.AT_EACCESS
206)
207
208// Routing and interface messages
209
210const (
211	SizeofIfMsghdr  = C.sizeof_struct_if_msghdr
212	SizeofIfData    = C.sizeof_struct_if_data
213	SizeofIfaMsghdr = C.sizeof_struct_ifa_msghdr
214	SizeofRtMsghdr  = C.sizeof_struct_rt_msghdr
215	SizeofRtMetrics = C.sizeof_struct_rt_metrics
216)
217
218type IfMsghdr C.struct_if_msghdr
219
220type IfData C.struct_if_data
221
222type IfaMsghdr C.struct_ifa_msghdr
223
224type RtMsghdr C.struct_rt_msghdr
225
226type RtMetrics C.struct_rt_metrics
227
228// Berkeley packet filter
229
230const (
231	SizeofBpfVersion = C.sizeof_struct_bpf_version
232	SizeofBpfStat    = C.sizeof_struct_bpf_stat
233	SizeofBpfProgram = C.sizeof_struct_bpf_program
234	SizeofBpfInsn    = C.sizeof_struct_bpf_insn
235	SizeofBpfHdr     = C.sizeof_struct_bpf_hdr
236)
237
238type BpfVersion C.struct_bpf_version
239
240type BpfStat C.struct_bpf_stat
241
242type BpfProgram C.struct_bpf_program
243
244type BpfInsn C.struct_bpf_insn
245
246type BpfTimeval C.struct_bpf_timeval
247
248type BpfHdr C.struct_bpf_hdr
249
250// sysconf information
251
252const _SC_PAGESIZE = C._SC_PAGESIZE
253
254// Terminal handling
255
256type Termios C.struct_termios
257
258type Termio C.struct_termio
259
260type Winsize C.struct_winsize
261