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