]> git.proxmox.com Git - rustc.git/blob - src/liblibc/src/unix/notbsd/android/mod.rs
Imported Upstream version 1.9.0+dfsg1
[rustc.git] / src / liblibc / src / unix / notbsd / android / mod.rs
1 //! Android-specific definitions for linux-like values
2
3 pub type c_char = u8;
4 pub type c_long = i32;
5 pub type c_ulong = u32;
6 pub type clock_t = i32;
7 pub type time_t = i32;
8 pub type suseconds_t = i32;
9 pub type wchar_t = u32;
10 pub type off_t = i32;
11 pub type off64_t = i64;
12 pub type ino_t = u32;
13 pub type blkcnt_t = u32;
14 pub type blksize_t = u32;
15 pub type dev_t = u32;
16 pub type nlink_t = u32;
17 pub type useconds_t = u32;
18 pub type socklen_t = i32;
19 pub type pthread_t = c_long;
20 pub type pthread_mutexattr_t = ::c_long;
21 pub type sigset_t = c_ulong;
22 pub type time64_t = i64;
23 pub type fsfilcnt_t = ::c_ulong;
24 pub type fsblkcnt_t = ::c_ulong;
25 pub type nfds_t = ::c_uint;
26 pub type rlim_t = c_ulong;
27
28 s! {
29 pub struct stat {
30 pub st_dev: ::c_ulonglong,
31 __pad0: [::c_uchar; 4],
32 __st_ino: ::ino_t,
33 pub st_mode: ::c_uint,
34 pub st_nlink: ::c_uint,
35 pub st_uid: ::uid_t,
36 pub st_gid: ::gid_t,
37 pub st_rdev: ::c_ulonglong,
38 __pad3: [::c_uchar; 4],
39 pub st_size: ::c_longlong,
40 pub st_blksize: blksize_t,
41 pub st_blocks: ::c_ulonglong,
42 pub st_atime: ::c_ulong,
43 pub st_atime_nsec: ::c_ulong,
44 pub st_mtime: ::c_ulong,
45 pub st_mtime_nsec: ::c_ulong,
46 pub st_ctime: ::c_ulong,
47 pub st_ctime_nsec: ::c_ulong,
48 pub st_ino: ::c_ulonglong,
49 }
50
51 pub struct stat64 {
52 pub st_dev: ::c_ulonglong,
53 __pad0: [::c_uchar; 4],
54 __st_ino: ::ino_t,
55 pub st_mode: ::c_uint,
56 pub st_nlink: ::c_uint,
57 pub st_uid: ::uid_t,
58 pub st_gid: ::gid_t,
59 pub st_rdev: ::c_ulonglong,
60 __pad3: [::c_uchar; 4],
61 pub st_size: ::c_longlong,
62 pub st_blksize: blksize_t,
63 pub st_blocks: ::c_ulonglong,
64 pub st_atime: ::c_ulong,
65 pub st_atime_nsec: ::c_ulong,
66 pub st_mtime: ::c_ulong,
67 pub st_mtime_nsec: ::c_ulong,
68 pub st_ctime: ::c_ulong,
69 pub st_ctime_nsec: ::c_ulong,
70 pub st_ino: ::c_ulonglong,
71 }
72
73 pub struct dirent {
74 pub d_ino: u64,
75 pub d_off: i64,
76 pub d_reclen: ::c_ushort,
77 pub d_type: ::c_uchar,
78 pub d_name: [::c_char; 256],
79 }
80
81 pub struct dirent64 {
82 pub d_ino: u64,
83 pub d_off: i64,
84 pub d_reclen: ::c_ushort,
85 pub d_type: ::c_uchar,
86 pub d_name: [::c_char; 256],
87 }
88
89 pub struct rlimit64 {
90 pub rlim_cur: u64,
91 pub rlim_max: u64,
92 }
93
94 pub struct pthread_attr_t {
95 pub flags: ::uint32_t,
96 pub stack_base: *mut ::c_void,
97 pub stack_size: ::size_t,
98 pub guard_size: ::size_t,
99 pub sched_policy: ::int32_t,
100 pub sched_priority: ::int32_t,
101 }
102
103 pub struct pthread_mutex_t { value: ::c_int }
104
105 pub struct pthread_cond_t { value: ::c_int }
106
107 pub struct pthread_rwlock_t {
108 lock: pthread_mutex_t,
109 cond: pthread_cond_t,
110 numLocks: ::c_int,
111 writerThreadId: ::c_int,
112 pendingReaders: ::c_int,
113 pendingWriters: ::c_int,
114 reserved: [*mut ::c_void; 4],
115 }
116
117 pub struct passwd {
118 pub pw_name: *mut ::c_char,
119 pub pw_passwd: *mut ::c_char,
120 pub pw_uid: ::uid_t,
121 pub pw_gid: ::gid_t,
122 pub pw_dir: *mut ::c_char,
123 pub pw_shell: *mut ::c_char,
124 }
125
126 pub struct stack_t {
127 pub ss_sp: *mut ::c_void,
128 pub ss_flags: ::c_int,
129 pub ss_size: ::size_t
130 }
131
132 pub struct siginfo_t {
133 pub si_signo: ::c_int,
134 pub si_errno: ::c_int,
135 pub si_code: ::c_int,
136 pub _pad: [::c_int; 29],
137 }
138
139 pub struct statfs {
140 pub f_type: ::uint32_t,
141 pub f_bsize: ::uint32_t,
142 pub f_blocks: ::uint64_t,
143 pub f_bfree: ::uint64_t,
144 pub f_bavail: ::uint64_t,
145 pub f_files: ::uint64_t,
146 pub f_ffree: ::uint64_t,
147 pub f_fsid: ::__fsid_t,
148 pub f_namelen: ::uint32_t,
149 pub f_frsize: ::uint32_t,
150 pub f_flags: ::uint32_t,
151 pub f_spare: [::uint32_t; 4],
152 }
153
154 pub struct __fsid_t {
155 __val: [::c_int; 2],
156 }
157
158 pub struct msghdr {
159 pub msg_name: *mut ::c_void,
160 pub msg_namelen: ::c_int,
161 pub msg_iov: *mut ::iovec,
162 pub msg_iovlen: ::size_t,
163 pub msg_control: *mut ::c_void,
164 pub msg_controllen: ::size_t,
165 pub msg_flags: ::c_int,
166 }
167
168 pub struct termios {
169 pub c_iflag: ::tcflag_t,
170 pub c_oflag: ::tcflag_t,
171 pub c_cflag: ::tcflag_t,
172 pub c_lflag: ::tcflag_t,
173 pub c_line: ::cc_t,
174 pub c_cc: [::cc_t; ::NCCS],
175 }
176
177 pub struct flock {
178 pub l_type: ::c_short,
179 pub l_whence: ::c_short,
180 pub l_start: ::off_t,
181 pub l_len: ::off_t,
182 pub l_pid: ::pid_t,
183 }
184 }
185
186 pub const BUFSIZ: ::c_uint = 1024;
187 pub const FILENAME_MAX: ::c_uint = 1024;
188 pub const FOPEN_MAX: ::c_uint = 20;
189 pub const L_tmpnam: ::c_uint = 1024;
190 pub const TMP_MAX: ::c_uint = 308915776;
191 pub const _PC_NAME_MAX: ::c_int = 4;
192
193 pub const FIONBIO: ::c_int = 0x5421;
194
195 pub const _SC_ARG_MAX: ::c_int = 0;
196 pub const _SC_BC_BASE_MAX: ::c_int = 1;
197 pub const _SC_BC_DIM_MAX: ::c_int = 2;
198 pub const _SC_BC_SCALE_MAX: ::c_int = 3;
199 pub const _SC_BC_STRING_MAX: ::c_int = 4;
200 pub const _SC_CHILD_MAX: ::c_int = 5;
201 pub const _SC_CLK_TCK: ::c_int = 6;
202 pub const _SC_COLL_WEIGHTS_MAX: ::c_int = 7;
203 pub const _SC_EXPR_NEST_MAX: ::c_int = 8;
204 pub const _SC_LINE_MAX: ::c_int = 9;
205 pub const _SC_NGROUPS_MAX: ::c_int = 10;
206 pub const _SC_OPEN_MAX: ::c_int = 11;
207 pub const _SC_2_C_BIND: ::c_int = 13;
208 pub const _SC_2_C_DEV: ::c_int = 14;
209 pub const _SC_2_C_VERSION: ::c_int = 15;
210 pub const _SC_2_CHAR_TERM: ::c_int = 16;
211 pub const _SC_2_FORT_DEV: ::c_int = 17;
212 pub const _SC_2_FORT_RUN: ::c_int = 18;
213 pub const _SC_2_LOCALEDEF: ::c_int = 19;
214 pub const _SC_2_SW_DEV: ::c_int = 20;
215 pub const _SC_2_UPE: ::c_int = 21;
216 pub const _SC_2_VERSION: ::c_int = 22;
217 pub const _SC_JOB_CONTROL: ::c_int = 23;
218 pub const _SC_SAVED_IDS: ::c_int = 24;
219 pub const _SC_VERSION: ::c_int = 25;
220 pub const _SC_RE_DUP_MAX: ::c_int = 26;
221 pub const _SC_STREAM_MAX: ::c_int = 27;
222 pub const _SC_TZNAME_MAX: ::c_int = 28;
223 pub const _SC_XOPEN_CRYPT: ::c_int = 29;
224 pub const _SC_XOPEN_ENH_I18N: ::c_int = 30;
225 pub const _SC_XOPEN_SHM: ::c_int = 31;
226 pub const _SC_XOPEN_VERSION: ::c_int = 32;
227 pub const _SC_XOPEN_XCU_VERSION: ::c_int = 33;
228 pub const _SC_XOPEN_REALTIME: ::c_int = 34;
229 pub const _SC_XOPEN_REALTIME_THREADS: ::c_int = 35;
230 pub const _SC_XOPEN_LEGACY: ::c_int = 36;
231 pub const _SC_ATEXIT_MAX: ::c_int = 37;
232 pub const _SC_IOV_MAX: ::c_int = 38;
233 pub const _SC_PAGESIZE: ::c_int = 39;
234 pub const _SC_PAGE_SIZE: ::c_int = 40;
235 pub const _SC_XOPEN_UNIX: ::c_int = 41;
236 pub const _SC_MQ_PRIO_MAX: ::c_int = 51;
237 pub const _SC_GETGR_R_SIZE_MAX: ::c_int = 71;
238 pub const _SC_GETPW_R_SIZE_MAX: ::c_int = 72;
239 pub const _SC_LOGIN_NAME_MAX: ::c_int = 73;
240 pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: ::c_int = 74;
241 pub const _SC_THREAD_KEYS_MAX: ::c_int = 75;
242 pub const _SC_THREAD_STACK_MIN: ::c_int = 76;
243 pub const _SC_THREAD_THREADS_MAX: ::c_int = 77;
244 pub const _SC_TTY_NAME_MAX: ::c_int = 78;
245 pub const _SC_THREADS: ::c_int = 79;
246 pub const _SC_THREAD_ATTR_STACKADDR: ::c_int = 80;
247 pub const _SC_THREAD_ATTR_STACKSIZE: ::c_int = 81;
248 pub const _SC_THREAD_PRIORITY_SCHEDULING: ::c_int = 82;
249 pub const _SC_THREAD_PRIO_INHERIT: ::c_int = 83;
250 pub const _SC_THREAD_PRIO_PROTECT: ::c_int = 84;
251 pub const _SC_THREAD_SAFE_FUNCTIONS: ::c_int = 85;
252 pub const _SC_NPROCESSORS_ONLN: ::c_int = 97;
253
254 pub const PTHREAD_STACK_MIN: ::size_t = 8192;
255 pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
256 value: 0,
257 };
258 pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
259 value: 0,
260 };
261 pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t {
262 lock: PTHREAD_MUTEX_INITIALIZER,
263 cond: PTHREAD_COND_INITIALIZER,
264 numLocks: 0,
265 writerThreadId: 0,
266 pendingReaders: 0,
267 pendingWriters: 0,
268 reserved: [0 as *mut _; 4],
269 };
270 pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 1;
271
272 pub const FIOCLEX: ::c_int = 0x5451;
273
274 pub const SA_ONSTACK: ::c_ulong = 0x08000000;
275 pub const SA_SIGINFO: ::c_ulong = 0x00000004;
276 pub const SA_NOCLDWAIT: ::c_ulong = 0x00000002;
277
278 pub const SIGCHLD: ::c_int = 17;
279 pub const SIGBUS: ::c_int = 7;
280 pub const SIGUSR1: ::c_int = 10;
281 pub const SIGUSR2: ::c_int = 12;
282 pub const SIGCONT: ::c_int = 18;
283 pub const SIGSTOP: ::c_int = 19;
284 pub const SIGTSTP: ::c_int = 20;
285 pub const SIGURG: ::c_int = 23;
286 pub const SIGIO: ::c_int = 29;
287 pub const SIGSYS: ::c_int = 31;
288 pub const SIGSTKFLT: ::c_int = 16;
289 pub const SIGUNUSED: ::c_int = 31;
290 pub const SIGTTIN: ::c_int = 21;
291 pub const SIGTTOU: ::c_int = 22;
292 pub const SIGXCPU: ::c_int = 24;
293 pub const SIGXFSZ: ::c_int = 25;
294 pub const SIGVTALRM: ::c_int = 26;
295 pub const SIGPROF: ::c_int = 27;
296 pub const SIGWINCH: ::c_int = 28;
297 pub const SIGPOLL: ::c_int = 29;
298 pub const SIGPWR: ::c_int = 30;
299 pub const SIG_SETMASK: ::c_int = 2;
300 pub const SIG_BLOCK: ::c_int = 0x000000;
301 pub const SIG_UNBLOCK: ::c_int = 0x01;
302
303 pub const RUSAGE_CHILDREN: ::c_int = -1;
304
305 pub const LC_PAPER: ::c_int = 7;
306 pub const LC_NAME: ::c_int = 8;
307 pub const LC_ADDRESS: ::c_int = 9;
308 pub const LC_TELEPHONE: ::c_int = 10;
309 pub const LC_MEASUREMENT: ::c_int = 11;
310 pub const LC_IDENTIFICATION: ::c_int = 12;
311
312 pub const MAP_ANON: ::c_int = 0x0020;
313 pub const MAP_ANONYMOUS: ::c_int = 0x0020;
314 pub const MAP_GROWSDOWN: ::c_int = 0x0100;
315 pub const MAP_DENYWRITE: ::c_int = 0x0800;
316 pub const MAP_EXECUTABLE: ::c_int = 0x01000;
317 pub const MAP_LOCKED: ::c_int = 0x02000;
318 pub const MAP_NORESERVE: ::c_int = 0x04000;
319 pub const MAP_POPULATE: ::c_int = 0x08000;
320 pub const MAP_NONBLOCK: ::c_int = 0x010000;
321 pub const MAP_STACK: ::c_int = 0x020000;
322
323 pub const EDEADLK: ::c_int = 35;
324 pub const ENAMETOOLONG: ::c_int = 36;
325 pub const ENOLCK: ::c_int = 37;
326 pub const ENOSYS: ::c_int = 38;
327 pub const ENOTEMPTY: ::c_int = 39;
328 pub const ELOOP: ::c_int = 40;
329 pub const ENOMSG: ::c_int = 42;
330 pub const EIDRM: ::c_int = 43;
331 pub const ECHRNG: ::c_int = 44;
332 pub const EL2NSYNC: ::c_int = 45;
333 pub const EL3HLT: ::c_int = 46;
334 pub const EL3RST: ::c_int = 47;
335 pub const ELNRNG: ::c_int = 48;
336 pub const EUNATCH: ::c_int = 49;
337 pub const ENOCSI: ::c_int = 50;
338 pub const EL2HLT: ::c_int = 51;
339 pub const EBADE: ::c_int = 52;
340 pub const EBADR: ::c_int = 53;
341 pub const EXFULL: ::c_int = 54;
342 pub const ENOANO: ::c_int = 55;
343 pub const EBADRQC: ::c_int = 56;
344 pub const EBADSLT: ::c_int = 57;
345
346 pub const EMULTIHOP: ::c_int = 72;
347 pub const EBADMSG: ::c_int = 74;
348 pub const EOVERFLOW: ::c_int = 75;
349 pub const ENOTUNIQ: ::c_int = 76;
350 pub const EBADFD: ::c_int = 77;
351 pub const EREMCHG: ::c_int = 78;
352 pub const ELIBACC: ::c_int = 79;
353 pub const ELIBBAD: ::c_int = 80;
354 pub const ELIBSCN: ::c_int = 81;
355 pub const ELIBMAX: ::c_int = 82;
356 pub const ELIBEXEC: ::c_int = 83;
357 pub const EILSEQ: ::c_int = 84;
358 pub const ERESTART: ::c_int = 85;
359 pub const ESTRPIPE: ::c_int = 86;
360 pub const EUSERS: ::c_int = 87;
361 pub const ENOTSOCK: ::c_int = 88;
362 pub const EDESTADDRREQ: ::c_int = 89;
363 pub const EMSGSIZE: ::c_int = 90;
364 pub const EPROTOTYPE: ::c_int = 91;
365 pub const ENOPROTOOPT: ::c_int = 92;
366 pub const EPROTONOSUPPORT: ::c_int = 93;
367 pub const ESOCKTNOSUPPORT: ::c_int = 94;
368 pub const EOPNOTSUPP: ::c_int = 95;
369 pub const EPFNOSUPPORT: ::c_int = 96;
370 pub const EAFNOSUPPORT: ::c_int = 97;
371 pub const EADDRINUSE: ::c_int = 98;
372 pub const EADDRNOTAVAIL: ::c_int = 99;
373 pub const ENETDOWN: ::c_int = 100;
374 pub const ENETUNREACH: ::c_int = 101;
375 pub const ENETRESET: ::c_int = 102;
376 pub const ECONNABORTED: ::c_int = 103;
377 pub const ECONNRESET: ::c_int = 104;
378 pub const ENOBUFS: ::c_int = 105;
379 pub const EISCONN: ::c_int = 106;
380 pub const ENOTCONN: ::c_int = 107;
381 pub const ESHUTDOWN: ::c_int = 108;
382 pub const ETOOMANYREFS: ::c_int = 109;
383 pub const ETIMEDOUT: ::c_int = 110;
384 pub const ECONNREFUSED: ::c_int = 111;
385 pub const EHOSTDOWN: ::c_int = 112;
386 pub const EHOSTUNREACH: ::c_int = 113;
387 pub const EALREADY: ::c_int = 114;
388 pub const EINPROGRESS: ::c_int = 115;
389 pub const ESTALE: ::c_int = 116;
390 pub const EUCLEAN: ::c_int = 117;
391 pub const ENOTNAM: ::c_int = 118;
392 pub const ENAVAIL: ::c_int = 119;
393 pub const EISNAM: ::c_int = 120;
394 pub const EREMOTEIO: ::c_int = 121;
395 pub const EDQUOT: ::c_int = 122;
396 pub const ENOMEDIUM: ::c_int = 123;
397 pub const EMEDIUMTYPE: ::c_int = 124;
398 pub const ECANCELED: ::c_int = 125;
399 pub const ENOKEY: ::c_int = 126;
400 pub const EKEYEXPIRED: ::c_int = 127;
401 pub const EKEYREVOKED: ::c_int = 128;
402 pub const EKEYREJECTED: ::c_int = 129;
403 pub const EOWNERDEAD: ::c_int = 130;
404 pub const ENOTRECOVERABLE: ::c_int = 131;
405
406 pub const SOCK_STREAM: ::c_int = 1;
407 pub const SOCK_DGRAM: ::c_int = 2;
408
409 pub const SOL_SOCKET: ::c_int = 1;
410
411 pub const SO_REUSEADDR: ::c_int = 2;
412 pub const SO_TYPE: ::c_int = 3;
413 pub const SO_ERROR: ::c_int = 4;
414 pub const SO_DONTROUTE: ::c_int = 5;
415 pub const SO_BROADCAST: ::c_int = 6;
416 pub const SO_SNDBUF: ::c_int = 7;
417 pub const SO_RCVBUF: ::c_int = 8;
418 pub const SO_KEEPALIVE: ::c_int = 9;
419 pub const SO_OOBINLINE: ::c_int = 10;
420 pub const SO_LINGER: ::c_int = 13;
421 pub const SO_REUSEPORT: ::c_int = 15;
422 pub const SO_RCVLOWAT: ::c_int = 18;
423 pub const SO_SNDLOWAT: ::c_int = 19;
424 pub const SO_RCVTIMEO: ::c_int = 20;
425 pub const SO_SNDTIMEO: ::c_int = 21;
426 pub const SO_ACCEPTCONN: ::c_int = 30;
427
428 pub const O_ACCMODE: ::c_int = 3;
429 pub const O_APPEND: ::c_int = 1024;
430 pub const O_CREAT: ::c_int = 64;
431 pub const O_EXCL: ::c_int = 128;
432 pub const O_NOCTTY: ::c_int = 256;
433 pub const O_NONBLOCK: ::c_int = 2048;
434 pub const O_SYNC: ::c_int = 0x101000;
435 pub const O_DIRECT: ::c_int = 0x10000;
436 pub const O_DIRECTORY: ::c_int = 0x4000;
437 pub const O_NOFOLLOW: ::c_int = 0x8000;
438 pub const O_ASYNC: ::c_int = 0x2000;
439 pub const O_NDELAY: ::c_int = 0x800;
440
441 pub const NI_MAXHOST: ::size_t = 1025;
442
443 pub const NCCS: usize = 19;
444 pub const TCSBRKP: ::c_int = 0x5425;
445 pub const TCSANOW: ::c_int = 0;
446 pub const TCSADRAIN: ::c_int = 0x1;
447 pub const TCSAFLUSH: ::c_int = 0x2;
448 pub const IUTF8: ::tcflag_t = 0x00004000;
449 pub const VEOF: usize = 4;
450 pub const VEOL: usize = 11;
451 pub const VEOL2: usize = 16;
452 pub const VMIN: usize = 6;
453 pub const IEXTEN: ::tcflag_t = 0x00008000;
454 pub const TOSTOP: ::tcflag_t = 0x00000100;
455 pub const FLUSHO: ::tcflag_t = 0x00001000;
456
457 pub const ADFS_SUPER_MAGIC: ::c_long = 0x0000adf5;
458 pub const AFFS_SUPER_MAGIC: ::c_long = 0x0000adff;
459 pub const CODA_SUPER_MAGIC: ::c_long = 0x73757245;
460 pub const CRAMFS_MAGIC: ::c_long = 0x28cd3d45;
461 pub const EFS_SUPER_MAGIC: ::c_long = 0x00414a53;
462 pub const EXT2_SUPER_MAGIC: ::c_long = 0x0000ef53;
463 pub const EXT3_SUPER_MAGIC: ::c_long = 0x0000ef53;
464 pub const EXT4_SUPER_MAGIC: ::c_long = 0x0000ef53;
465 pub const HPFS_SUPER_MAGIC: ::c_long = 0xf995e849;
466 pub const HUGETLBFS_MAGIC: ::c_long = 0x958458f6;
467 pub const ISOFS_SUPER_MAGIC: ::c_long = 0x00009660;
468 pub const JFFS2_SUPER_MAGIC: ::c_long = 0x000072b6;
469 pub const MINIX_SUPER_MAGIC: ::c_long = 0x0000137f;
470 pub const MINIX_SUPER_MAGIC2: ::c_long = 0x0000138f;
471 pub const MINIX2_SUPER_MAGIC: ::c_long = 0x00002468;
472 pub const MINIX2_SUPER_MAGIC2: ::c_long = 0x00002478;
473 pub const MSDOS_SUPER_MAGIC: ::c_long = 0x00004d44;
474 pub const NCP_SUPER_MAGIC: ::c_long = 0x0000564c;
475 pub const NFS_SUPER_MAGIC: ::c_long = 0x00006969;
476 pub const OPENPROM_SUPER_MAGIC: ::c_long = 0x00009fa1;
477 pub const PROC_SUPER_MAGIC: ::c_long = 0x00009fa0;
478 pub const QNX4_SUPER_MAGIC: ::c_long = 0x0000002f;
479 pub const REISERFS_SUPER_MAGIC: ::c_long = 0x52654973;
480 pub const SMB_SUPER_MAGIC: ::c_long = 0x0000517b;
481 pub const TMPFS_MAGIC: ::c_long = 0x01021994;
482 pub const USBDEVICE_SUPER_MAGIC: ::c_long = 0x00009fa2;
483
484 pub const MADV_HUGEPAGE: ::c_int = 14;
485 pub const MADV_NOHUGEPAGE: ::c_int = 15;
486 pub const MAP_HUGETLB: ::c_int = 0x040000;
487
488 pub const PTRACE_TRACEME: ::c_int = 0;
489 pub const PTRACE_PEEKTEXT: ::c_int = 1;
490 pub const PTRACE_PEEKDATA: ::c_int = 2;
491 pub const PTRACE_PEEKUSER: ::c_int = 3;
492 pub const PTRACE_POKETEXT: ::c_int = 4;
493 pub const PTRACE_POKEDATA: ::c_int = 5;
494 pub const PTRACE_POKEUSER: ::c_int = 6;
495 pub const PTRACE_CONT: ::c_int = 7;
496 pub const PTRACE_KILL: ::c_int = 8;
497 pub const PTRACE_SINGLESTEP: ::c_int = 9;
498 pub const PTRACE_ATTACH: ::c_int = 16;
499 pub const PTRACE_DETACH: ::c_int = 17;
500 pub const PTRACE_SYSCALL: ::c_int = 24;
501 pub const PTRACE_SETOPTIONS: ::c_int = 0x4200;
502 pub const PTRACE_GETEVENTMSG: ::c_int = 0x4201;
503 pub const PTRACE_GETSIGINFO: ::c_int = 0x4202;
504 pub const PTRACE_SETSIGINFO: ::c_int = 0x4203;
505 pub const PTRACE_GETFPREGS: ::c_int = 14;
506 pub const PTRACE_SETFPREGS: ::c_int = 15;
507 pub const PTRACE_GETREGS: ::c_int = 12;
508 pub const PTRACE_SETREGS: ::c_int = 13;
509
510 pub const EFD_NONBLOCK: ::c_int = 0x800;
511
512 pub const F_GETLK: ::c_int = 5;
513 pub const F_GETOWN: ::c_int = 9;
514 pub const F_SETOWN: ::c_int = 8;
515 pub const F_SETLK: ::c_int = 6;
516 pub const F_SETLKW: ::c_int = 7;
517
518 pub const TCGETS: ::c_int = 0x5401;
519 pub const TCSETS: ::c_int = 0x5402;
520 pub const TCSETSW: ::c_int = 0x5403;
521 pub const TCSETSF: ::c_int = 0x5404;
522 pub const TCGETA: ::c_int = 0x5405;
523 pub const TCSETA: ::c_int = 0x5406;
524 pub const TCSETAW: ::c_int = 0x5407;
525 pub const TCSETAF: ::c_int = 0x5408;
526 pub const TCSBRK: ::c_int = 0x5409;
527 pub const TCXONC: ::c_int = 0x540A;
528 pub const TCFLSH: ::c_int = 0x540B;
529 pub const TIOCGSOFTCAR: ::c_int = 0x5419;
530 pub const TIOCSSOFTCAR: ::c_int = 0x541A;
531 pub const TIOCINQ: ::c_int = 0x541B;
532 pub const TIOCLINUX: ::c_int = 0x541C;
533 pub const TIOCGSERIAL: ::c_int = 0x541E;
534 pub const TIOCEXCL: ::c_int = 0x540C;
535 pub const TIOCNXCL: ::c_int = 0x540D;
536 pub const TIOCSCTTY: ::c_int = 0x540E;
537 pub const TIOCGPGRP: ::c_int = 0x540F;
538 pub const TIOCSPGRP: ::c_int = 0x5410;
539 pub const TIOCOUTQ: ::c_int = 0x5411;
540 pub const TIOCSTI: ::c_int = 0x5412;
541 pub const TIOCGWINSZ: ::c_int = 0x5413;
542 pub const TIOCSWINSZ: ::c_int = 0x5414;
543 pub const TIOCMGET: ::c_int = 0x5415;
544 pub const TIOCMBIS: ::c_int = 0x5416;
545 pub const TIOCMBIC: ::c_int = 0x5417;
546 pub const TIOCMSET: ::c_int = 0x5418;
547 pub const FIONREAD: ::c_int = 0x541B;
548 pub const TIOCCONS: ::c_int = 0x541D;
549
550 pub const RTLD_GLOBAL: ::c_int = 0x2;
551 pub const RTLD_NOLOAD: ::c_int = 0x4;
552 pub const RTLD_NOW: ::c_int = 0;
553 pub const RTLD_DEFAULT: *mut ::c_void = -1isize as *mut ::c_void;
554
555 f! {
556 pub fn sigemptyset(set: *mut sigset_t) -> ::c_int {
557 *set = 0;
558 return 0
559 }
560 pub fn sigaddset(set: *mut sigset_t, signum: ::c_int) -> ::c_int {
561 *set |= signum as sigset_t;
562 return 0
563 }
564 pub fn sigfillset(set: *mut sigset_t) -> ::c_int {
565 *set = !0;
566 return 0
567 }
568 pub fn sigdelset(set: *mut sigset_t, signum: ::c_int) -> ::c_int {
569 *set &= !(signum as sigset_t);
570 return 0
571 }
572 pub fn sigismember(set: *const sigset_t, signum: ::c_int) -> ::c_int {
573 (*set & (signum as sigset_t)) as ::c_int
574 }
575 pub fn cfgetispeed(termios: *const ::termios) -> ::speed_t {
576 (*termios).c_cflag & ::CBAUD
577 }
578 pub fn cfgetospeed(termios: *const ::termios) -> ::speed_t {
579 (*termios).c_cflag & ::CBAUD
580 }
581 pub fn cfsetispeed(termios: *mut ::termios, speed: ::speed_t) -> ::c_int {
582 let cbaud = ::CBAUD;
583 (*termios).c_cflag = ((*termios).c_cflag & !cbaud) | (speed & cbaud);
584 return 0
585 }
586 pub fn cfsetospeed(termios: *mut ::termios, speed: ::speed_t) -> ::c_int {
587 let cbaud = ::CBAUD;
588 (*termios).c_cflag = ((*termios).c_cflag & !cbaud) | (speed & cbaud);
589 return 0
590 }
591 pub fn tcgetattr(fd: ::c_int, termios: *mut ::termios) -> ::c_int {
592 ioctl(fd, ::TCGETS, termios)
593 }
594 pub fn tcsetattr(fd: ::c_int,
595 optional_actions: ::c_int,
596 termios: *const ::termios) -> ::c_int {
597 ioctl(fd, optional_actions, termios)
598 }
599 pub fn tcflow(fd: ::c_int, action: ::c_int) -> ::c_int {
600 ioctl(fd, ::TCXONC, action as *mut ::c_void)
601 }
602 pub fn tcflush(fd: ::c_int, action: ::c_int) -> ::c_int {
603 ioctl(fd, ::TCFLSH, action as *mut ::c_void)
604 }
605 pub fn tcsendbreak(fd: ::c_int, duration: ::c_int) -> ::c_int {
606 ioctl(fd, TCSBRKP, duration as *mut ::c_void)
607 }
608 }
609
610 extern {
611 pub fn madvise(addr: *const ::c_void, len: ::size_t, advice: ::c_int)
612 -> ::c_int;
613 pub fn ioctl(fd: ::c_int, request: ::c_int, ...) -> ::c_int;
614 pub fn readlink(path: *const ::c_char,
615 buf: *mut ::c_char,
616 bufsz: ::size_t)
617 -> ::c_int;
618 pub fn msync(addr: *const ::c_void, len: ::size_t,
619 flags: ::c_int) -> ::c_int;
620 pub fn mprotect(addr: *const ::c_void, len: ::size_t, prot: ::c_int)
621 -> ::c_int;
622 pub fn sysconf(name: ::c_int) -> ::c_long;
623 pub fn recvfrom(socket: ::c_int, buf: *mut ::c_void, len: ::size_t,
624 flags: ::c_int, addr: *const ::sockaddr,
625 addrlen: *mut ::socklen_t) -> ::ssize_t;
626 pub fn getnameinfo(sa: *const ::sockaddr,
627 salen: ::socklen_t,
628 host: *mut ::c_char,
629 hostlen: ::size_t,
630 serv: *mut ::c_char,
631 sevlen: ::size_t,
632 flags: ::c_int) -> ::c_int;
633 pub fn timegm64(tm: *const ::tm) -> time64_t;
634 pub fn eventfd(init: ::c_uint, flags: ::c_int) -> ::c_int;
635 pub fn ptrace(request: ::c_int, ...) -> ::c_long;
636 pub fn fstat64(fildes: ::c_int, buf: *mut stat64) -> ::c_int;
637 pub fn stat64(path: *const c_char, buf: *mut stat64) -> ::c_int;
638 pub fn open64(path: *const c_char, oflag: ::c_int, ...) -> ::c_int;
639 pub fn creat64(path: *const c_char, mode: mode_t) -> ::c_int;
640 pub fn lseek64(fd: ::c_int, offset: off64_t, whence: ::c_int) -> off64_t;
641 pub fn pread64(fd: ::c_int, buf: *mut ::c_void, count: ::size_t,
642 offset: off64_t) -> ::ssize_t;
643 pub fn pwrite64(fd: ::c_int, buf: *const ::c_void, count: ::size_t,
644 offset: off64_t) -> ::ssize_t;
645 pub fn mmap64(addr: *mut ::c_void,
646 len: ::size_t,
647 prot: ::c_int,
648 flags: ::c_int,
649 fd: ::c_int,
650 offset: off64_t)
651 -> *mut ::c_void;
652 pub fn lstat64(path: *const c_char, buf: *mut stat64) -> ::c_int;
653 pub fn ftruncate64(fd: ::c_int, length: off64_t) -> ::c_int;
654 pub fn readdir64_r(dirp: *mut ::DIR, entry: *mut ::dirent64,
655 result: *mut *mut ::dirent64) -> ::c_int;
656 pub fn getrlimit64(resource: ::c_int, rlim: *mut rlimit64) -> ::c_int;
657 pub fn setrlimit64(resource: ::c_int, rlim: *const rlimit64) -> ::c_int;
658 }
659
660 cfg_if! {
661 if #[cfg(target_pointer_width = "32")] {
662 mod b32;
663 pub use self::b32::*;
664 } else if #[cfg(target_pointer_width = "64")] {
665 mod b64;
666 pub use self::b64::*;
667 } else {
668 // Unknown target_pointer_width
669 }
670 }