]> git.proxmox.com Git - rustc.git/blob - src/liblibc/src/unix/notbsd/android/mod.rs
New upstream version 1.13.0+dfsg1
[rustc.git] / src / liblibc / src / unix / notbsd / android / mod.rs
1 //! Android-specific definitions for linux-like values
2
3 use dox::mem;
4
5 pub type c_char = u8;
6 pub type clock_t = ::c_long;
7 pub type time_t = ::c_long;
8 pub type suseconds_t = ::c_long;
9 pub type wchar_t = u32;
10 pub type off_t = ::c_long;
11 pub type blkcnt_t = ::c_ulong;
12 pub type blksize_t = ::c_ulong;
13 pub type nlink_t = u32;
14 pub type useconds_t = u32;
15 pub type socklen_t = i32;
16 pub type pthread_t = ::c_long;
17 pub type pthread_mutexattr_t = ::c_long;
18 pub type pthread_condattr_t = ::c_long;
19 pub type sigset_t = ::c_ulong;
20 pub type time64_t = i64; // N/A on android
21 pub type fsfilcnt_t = ::c_ulong;
22 pub type fsblkcnt_t = ::c_ulong;
23 pub type nfds_t = ::c_uint;
24 pub type rlim_t = ::c_ulong;
25 pub type dev_t = ::c_ulong;
26 pub type ino_t = ::c_ulong;
27 pub type __CPU_BITTYPE = ::c_ulong;
28
29 s! {
30 pub struct dirent {
31 pub d_ino: u64,
32 pub d_off: i64,
33 pub d_reclen: ::c_ushort,
34 pub d_type: ::c_uchar,
35 pub d_name: [::c_char; 256],
36 }
37
38 pub struct dirent64 {
39 pub d_ino: u64,
40 pub d_off: i64,
41 pub d_reclen: ::c_ushort,
42 pub d_type: ::c_uchar,
43 pub d_name: [::c_char; 256],
44 }
45
46 pub struct rlimit64 {
47 pub rlim_cur: u64,
48 pub rlim_max: u64,
49 }
50
51 pub struct stack_t {
52 pub ss_sp: *mut ::c_void,
53 pub ss_flags: ::c_int,
54 pub ss_size: ::size_t
55 }
56
57 pub struct siginfo_t {
58 pub si_signo: ::c_int,
59 pub si_errno: ::c_int,
60 pub si_code: ::c_int,
61 pub _pad: [::c_int; 29],
62 }
63
64 pub struct __fsid_t {
65 __val: [::c_int; 2],
66 }
67
68 pub struct msghdr {
69 pub msg_name: *mut ::c_void,
70 pub msg_namelen: ::c_int,
71 pub msg_iov: *mut ::iovec,
72 pub msg_iovlen: ::size_t,
73 pub msg_control: *mut ::c_void,
74 pub msg_controllen: ::size_t,
75 pub msg_flags: ::c_int,
76 }
77
78 pub struct termios {
79 pub c_iflag: ::tcflag_t,
80 pub c_oflag: ::tcflag_t,
81 pub c_cflag: ::tcflag_t,
82 pub c_lflag: ::tcflag_t,
83 pub c_line: ::cc_t,
84 pub c_cc: [::cc_t; ::NCCS],
85 }
86
87 pub struct flock {
88 pub l_type: ::c_short,
89 pub l_whence: ::c_short,
90 pub l_start: ::off_t,
91 pub l_len: ::off_t,
92 pub l_pid: ::pid_t,
93 }
94
95 pub struct cpu_set_t {
96 #[cfg(target_pointer_width = "64")]
97 __bits: [__CPU_BITTYPE; 16],
98 #[cfg(target_pointer_width = "32")]
99 __bits: [__CPU_BITTYPE; 1],
100 }
101
102 pub struct sem_t {
103 count: ::c_uint,
104 }
105
106 pub struct lastlog {
107 ll_time: ::time_t,
108 ll_line: [::c_char; UT_LINESIZE],
109 ll_host: [::c_char; UT_HOSTSIZE],
110 }
111
112 pub struct exit_status {
113 pub e_termination: ::c_short,
114 pub e_exit: ::c_short,
115 }
116
117 pub struct utmp {
118 pub ut_type: ::c_short,
119 pub ut_pid: ::pid_t,
120 pub ut_line: [::c_char; UT_LINESIZE],
121 pub ut_id: [::c_char; 4],
122
123 pub ut_user: [::c_char; UT_NAMESIZE],
124 pub ut_host: [::c_char; UT_HOSTSIZE],
125 pub ut_exit: exit_status,
126 pub ut_session: ::c_long,
127 pub ut_tv: ::timeval,
128
129 pub ut_addr_v6: [::int32_t; 4],
130 unused: [::c_char; 20],
131 }
132 }
133
134 pub const USER_PROCESS: ::c_short = 7;
135
136 pub const BUFSIZ: ::c_uint = 1024;
137 pub const FILENAME_MAX: ::c_uint = 1024;
138 pub const FOPEN_MAX: ::c_uint = 20;
139 pub const POSIX_FADV_DONTNEED: ::c_int = 4;
140 pub const POSIX_FADV_NOREUSE: ::c_int = 5;
141 pub const L_tmpnam: ::c_uint = 1024;
142 pub const TMP_MAX: ::c_uint = 308915776;
143 pub const _PC_LINK_MAX: ::c_int = 1;
144 pub const _PC_MAX_CANON: ::c_int = 2;
145 pub const _PC_MAX_INPUT: ::c_int = 3;
146 pub const _PC_NAME_MAX: ::c_int = 4;
147 pub const _PC_PATH_MAX: ::c_int = 5;
148 pub const _PC_PIPE_BUF: ::c_int = 6;
149 pub const _PC_CHOWN_RESTRICTED: ::c_int = 14;
150 pub const _PC_NO_TRUNC: ::c_int = 15;
151 pub const _PC_VDISABLE: ::c_int = 16;
152
153 pub const FIONBIO: ::c_int = 0x5421;
154
155 pub const _SC_ARG_MAX: ::c_int = 0;
156 pub const _SC_BC_BASE_MAX: ::c_int = 1;
157 pub const _SC_BC_DIM_MAX: ::c_int = 2;
158 pub const _SC_BC_SCALE_MAX: ::c_int = 3;
159 pub const _SC_BC_STRING_MAX: ::c_int = 4;
160 pub const _SC_CHILD_MAX: ::c_int = 5;
161 pub const _SC_CLK_TCK: ::c_int = 6;
162 pub const _SC_COLL_WEIGHTS_MAX: ::c_int = 7;
163 pub const _SC_EXPR_NEST_MAX: ::c_int = 8;
164 pub const _SC_LINE_MAX: ::c_int = 9;
165 pub const _SC_NGROUPS_MAX: ::c_int = 10;
166 pub const _SC_OPEN_MAX: ::c_int = 11;
167 pub const _SC_2_C_BIND: ::c_int = 13;
168 pub const _SC_2_C_DEV: ::c_int = 14;
169 pub const _SC_2_C_VERSION: ::c_int = 15;
170 pub const _SC_2_CHAR_TERM: ::c_int = 16;
171 pub const _SC_2_FORT_DEV: ::c_int = 17;
172 pub const _SC_2_FORT_RUN: ::c_int = 18;
173 pub const _SC_2_LOCALEDEF: ::c_int = 19;
174 pub const _SC_2_SW_DEV: ::c_int = 20;
175 pub const _SC_2_UPE: ::c_int = 21;
176 pub const _SC_2_VERSION: ::c_int = 22;
177 pub const _SC_JOB_CONTROL: ::c_int = 23;
178 pub const _SC_SAVED_IDS: ::c_int = 24;
179 pub const _SC_VERSION: ::c_int = 25;
180 pub const _SC_RE_DUP_MAX: ::c_int = 26;
181 pub const _SC_STREAM_MAX: ::c_int = 27;
182 pub const _SC_TZNAME_MAX: ::c_int = 28;
183 pub const _SC_XOPEN_CRYPT: ::c_int = 29;
184 pub const _SC_XOPEN_ENH_I18N: ::c_int = 30;
185 pub const _SC_XOPEN_SHM: ::c_int = 31;
186 pub const _SC_XOPEN_VERSION: ::c_int = 32;
187 pub const _SC_XOPEN_XCU_VERSION: ::c_int = 33;
188 pub const _SC_XOPEN_REALTIME: ::c_int = 34;
189 pub const _SC_XOPEN_REALTIME_THREADS: ::c_int = 35;
190 pub const _SC_XOPEN_LEGACY: ::c_int = 36;
191 pub const _SC_ATEXIT_MAX: ::c_int = 37;
192 pub const _SC_IOV_MAX: ::c_int = 38;
193 pub const _SC_PAGESIZE: ::c_int = 39;
194 pub const _SC_PAGE_SIZE: ::c_int = 40;
195 pub const _SC_XOPEN_UNIX: ::c_int = 41;
196 pub const _SC_MQ_PRIO_MAX: ::c_int = 51;
197 pub const _SC_GETGR_R_SIZE_MAX: ::c_int = 71;
198 pub const _SC_GETPW_R_SIZE_MAX: ::c_int = 72;
199 pub const _SC_LOGIN_NAME_MAX: ::c_int = 73;
200 pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: ::c_int = 74;
201 pub const _SC_THREAD_KEYS_MAX: ::c_int = 75;
202 pub const _SC_THREAD_STACK_MIN: ::c_int = 76;
203 pub const _SC_THREAD_THREADS_MAX: ::c_int = 77;
204 pub const _SC_TTY_NAME_MAX: ::c_int = 78;
205 pub const _SC_THREADS: ::c_int = 79;
206 pub const _SC_THREAD_ATTR_STACKADDR: ::c_int = 80;
207 pub const _SC_THREAD_ATTR_STACKSIZE: ::c_int = 81;
208 pub const _SC_THREAD_PRIORITY_SCHEDULING: ::c_int = 82;
209 pub const _SC_THREAD_PRIO_INHERIT: ::c_int = 83;
210 pub const _SC_THREAD_PRIO_PROTECT: ::c_int = 84;
211 pub const _SC_THREAD_SAFE_FUNCTIONS: ::c_int = 85;
212 pub const _SC_NPROCESSORS_ONLN: ::c_int = 97;
213
214 pub const PTHREAD_MUTEX_NORMAL: ::c_int = 0;
215 pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 1;
216 pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 2;
217 pub const PTHREAD_MUTEX_DEFAULT: ::c_int = PTHREAD_MUTEX_NORMAL;
218
219 pub const FIOCLEX: ::c_int = 0x5451;
220
221 pub const SA_ONSTACK: ::c_ulong = 0x08000000;
222 pub const SA_SIGINFO: ::c_ulong = 0x00000004;
223 pub const SA_NOCLDWAIT: ::c_ulong = 0x00000002;
224
225 pub const SIGCHLD: ::c_int = 17;
226 pub const SIGBUS: ::c_int = 7;
227 pub const SIGUSR1: ::c_int = 10;
228 pub const SIGUSR2: ::c_int = 12;
229 pub const SIGCONT: ::c_int = 18;
230 pub const SIGSTOP: ::c_int = 19;
231 pub const SIGTSTP: ::c_int = 20;
232 pub const SIGURG: ::c_int = 23;
233 pub const SIGIO: ::c_int = 29;
234 pub const SIGSYS: ::c_int = 31;
235 pub const SIGSTKFLT: ::c_int = 16;
236 pub const SIGUNUSED: ::c_int = 31;
237 pub const SIGTTIN: ::c_int = 21;
238 pub const SIGTTOU: ::c_int = 22;
239 pub const SIGXCPU: ::c_int = 24;
240 pub const SIGXFSZ: ::c_int = 25;
241 pub const SIGVTALRM: ::c_int = 26;
242 pub const SIGPROF: ::c_int = 27;
243 pub const SIGWINCH: ::c_int = 28;
244 pub const SIGPOLL: ::c_int = 29;
245 pub const SIGPWR: ::c_int = 30;
246 pub const SIG_SETMASK: ::c_int = 2;
247 pub const SIG_BLOCK: ::c_int = 0x000000;
248 pub const SIG_UNBLOCK: ::c_int = 0x01;
249
250 pub const RUSAGE_CHILDREN: ::c_int = -1;
251
252 pub const LC_PAPER: ::c_int = 7;
253 pub const LC_NAME: ::c_int = 8;
254 pub const LC_ADDRESS: ::c_int = 9;
255 pub const LC_TELEPHONE: ::c_int = 10;
256 pub const LC_MEASUREMENT: ::c_int = 11;
257 pub const LC_IDENTIFICATION: ::c_int = 12;
258 pub const LC_PAPER_MASK: ::c_int = (1 << LC_PAPER);
259 pub const LC_NAME_MASK: ::c_int = (1 << LC_NAME);
260 pub const LC_ADDRESS_MASK: ::c_int = (1 << LC_ADDRESS);
261 pub const LC_TELEPHONE_MASK: ::c_int = (1 << LC_TELEPHONE);
262 pub const LC_MEASUREMENT_MASK: ::c_int = (1 << LC_MEASUREMENT);
263 pub const LC_IDENTIFICATION_MASK: ::c_int = (1 << LC_IDENTIFICATION);
264 pub const LC_ALL_MASK: ::c_int = ::LC_CTYPE_MASK
265 | ::LC_NUMERIC_MASK
266 | ::LC_TIME_MASK
267 | ::LC_COLLATE_MASK
268 | ::LC_MONETARY_MASK
269 | ::LC_MESSAGES_MASK
270 | LC_PAPER_MASK
271 | LC_NAME_MASK
272 | LC_ADDRESS_MASK
273 | LC_TELEPHONE_MASK
274 | LC_MEASUREMENT_MASK
275 | LC_IDENTIFICATION_MASK;
276
277 pub const MAP_ANON: ::c_int = 0x0020;
278 pub const MAP_ANONYMOUS: ::c_int = 0x0020;
279 pub const MAP_GROWSDOWN: ::c_int = 0x0100;
280 pub const MAP_DENYWRITE: ::c_int = 0x0800;
281 pub const MAP_EXECUTABLE: ::c_int = 0x01000;
282 pub const MAP_LOCKED: ::c_int = 0x02000;
283 pub const MAP_NORESERVE: ::c_int = 0x04000;
284 pub const MAP_POPULATE: ::c_int = 0x08000;
285 pub const MAP_NONBLOCK: ::c_int = 0x010000;
286 pub const MAP_STACK: ::c_int = 0x020000;
287
288 pub const EDEADLK: ::c_int = 35;
289 pub const ENAMETOOLONG: ::c_int = 36;
290 pub const ENOLCK: ::c_int = 37;
291 pub const ENOSYS: ::c_int = 38;
292 pub const ENOTEMPTY: ::c_int = 39;
293 pub const ELOOP: ::c_int = 40;
294 pub const ENOMSG: ::c_int = 42;
295 pub const EIDRM: ::c_int = 43;
296 pub const ECHRNG: ::c_int = 44;
297 pub const EL2NSYNC: ::c_int = 45;
298 pub const EL3HLT: ::c_int = 46;
299 pub const EL3RST: ::c_int = 47;
300 pub const ELNRNG: ::c_int = 48;
301 pub const EUNATCH: ::c_int = 49;
302 pub const ENOCSI: ::c_int = 50;
303 pub const EL2HLT: ::c_int = 51;
304 pub const EBADE: ::c_int = 52;
305 pub const EBADR: ::c_int = 53;
306 pub const EXFULL: ::c_int = 54;
307 pub const ENOANO: ::c_int = 55;
308 pub const EBADRQC: ::c_int = 56;
309 pub const EBADSLT: ::c_int = 57;
310
311 pub const EMULTIHOP: ::c_int = 72;
312 pub const EBADMSG: ::c_int = 74;
313 pub const EOVERFLOW: ::c_int = 75;
314 pub const ENOTUNIQ: ::c_int = 76;
315 pub const EBADFD: ::c_int = 77;
316 pub const EREMCHG: ::c_int = 78;
317 pub const ELIBACC: ::c_int = 79;
318 pub const ELIBBAD: ::c_int = 80;
319 pub const ELIBSCN: ::c_int = 81;
320 pub const ELIBMAX: ::c_int = 82;
321 pub const ELIBEXEC: ::c_int = 83;
322 pub const EILSEQ: ::c_int = 84;
323 pub const ERESTART: ::c_int = 85;
324 pub const ESTRPIPE: ::c_int = 86;
325 pub const EUSERS: ::c_int = 87;
326 pub const ENOTSOCK: ::c_int = 88;
327 pub const EDESTADDRREQ: ::c_int = 89;
328 pub const EMSGSIZE: ::c_int = 90;
329 pub const EPROTOTYPE: ::c_int = 91;
330 pub const ENOPROTOOPT: ::c_int = 92;
331 pub const EPROTONOSUPPORT: ::c_int = 93;
332 pub const ESOCKTNOSUPPORT: ::c_int = 94;
333 pub const EOPNOTSUPP: ::c_int = 95;
334 pub const EPFNOSUPPORT: ::c_int = 96;
335 pub const EAFNOSUPPORT: ::c_int = 97;
336 pub const EADDRINUSE: ::c_int = 98;
337 pub const EADDRNOTAVAIL: ::c_int = 99;
338 pub const ENETDOWN: ::c_int = 100;
339 pub const ENETUNREACH: ::c_int = 101;
340 pub const ENETRESET: ::c_int = 102;
341 pub const ECONNABORTED: ::c_int = 103;
342 pub const ECONNRESET: ::c_int = 104;
343 pub const ENOBUFS: ::c_int = 105;
344 pub const EISCONN: ::c_int = 106;
345 pub const ENOTCONN: ::c_int = 107;
346 pub const ESHUTDOWN: ::c_int = 108;
347 pub const ETOOMANYREFS: ::c_int = 109;
348 pub const ETIMEDOUT: ::c_int = 110;
349 pub const ECONNREFUSED: ::c_int = 111;
350 pub const EHOSTDOWN: ::c_int = 112;
351 pub const EHOSTUNREACH: ::c_int = 113;
352 pub const EALREADY: ::c_int = 114;
353 pub const EINPROGRESS: ::c_int = 115;
354 pub const ESTALE: ::c_int = 116;
355 pub const EUCLEAN: ::c_int = 117;
356 pub const ENOTNAM: ::c_int = 118;
357 pub const ENAVAIL: ::c_int = 119;
358 pub const EISNAM: ::c_int = 120;
359 pub const EREMOTEIO: ::c_int = 121;
360 pub const EDQUOT: ::c_int = 122;
361 pub const ENOMEDIUM: ::c_int = 123;
362 pub const EMEDIUMTYPE: ::c_int = 124;
363 pub const ECANCELED: ::c_int = 125;
364 pub const ENOKEY: ::c_int = 126;
365 pub const EKEYEXPIRED: ::c_int = 127;
366 pub const EKEYREVOKED: ::c_int = 128;
367 pub const EKEYREJECTED: ::c_int = 129;
368 pub const EOWNERDEAD: ::c_int = 130;
369 pub const ENOTRECOVERABLE: ::c_int = 131;
370
371 pub const SOCK_STREAM: ::c_int = 1;
372 pub const SOCK_DGRAM: ::c_int = 2;
373 pub const SOCK_SEQPACKET: ::c_int = 5;
374
375 pub const SOL_SOCKET: ::c_int = 1;
376
377 pub const SO_REUSEADDR: ::c_int = 2;
378 pub const SO_TYPE: ::c_int = 3;
379 pub const SO_ERROR: ::c_int = 4;
380 pub const SO_DONTROUTE: ::c_int = 5;
381 pub const SO_BROADCAST: ::c_int = 6;
382 pub const SO_SNDBUF: ::c_int = 7;
383 pub const SO_RCVBUF: ::c_int = 8;
384 pub const SO_KEEPALIVE: ::c_int = 9;
385 pub const SO_OOBINLINE: ::c_int = 10;
386 pub const SO_LINGER: ::c_int = 13;
387 pub const SO_REUSEPORT: ::c_int = 15;
388 pub const SO_RCVLOWAT: ::c_int = 18;
389 pub const SO_SNDLOWAT: ::c_int = 19;
390 pub const SO_RCVTIMEO: ::c_int = 20;
391 pub const SO_SNDTIMEO: ::c_int = 21;
392 pub const SO_ACCEPTCONN: ::c_int = 30;
393
394 pub const O_ACCMODE: ::c_int = 3;
395 pub const O_APPEND: ::c_int = 1024;
396 pub const O_CREAT: ::c_int = 64;
397 pub const O_EXCL: ::c_int = 128;
398 pub const O_NOCTTY: ::c_int = 256;
399 pub const O_NONBLOCK: ::c_int = 2048;
400 pub const O_SYNC: ::c_int = 0x101000;
401 pub const O_DIRECT: ::c_int = 0x10000;
402 pub const O_DIRECTORY: ::c_int = 0x4000;
403 pub const O_NOFOLLOW: ::c_int = 0x8000;
404 pub const O_ASYNC: ::c_int = 0x2000;
405 pub const O_NDELAY: ::c_int = 0x800;
406
407 pub const NI_MAXHOST: ::size_t = 1025;
408
409 pub const NCCS: usize = 19;
410 pub const TCSBRKP: ::c_int = 0x5425;
411 pub const TCSANOW: ::c_int = 0;
412 pub const TCSADRAIN: ::c_int = 0x1;
413 pub const TCSAFLUSH: ::c_int = 0x2;
414 pub const IUTF8: ::tcflag_t = 0x00004000;
415 pub const VEOF: usize = 4;
416 pub const VEOL: usize = 11;
417 pub const VEOL2: usize = 16;
418 pub const VMIN: usize = 6;
419 pub const IEXTEN: ::tcflag_t = 0x00008000;
420 pub const TOSTOP: ::tcflag_t = 0x00000100;
421 pub const FLUSHO: ::tcflag_t = 0x00001000;
422
423 pub const ADFS_SUPER_MAGIC: ::c_long = 0x0000adf5;
424 pub const AFFS_SUPER_MAGIC: ::c_long = 0x0000adff;
425 pub const CODA_SUPER_MAGIC: ::c_long = 0x73757245;
426 pub const CRAMFS_MAGIC: ::c_long = 0x28cd3d45;
427 pub const EFS_SUPER_MAGIC: ::c_long = 0x00414a53;
428 pub const EXT2_SUPER_MAGIC: ::c_long = 0x0000ef53;
429 pub const EXT3_SUPER_MAGIC: ::c_long = 0x0000ef53;
430 pub const EXT4_SUPER_MAGIC: ::c_long = 0x0000ef53;
431 pub const HPFS_SUPER_MAGIC: ::c_long = 0xf995e849;
432 pub const HUGETLBFS_MAGIC: ::c_long = 0x958458f6;
433 pub const ISOFS_SUPER_MAGIC: ::c_long = 0x00009660;
434 pub const JFFS2_SUPER_MAGIC: ::c_long = 0x000072b6;
435 pub const MINIX_SUPER_MAGIC: ::c_long = 0x0000137f;
436 pub const MINIX_SUPER_MAGIC2: ::c_long = 0x0000138f;
437 pub const MINIX2_SUPER_MAGIC: ::c_long = 0x00002468;
438 pub const MINIX2_SUPER_MAGIC2: ::c_long = 0x00002478;
439 pub const MSDOS_SUPER_MAGIC: ::c_long = 0x00004d44;
440 pub const NCP_SUPER_MAGIC: ::c_long = 0x0000564c;
441 pub const NFS_SUPER_MAGIC: ::c_long = 0x00006969;
442 pub const OPENPROM_SUPER_MAGIC: ::c_long = 0x00009fa1;
443 pub const PROC_SUPER_MAGIC: ::c_long = 0x00009fa0;
444 pub const QNX4_SUPER_MAGIC: ::c_long = 0x0000002f;
445 pub const REISERFS_SUPER_MAGIC: ::c_long = 0x52654973;
446 pub const SMB_SUPER_MAGIC: ::c_long = 0x0000517b;
447 pub const TMPFS_MAGIC: ::c_long = 0x01021994;
448 pub const USBDEVICE_SUPER_MAGIC: ::c_long = 0x00009fa2;
449
450 pub const MADV_HUGEPAGE: ::c_int = 14;
451 pub const MADV_NOHUGEPAGE: ::c_int = 15;
452 pub const MAP_HUGETLB: ::c_int = 0x040000;
453
454 pub const PTRACE_TRACEME: ::c_int = 0;
455 pub const PTRACE_PEEKTEXT: ::c_int = 1;
456 pub const PTRACE_PEEKDATA: ::c_int = 2;
457 pub const PTRACE_PEEKUSER: ::c_int = 3;
458 pub const PTRACE_POKETEXT: ::c_int = 4;
459 pub const PTRACE_POKEDATA: ::c_int = 5;
460 pub const PTRACE_POKEUSER: ::c_int = 6;
461 pub const PTRACE_CONT: ::c_int = 7;
462 pub const PTRACE_KILL: ::c_int = 8;
463 pub const PTRACE_SINGLESTEP: ::c_int = 9;
464 pub const PTRACE_ATTACH: ::c_int = 16;
465 pub const PTRACE_DETACH: ::c_int = 17;
466 pub const PTRACE_SYSCALL: ::c_int = 24;
467 pub const PTRACE_SETOPTIONS: ::c_int = 0x4200;
468 pub const PTRACE_GETEVENTMSG: ::c_int = 0x4201;
469 pub const PTRACE_GETSIGINFO: ::c_int = 0x4202;
470 pub const PTRACE_SETSIGINFO: ::c_int = 0x4203;
471 pub const PTRACE_GETFPREGS: ::c_int = 14;
472 pub const PTRACE_SETFPREGS: ::c_int = 15;
473 pub const PTRACE_GETREGS: ::c_int = 12;
474 pub const PTRACE_SETREGS: ::c_int = 13;
475
476 pub const EFD_NONBLOCK: ::c_int = 0x800;
477
478 pub const F_GETLK: ::c_int = 5;
479 pub const F_GETOWN: ::c_int = 9;
480 pub const F_SETOWN: ::c_int = 8;
481 pub const F_SETLK: ::c_int = 6;
482 pub const F_SETLKW: ::c_int = 7;
483
484 pub const TCGETS: ::c_int = 0x5401;
485 pub const TCSETS: ::c_int = 0x5402;
486 pub const TCSETSW: ::c_int = 0x5403;
487 pub const TCSETSF: ::c_int = 0x5404;
488 pub const TCGETA: ::c_int = 0x5405;
489 pub const TCSETA: ::c_int = 0x5406;
490 pub const TCSETAW: ::c_int = 0x5407;
491 pub const TCSETAF: ::c_int = 0x5408;
492 pub const TCSBRK: ::c_int = 0x5409;
493 pub const TCXONC: ::c_int = 0x540A;
494 pub const TCFLSH: ::c_int = 0x540B;
495 pub const TIOCGSOFTCAR: ::c_int = 0x5419;
496 pub const TIOCSSOFTCAR: ::c_int = 0x541A;
497 pub const TIOCINQ: ::c_int = 0x541B;
498 pub const TIOCLINUX: ::c_int = 0x541C;
499 pub const TIOCGSERIAL: ::c_int = 0x541E;
500 pub const TIOCEXCL: ::c_int = 0x540C;
501 pub const TIOCNXCL: ::c_int = 0x540D;
502 pub const TIOCSCTTY: ::c_int = 0x540E;
503 pub const TIOCGPGRP: ::c_int = 0x540F;
504 pub const TIOCSPGRP: ::c_int = 0x5410;
505 pub const TIOCOUTQ: ::c_int = 0x5411;
506 pub const TIOCSTI: ::c_int = 0x5412;
507 pub const TIOCGWINSZ: ::c_int = 0x5413;
508 pub const TIOCSWINSZ: ::c_int = 0x5414;
509 pub const TIOCMGET: ::c_int = 0x5415;
510 pub const TIOCMBIS: ::c_int = 0x5416;
511 pub const TIOCMBIC: ::c_int = 0x5417;
512 pub const TIOCMSET: ::c_int = 0x5418;
513 pub const FIONREAD: ::c_int = 0x541B;
514 pub const TIOCCONS: ::c_int = 0x541D;
515
516 pub const RTLD_GLOBAL: ::c_int = 0x2;
517 pub const RTLD_NOLOAD: ::c_int = 0x4;
518 pub const RTLD_NOW: ::c_int = 0;
519 pub const RTLD_DEFAULT: *mut ::c_void = -1isize as *mut ::c_void;
520
521 pub const SEM_FAILED: *mut sem_t = 0 as *mut sem_t;
522
523 pub const LINUX_REBOOT_MAGIC1: ::c_int = 0xfee1dead;
524 pub const LINUX_REBOOT_MAGIC2: ::c_int = 672274793;
525 pub const LINUX_REBOOT_MAGIC2A: ::c_int = 85072278;
526 pub const LINUX_REBOOT_MAGIC2B: ::c_int = 369367448;
527 pub const LINUX_REBOOT_MAGIC2C: ::c_int = 537993216;
528
529 pub const LINUX_REBOOT_CMD_RESTART: ::c_int = 0x01234567;
530 pub const LINUX_REBOOT_CMD_HALT: ::c_int = 0xCDEF0123;
531 pub const LINUX_REBOOT_CMD_CAD_ON: ::c_int = 0x89ABCDEF;
532 pub const LINUX_REBOOT_CMD_CAD_OFF: ::c_int = 0x00000000;
533 pub const LINUX_REBOOT_CMD_POWER_OFF: ::c_int = 0x4321FEDC;
534 pub const LINUX_REBOOT_CMD_RESTART2: ::c_int = 0xA1B2C3D4;
535 pub const LINUX_REBOOT_CMD_SW_SUSPEND: ::c_int = 0xD000FCE2;
536 pub const LINUX_REBOOT_CMD_KEXEC: ::c_int = 0x45584543;
537
538 pub const MCL_CURRENT: ::c_int = 0x0001;
539 pub const MCL_FUTURE: ::c_int = 0x0002;
540
541 pub const SIGSTKSZ: ::size_t = 8192;
542 pub const CBAUD: ::tcflag_t = 0o0010017;
543 pub const TAB1: ::c_int = 0x00000800;
544 pub const TAB2: ::c_int = 0x00001000;
545 pub const TAB3: ::c_int = 0x00001800;
546 pub const CR1: ::c_int = 0x00000200;
547 pub const CR2: ::c_int = 0x00000400;
548 pub const CR3: ::c_int = 0x00000600;
549 pub const FF1: ::c_int = 0x00008000;
550 pub const BS1: ::c_int = 0x00002000;
551 pub const VT1: ::c_int = 0x00004000;
552 pub const VWERASE: usize = 14;
553 pub const VREPRINT: usize = 12;
554 pub const VSUSP: usize = 10;
555 pub const VSTART: usize = 8;
556 pub const VSTOP: usize = 9;
557 pub const VDISCARD: usize = 13;
558 pub const VTIME: usize = 5;
559 pub const IXON: ::tcflag_t = 0x00000400;
560 pub const IXOFF: ::tcflag_t = 0x00001000;
561 pub const ONLCR: ::tcflag_t = 0x4;
562 pub const CSIZE: ::tcflag_t = 0x00000030;
563 pub const CS6: ::tcflag_t = 0x00000010;
564 pub const CS7: ::tcflag_t = 0x00000020;
565 pub const CS8: ::tcflag_t = 0x00000030;
566 pub const CSTOPB: ::tcflag_t = 0x00000040;
567 pub const CREAD: ::tcflag_t = 0x00000080;
568 pub const PARENB: ::tcflag_t = 0x00000100;
569 pub const PARODD: ::tcflag_t = 0x00000200;
570 pub const HUPCL: ::tcflag_t = 0x00000400;
571 pub const CLOCAL: ::tcflag_t = 0x00000800;
572 pub const ECHOKE: ::tcflag_t = 0x00000800;
573 pub const ECHOE: ::tcflag_t = 0x00000010;
574 pub const ECHOK: ::tcflag_t = 0x00000020;
575 pub const ECHONL: ::tcflag_t = 0x00000040;
576 pub const ECHOPRT: ::tcflag_t = 0x00000400;
577 pub const ECHOCTL: ::tcflag_t = 0x00000200;
578 pub const ISIG: ::tcflag_t = 0x00000001;
579 pub const ICANON: ::tcflag_t = 0x00000002;
580 pub const PENDIN: ::tcflag_t = 0x00004000;
581 pub const NOFLSH: ::tcflag_t = 0x00000080;
582
583 pub const EAI_SYSTEM: ::c_int = 11;
584
585 pub const NETLINK_ROUTE: ::c_int = 0;
586 pub const NETLINK_UNUSED: ::c_int = 1;
587 pub const NETLINK_USERSOCK: ::c_int = 2;
588 pub const NETLINK_FIREWALL: ::c_int = 3;
589 pub const NETLINK_SOCK_DIAG: ::c_int = 4;
590 pub const NETLINK_NFLOG: ::c_int = 5;
591 pub const NETLINK_XFRM: ::c_int = 6;
592 pub const NETLINK_SELINUX: ::c_int = 7;
593 pub const NETLINK_ISCSI: ::c_int = 8;
594 pub const NETLINK_AUDIT: ::c_int = 9;
595 pub const NETLINK_FIB_LOOKUP: ::c_int = 10;
596 pub const NETLINK_CONNECTOR: ::c_int = 11;
597 pub const NETLINK_NETFILTER: ::c_int = 12;
598 pub const NETLINK_IP6_FW: ::c_int = 13;
599 pub const NETLINK_DNRTMSG: ::c_int = 14;
600 pub const NETLINK_KOBJECT_UEVENT: ::c_int = 15;
601 pub const NETLINK_GENERIC: ::c_int = 16;
602 pub const NETLINK_SCSITRANSPORT: ::c_int = 18;
603 pub const NETLINK_ECRYPTFS: ::c_int = 19;
604 pub const NETLINK_RDMA: ::c_int = 20;
605 pub const NETLINK_CRYPTO: ::c_int = 21;
606 pub const NETLINK_INET_DIAG: ::c_int = NETLINK_SOCK_DIAG;
607
608 pub const MAX_LINKS: ::c_int = 32;
609
610 pub const NLM_F_REQUEST: ::c_int = 1;
611 pub const NLM_F_MULTI: ::c_int = 2;
612 pub const NLM_F_ACK: ::c_int = 4;
613 pub const NLM_F_ECHO: ::c_int = 8;
614 pub const NLM_F_DUMP_INTR: ::c_int = 16;
615
616 pub const NLM_F_ROOT: ::c_int = 0x100;
617 pub const NLM_F_MATCH: ::c_int = 0x200;
618 pub const NLM_F_ATOMIC: ::c_int = 0x400;
619 pub const NLM_F_DUMP: ::c_int = NLM_F_ROOT | NLM_F_MATCH;
620
621 pub const NLM_F_REPLACE: ::c_int = 0x100;
622 pub const NLM_F_EXCL: ::c_int = 0x200;
623 pub const NLM_F_CREATE: ::c_int = 0x400;
624 pub const NLM_F_APPEND: ::c_int = 0x800;
625
626 pub const NLMSG_NOOP: ::c_int = 0x1;
627 pub const NLMSG_ERROR: ::c_int = 0x2;
628 pub const NLMSG_DONE: ::c_int = 0x3;
629 pub const NLMSG_OVERRUN: ::c_int = 0x4;
630 pub const NLMSG_MIN_TYPE: ::c_int = 0x10;
631
632 pub const NETLINK_ADD_MEMBERSHIP: ::c_int = 1;
633 pub const NETLINK_DROP_MEMBERSHIP: ::c_int = 2;
634 pub const NETLINK_PKTINFO: ::c_int = 3;
635 pub const NETLINK_BROADCAST_ERROR: ::c_int = 4;
636 pub const NETLINK_NO_ENOBUFS: ::c_int = 5;
637 pub const NETLINK_RX_RING: ::c_int = 6;
638 pub const NETLINK_TX_RING: ::c_int = 7;
639
640 pub const NLA_F_NESTED: ::c_int = 1 << 15;
641 pub const NLA_F_NET_BYTEORDER: ::c_int = 1 << 14;
642 pub const NLA_TYPE_MASK: ::c_int = !(NLA_F_NESTED | NLA_F_NET_BYTEORDER);
643
644 f! {
645 pub fn sigemptyset(set: *mut sigset_t) -> ::c_int {
646 *set = 0;
647 return 0
648 }
649 pub fn sigaddset(set: *mut sigset_t, signum: ::c_int) -> ::c_int {
650 *set |= signum as sigset_t;
651 return 0
652 }
653 pub fn sigfillset(set: *mut sigset_t) -> ::c_int {
654 *set = !0;
655 return 0
656 }
657 pub fn sigdelset(set: *mut sigset_t, signum: ::c_int) -> ::c_int {
658 *set &= !(signum as sigset_t);
659 return 0
660 }
661 pub fn sigismember(set: *const sigset_t, signum: ::c_int) -> ::c_int {
662 (*set & (signum as sigset_t)) as ::c_int
663 }
664 pub fn cfgetispeed(termios: *const ::termios) -> ::speed_t {
665 (*termios).c_cflag & ::CBAUD
666 }
667 pub fn cfgetospeed(termios: *const ::termios) -> ::speed_t {
668 (*termios).c_cflag & ::CBAUD
669 }
670 pub fn cfsetispeed(termios: *mut ::termios, speed: ::speed_t) -> ::c_int {
671 let cbaud = ::CBAUD;
672 (*termios).c_cflag = ((*termios).c_cflag & !cbaud) | (speed & cbaud);
673 return 0
674 }
675 pub fn cfsetospeed(termios: *mut ::termios, speed: ::speed_t) -> ::c_int {
676 let cbaud = ::CBAUD;
677 (*termios).c_cflag = ((*termios).c_cflag & !cbaud) | (speed & cbaud);
678 return 0
679 }
680 pub fn tcgetattr(fd: ::c_int, termios: *mut ::termios) -> ::c_int {
681 ioctl(fd, ::TCGETS, termios)
682 }
683 pub fn tcsetattr(fd: ::c_int,
684 optional_actions: ::c_int,
685 termios: *const ::termios) -> ::c_int {
686 ioctl(fd, optional_actions, termios)
687 }
688 pub fn tcflow(fd: ::c_int, action: ::c_int) -> ::c_int {
689 ioctl(fd, ::TCXONC, action as *mut ::c_void)
690 }
691 pub fn tcflush(fd: ::c_int, action: ::c_int) -> ::c_int {
692 ioctl(fd, ::TCFLSH, action as *mut ::c_void)
693 }
694 pub fn tcsendbreak(fd: ::c_int, duration: ::c_int) -> ::c_int {
695 ioctl(fd, TCSBRKP, duration as *mut ::c_void)
696 }
697
698 pub fn CPU_ZERO(cpuset: &mut cpu_set_t) -> () {
699 for slot in cpuset.__bits.iter_mut() {
700 *slot = 0;
701 }
702 }
703
704 pub fn CPU_SET(cpu: usize, cpuset: &mut cpu_set_t) -> () {
705 let size_in___bits = 8 * mem::size_of_val(&cpuset.__bits[0]);
706 let (idx, offset) = (cpu / size_in___bits, cpu % size_in___bits);
707 cpuset.__bits[idx] |= 1 << offset;
708 ()
709 }
710
711 pub fn CPU_CLR(cpu: usize, cpuset: &mut cpu_set_t) -> () {
712 let size_in___bits = 8 * mem::size_of_val(&cpuset.__bits[0]);
713 let (idx, offset) = (cpu / size_in___bits, cpu % size_in___bits);
714 cpuset.__bits[idx] &= !(1 << offset);
715 ()
716 }
717
718 pub fn CPU_ISSET(cpu: usize, cpuset: &cpu_set_t) -> bool {
719 let size_in___bits = 8 * mem::size_of_val(&cpuset.__bits[0]);
720 let (idx, offset) = (cpu / size_in___bits, cpu % size_in___bits);
721 0 != (cpuset.__bits[idx] & (1 << offset))
722 }
723
724 pub fn CPU_EQUAL(set1: &cpu_set_t, set2: &cpu_set_t) -> bool {
725 set1.__bits == set2.__bits
726 }
727 }
728
729 extern {
730 static mut __progname: *mut ::c_char;
731 }
732
733 extern {
734 pub fn madvise(addr: *const ::c_void, len: ::size_t, advice: ::c_int)
735 -> ::c_int;
736 pub fn ioctl(fd: ::c_int, request: ::c_int, ...) -> ::c_int;
737 pub fn readlink(path: *const ::c_char,
738 buf: *mut ::c_char,
739 bufsz: ::size_t)
740 -> ::c_int;
741 pub fn msync(addr: *const ::c_void, len: ::size_t,
742 flags: ::c_int) -> ::c_int;
743 pub fn mprotect(addr: *const ::c_void, len: ::size_t, prot: ::c_int)
744 -> ::c_int;
745 pub fn sysconf(name: ::c_int) -> ::c_long;
746 pub fn recvfrom(socket: ::c_int, buf: *mut ::c_void, len: ::size_t,
747 flags: ::c_int, addr: *const ::sockaddr,
748 addrlen: *mut ::socklen_t) -> ::ssize_t;
749 pub fn getnameinfo(sa: *const ::sockaddr,
750 salen: ::socklen_t,
751 host: *mut ::c_char,
752 hostlen: ::size_t,
753 serv: *mut ::c_char,
754 sevlen: ::size_t,
755 flags: ::c_int) -> ::c_int;
756 pub fn ptrace(request: ::c_int, ...) -> ::c_long;
757 pub fn getpriority(which: ::c_int, who: ::c_int) -> ::c_int;
758 pub fn setpriority(which: ::c_int, who: ::c_int, prio: ::c_int) -> ::c_int;
759 pub fn __sched_cpualloc(count: ::size_t) -> *mut ::cpu_set_t;
760 pub fn __sched_cpufree(set: *mut ::cpu_set_t);
761 pub fn __sched_cpucount(setsize: ::size_t, set: *mut cpu_set_t) -> ::c_int;
762 pub fn sched_getcpu() -> ::c_int;
763
764 pub fn utmpname(name: *const ::c_char) -> ::c_int;
765 pub fn setutent();
766 pub fn getutent() -> *mut utmp;
767 }
768
769 cfg_if! {
770 if #[cfg(target_pointer_width = "32")] {
771 mod b32;
772 pub use self::b32::*;
773 } else if #[cfg(target_pointer_width = "64")] {
774 mod b64;
775 pub use self::b64::*;
776 } else {
777 // Unknown target_pointer_width
778 }
779 }