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