blob: a0d947bc4245308684ce7383956772206b45a178 [file] [log] [blame]
Brian Anderson773aab82015-12-29 20:00:29 +00001pub type clock_t = c_long;
2pub type time_t = c_long;
3pub type suseconds_t = c_long;
Alex Crichton62a6c822015-11-09 13:58:44 -08004pub type ino_t = u64;
5pub type off_t = i64;
6pub type blkcnt_t = i64;
Brian Anderson773aab82015-12-29 20:00:29 +00007
Brian Anderson773aab82015-12-29 20:00:29 +00008pub type blksize_t = c_long;
9pub type fsblkcnt_t = ::c_ulonglong;
10pub type fsfilcnt_t = ::c_ulonglong;
11pub type rlim_t = ::c_ulonglong;
Alex Crichton62a6c822015-11-09 13:58:44 -080012
13s! {
Alan Somersa46123c2016-11-13 18:04:47 -070014 pub struct aiocb {
15 pub aio_fildes: ::c_int,
16 pub aio_lio_opcode: ::c_int,
17 pub aio_reqprio: ::c_int,
18 pub aio_buf: *mut ::c_void,
19 pub aio_nbytes: ::size_t,
20 pub aio_sigevent: ::sigevent,
21 __td: *mut ::c_void,
22 __lock: [::c_int; 2],
23 __err: ::c_int,
24 __ret: ::ssize_t,
25 pub aio_offset: off_t,
26 __next: *mut ::c_void,
27 __prev: *mut ::c_void,
28 #[cfg(target_pointer_width = "32")]
29 __dummy4: [::c_char; 24],
30 #[cfg(target_pointer_width = "64")]
31 __dummy4: [::c_char; 16],
32 }
33
Alex Crichton62a6c822015-11-09 13:58:44 -080034 pub struct sigaction {
35 pub sa_sigaction: ::sighandler_t,
36 pub sa_mask: ::sigset_t,
37 pub sa_flags: ::c_int,
38 _restorer: *mut ::c_void,
39 }
40
Alexander Polakov58501562015-12-14 02:09:45 +030041 pub struct ipc_perm {
42 pub __ipc_perm_key: ::key_t,
43 pub uid: ::uid_t,
44 pub gid: ::gid_t,
45 pub cuid: ::uid_t,
46 pub cgid: ::gid_t,
47 pub mode: ::mode_t,
48 pub __seq: ::c_int,
49 __unused1: ::c_long,
50 __unused2: ::c_long
51 }
52
Alex Crichton8dce9ad2015-12-03 11:44:14 -080053 pub struct termios {
54 pub c_iflag: ::tcflag_t,
55 pub c_oflag: ::tcflag_t,
56 pub c_cflag: ::tcflag_t,
57 pub c_lflag: ::tcflag_t,
58 pub c_line: ::cc_t,
59 pub c_cc: [::cc_t; ::NCCS],
60 pub __c_ispeed: ::speed_t,
61 pub __c_ospeed: ::speed_t,
62 }
63
64 pub struct flock {
65 pub l_type: ::c_short,
66 pub l_whence: ::c_short,
67 pub l_start: ::off_t,
68 pub l_len: ::off_t,
69 pub l_pid: ::pid_t,
70 }
Raphael Cohne6150ae2016-05-13 11:18:34 +010071
72 pub struct sysinfo {
73 pub uptime: ::c_ulong,
74 pub loads: [::c_ulong; 3],
75 pub totalram: ::c_ulong,
76 pub freeram: ::c_ulong,
77 pub sharedram: ::c_ulong,
78 pub bufferram: ::c_ulong,
79 pub totalswap: ::c_ulong,
80 pub freeswap: ::c_ulong,
81 pub procs: ::c_ushort,
82 pub pad: ::c_ushort,
83 pub totalhigh: ::c_ulong,
84 pub freehigh: ::c_ulong,
85 pub mem_unit: ::c_uint,
86 pub __reserved: [::c_char; 256],
87 }
Alex Crichton62a6c822015-11-09 13:58:44 -080088}
89
Jorge Aparicio540d1402016-12-31 16:40:13 -050090pub const CLONE_NEWCGROUP: ::c_int = 0x02000000;
91
92pub const SFD_CLOEXEC: ::c_int = 0x080000;
93
94pub const NCCS: usize = 32;
95
96pub const O_TRUNC: ::c_int = 512;
97
98pub const O_CLOEXEC: ::c_int = 0x80000;
99
100pub const EBFONT: ::c_int = 59;
101pub const ENOSTR: ::c_int = 60;
102pub const ENODATA: ::c_int = 61;
103pub const ETIME: ::c_int = 62;
104pub const ENOSR: ::c_int = 63;
105pub const ENONET: ::c_int = 64;
106pub const ENOPKG: ::c_int = 65;
107pub const EREMOTE: ::c_int = 66;
108pub const ENOLINK: ::c_int = 67;
109pub const EADV: ::c_int = 68;
110pub const ESRMNT: ::c_int = 69;
111pub const ECOMM: ::c_int = 70;
112pub const EPROTO: ::c_int = 71;
113pub const EDOTDOT: ::c_int = 73;
114
115pub const SA_NODEFER: ::c_int = 0x40000000;
116pub const SA_RESETHAND: ::c_int = 0x80000000;
117pub const SA_RESTART: ::c_int = 0x10000000;
118pub const SA_NOCLDSTOP: ::c_int = 0x00000001;
119
120pub const EPOLL_CLOEXEC: ::c_int = 0x80000;
121
122pub const EFD_CLOEXEC: ::c_int = 0x80000;
123
Alex Crichton74825222015-10-29 17:36:55 -0700124pub const BUFSIZ: ::c_uint = 1024;
125pub const TMP_MAX: ::c_uint = 10000;
126pub const FOPEN_MAX: ::c_uint = 1000;
Amos Onnbe1cbaf2017-04-04 00:42:47 +0200127pub const O_PATH: ::c_int = 0o10000000;
128pub const O_EXEC: ::c_int = 0o10000000;
129pub const O_SEARCH: ::c_int = 0o10000000;
Alex Crichton74825222015-10-29 17:36:55 -0700130pub const O_ACCMODE: ::c_int = 0o10000003;
Jorge Aparicio751bea32016-01-30 01:28:50 -0500131pub const O_NDELAY: ::c_int = O_NONBLOCK;
Alex Crichton9f52b892015-11-06 15:13:41 -0800132pub const NI_MAXHOST: ::socklen_t = 255;
133pub const PTHREAD_STACK_MIN: ::size_t = 2048;
Jorge Aparicio756d7ee2016-09-03 01:46:06 -0500134pub const POSIX_FADV_DONTNEED: ::c_int = 4;
135pub const POSIX_FADV_NOREUSE: ::c_int = 5;
Alex Crichton74825222015-10-29 17:36:55 -0700136
Ian Denhardt0ecafc32016-10-03 20:08:12 -0400137pub const POSIX_MADV_DONTNEED: ::c_int = 4;
138
Alex Crichton62a6c822015-11-09 13:58:44 -0800139pub const RLIM_INFINITY: ::rlim_t = !0;
140pub const RLIMIT_RTTIME: ::c_int = 15;
141pub const RLIMIT_NLIMITS: ::c_int = 16;
142
Jorge Aparicio751bea32016-01-30 01:28:50 -0500143pub const MAP_ANONYMOUS: ::c_int = MAP_ANON;
Alex Crichton62a6c822015-11-09 13:58:44 -0800144
145pub const TCP_COOKIE_TRANSACTIONS: ::c_int = 15;
146pub const TCP_THIN_LINEAR_TIMEOUTS: ::c_int = 16;
147pub const TCP_THIN_DUPACK: ::c_int = 17;
148pub const TCP_USER_TIMEOUT: ::c_int = 18;
149pub const TCP_REPAIR: ::c_int = 19;
150pub const TCP_REPAIR_QUEUE: ::c_int = 20;
151pub const TCP_QUEUE_SEQ: ::c_int = 21;
152pub const TCP_REPAIR_OPTIONS: ::c_int = 22;
153pub const TCP_FASTOPEN: ::c_int = 23;
154pub const TCP_TIMESTAMP: ::c_int = 24;
155
Jorge Aparicio751bea32016-01-30 01:28:50 -0500156pub const SIGUNUSED: ::c_int = ::SIGSYS;
Alex Crichton62a6c822015-11-09 13:58:44 -0800157
158pub const FALLOC_FL_KEEP_SIZE: ::c_int = 0x01;
159pub const FALLOC_FL_PUNCH_HOLE: ::c_int = 0x02;
160
Tomasz MiÄ…skocb644852016-07-20 07:31:48 +0200161pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4;
Alex Crichton62a6c822015-11-09 13:58:44 -0800162pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4;
163
Alex Crichton8dce9ad2015-12-03 11:44:14 -0800164pub const CPU_SETSIZE: ::c_int = 128;
165
Alex Crichton8dce9ad2015-12-03 11:44:14 -0800166pub const QFMT_VFS_V1: ::c_int = 4;
167
168pub const PTRACE_TRACEME: ::c_int = 0;
169pub const PTRACE_PEEKTEXT: ::c_int = 1;
170pub const PTRACE_PEEKDATA: ::c_int = 2;
171pub const PTRACE_PEEKUSER: ::c_int = 3;
172pub const PTRACE_POKETEXT: ::c_int = 4;
173pub const PTRACE_POKEDATA: ::c_int = 5;
174pub const PTRACE_POKEUSER: ::c_int = 6;
175pub const PTRACE_CONT: ::c_int = 7;
176pub const PTRACE_KILL: ::c_int = 8;
177pub const PTRACE_SINGLESTEP: ::c_int = 9;
178pub const PTRACE_ATTACH: ::c_int = 16;
179pub const PTRACE_DETACH: ::c_int = 17;
180pub const PTRACE_SYSCALL: ::c_int = 24;
181pub const PTRACE_SETOPTIONS: ::c_int = 0x4200;
182pub const PTRACE_GETEVENTMSG: ::c_int = 0x4201;
183pub const PTRACE_GETSIGINFO: ::c_int = 0x4202;
184pub const PTRACE_SETSIGINFO: ::c_int = 0x4203;
185pub const PTRACE_GETREGSET: ::c_int = 0x4204;
186pub const PTRACE_SETREGSET: ::c_int = 0x4205;
187pub const PTRACE_SEIZE: ::c_int = 0x4206;
188pub const PTRACE_INTERRUPT: ::c_int = 0x4207;
189pub const PTRACE_LISTEN: ::c_int = 0x4208;
190pub const PTRACE_PEEKSIGINFO: ::c_int = 0x4209;
191
valaraucabb0064b2016-07-31 16:13:40 -0400192pub const PTRACE_O_EXITKILL: ::c_int = 1048576;
193pub const PTRACE_O_TRACECLONE: ::c_int = 8;
194pub const PTRACE_O_TRACEEXEC: ::c_int = 16;
195pub const PTRACE_O_TRACEEXIT: ::c_int = 64;
196pub const PTRACE_O_TRACEFORK: ::c_int = 2;
197pub const PTRACE_O_TRACESYSGOOD: ::c_int = 1;
198pub const PTRACE_O_TRACEVFORK: ::c_int = 4;
199pub const PTRACE_O_TRACEVFORKDONE: ::c_int = 32;
200pub const PTRACE_O_SUSPEND_SECCOMP: ::c_int = 2097152;
201
Alex Crichton8dce9ad2015-12-03 11:44:14 -0800202pub const MADV_DODUMP: ::c_int = 17;
203pub const MADV_DONTDUMP: ::c_int = 16;
204
205pub const EPOLLWAKEUP: ::c_int = 0x20000000;
206
Philipp Matthias Schaefer965df8e2016-08-10 22:18:29 +0200207pub const POLLRDNORM: ::c_short = 0x040;
Philipp Matthias Schaefer965df8e2016-08-10 22:18:29 +0200208pub const POLLRDBAND: ::c_short = 0x080;
Philipp Matthias Schaefer965df8e2016-08-10 22:18:29 +0200209
Alex Crichton8dce9ad2015-12-03 11:44:14 -0800210pub const MADV_HUGEPAGE: ::c_int = 14;
211pub const MADV_NOHUGEPAGE: ::c_int = 15;
Alex Crichton8dce9ad2015-12-03 11:44:14 -0800212
213pub const PTRACE_GETFPREGS: ::c_uint = 14;
214pub const PTRACE_SETFPREGS: ::c_uint = 15;
215pub const PTRACE_GETFPXREGS: ::c_uint = 18;
216pub const PTRACE_SETFPXREGS: ::c_uint = 19;
217pub const PTRACE_GETREGS: ::c_uint = 12;
218pub const PTRACE_SETREGS: ::c_uint = 13;
219
Jorge Aparicio751bea32016-01-30 01:28:50 -0500220pub const EFD_NONBLOCK: ::c_int = ::O_NONBLOCK;
Alex Crichton8dce9ad2015-12-03 11:44:14 -0800221
Jorge Aparicio751bea32016-01-30 01:28:50 -0500222pub const SFD_NONBLOCK: ::c_int = ::O_NONBLOCK;
Alex Crichton8dce9ad2015-12-03 11:44:14 -0800223
224pub const TCSANOW: ::c_int = 0;
225pub const TCSADRAIN: ::c_int = 1;
226pub const TCSAFLUSH: ::c_int = 2;
227
Fletcher Nichol78d9be22016-05-15 13:55:45 -0600228pub const TIOCINQ: ::c_int = ::FIONREAD;
Alex Crichton6cf54d52016-01-11 13:04:28 -0800229
Alex Crichton29de5982016-02-04 13:48:13 -0800230pub const RTLD_GLOBAL: ::c_int = 0x100;
231pub const RTLD_NOLOAD: ::c_int = 0x4;
232
NODA, Kai7e752a32016-03-31 18:59:05 +0800233// TODO(#247) Temporarily musl-specific (available since musl 0.9.12 / Linux
234// kernel 3.10). See also notbsd/mod.rs
235pub const CLOCK_SGI_CYCLE: ::clockid_t = 10;
236pub const CLOCK_TAI: ::clockid_t = 11;
237
Alex Crichton8018a502016-08-26 22:54:58 -0700238pub const MCL_CURRENT: ::c_int = 0x0001;
239pub const MCL_FUTURE: ::c_int = 0x0002;
240
241pub const SIGSTKSZ: ::size_t = 8192;
Anatol Pomozovde75eb62017-04-04 13:26:32 -0700242pub const MINSIGSTKSZ: ::size_t = 2048;
Alex Crichton8018a502016-08-26 22:54:58 -0700243pub const CBAUD: ::tcflag_t = 0o0010017;
244pub const TAB1: ::c_int = 0x00000800;
245pub const TAB2: ::c_int = 0x00001000;
246pub const TAB3: ::c_int = 0x00001800;
247pub const CR1: ::c_int = 0x00000200;
248pub const CR2: ::c_int = 0x00000400;
249pub const CR3: ::c_int = 0x00000600;
250pub const FF1: ::c_int = 0x00008000;
251pub const BS1: ::c_int = 0x00002000;
252pub const VT1: ::c_int = 0x00004000;
253pub const VWERASE: usize = 14;
254pub const VREPRINT: usize = 12;
255pub const VSUSP: usize = 10;
256pub const VSTART: usize = 8;
257pub const VSTOP: usize = 9;
258pub const VDISCARD: usize = 13;
259pub const VTIME: usize = 5;
260pub const IXON: ::tcflag_t = 0x00000400;
261pub const IXOFF: ::tcflag_t = 0x00001000;
262pub const ONLCR: ::tcflag_t = 0x4;
263pub const CSIZE: ::tcflag_t = 0x00000030;
264pub const CS6: ::tcflag_t = 0x00000010;
265pub const CS7: ::tcflag_t = 0x00000020;
266pub const CS8: ::tcflag_t = 0x00000030;
267pub const CSTOPB: ::tcflag_t = 0x00000040;
268pub const CREAD: ::tcflag_t = 0x00000080;
269pub const PARENB: ::tcflag_t = 0x00000100;
270pub const PARODD: ::tcflag_t = 0x00000200;
271pub const HUPCL: ::tcflag_t = 0x00000400;
272pub const CLOCAL: ::tcflag_t = 0x00000800;
273pub const ECHOKE: ::tcflag_t = 0x00000800;
274pub const ECHOE: ::tcflag_t = 0x00000010;
275pub const ECHOK: ::tcflag_t = 0x00000020;
276pub const ECHONL: ::tcflag_t = 0x00000040;
277pub const ECHOPRT: ::tcflag_t = 0x00000400;
278pub const ECHOCTL: ::tcflag_t = 0x00000200;
279pub const ISIG: ::tcflag_t = 0x00000001;
280pub const ICANON: ::tcflag_t = 0x00000002;
281pub const PENDIN: ::tcflag_t = 0x00004000;
282pub const NOFLSH: ::tcflag_t = 0x00000080;
283
Zac Berkowitz1a9112d2017-02-21 00:06:31 +0000284pub const B0: ::speed_t = 0o000000;
285pub const B50: ::speed_t = 0o000001;
286pub const B75: ::speed_t = 0o000002;
287pub const B110: ::speed_t = 0o000003;
288pub const B134: ::speed_t = 0o000004;
289pub const B150: ::speed_t = 0o000005;
290pub const B200: ::speed_t = 0o000006;
291pub const B300: ::speed_t = 0o000007;
292pub const B600: ::speed_t = 0o000010;
293pub const B1200: ::speed_t = 0o000011;
294pub const B1800: ::speed_t = 0o000012;
295pub const B2400: ::speed_t = 0o000013;
296pub const B4800: ::speed_t = 0o000014;
297pub const B9600: ::speed_t = 0o000015;
298pub const B19200: ::speed_t = 0o000016;
299pub const B38400: ::speed_t = 0o000017;
300pub const EXTA: ::speed_t = B19200;
301pub const EXTB: ::speed_t = B38400;
302pub const B57600: ::speed_t = 0o010001;
303pub const B115200: ::speed_t = 0o010002;
304pub const B230400: ::speed_t = 0o010003;
305pub const B460800: ::speed_t = 0o010004;
306pub const B500000: ::speed_t = 0o010005;
307pub const B576000: ::speed_t = 0o010006;
308pub const B921600: ::speed_t = 0o010007;
309pub const B1000000: ::speed_t = 0o010010;
310pub const B1152000: ::speed_t = 0o010011;
311pub const B1500000: ::speed_t = 0o010012;
312pub const B2000000: ::speed_t = 0o010013;
313pub const B2500000: ::speed_t = 0o010014;
314pub const B3000000: ::speed_t = 0o010015;
315pub const B3500000: ::speed_t = 0o010016;
316pub const B4000000: ::speed_t = 0o010017;
317
Alex Crichton74825222015-10-29 17:36:55 -0700318extern {
Alex Crichton74825222015-10-29 17:36:55 -0700319 pub fn ioctl(fd: ::c_int, request: ::c_int, ...) -> ::c_int;
Alex Crichton8dce9ad2015-12-03 11:44:14 -0800320 pub fn ptrace(request: ::c_int, ...) -> ::c_long;
Raphael Cohnfabef1d2016-05-19 14:28:40 +0100321 pub fn getpriority(which: ::c_int, who: ::id_t) -> ::c_int;
322 pub fn setpriority(which: ::c_int, who: ::id_t, prio: ::c_int) -> ::c_int;
Alex Crichton74825222015-10-29 17:36:55 -0700323}
Brian Anderson773aab82015-12-29 20:00:29 +0000324
325cfg_if! {
Raph Leviend6c3de82016-10-24 10:35:42 -0700326 if #[cfg(any(target_arch = "x86_64", target_arch = "aarch64"))] {
Brian Anderson773aab82015-12-29 20:00:29 +0000327 mod b64;
328 pub use self::b64::*;
329 } else if #[cfg(any(target_arch = "x86",
Jorge Aparicio751bea32016-01-30 01:28:50 -0500330 target_arch = "mips",
Brian Anderson773aab82015-12-29 20:00:29 +0000331 target_arch = "arm",
Brian Andersonab0499f2016-09-06 00:09:30 +0000332 target_arch = "asmjs",
333 target_arch = "wasm32"))] {
Brian Anderson773aab82015-12-29 20:00:29 +0000334 mod b32;
335 pub use self::b32::*;
336 } else { }
337}