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
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#include <sys/types.h>
18#include <sys/time.h>
19#include <sys/limits.h>
20#include <sys/un.h>
21#include <sys/utsname.h>
22#include <sys/ptrace.h>
23#include <sys/statfs.h>
24
25#include <net/if.h>
26#include <net/if_dl.h>
27#include <netinet/in.h>
28#include <netinet/icmp6.h>
29
30#include <termios.h>
31
32#include <dirent.h>
33#include <fcntl.h>
34#include <gcrypt.h>
35
36enum {
37	sizeofPtr = sizeof(void*),
38};
39
40union sockaddr_all {
41	struct sockaddr s1;	// this one gets used for fields
42	struct sockaddr_in s2;	// these pad it out
43	struct sockaddr_in6 s3;
44	struct sockaddr_un s4;
45};
46
47struct sockaddr_any {
48	struct sockaddr addr;
49	char pad[sizeof(union sockaddr_all) - sizeof(struct sockaddr)];
50};
51
52*/
53import "C"
54
55// Machine characteristics; for internal use.
56
57const (
58	sizeofPtr      = C.sizeofPtr
59	sizeofShort    = C.sizeof_short
60	sizeofInt      = C.sizeof_int
61	sizeofLong     = C.sizeof_long
62	sizeofLongLong = C.sizeof_longlong
63	PathMax        = C.PATH_MAX
64)
65
66// Basic types
67
68type (
69	_C_short     C.short
70	_C_int       C.int
71	_C_long      C.long
72	_C_long_long C.longlong
73)
74
75// Time
76
77type Timespec C.struct_timespec
78
79type Timeval C.struct_timeval
80
81type Timeval32 C.struct_timeval32
82
83type Timezone C.struct_timezone
84
85// Processes
86
87type Rusage C.struct_rusage
88
89type Rlimit C.struct_rlimit
90
91type _Pid_t C.pid_t
92
93type _Gid_t C.gid_t
94
95// Files
96
97type Flock_t C.struct_flock
98
99type Stat_t C.struct_stat
100
101type Statfs_t C.struct_statfs
102
103type Fsid64_t C.fsid64_t
104
105type StTimespec_t C.st_timespec_t
106
107type Dirent C.struct_dirent
108
109// Sockets
110
111type RawSockaddrInet4 C.struct_sockaddr_in
112
113type RawSockaddrInet6 C.struct_sockaddr_in6
114
115type RawSockaddrUnix C.struct_sockaddr_un
116
117type RawSockaddrDatalink C.struct_sockaddr_dl
118
119type RawSockaddr C.struct_sockaddr
120
121type RawSockaddrAny C.struct_sockaddr_any
122
123type _Socklen C.socklen_t
124
125type Cmsghdr C.struct_cmsghdr
126
127type ICMPv6Filter C.struct_icmp6_filter
128
129type Iovec C.struct_iovec
130
131type IPMreq C.struct_ip_mreq
132
133type IPv6Mreq C.struct_ipv6_mreq
134
135type Linger C.struct_linger
136
137type Msghdr C.struct_msghdr
138
139const (
140	SizeofSockaddrInet4    = C.sizeof_struct_sockaddr_in
141	SizeofSockaddrInet6    = C.sizeof_struct_sockaddr_in6
142	SizeofSockaddrAny      = C.sizeof_struct_sockaddr_any
143	SizeofSockaddrUnix     = C.sizeof_struct_sockaddr_un
144	SizeofSockaddrDatalink = C.sizeof_struct_sockaddr_dl
145	SizeofLinger           = C.sizeof_struct_linger
146	SizeofIPMreq           = C.sizeof_struct_ip_mreq
147	SizeofIPv6Mreq         = C.sizeof_struct_ipv6_mreq
148	SizeofMsghdr           = C.sizeof_struct_msghdr
149	SizeofCmsghdr          = C.sizeof_struct_cmsghdr
150	SizeofICMPv6Filter     = C.sizeof_struct_icmp6_filter
151)
152
153// Ptrace requests
154
155const (
156	PTRACE_TRACEME = C.PT_TRACE_ME
157	PTRACE_CONT    = C.PT_CONTINUE
158	PTRACE_KILL    = C.PT_KILL
159)
160
161// Routing and interface messages
162
163const (
164	SizeofIfMsghdr = C.sizeof_struct_if_msghdr
165)
166
167type IfMsgHdr C.struct_if_msghdr
168
169// Misc
170
171type Utsname C.struct_utsname
172
173const (
174	_AT_FDCWD            = C.AT_FDCWD
175	_AT_REMOVEDIR        = C.AT_REMOVEDIR
176	_AT_SYMLINK_NOFOLLOW = C.AT_SYMLINK_NOFOLLOW
177)
178
179// Terminal handling
180
181type Termios C.struct_termios
182