libc/new/linux_uapi/asm/
socket.rs1use crate::prelude::*;
4
5pub const SOL_SOCKET: c_int = 1;
6
7pub const SO_DEBUG: c_int = 1;
8pub const SO_REUSEADDR: c_int = 2;
9pub const SO_TYPE: c_int = 3;
10pub const SO_ERROR: c_int = 4;
11pub const SO_DONTROUTE: c_int = 5;
12pub const SO_BROADCAST: c_int = 6;
13pub const SO_SNDBUF: c_int = 7;
14pub const SO_RCVBUF: c_int = 8;
15pub const SO_SNDBUFFORCE: c_int = 32;
16pub const SO_RCVBUFFORCE: c_int = 33;
17pub const SO_KEEPALIVE: c_int = 9;
18pub const SO_OOBINLINE: c_int = 10;
19pub const SO_NO_CHECK: c_int = 11;
20pub const SO_PRIORITY: c_int = 12;
21pub const SO_LINGER: c_int = 13;
22pub const SO_BSDCOMPAT: c_int = 14;
23pub const SO_REUSEPORT: c_int = 15;
24
25cfg_if! {
26 if #[cfg(not(any(target_arch = "powerpc", target_arch = "powerpc64")))] {
27 pub const SO_PASSCRED: c_int = 16;
29 pub const SO_PEERCRED: c_int = 17;
30 pub const SO_RCVLOWAT: c_int = 18;
31 pub const SO_SNDLOWAT: c_int = 19;
32 const SO_RCVTIMEO_OLD: c_int = 20;
33 const SO_SNDTIMEO_OLD: c_int = 21;
34 } else {
35 use super::{
36 SO_RCVTIMEO_OLD,
37 SO_SNDTIMEO_OLD,
38 };
39 }
40}
41
42pub const SO_SECURITY_AUTHENTICATION: c_int = 22;
44pub const SO_SECURITY_ENCRYPTION_TRANSPORT: c_int = 23;
45pub const SO_SECURITY_ENCRYPTION_NETWORK: c_int = 24;
46
47pub const SO_BINDTODEVICE: c_int = 25;
48
49pub const SO_ATTACH_FILTER: c_int = 26;
51pub const SO_DETACH_FILTER: c_int = 27;
52pub const SO_GET_FILTER: c_int = SO_ATTACH_FILTER;
53
54pub const SO_PEERNAME: c_int = 28;
55
56pub const SO_ACCEPTCONN: c_int = 30;
57
58pub const SO_PEERSEC: c_int = 31;
59pub const SO_PASSSEC: c_int = 34;
60
61pub const SO_MARK: c_int = 36;
62
63pub const SO_PROTOCOL: c_int = 38;
64pub const SO_DOMAIN: c_int = 39;
65
66pub const SO_RXQ_OVFL: c_int = 40;
67
68pub const SO_WIFI_STATUS: c_int = 41;
69pub const SCM_WIFI_STATUS: c_int = SO_WIFI_STATUS;
70pub const SO_PEEK_OFF: c_int = 42;
71
72pub const SO_NOFCS: c_int = 43;
74
75pub const SO_LOCK_FILTER: c_int = 44;
76
77pub const SO_SELECT_ERR_QUEUE: c_int = 45;
78
79pub const SO_BUSY_POLL: c_int = 46;
80
81pub const SO_MAX_PACING_RATE: c_int = 47;
82
83pub const SO_BPF_EXTENSIONS: c_int = 48;
84
85pub const SO_INCOMING_CPU: c_int = 49;
86
87pub const SO_ATTACH_BPF: c_int = 50;
88pub const SO_DETACH_BPF: c_int = SO_DETACH_FILTER;
89
90pub const SO_ATTACH_REUSEPORT_CBPF: c_int = 51;
91pub const SO_ATTACH_REUSEPORT_EBPF: c_int = 52;
92
93pub const SO_CNX_ADVICE: c_int = 53;
94
95pub const SCM_TIMESTAMPING_OPT_STATS: c_int = 54;
96
97pub const SO_MEMINFO: c_int = 55;
98
99pub const SO_INCOMING_NAPI_ID: c_int = 56;
100
101pub const SO_COOKIE: c_int = 57;
102
103pub const SCM_TIMESTAMPING_PKTINFO: c_int = 58;
104
105pub const SO_PEERGROUPS: c_int = 59;
106
107pub const SO_ZEROCOPY: c_int = 60;
108
109pub const SO_TXTIME: c_int = 61;
110pub const SCM_TXTIME: c_int = SO_TXTIME;
111
112pub const SO_BINDTOIFINDEX: c_int = 62;
113
114const SO_TIMESTAMP_OLD: c_int = 29;
115const SO_TIMESTAMPNS_OLD: c_int = 35;
116const SO_TIMESTAMPING_OLD: c_int = 37;
117
118cfg_if! {
119 if #[cfg(all(
122 any(
123 target_arch = "x86",
124 target_arch = "x86_64",
125 target_arch = "arm",
126 target_arch = "aarch64",
127 target_arch = "csky",
128 target_arch = "loongarch64"
129 ),
130 not(any(target_env = "musl", target_env = "ohos"))
131 ))] {
132 pub const SO_TIMESTAMP_NEW: c_int = 63;
133 pub const SO_TIMESTAMPNS_NEW: c_int = 64;
134 pub const SO_TIMESTAMPING_NEW: c_int = 65;
135
136 pub const SO_RCVTIMEO_NEW: c_int = 66;
137 pub const SO_SNDTIMEO_NEW: c_int = 67;
138 } else if #[cfg(not(any(
139 target_pointer_width = "64",
140 all(target_arch = "x86_64", target_pointer_width = "32")
141 )))] {
142 const SO_TIMESTAMP_NEW: c_int = 63;
145 const SO_TIMESTAMPNS_NEW: c_int = 64;
146 const SO_TIMESTAMPING_NEW: c_int = 65;
147
148 const SO_RCVTIMEO_NEW: c_int = 66;
149 const SO_SNDTIMEO_NEW: c_int = 67;
150 }
151}
152
153pub const SO_DETACH_REUSEPORT_BPF: c_int = 68;
154
155pub const SO_PREFER_BUSY_POLL: c_int = 69;
156pub const SO_BUSY_POLL_BUDGET: c_int = 70;
157
158pub const SO_NETNS_COOKIE: c_int = 71;
159
160pub const SO_BUF_LOCK: c_int = 72;
161
162pub const SO_RESERVE_MEM: c_int = 73;
163
164pub const SO_TXREHASH: c_int = 74;
165
166pub const SO_RCVMARK: c_int = 75;
167
168pub const SO_PASSPIDFD: c_int = 76;
169pub const SO_PEERPIDFD: c_int = 77;
170
171pub const SO_DEVMEM_LINEAR: c_int = 78;
172pub const SCM_DEVMEM_LINEAR: c_int = SO_DEVMEM_LINEAR;
173pub const SO_DEVMEM_DMABUF: c_int = 79;
174pub const SCM_DEVMEM_DMABUF: c_int = SO_DEVMEM_DMABUF;
175pub const SO_DEVMEM_DONTNEED: c_int = 80;
176
177cfg_if! {
178 if #[cfg(any(
179 target_pointer_width = "64",
180 all(target_arch = "x86_64", target_pointer_width = "32")
181 ))] {
182 pub const SO_TIMESTAMP: c_int = SO_TIMESTAMP_OLD;
183 pub const SO_TIMESTAMPNS: c_int = SO_TIMESTAMPNS_OLD;
184 pub const SO_TIMESTAMPING: c_int = SO_TIMESTAMPING_OLD;
185
186 pub const SO_RCVTIMEO: c_int = SO_RCVTIMEO_OLD;
187 pub const SO_SNDTIMEO: c_int = SO_SNDTIMEO_OLD;
188 } else {
189 #[allow(deprecated)]
190 const TIME_T_LONG: bool = size_of::<crate::time_t>() == size_of::<c_long>();
191
192 pub const SO_TIMESTAMP: c_int = if TIME_T_LONG {
193 SO_TIMESTAMP_OLD
194 } else {
195 SO_TIMESTAMP_NEW
196 };
197 pub const SO_TIMESTAMPNS: c_int = if TIME_T_LONG {
198 SO_TIMESTAMPNS_OLD
199 } else {
200 SO_TIMESTAMPNS_NEW
201 };
202 pub const SO_TIMESTAMPING: c_int = if TIME_T_LONG {
203 SO_TIMESTAMPING_OLD
204 } else {
205 SO_TIMESTAMPING_NEW
206 };
207
208 pub const SO_RCVTIMEO: c_int = if TIME_T_LONG {
209 SO_RCVTIMEO_OLD
210 } else {
211 SO_RCVTIMEO_NEW
212 };
213 pub const SO_SNDTIMEO: c_int = if TIME_T_LONG {
214 SO_SNDTIMEO_OLD
215 } else {
216 SO_SNDTIMEO_NEW
217 };
218 }
219}
220
221pub const SCM_TIMESTAMP: c_int = SO_TIMESTAMP;
222pub const SCM_TIMESTAMPNS: c_int = SO_TIMESTAMPNS;
223pub const SCM_TIMESTAMPING: c_int = SO_TIMESTAMPING;