]> git.proxmox.com Git - rustc.git/blame - vendor/libc/src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs
New upstream version 1.46.0~beta.2+dfsg1
[rustc.git] / vendor / libc / src / unix / linux_like / linux / gnu / b64 / x86_64 / mod.rs
CommitLineData
476ff2be
SL
1//! x86_64-specific definitions for 64-bit linux-like values
2
3pub type c_char = i8;
4pub type wchar_t = i32;
5pub type nlink_t = u64;
6pub type blksize_t = i64;
7pub type greg_t = i64;
8bb4bdeb 8pub type suseconds_t = i64;
041b39d2 9pub type __u64 = ::c_ulonglong;
476ff2be
SL
10
11s! {
416331ca
XL
12 pub struct sigaction {
13 pub sa_sigaction: ::sighandler_t,
14 pub sa_mask: ::sigset_t,
15 #[cfg(target_arch = "sparc64")]
16 __reserved0: ::c_int,
17 pub sa_flags: ::c_int,
18 pub sa_restorer: ::Option<extern fn()>,
19 }
20
21 pub struct statfs {
22 pub f_type: ::__fsword_t,
23 pub f_bsize: ::__fsword_t,
24 pub f_blocks: ::fsblkcnt_t,
25 pub f_bfree: ::fsblkcnt_t,
26 pub f_bavail: ::fsblkcnt_t,
27
28 pub f_files: ::fsfilcnt_t,
29 pub f_ffree: ::fsfilcnt_t,
30 pub f_fsid: ::fsid_t,
31
32 pub f_namelen: ::__fsword_t,
33 pub f_frsize: ::__fsword_t,
34 f_spare: [::__fsword_t; 5],
35 }
36
37 pub struct flock {
38 pub l_type: ::c_short,
39 pub l_whence: ::c_short,
40 pub l_start: ::off_t,
41 pub l_len: ::off_t,
42 pub l_pid: ::pid_t,
43 }
44
dfeec247
XL
45 pub struct flock64 {
46 pub l_type: ::c_short,
47 pub l_whence: ::c_short,
48 pub l_start: ::off64_t,
49 pub l_len: ::off64_t,
50 pub l_pid: ::pid_t,
51 }
52
416331ca
XL
53 pub struct siginfo_t {
54 pub si_signo: ::c_int,
55 pub si_errno: ::c_int,
56 pub si_code: ::c_int,
57 #[doc(hidden)]
58 #[deprecated(
59 since="0.2.54",
60 note="Please leave a comment on \
61 https://github.com/rust-lang/libc/pull/1316 if you're using \
62 this field"
63 )]
64 pub _pad: [::c_int; 29],
65 _align: [u64; 0],
66 }
67
68 pub struct stack_t {
69 pub ss_sp: *mut ::c_void,
70 pub ss_flags: ::c_int,
71 pub ss_size: ::size_t
72 }
73
476ff2be
SL
74 pub struct stat {
75 pub st_dev: ::dev_t,
76 pub st_ino: ::ino_t,
77 pub st_nlink: ::nlink_t,
78 pub st_mode: ::mode_t,
79 pub st_uid: ::uid_t,
80 pub st_gid: ::gid_t,
81 __pad0: ::c_int,
82 pub st_rdev: ::dev_t,
83 pub st_size: ::off_t,
84 pub st_blksize: ::blksize_t,
85 pub st_blocks: ::blkcnt_t,
86 pub st_atime: ::time_t,
abe05a73 87 pub st_atime_nsec: i64,
476ff2be 88 pub st_mtime: ::time_t,
abe05a73 89 pub st_mtime_nsec: i64,
476ff2be 90 pub st_ctime: ::time_t,
abe05a73
XL
91 pub st_ctime_nsec: i64,
92 __unused: [i64; 3],
476ff2be
SL
93 }
94
95 pub struct stat64 {
96 pub st_dev: ::dev_t,
97 pub st_ino: ::ino64_t,
98 pub st_nlink: ::nlink_t,
99 pub st_mode: ::mode_t,
100 pub st_uid: ::uid_t,
101 pub st_gid: ::gid_t,
102 __pad0: ::c_int,
103 pub st_rdev: ::dev_t,
104 pub st_size: ::off_t,
105 pub st_blksize: ::blksize_t,
106 pub st_blocks: ::blkcnt64_t,
107 pub st_atime: ::time_t,
abe05a73 108 pub st_atime_nsec: i64,
476ff2be 109 pub st_mtime: ::time_t,
abe05a73 110 pub st_mtime_nsec: i64,
476ff2be 111 pub st_ctime: ::time_t,
abe05a73
XL
112 pub st_ctime_nsec: i64,
113 __reserved: [i64; 3],
476ff2be
SL
114 }
115
ea8adc8c
XL
116 pub struct statfs64 {
117 pub f_type: ::__fsword_t,
118 pub f_bsize: ::__fsword_t,
119 pub f_blocks: u64,
120 pub f_bfree: u64,
121 pub f_bavail: u64,
122 pub f_files: u64,
123 pub f_ffree: u64,
124 pub f_fsid: ::fsid_t,
125 pub f_namelen: ::__fsword_t,
126 pub f_frsize: ::__fsword_t,
127 pub f_flags: ::__fsword_t,
128 pub f_spare: [::__fsword_t; 4],
129 }
130
131 pub struct statvfs64 {
132 pub f_bsize: ::c_ulong,
133 pub f_frsize: ::c_ulong,
134 pub f_blocks: u64,
135 pub f_bfree: u64,
136 pub f_bavail: u64,
137 pub f_files: u64,
138 pub f_ffree: u64,
139 pub f_favail: u64,
140 pub f_fsid: ::c_ulong,
141 pub f_flag: ::c_ulong,
142 pub f_namemax: ::c_ulong,
143 __f_spare: [::c_int; 6],
144 }
145
476ff2be 146 pub struct pthread_attr_t {
abe05a73
XL
147 #[cfg(target_pointer_width = "32")]
148 __size: [u32; 8],
149 #[cfg(target_pointer_width = "64")]
476ff2be
SL
150 __size: [u64; 7]
151 }
152
153 pub struct _libc_fpxreg {
154 pub significand: [u16; 4],
155 pub exponent: u16,
156 __private: [u16; 3],
157 }
158
159 pub struct _libc_xmmreg {
160 pub element: [u32; 4],
161 }
162
163 pub struct _libc_fpstate {
164 pub cwd: u16,
165 pub swd: u16,
166 pub ftw: u16,
167 pub fop: u16,
168 pub rip: u64,
169 pub rdp: u64,
170 pub mxcsr: u32,
171 pub mxcr_mask: u32,
172 pub _st: [_libc_fpxreg; 8],
173 pub _xmm: [_libc_xmmreg; 16],
174 __private: [u64; 12],
175 }
176
041b39d2
XL
177 pub struct user_regs_struct {
178 pub r15: ::c_ulonglong,
179 pub r14: ::c_ulonglong,
180 pub r13: ::c_ulonglong,
181 pub r12: ::c_ulonglong,
182 pub rbp: ::c_ulonglong,
183 pub rbx: ::c_ulonglong,
184 pub r11: ::c_ulonglong,
185 pub r10: ::c_ulonglong,
186 pub r9: ::c_ulonglong,
187 pub r8: ::c_ulonglong,
188 pub rax: ::c_ulonglong,
189 pub rcx: ::c_ulonglong,
190 pub rdx: ::c_ulonglong,
191 pub rsi: ::c_ulonglong,
192 pub rdi: ::c_ulonglong,
193 pub orig_rax: ::c_ulonglong,
194 pub rip: ::c_ulonglong,
195 pub cs: ::c_ulonglong,
196 pub eflags: ::c_ulonglong,
197 pub rsp: ::c_ulonglong,
198 pub ss: ::c_ulonglong,
199 pub fs_base: ::c_ulonglong,
200 pub gs_base: ::c_ulonglong,
201 pub ds: ::c_ulonglong,
202 pub es: ::c_ulonglong,
203 pub fs: ::c_ulonglong,
204 pub gs: ::c_ulonglong,
205 }
206
207 pub struct user {
208 pub regs: user_regs_struct,
209 pub u_fpvalid: ::c_int,
210 pub i387: user_fpregs_struct,
211 pub u_tsize: ::c_ulonglong,
212 pub u_dsize: ::c_ulonglong,
213 pub u_ssize: ::c_ulonglong,
214 pub start_code: ::c_ulonglong,
215 pub start_stack: ::c_ulonglong,
216 pub signal: ::c_longlong,
217 __reserved: ::c_int,
abe05a73
XL
218 #[cfg(target_pointer_width = "32")]
219 __pad1: u32,
041b39d2 220 pub u_ar0: *mut user_regs_struct,
abe05a73
XL
221 #[cfg(target_pointer_width = "32")]
222 __pad2: u32,
041b39d2
XL
223 pub u_fpstate: *mut user_fpregs_struct,
224 pub magic: ::c_ulonglong,
225 pub u_comm: [::c_char; 32],
226 pub u_debugreg: [::c_ulonglong; 8],
227 }
228
476ff2be
SL
229 pub struct mcontext_t {
230 pub gregs: [greg_t; 23],
231 pub fpregs: *mut _libc_fpstate,
232 __private: [u64; 8],
233 }
234
476ff2be
SL
235 pub struct ipc_perm {
236 pub __key: ::key_t,
237 pub uid: ::uid_t,
238 pub gid: ::gid_t,
239 pub cuid: ::uid_t,
240 pub cgid: ::gid_t,
241 pub mode: ::c_ushort,
242 __pad1: ::c_ushort,
243 pub __seq: ::c_ushort,
244 __pad2: ::c_ushort,
abe05a73
XL
245 __unused1: u64,
246 __unused2: u64
476ff2be
SL
247 }
248
249 pub struct shmid_ds {
250 pub shm_perm: ::ipc_perm,
251 pub shm_segsz: ::size_t,
252 pub shm_atime: ::time_t,
253 pub shm_dtime: ::time_t,
254 pub shm_ctime: ::time_t,
255 pub shm_cpid: ::pid_t,
256 pub shm_lpid: ::pid_t,
257 pub shm_nattch: ::shmatt_t,
abe05a73
XL
258 __unused4: u64,
259 __unused5: u64
260 }
261
262 pub struct termios2 {
263 pub c_iflag: ::tcflag_t,
264 pub c_oflag: ::tcflag_t,
265 pub c_cflag: ::tcflag_t,
266 pub c_lflag: ::tcflag_t,
267 pub c_line: ::cc_t,
268 pub c_cc: [::cc_t; 19],
269 pub c_ispeed: ::speed_t,
270 pub c_ospeed: ::speed_t,
476ff2be 271 }
dfeec247
XL
272
273 pub struct ip_mreqn {
274 pub imr_multiaddr: ::in_addr,
275 pub imr_address: ::in_addr,
276 pub imr_ifindex: ::c_int,
277 }
476ff2be
SL
278}
279
532ac7d7
XL
280s_no_extra_traits! {
281 pub struct user_fpregs_struct {
282 pub cwd: ::c_ushort,
283 pub swd: ::c_ushort,
284 pub ftw: ::c_ushort,
285 pub fop: ::c_ushort,
286 pub rip: ::c_ulonglong,
287 pub rdp: ::c_ulonglong,
288 pub mxcsr: ::c_uint,
289 pub mxcr_mask: ::c_uint,
290 pub st_space: [::c_uint; 32],
291 pub xmm_space: [::c_uint; 64],
292 padding: [::c_uint; 24],
293 }
294
295 pub struct ucontext_t {
296 pub uc_flags: ::c_ulong,
297 pub uc_link: *mut ucontext_t,
298 pub uc_stack: ::stack_t,
299 pub uc_mcontext: mcontext_t,
300 pub uc_sigmask: ::sigset_t,
301 __private: [u8; 512],
416331ca
XL
302 // FIXME: the shadow stack field requires glibc >= 2.28.
303 // Re-add once we drop compatibility with glibc versions older than
304 // 2.28.
305 //
306 // __ssp: [::c_ulonglong; 4],
532ac7d7
XL
307 }
308}
309
310cfg_if! {
311 if #[cfg(feature = "extra_traits")] {
312 impl PartialEq for user_fpregs_struct {
313 fn eq(&self, other: &user_fpregs_struct) -> bool {
314 self.cwd == other.cwd
315 && self.swd == other.swd
316 && self.ftw == other.ftw
317 && self.fop == other.fop
318 && self.rip == other.rip
319 && self.rdp == other.rdp
320 && self.mxcsr == other.mxcsr
321 && self.mxcr_mask == other.mxcr_mask
322 && self.st_space == other.st_space
323 && self
324 .xmm_space
325 .iter()
326 .zip(other.xmm_space.iter())
327 .all(|(a,b)| a == b)
328 // Ignore padding field
329 }
330 }
331
332 impl Eq for user_fpregs_struct {}
333
334 impl ::fmt::Debug for user_fpregs_struct {
335 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
336 f.debug_struct("user_fpregs_struct")
337 .field("cwd", &self.cwd)
338 .field("ftw", &self.ftw)
339 .field("fop", &self.fop)
340 .field("rip", &self.rip)
341 .field("rdp", &self.rdp)
342 .field("mxcsr", &self.mxcsr)
343 .field("mxcr_mask", &self.mxcr_mask)
344 .field("st_space", &self.st_space)
345 // FIXME: .field("xmm_space", &self.xmm_space)
346 // Ignore padding field
347 .finish()
348 }
349 }
350
351 impl ::hash::Hash for user_fpregs_struct {
352 fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
353 self.cwd.hash(state);
354 self.ftw.hash(state);
355 self.fop.hash(state);
356 self.rip.hash(state);
357 self.rdp.hash(state);
358 self.mxcsr.hash(state);
359 self.mxcr_mask.hash(state);
360 self.st_space.hash(state);
361 self.xmm_space.hash(state);
362 // Ignore padding field
363 }
364 }
365
366 impl PartialEq for ucontext_t {
367 fn eq(&self, other: &ucontext_t) -> bool {
368 self.uc_flags == other.uc_flags
369 && self.uc_link == other.uc_link
370 && self.uc_stack == other.uc_stack
371 && self.uc_mcontext == other.uc_mcontext
372 && self.uc_sigmask == other.uc_sigmask
373 // Ignore __private field
374 }
375 }
376
377 impl Eq for ucontext_t {}
378
379 impl ::fmt::Debug for ucontext_t {
380 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
381 f.debug_struct("ucontext_t")
382 .field("uc_flags", &self.uc_flags)
383 .field("uc_link", &self.uc_link)
384 .field("uc_stack", &self.uc_stack)
385 .field("uc_mcontext", &self.uc_mcontext)
386 .field("uc_sigmask", &self.uc_sigmask)
387 // Ignore __private field
388 .finish()
389 }
390 }
391
392 impl ::hash::Hash for ucontext_t {
393 fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
394 self.uc_flags.hash(state);
395 self.uc_link.hash(state);
396 self.uc_stack.hash(state);
397 self.uc_mcontext.hash(state);
398 self.uc_sigmask.hash(state);
399 // Ignore __private field
400 }
401 }
402 }
403}
404
416331ca
XL
405pub const POSIX_FADV_DONTNEED: ::c_int = 4;
406pub const POSIX_FADV_NOREUSE: ::c_int = 5;
407
408pub const VEOF: usize = 4;
409pub const RTLD_DEEPBIND: ::c_int = 0x8;
410pub const RTLD_GLOBAL: ::c_int = 0x100;
411pub const RTLD_NOLOAD: ::c_int = 0x4;
8bb4bdeb
XL
412pub const TIOCGSOFTCAR: ::c_ulong = 0x5419;
413pub const TIOCSSOFTCAR: ::c_ulong = 0x541A;
416331ca
XL
414pub const TIOCGRS485: ::c_int = 0x542E;
415pub const TIOCSRS485: ::c_int = 0x542F;
8bb4bdeb 416
416331ca
XL
417pub const RLIMIT_RSS: ::__rlimit_resource_t = 5;
418pub const RLIMIT_AS: ::__rlimit_resource_t = 9;
419pub const RLIMIT_MEMLOCK: ::__rlimit_resource_t = 8;
420pub const RLIMIT_NOFILE: ::__rlimit_resource_t = 7;
421pub const RLIMIT_NPROC: ::__rlimit_resource_t = 6;
8bb4bdeb
XL
422
423pub const O_APPEND: ::c_int = 1024;
424pub const O_CREAT: ::c_int = 64;
425pub const O_EXCL: ::c_int = 128;
426pub const O_NOCTTY: ::c_int = 256;
427pub const O_NONBLOCK: ::c_int = 2048;
428pub const O_SYNC: ::c_int = 1052672;
429pub const O_RSYNC: ::c_int = 1052672;
430pub const O_DSYNC: ::c_int = 4096;
431pub const O_FSYNC: ::c_int = 0x101000;
3b2f2976
XL
432pub const O_NOATIME: ::c_int = 0o1000000;
433pub const O_PATH: ::c_int = 0o10000000;
ff7c6d11 434pub const O_TMPFILE: ::c_int = 0o20000000 | O_DIRECTORY;
8bb4bdeb 435
416331ca 436pub const MADV_SOFT_OFFLINE: ::c_int = 101;
8bb4bdeb
XL
437pub const MAP_GROWSDOWN: ::c_int = 0x0100;
438
439pub const EDEADLK: ::c_int = 35;
440pub const ENAMETOOLONG: ::c_int = 36;
441pub const ENOLCK: ::c_int = 37;
442pub const ENOSYS: ::c_int = 38;
443pub const ENOTEMPTY: ::c_int = 39;
444pub const ELOOP: ::c_int = 40;
445pub const ENOMSG: ::c_int = 42;
446pub const EIDRM: ::c_int = 43;
447pub const ECHRNG: ::c_int = 44;
448pub const EL2NSYNC: ::c_int = 45;
449pub const EL3HLT: ::c_int = 46;
450pub const EL3RST: ::c_int = 47;
451pub const ELNRNG: ::c_int = 48;
452pub const EUNATCH: ::c_int = 49;
453pub const ENOCSI: ::c_int = 50;
454pub const EL2HLT: ::c_int = 51;
455pub const EBADE: ::c_int = 52;
456pub const EBADR: ::c_int = 53;
457pub const EXFULL: ::c_int = 54;
458pub const ENOANO: ::c_int = 55;
459pub const EBADRQC: ::c_int = 56;
460pub const EBADSLT: ::c_int = 57;
461pub const EMULTIHOP: ::c_int = 72;
462pub const EOVERFLOW: ::c_int = 75;
463pub const ENOTUNIQ: ::c_int = 76;
464pub const EBADFD: ::c_int = 77;
465pub const EBADMSG: ::c_int = 74;
466pub const EREMCHG: ::c_int = 78;
467pub const ELIBACC: ::c_int = 79;
468pub const ELIBBAD: ::c_int = 80;
469pub const ELIBSCN: ::c_int = 81;
470pub const ELIBMAX: ::c_int = 82;
471pub const ELIBEXEC: ::c_int = 83;
472pub const EILSEQ: ::c_int = 84;
473pub const ERESTART: ::c_int = 85;
474pub const ESTRPIPE: ::c_int = 86;
475pub const EUSERS: ::c_int = 87;
476pub const ENOTSOCK: ::c_int = 88;
477pub const EDESTADDRREQ: ::c_int = 89;
478pub const EMSGSIZE: ::c_int = 90;
479pub const EPROTOTYPE: ::c_int = 91;
480pub const ENOPROTOOPT: ::c_int = 92;
481pub const EPROTONOSUPPORT: ::c_int = 93;
482pub const ESOCKTNOSUPPORT: ::c_int = 94;
483pub const EOPNOTSUPP: ::c_int = 95;
484pub const EPFNOSUPPORT: ::c_int = 96;
485pub const EAFNOSUPPORT: ::c_int = 97;
486pub const EADDRINUSE: ::c_int = 98;
487pub const EADDRNOTAVAIL: ::c_int = 99;
488pub const ENETDOWN: ::c_int = 100;
489pub const ENETUNREACH: ::c_int = 101;
490pub const ENETRESET: ::c_int = 102;
491pub const ECONNABORTED: ::c_int = 103;
492pub const ECONNRESET: ::c_int = 104;
493pub const ENOBUFS: ::c_int = 105;
494pub const EISCONN: ::c_int = 106;
495pub const ENOTCONN: ::c_int = 107;
496pub const ESHUTDOWN: ::c_int = 108;
497pub const ETOOMANYREFS: ::c_int = 109;
498pub const ETIMEDOUT: ::c_int = 110;
499pub const ECONNREFUSED: ::c_int = 111;
500pub const EHOSTDOWN: ::c_int = 112;
501pub const EHOSTUNREACH: ::c_int = 113;
502pub const EALREADY: ::c_int = 114;
503pub const EINPROGRESS: ::c_int = 115;
504pub const ESTALE: ::c_int = 116;
505pub const EDQUOT: ::c_int = 122;
506pub const ENOMEDIUM: ::c_int = 123;
507pub const EMEDIUMTYPE: ::c_int = 124;
508pub const ECANCELED: ::c_int = 125;
509pub const ENOKEY: ::c_int = 126;
510pub const EKEYEXPIRED: ::c_int = 127;
511pub const EKEYREVOKED: ::c_int = 128;
512pub const EKEYREJECTED: ::c_int = 129;
513pub const EOWNERDEAD: ::c_int = 130;
514pub const ENOTRECOVERABLE: ::c_int = 131;
515pub const EHWPOISON: ::c_int = 133;
516pub const ERFKILL: ::c_int = 132;
517
518pub const SOL_SOCKET: ::c_int = 1;
519
520pub const SO_REUSEADDR: ::c_int = 2;
521pub const SO_TYPE: ::c_int = 3;
522pub const SO_ERROR: ::c_int = 4;
523pub const SO_DONTROUTE: ::c_int = 5;
524pub const SO_BROADCAST: ::c_int = 6;
525pub const SO_SNDBUF: ::c_int = 7;
526pub const SO_RCVBUF: ::c_int = 8;
527pub const SO_SNDBUFFORCE: ::c_int = 32;
528pub const SO_RCVBUFFORCE: ::c_int = 33;
529pub const SO_KEEPALIVE: ::c_int = 9;
530pub const SO_OOBINLINE: ::c_int = 10;
531pub const SO_NO_CHECK: ::c_int = 11;
532pub const SO_PRIORITY: ::c_int = 12;
533pub const SO_LINGER: ::c_int = 13;
534pub const SO_BSDCOMPAT: ::c_int = 14;
535pub const SO_REUSEPORT: ::c_int = 15;
536pub const SO_PASSCRED: ::c_int = 16;
537pub const SO_PEERCRED: ::c_int = 17;
538pub const SO_RCVLOWAT: ::c_int = 18;
539pub const SO_SNDLOWAT: ::c_int = 19;
540pub const SO_RCVTIMEO: ::c_int = 20;
541pub const SO_SNDTIMEO: ::c_int = 21;
542pub const SO_SECURITY_AUTHENTICATION: ::c_int = 22;
543pub const SO_SECURITY_ENCRYPTION_TRANSPORT: ::c_int = 23;
544pub const SO_SECURITY_ENCRYPTION_NETWORK: ::c_int = 24;
545pub const SO_BINDTODEVICE: ::c_int = 25;
546pub const SO_ATTACH_FILTER: ::c_int = 26;
547pub const SO_DETACH_FILTER: ::c_int = 27;
548pub const SO_GET_FILTER: ::c_int = SO_ATTACH_FILTER;
549pub const SO_PEERNAME: ::c_int = 28;
550pub const SO_TIMESTAMP: ::c_int = 29;
8bb4bdeb
XL
551pub const SO_ACCEPTCONN: ::c_int = 30;
552pub const SO_PEERSEC: ::c_int = 31;
553pub const SO_PASSSEC: ::c_int = 34;
554pub const SO_TIMESTAMPNS: ::c_int = 35;
555pub const SCM_TIMESTAMPNS: ::c_int = SO_TIMESTAMPNS;
556pub const SO_MARK: ::c_int = 36;
8bb4bdeb
XL
557pub const SO_PROTOCOL: ::c_int = 38;
558pub const SO_DOMAIN: ::c_int = 39;
559pub const SO_RXQ_OVFL: ::c_int = 40;
560pub const SO_WIFI_STATUS: ::c_int = 41;
561pub const SCM_WIFI_STATUS: ::c_int = SO_WIFI_STATUS;
562pub const SO_PEEK_OFF: ::c_int = 42;
563pub const SO_NOFCS: ::c_int = 43;
564pub const SO_LOCK_FILTER: ::c_int = 44;
565pub const SO_SELECT_ERR_QUEUE: ::c_int = 45;
566pub const SO_BUSY_POLL: ::c_int = 46;
567pub const SO_MAX_PACING_RATE: ::c_int = 47;
568pub const SO_BPF_EXTENSIONS: ::c_int = 48;
569pub const SO_INCOMING_CPU: ::c_int = 49;
570pub const SO_ATTACH_BPF: ::c_int = 50;
571pub const SO_DETACH_BPF: ::c_int = SO_DETACH_FILTER;
572
416331ca
XL
573pub const SOCK_STREAM: ::c_int = 1;
574pub const SOCK_DGRAM: ::c_int = 2;
575
8bb4bdeb
XL
576pub const SA_ONSTACK: ::c_int = 0x08000000;
577pub const SA_SIGINFO: ::c_int = 0x00000004;
578pub const SA_NOCLDWAIT: ::c_int = 0x00000002;
579
416331ca
XL
580pub const SIGTTIN: ::c_int = 21;
581pub const SIGTTOU: ::c_int = 22;
582pub const SIGXCPU: ::c_int = 24;
583pub const SIGXFSZ: ::c_int = 25;
584pub const SIGVTALRM: ::c_int = 26;
585pub const SIGPROF: ::c_int = 27;
586pub const SIGWINCH: ::c_int = 28;
8bb4bdeb
XL
587pub const SIGCHLD: ::c_int = 17;
588pub const SIGBUS: ::c_int = 7;
589pub const SIGUSR1: ::c_int = 10;
590pub const SIGUSR2: ::c_int = 12;
591pub const SIGCONT: ::c_int = 18;
592pub const SIGSTOP: ::c_int = 19;
593pub const SIGTSTP: ::c_int = 20;
594pub const SIGURG: ::c_int = 23;
595pub const SIGIO: ::c_int = 29;
596pub const SIGSYS: ::c_int = 31;
597pub const SIGSTKFLT: ::c_int = 16;
e74abb32 598#[deprecated(since = "0.2.55", note = "Use SIGSYS instead")]
8bb4bdeb
XL
599pub const SIGUNUSED: ::c_int = 31;
600pub const SIGPOLL: ::c_int = 29;
601pub const SIGPWR: ::c_int = 30;
602pub const SIG_SETMASK: ::c_int = 2;
603pub const SIG_BLOCK: ::c_int = 0x000000;
604pub const SIG_UNBLOCK: ::c_int = 0x01;
605
606pub const POLLWRNORM: ::c_short = 0x100;
607pub const POLLWRBAND: ::c_short = 0x200;
608
609pub const O_ASYNC: ::c_int = 0x2000;
610pub const O_NDELAY: ::c_int = 0x800;
611
612pub const PTRACE_DETACH: ::c_uint = 17;
613
614pub const EFD_NONBLOCK: ::c_int = 0x800;
615
616pub const F_GETLK: ::c_int = 5;
617pub const F_GETOWN: ::c_int = 9;
618pub const F_SETOWN: ::c_int = 8;
619pub const F_SETLK: ::c_int = 6;
620pub const F_SETLKW: ::c_int = 7;
ba9703b0
XL
621pub const F_OFD_GETLK: ::c_int = 36;
622pub const F_OFD_SETLK: ::c_int = 37;
623pub const F_OFD_SETLKW: ::c_int = 38;
8bb4bdeb 624
8faf50e0
XL
625pub const F_RDLCK: ::c_int = 0;
626pub const F_WRLCK: ::c_int = 1;
627pub const F_UNLCK: ::c_int = 2;
628
8bb4bdeb
XL
629pub const SFD_NONBLOCK: ::c_int = 0x0800;
630
416331ca
XL
631pub const TCSANOW: ::c_int = 0;
632pub const TCSADRAIN: ::c_int = 1;
633pub const TCSAFLUSH: ::c_int = 2;
634
635pub const TIOCLINUX: ::c_ulong = 0x541C;
636pub const TIOCGSERIAL: ::c_ulong = 0x541E;
8bb4bdeb
XL
637pub const TIOCEXCL: ::c_ulong = 0x540C;
638pub const TIOCNXCL: ::c_ulong = 0x540D;
639pub const TIOCSCTTY: ::c_ulong = 0x540E;
640pub const TIOCSTI: ::c_ulong = 0x5412;
641pub const TIOCMGET: ::c_ulong = 0x5415;
642pub const TIOCMBIS: ::c_ulong = 0x5416;
643pub const TIOCMBIC: ::c_ulong = 0x5417;
644pub const TIOCMSET: ::c_ulong = 0x5418;
645pub const TIOCCONS: ::c_ulong = 0x541D;
646
416331ca
XL
647pub const TIOCM_ST: ::c_int = 0x008;
648pub const TIOCM_SR: ::c_int = 0x010;
649pub const TIOCM_CTS: ::c_int = 0x020;
650pub const TIOCM_CAR: ::c_int = 0x040;
651pub const TIOCM_RNG: ::c_int = 0x080;
652pub const TIOCM_DSR: ::c_int = 0x100;
653
8bb4bdeb
XL
654pub const SFD_CLOEXEC: ::c_int = 0x080000;
655
656pub const NCCS: usize = 32;
657
658pub const O_TRUNC: ::c_int = 512;
659
660pub const O_CLOEXEC: ::c_int = 0x80000;
661
662pub const EBFONT: ::c_int = 59;
663pub const ENOSTR: ::c_int = 60;
664pub const ENODATA: ::c_int = 61;
665pub const ETIME: ::c_int = 62;
666pub const ENOSR: ::c_int = 63;
667pub const ENONET: ::c_int = 64;
668pub const ENOPKG: ::c_int = 65;
669pub const EREMOTE: ::c_int = 66;
670pub const ENOLINK: ::c_int = 67;
671pub const EADV: ::c_int = 68;
672pub const ESRMNT: ::c_int = 69;
673pub const ECOMM: ::c_int = 70;
674pub const EPROTO: ::c_int = 71;
675pub const EDOTDOT: ::c_int = 73;
676
677pub const SA_NODEFER: ::c_int = 0x40000000;
678pub const SA_RESETHAND: ::c_int = 0x80000000;
679pub const SA_RESTART: ::c_int = 0x10000000;
680pub const SA_NOCLDSTOP: ::c_int = 0x00000001;
681
682pub const EPOLL_CLOEXEC: ::c_int = 0x80000;
683
684pub const EFD_CLOEXEC: ::c_int = 0x80000;
685
476ff2be 686pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4;
476ff2be
SL
687pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4;
688
689pub const O_DIRECT: ::c_int = 0x4000;
690pub const O_DIRECTORY: ::c_int = 0x10000;
691pub const O_NOFOLLOW: ::c_int = 0x20000;
692
416331ca 693pub const MAP_HUGETLB: ::c_int = 0x040000;
476ff2be
SL
694pub const MAP_LOCKED: ::c_int = 0x02000;
695pub const MAP_NORESERVE: ::c_int = 0x04000;
696pub const MAP_32BIT: ::c_int = 0x0040;
416331ca
XL
697pub const MAP_ANON: ::c_int = 0x0020;
698pub const MAP_ANONYMOUS: ::c_int = 0x0020;
699pub const MAP_DENYWRITE: ::c_int = 0x0800;
700pub const MAP_EXECUTABLE: ::c_int = 0x01000;
701pub const MAP_POPULATE: ::c_int = 0x08000;
702pub const MAP_NONBLOCK: ::c_int = 0x010000;
703pub const MAP_STACK: ::c_int = 0x020000;
ba9703b0 704pub const MAP_SYNC : ::c_int = 0x080000;
476ff2be
SL
705
706pub const EDEADLOCK: ::c_int = 35;
416331ca
XL
707pub const EUCLEAN: ::c_int = 117;
708pub const ENOTNAM: ::c_int = 118;
709pub const ENAVAIL: ::c_int = 119;
710pub const EISNAM: ::c_int = 120;
711pub const EREMOTEIO: ::c_int = 121;
476ff2be 712
476ff2be 713pub const FIOCLEX: ::c_ulong = 0x5451;
416331ca 714pub const FIONCLEX: ::c_ulong = 0x5450;
476ff2be
SL
715pub const FIONBIO: ::c_ulong = 0x5421;
716
717pub const PTRACE_GETFPREGS: ::c_uint = 14;
718pub const PTRACE_SETFPREGS: ::c_uint = 15;
719pub const PTRACE_GETFPXREGS: ::c_uint = 18;
720pub const PTRACE_SETFPXREGS: ::c_uint = 19;
721pub const PTRACE_GETREGS: ::c_uint = 12;
722pub const PTRACE_SETREGS: ::c_uint = 13;
476ff2be 723pub const PTRACE_PEEKSIGINFO_SHARED: ::c_uint = 1;
f035d41b
XL
724pub const PTRACE_SYSEMU: ::c_uint = 31;
725pub const PTRACE_SYSEMU_SINGLESTEP: ::c_uint = 32;
476ff2be 726
476ff2be
SL
727pub const MCL_CURRENT: ::c_int = 0x0001;
728pub const MCL_FUTURE: ::c_int = 0x0002;
729
730pub const SIGSTKSZ: ::size_t = 8192;
7cac9316 731pub const MINSIGSTKSZ: ::size_t = 2048;
476ff2be 732pub const CBAUD: ::tcflag_t = 0o0010017;
416331ca
XL
733pub const TAB1: ::tcflag_t = 0x00000800;
734pub const TAB2: ::tcflag_t = 0x00001000;
735pub const TAB3: ::tcflag_t = 0x00001800;
736pub const CR1: ::tcflag_t = 0x00000200;
737pub const CR2: ::tcflag_t = 0x00000400;
738pub const CR3: ::tcflag_t = 0x00000600;
739pub const FF1: ::tcflag_t = 0x00008000;
740pub const BS1: ::tcflag_t = 0x00002000;
741pub const VT1: ::tcflag_t = 0x00004000;
476ff2be
SL
742pub const VWERASE: usize = 14;
743pub const VREPRINT: usize = 12;
744pub const VSUSP: usize = 10;
745pub const VSTART: usize = 8;
746pub const VSTOP: usize = 9;
747pub const VDISCARD: usize = 13;
748pub const VTIME: usize = 5;
749pub const IXON: ::tcflag_t = 0x00000400;
750pub const IXOFF: ::tcflag_t = 0x00001000;
751pub const ONLCR: ::tcflag_t = 0x4;
752pub const CSIZE: ::tcflag_t = 0x00000030;
753pub const CS6: ::tcflag_t = 0x00000010;
754pub const CS7: ::tcflag_t = 0x00000020;
755pub const CS8: ::tcflag_t = 0x00000030;
756pub const CSTOPB: ::tcflag_t = 0x00000040;
757pub const CREAD: ::tcflag_t = 0x00000080;
758pub const PARENB: ::tcflag_t = 0x00000100;
759pub const PARODD: ::tcflag_t = 0x00000200;
760pub const HUPCL: ::tcflag_t = 0x00000400;
761pub const CLOCAL: ::tcflag_t = 0x00000800;
762pub const ECHOKE: ::tcflag_t = 0x00000800;
763pub const ECHOE: ::tcflag_t = 0x00000010;
764pub const ECHOK: ::tcflag_t = 0x00000020;
765pub const ECHONL: ::tcflag_t = 0x00000040;
766pub const ECHOPRT: ::tcflag_t = 0x00000400;
767pub const ECHOCTL: ::tcflag_t = 0x00000200;
768pub const ISIG: ::tcflag_t = 0x00000001;
769pub const ICANON: ::tcflag_t = 0x00000002;
770pub const PENDIN: ::tcflag_t = 0x00004000;
771pub const NOFLSH: ::tcflag_t = 0x00000080;
041b39d2
XL
772pub const CIBAUD: ::tcflag_t = 0o02003600000;
773pub const CBAUDEX: ::tcflag_t = 0o010000;
774pub const VSWTC: usize = 7;
e74abb32
XL
775pub const OLCUC: ::tcflag_t = 0o000002;
776pub const NLDLY: ::tcflag_t = 0o000400;
777pub const CRDLY: ::tcflag_t = 0o003000;
041b39d2 778pub const TABDLY: ::tcflag_t = 0o014000;
e74abb32
XL
779pub const BSDLY: ::tcflag_t = 0o020000;
780pub const FFDLY: ::tcflag_t = 0o100000;
781pub const VTDLY: ::tcflag_t = 0o040000;
782pub const XTABS: ::tcflag_t = 0o014000;
476ff2be 783
8bb4bdeb
XL
784pub const B0: ::speed_t = 0o000000;
785pub const B50: ::speed_t = 0o000001;
786pub const B75: ::speed_t = 0o000002;
787pub const B110: ::speed_t = 0o000003;
788pub const B134: ::speed_t = 0o000004;
789pub const B150: ::speed_t = 0o000005;
790pub const B200: ::speed_t = 0o000006;
791pub const B300: ::speed_t = 0o000007;
792pub const B600: ::speed_t = 0o000010;
793pub const B1200: ::speed_t = 0o000011;
794pub const B1800: ::speed_t = 0o000012;
795pub const B2400: ::speed_t = 0o000013;
796pub const B4800: ::speed_t = 0o000014;
797pub const B9600: ::speed_t = 0o000015;
798pub const B19200: ::speed_t = 0o000016;
799pub const B38400: ::speed_t = 0o000017;
800pub const EXTA: ::speed_t = B19200;
801pub const EXTB: ::speed_t = B38400;
abe05a73 802pub const BOTHER: ::speed_t = 0o010000;
8bb4bdeb
XL
803pub const B57600: ::speed_t = 0o010001;
804pub const B115200: ::speed_t = 0o010002;
805pub const B230400: ::speed_t = 0o010003;
806pub const B460800: ::speed_t = 0o010004;
807pub const B500000: ::speed_t = 0o010005;
808pub const B576000: ::speed_t = 0o010006;
809pub const B921600: ::speed_t = 0o010007;
810pub const B1000000: ::speed_t = 0o010010;
811pub const B1152000: ::speed_t = 0o010011;
812pub const B1500000: ::speed_t = 0o010012;
813pub const B2000000: ::speed_t = 0o010013;
814pub const B2500000: ::speed_t = 0o010014;
815pub const B3000000: ::speed_t = 0o010015;
816pub const B3500000: ::speed_t = 0o010016;
817pub const B4000000: ::speed_t = 0o010017;
818
476ff2be
SL
819pub const VEOL: usize = 11;
820pub const VEOL2: usize = 16;
821pub const VMIN: usize = 6;
822pub const IEXTEN: ::tcflag_t = 0x00008000;
823pub const TOSTOP: ::tcflag_t = 0x00000100;
824pub const FLUSHO: ::tcflag_t = 0x00001000;
825pub const EXTPROC: ::tcflag_t = 0x00010000;
826pub const TCGETS: ::c_ulong = 0x5401;
827pub const TCSETS: ::c_ulong = 0x5402;
828pub const TCSETSW: ::c_ulong = 0x5403;
829pub const TCSETSF: ::c_ulong = 0x5404;
830pub const TCGETA: ::c_ulong = 0x5405;
831pub const TCSETA: ::c_ulong = 0x5406;
832pub const TCSETAW: ::c_ulong = 0x5407;
833pub const TCSETAF: ::c_ulong = 0x5408;
834pub const TCSBRK: ::c_ulong = 0x5409;
835pub const TCXONC: ::c_ulong = 0x540A;
836pub const TCFLSH: ::c_ulong = 0x540B;
837pub const TIOCINQ: ::c_ulong = 0x541B;
838pub const TIOCGPGRP: ::c_ulong = 0x540F;
839pub const TIOCSPGRP: ::c_ulong = 0x5410;
840pub const TIOCOUTQ: ::c_ulong = 0x5411;
841pub const TIOCGWINSZ: ::c_ulong = 0x5413;
842pub const TIOCSWINSZ: ::c_ulong = 0x5414;
843pub const FIONREAD: ::c_ulong = 0x541B;
f035d41b
XL
844pub const TIOCSBRK: ::c_ulong = 0x5427;
845pub const TIOCCBRK: ::c_ulong = 0x5428;
476ff2be 846
3b2f2976
XL
847// offsets in user_regs_structs, from sys/reg.h
848pub const R15: ::c_int = 0;
849pub const R14: ::c_int = 1;
850pub const R13: ::c_int = 2;
851pub const R12: ::c_int = 3;
852pub const RBP: ::c_int = 4;
853pub const RBX: ::c_int = 5;
854pub const R11: ::c_int = 6;
855pub const R10: ::c_int = 7;
856pub const R9: ::c_int = 8;
857pub const R8: ::c_int = 9;
858pub const RAX: ::c_int = 10;
859pub const RCX: ::c_int = 11;
860pub const RDX: ::c_int = 12;
861pub const RSI: ::c_int = 13;
862pub const RDI: ::c_int = 14;
863pub const ORIG_RAX: ::c_int = 15;
864pub const RIP: ::c_int = 16;
865pub const CS: ::c_int = 17;
866pub const EFLAGS: ::c_int = 18;
867pub const RSP: ::c_int = 19;
868pub const SS: ::c_int = 20;
869pub const FS_BASE: ::c_int = 21;
870pub const GS_BASE: ::c_int = 22;
871pub const DS: ::c_int = 23;
872pub const ES: ::c_int = 24;
873pub const FS: ::c_int = 25;
874pub const GS: ::c_int = 26;
875
532ac7d7
XL
876// offsets in mcontext_t.gregs from sys/ucontext.h
877pub const REG_R8: ::c_int = 0;
878pub const REG_R9: ::c_int = 1;
879pub const REG_R10: ::c_int = 2;
880pub const REG_R11: ::c_int = 3;
881pub const REG_R12: ::c_int = 4;
882pub const REG_R13: ::c_int = 5;
883pub const REG_R14: ::c_int = 6;
884pub const REG_R15: ::c_int = 7;
885pub const REG_RDI: ::c_int = 8;
886pub const REG_RSI: ::c_int = 9;
887pub const REG_RBP: ::c_int = 10;
888pub const REG_RBX: ::c_int = 11;
889pub const REG_RDX: ::c_int = 12;
890pub const REG_RAX: ::c_int = 13;
891pub const REG_RCX: ::c_int = 14;
892pub const REG_RSP: ::c_int = 15;
893pub const REG_RIP: ::c_int = 16;
894pub const REG_EFL: ::c_int = 17;
895pub const REG_CSGSFS: ::c_int = 18;
896pub const REG_ERR: ::c_int = 19;
897pub const REG_TRAPNO: ::c_int = 20;
898pub const REG_OLDMASK: ::c_int = 21;
899pub const REG_CR2: ::c_int = 22;
900
e74abb32 901extern "C" {
476ff2be
SL
902 pub fn getcontext(ucp: *mut ucontext_t) -> ::c_int;
903 pub fn setcontext(ucp: *const ucontext_t) -> ::c_int;
e74abb32
XL
904 pub fn makecontext(
905 ucp: *mut ucontext_t,
906 func: extern "C" fn(),
907 argc: ::c_int,
908 ...
909 );
910 pub fn swapcontext(
911 uocp: *mut ucontext_t,
912 ucp: *const ucontext_t,
913 ) -> ::c_int;
041b39d2 914 pub fn iopl(level: ::c_int) -> ::c_int;
e74abb32
XL
915 pub fn ioperm(
916 from: ::c_ulong,
917 num: ::c_ulong,
918 turn_on: ::c_int,
919 ) -> ::c_int;
476ff2be 920}
416331ca
XL
921
922cfg_if! {
923 if #[cfg(target_pointer_width = "32")] {
924 mod x32;
925 pub use self::x32::*;
926 } else {
927 mod not_x32;
928 pub use self::not_x32::*;
929 }
930}
e74abb32
XL
931
932cfg_if! {
933 if #[cfg(libc_align)] {
934 mod align;
935 pub use self::align::*;
936 }
937}