]> git.proxmox.com Git - rustc.git/blame - src/liblibc/src/unix/notbsd/linux/mod.rs
Imported Upstream version 1.9.0+dfsg1
[rustc.git] / src / liblibc / src / unix / notbsd / linux / mod.rs
CommitLineData
92a42be0
SL
1//! Linux-specific definitions for linux-like values
2
7453a54e
SL
3use dox::mem;
4
92a42be0
SL
5pub type useconds_t = u32;
6pub type dev_t = u64;
7pub type socklen_t = u32;
8pub type pthread_t = c_ulong;
9pub type mode_t = u32;
10pub type ino64_t = u64;
11pub type off64_t = i64;
12pub type blkcnt64_t = i64;
13pub type rlim64_t = u64;
9cc50fc6
SL
14pub type key_t = ::c_int;
15pub type shmatt_t = ::c_ulong;
16pub type mqd_t = ::c_int;
17pub type nfds_t = ::c_ulong;
92a42be0
SL
18
19pub enum fpos64_t {} // TODO: fill this out with a struct
20
21s! {
22 pub struct dirent {
23 pub d_ino: ::ino_t,
24 pub d_off: ::off_t,
25 pub d_reclen: ::c_ushort,
26 pub d_type: ::c_uchar,
27 pub d_name: [::c_char; 256],
28 }
29
30 pub struct dirent64 {
31 pub d_ino: ::ino64_t,
32 pub d_off: ::off64_t,
33 pub d_reclen: ::c_ushort,
34 pub d_type: ::c_uchar,
35 pub d_name: [::c_char; 256],
36 }
37
38 pub struct rlimit64 {
39 pub rlim_cur: rlim64_t,
40 pub rlim_max: rlim64_t,
41 }
42
43 pub struct glob_t {
44 pub gl_pathc: ::size_t,
45 pub gl_pathv: *mut *mut c_char,
46 pub gl_offs: ::size_t,
47 pub gl_flags: ::c_int,
48
49 __unused1: *mut ::c_void,
50 __unused2: *mut ::c_void,
51 __unused3: *mut ::c_void,
52 __unused4: *mut ::c_void,
53 __unused5: *mut ::c_void,
54 }
55
56 pub struct ifaddrs {
57 pub ifa_next: *mut ifaddrs,
58 pub ifa_name: *mut c_char,
59 pub ifa_flags: ::c_uint,
60 pub ifa_addr: *mut ::sockaddr,
61 pub ifa_netmask: *mut ::sockaddr,
62 pub ifa_ifu: *mut ::sockaddr, // FIXME This should be a union
63 pub ifa_data: *mut ::c_void
64 }
65
66 pub struct pthread_mutex_t {
67 #[cfg(any(target_arch = "mips", target_arch = "mipsel",
68 target_arch = "arm"))]
69 __align: [::c_long; 0],
70 #[cfg(not(any(target_arch = "mips", target_arch = "mipsel",
71 target_arch = "arm")))]
72 __align: [::c_longlong; 0],
73 size: [u8; __SIZEOF_PTHREAD_MUTEX_T],
74 }
75
76 pub struct pthread_rwlock_t {
77 #[cfg(any(target_arch = "mips", target_arch = "mipsel",
78 target_arch = "arm"))]
79 __align: [::c_long; 0],
80 #[cfg(not(any(target_arch = "mips", target_arch = "mipsel",
81 target_arch = "arm")))]
82 __align: [::c_longlong; 0],
83 size: [u8; __SIZEOF_PTHREAD_RWLOCK_T],
84 }
85
86 pub struct pthread_mutexattr_t {
7453a54e 87 #[cfg(any(target_arch = "x86_64", target_arch = "powerpc64"))]
92a42be0 88 __align: [::c_int; 0],
7453a54e 89 #[cfg(not(any(target_arch = "x86_64", target_arch = "powerpc64")))]
92a42be0
SL
90 __align: [::c_long; 0],
91 size: [u8; __SIZEOF_PTHREAD_MUTEXATTR_T],
92 }
93
94 pub struct pthread_cond_t {
7453a54e
SL
95 #[cfg(target_env = "musl")]
96 __align: [*const ::c_void; 0],
97 #[cfg(not(target_env = "musl"))]
92a42be0
SL
98 __align: [::c_longlong; 0],
99 size: [u8; __SIZEOF_PTHREAD_COND_T],
100 }
101
102 pub struct passwd {
103 pub pw_name: *mut ::c_char,
104 pub pw_passwd: *mut ::c_char,
105 pub pw_uid: ::uid_t,
106 pub pw_gid: ::gid_t,
107 pub pw_gecos: *mut ::c_char,
108 pub pw_dir: *mut ::c_char,
109 pub pw_shell: *mut ::c_char,
110 }
111
112 pub struct statvfs {
113 pub f_bsize: ::c_ulong,
114 pub f_frsize: ::c_ulong,
115 pub f_blocks: ::fsblkcnt_t,
116 pub f_bfree: ::fsblkcnt_t,
117 pub f_bavail: ::fsblkcnt_t,
118 pub f_files: ::fsfilcnt_t,
119 pub f_ffree: ::fsfilcnt_t,
120 pub f_favail: ::fsfilcnt_t,
121 pub f_fsid: ::c_ulong,
122 #[cfg(target_pointer_width = "32")]
123 pub __f_unused: ::c_int,
124 pub f_flag: ::c_ulong,
125 pub f_namemax: ::c_ulong,
126 __f_spare: [::c_int; 6],
127 }
128
9cc50fc6
SL
129 pub struct dqblk {
130 pub dqb_bhardlimit: ::uint64_t,
131 pub dqb_bsoftlimit: ::uint64_t,
132 pub dqb_curspace: ::uint64_t,
133 pub dqb_ihardlimit: ::uint64_t,
134 pub dqb_isoftlimit: ::uint64_t,
135 pub dqb_curinodes: ::uint64_t,
136 pub dqb_btime: ::uint64_t,
137 pub dqb_itime: ::uint64_t,
138 pub dqb_valid: ::uint32_t,
139 }
140
141 pub struct signalfd_siginfo {
142 pub ssi_signo: ::uint32_t,
143 pub ssi_errno: ::int32_t,
144 pub ssi_code: ::int32_t,
145 pub ssi_pid: ::uint32_t,
146 pub ssi_uid: ::uint32_t,
147 pub ssi_fd: ::int32_t,
148 pub ssi_tid: ::uint32_t,
149 pub ssi_band: ::uint32_t,
150 pub ssi_overrun: ::uint32_t,
151 pub ssi_trapno: ::uint32_t,
152 pub ssi_status: ::int32_t,
153 pub ssi_int: ::int32_t,
154 pub ssi_ptr: ::uint64_t,
155 pub ssi_utime: ::uint64_t,
156 pub ssi_stime: ::uint64_t,
157 pub ssi_addr: ::uint64_t,
158 _pad: [::uint8_t; 48],
159 }
160
161 pub struct fsid_t {
162 __val: [::c_int; 2],
163 }
164
165 pub struct mq_attr {
166 pub mq_flags: ::c_long,
167 pub mq_maxmsg: ::c_long,
168 pub mq_msgsize: ::c_long,
169 pub mq_curmsgs: ::c_long,
170 pad: [::c_long; 4]
171 }
172
173 pub struct cpu_set_t {
174 #[cfg(target_pointer_width = "32")]
175 bits: [u32; 32],
176 #[cfg(target_pointer_width = "64")]
177 bits: [u64; 16],
178 }
92a42be0
SL
179}
180
181pub const FILENAME_MAX: ::c_uint = 4096;
182pub const L_tmpnam: ::c_uint = 20;
183pub const _PC_NAME_MAX: ::c_int = 3;
184
185pub const _SC_ARG_MAX: ::c_int = 0;
186pub const _SC_CHILD_MAX: ::c_int = 1;
187pub const _SC_CLK_TCK: ::c_int = 2;
188pub const _SC_NGROUPS_MAX: ::c_int = 3;
189pub const _SC_OPEN_MAX: ::c_int = 4;
190pub const _SC_STREAM_MAX: ::c_int = 5;
191pub const _SC_TZNAME_MAX: ::c_int = 6;
192pub const _SC_JOB_CONTROL: ::c_int = 7;
193pub const _SC_SAVED_IDS: ::c_int = 8;
194pub const _SC_REALTIME_SIGNALS: ::c_int = 9;
195pub const _SC_PRIORITY_SCHEDULING: ::c_int = 10;
196pub const _SC_TIMERS: ::c_int = 11;
197pub const _SC_ASYNCHRONOUS_IO: ::c_int = 12;
198pub const _SC_PRIORITIZED_IO: ::c_int = 13;
199pub const _SC_SYNCHRONIZED_IO: ::c_int = 14;
200pub const _SC_FSYNC: ::c_int = 15;
201pub const _SC_MAPPED_FILES: ::c_int = 16;
202pub const _SC_MEMLOCK: ::c_int = 17;
203pub const _SC_MEMLOCK_RANGE: ::c_int = 18;
204pub const _SC_MEMORY_PROTECTION: ::c_int = 19;
205pub const _SC_MESSAGE_PASSING: ::c_int = 20;
206pub const _SC_SEMAPHORES: ::c_int = 21;
207pub const _SC_SHARED_MEMORY_OBJECTS: ::c_int = 22;
208pub const _SC_AIO_LISTIO_MAX: ::c_int = 23;
209pub const _SC_AIO_MAX: ::c_int = 24;
210pub const _SC_AIO_PRIO_DELTA_MAX: ::c_int = 25;
211pub const _SC_DELAYTIMER_MAX: ::c_int = 26;
212pub const _SC_MQ_OPEN_MAX: ::c_int = 27;
213pub const _SC_MQ_PRIO_MAX: ::c_int = 28;
214pub const _SC_VERSION: ::c_int = 29;
215pub const _SC_PAGESIZE: ::c_int = 30;
7453a54e 216pub const _SC_PAGE_SIZE: ::c_int = _SC_PAGESIZE;
92a42be0
SL
217pub const _SC_RTSIG_MAX: ::c_int = 31;
218pub const _SC_SEM_NSEMS_MAX: ::c_int = 32;
219pub const _SC_SEM_VALUE_MAX: ::c_int = 33;
220pub const _SC_SIGQUEUE_MAX: ::c_int = 34;
221pub const _SC_TIMER_MAX: ::c_int = 35;
222pub const _SC_BC_BASE_MAX: ::c_int = 36;
223pub const _SC_BC_DIM_MAX: ::c_int = 37;
224pub const _SC_BC_SCALE_MAX: ::c_int = 38;
225pub const _SC_BC_STRING_MAX: ::c_int = 39;
226pub const _SC_COLL_WEIGHTS_MAX: ::c_int = 40;
227pub const _SC_EXPR_NEST_MAX: ::c_int = 42;
228pub const _SC_LINE_MAX: ::c_int = 43;
229pub const _SC_RE_DUP_MAX: ::c_int = 44;
230pub const _SC_2_VERSION: ::c_int = 46;
231pub const _SC_2_C_BIND: ::c_int = 47;
232pub const _SC_2_C_DEV: ::c_int = 48;
233pub const _SC_2_FORT_DEV: ::c_int = 49;
234pub const _SC_2_FORT_RUN: ::c_int = 50;
235pub const _SC_2_SW_DEV: ::c_int = 51;
236pub const _SC_2_LOCALEDEF: ::c_int = 52;
237pub const _SC_IOV_MAX: ::c_int = 60;
238pub const _SC_THREADS: ::c_int = 67;
239pub const _SC_THREAD_SAFE_FUNCTIONS: ::c_int = 68;
240pub const _SC_GETGR_R_SIZE_MAX: ::c_int = 69;
241pub const _SC_GETPW_R_SIZE_MAX: ::c_int = 70;
242pub const _SC_LOGIN_NAME_MAX: ::c_int = 71;
243pub const _SC_TTY_NAME_MAX: ::c_int = 72;
244pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: ::c_int = 73;
245pub const _SC_THREAD_KEYS_MAX: ::c_int = 74;
246pub const _SC_THREAD_STACK_MIN: ::c_int = 75;
247pub const _SC_THREAD_THREADS_MAX: ::c_int = 76;
248pub const _SC_THREAD_ATTR_STACKADDR: ::c_int = 77;
249pub const _SC_THREAD_ATTR_STACKSIZE: ::c_int = 78;
250pub const _SC_THREAD_PRIORITY_SCHEDULING: ::c_int = 79;
251pub const _SC_THREAD_PRIO_INHERIT: ::c_int = 80;
252pub const _SC_THREAD_PRIO_PROTECT: ::c_int = 81;
253pub const _SC_NPROCESSORS_ONLN: ::c_int = 84;
254pub const _SC_ATEXIT_MAX: ::c_int = 87;
255pub const _SC_XOPEN_VERSION: ::c_int = 89;
256pub const _SC_XOPEN_XCU_VERSION: ::c_int = 90;
257pub const _SC_XOPEN_UNIX: ::c_int = 91;
258pub const _SC_XOPEN_CRYPT: ::c_int = 92;
259pub const _SC_XOPEN_ENH_I18N: ::c_int = 93;
260pub const _SC_XOPEN_SHM: ::c_int = 94;
261pub const _SC_2_CHAR_TERM: ::c_int = 95;
262pub const _SC_2_UPE: ::c_int = 97;
263pub const _SC_XBS5_ILP32_OFF32: ::c_int = 125;
264pub const _SC_XBS5_ILP32_OFFBIG: ::c_int = 126;
265pub const _SC_XBS5_LPBIG_OFFBIG: ::c_int = 128;
266pub const _SC_XOPEN_LEGACY: ::c_int = 129;
267pub const _SC_XOPEN_REALTIME: ::c_int = 130;
268pub const _SC_XOPEN_REALTIME_THREADS: ::c_int = 131;
269
270pub const RLIM_SAVED_MAX: ::rlim_t = RLIM_INFINITY;
271pub const RLIM_SAVED_CUR: ::rlim_t = RLIM_INFINITY;
272
273pub const GLOB_ERR: ::c_int = 1 << 0;
274pub const GLOB_MARK: ::c_int = 1 << 1;
275pub const GLOB_NOSORT: ::c_int = 1 << 2;
276pub const GLOB_DOOFFS: ::c_int = 1 << 3;
277pub const GLOB_NOCHECK: ::c_int = 1 << 4;
278pub const GLOB_APPEND: ::c_int = 1 << 5;
279pub const GLOB_NOESCAPE: ::c_int = 1 << 6;
280
281pub const GLOB_NOSPACE: ::c_int = 1;
282pub const GLOB_ABORTED: ::c_int = 2;
283pub const GLOB_NOMATCH: ::c_int = 3;
284
285pub const POSIX_MADV_NORMAL: ::c_int = 0;
286pub const POSIX_MADV_RANDOM: ::c_int = 1;
287pub const POSIX_MADV_SEQUENTIAL: ::c_int = 2;
288pub const POSIX_MADV_WILLNEED: ::c_int = 3;
289
290pub const S_IEXEC: mode_t = 64;
291pub const S_IWRITE: mode_t = 128;
292pub const S_IREAD: mode_t = 256;
293
294pub const F_LOCK: ::c_int = 1;
295pub const F_TEST: ::c_int = 3;
296pub const F_TLOCK: ::c_int = 2;
297pub const F_ULOCK: ::c_int = 0;
298
299pub const ST_RDONLY: ::c_ulong = 1;
300pub const ST_NOSUID: ::c_ulong = 2;
301pub const ST_NODEV: ::c_ulong = 4;
302pub const ST_NOEXEC: ::c_ulong = 8;
303pub const ST_SYNCHRONOUS: ::c_ulong = 16;
304pub const ST_MANDLOCK: ::c_ulong = 64;
305pub const ST_WRITE: ::c_ulong = 128;
306pub const ST_APPEND: ::c_ulong = 256;
307pub const ST_IMMUTABLE: ::c_ulong = 512;
308pub const ST_NOATIME: ::c_ulong = 1024;
309pub const ST_NODIRATIME: ::c_ulong = 2048;
310
9cc50fc6
SL
311pub const RTLD_NEXT: *mut ::c_void = -1i64 as *mut ::c_void;
312pub const RTLD_DEFAULT: *mut ::c_void = 0i64 as *mut ::c_void;
7453a54e
SL
313pub const RTLD_NODELETE: ::c_int = 0x1000;
314pub const RTLD_NOW: ::c_int = 0x2;
9cc50fc6 315
92a42be0
SL
316pub const TCP_MD5SIG: ::c_int = 14;
317
92a42be0
SL
318pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
319 __align: [],
320 size: [0; __SIZEOF_PTHREAD_MUTEX_T],
321};
322pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
323 __align: [],
324 size: [0; __SIZEOF_PTHREAD_COND_T],
325};
326pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t {
327 __align: [],
328 size: [0; __SIZEOF_PTHREAD_RWLOCK_T],
329};
330pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 1;
331pub const __SIZEOF_PTHREAD_COND_T: usize = 48;
332
9cc50fc6
SL
333pub const SCHED_OTHER: ::c_int = 0;
334pub const SCHED_FIFO: ::c_int = 1;
335pub const SCHED_RR: ::c_int = 2;
336pub const SCHED_BATCH: ::c_int = 3;
337pub const SCHED_IDLE: ::c_int = 5;
338
339pub const IPC_CREAT: ::c_int = 0o1000;
340pub const IPC_EXCL: ::c_int = 0o2000;
341pub const IPC_NOWAIT: ::c_int = 0o4000;
342
343pub const IPC_RMID: ::c_int = 0;
344pub const IPC_SET: ::c_int = 1;
345pub const IPC_STAT: ::c_int = 2;
346pub const IPC_INFO: ::c_int = 3;
347
348pub const SHM_R: ::c_int = 0o400;
349pub const SHM_W: ::c_int = 0o200;
350
351pub const SHM_RDONLY: ::c_int = 0o10000;
352pub const SHM_RND: ::c_int = 0o20000;
353pub const SHM_REMAP: ::c_int = 0o40000;
354pub const SHM_EXEC: ::c_int = 0o100000;
355
356pub const SHM_LOCK: ::c_int = 11;
357pub const SHM_UNLOCK: ::c_int = 12;
358
359pub const SHM_HUGETLB: ::c_int = 0o4000;
360pub const SHM_NORESERVE: ::c_int = 0o10000;
361
9cc50fc6
SL
362pub const EPOLLRDHUP: ::c_int = 0x2000;
363pub const EPOLLONESHOT: ::c_int = 0x40000000;
364
365pub const QFMT_VFS_OLD: ::c_int = 1;
366pub const QFMT_VFS_V0: ::c_int = 2;
367
368pub const SFD_CLOEXEC: ::c_int = 0x080000;
369
370pub const EFD_SEMAPHORE: ::c_int = 0x1;
371
372pub const NCCS: usize = 32;
373
54a0048b
SL
374pub const AF_NETLINK: ::c_int = 16;
375
376f! {
377 pub fn CPU_ZERO(cpuset: &mut cpu_set_t) -> () {
378 for slot in cpuset.bits.iter_mut() {
379 *slot = 0;
380 }
381 }
382
383 pub fn CPU_SET(cpu: usize, cpuset: &mut cpu_set_t) -> () {
384 let size = mem::size_of_val(&cpuset.bits[0]);
385 let (idx, offset) = (cpu / size, cpu % size);
386 cpuset.bits[idx] |= 1 << offset;
387 ()
388 }
9cc50fc6 389
54a0048b
SL
390 pub fn CPU_ISSET(cpu: usize, cpuset: &cpu_set_t) -> bool {
391 let size = mem::size_of_val(&cpuset.bits[0]);
392 let (idx, offset) = (cpu / size, cpu % size);
393 0 != (cpuset.bits[idx] & (1 << offset))
394 }
395
396 pub fn CPU_EQUAL(set1: &cpu_set_t, set2: &cpu_set_t) -> bool {
397 set1.bits == set2.bits
398 }
399}
400
401#[link(name = "util")]
92a42be0
SL
402extern {
403 pub fn shm_open(name: *const c_char, oflag: ::c_int,
404 mode: mode_t) -> ::c_int;
9cc50fc6 405 pub fn shmget(key: ::key_t, size: ::size_t, shmflg: ::c_int) -> ::c_int;
54a0048b
SL
406 pub fn shmat(shmid: ::c_int,
407 shmaddr: *const ::c_void,
408 shmflg: ::c_int) -> *mut ::c_void;
9cc50fc6 409 pub fn shmdt(shmaddr: *const ::c_void) -> ::c_int;
54a0048b
SL
410 pub fn shmctl(shmid: ::c_int,
411 cmd: ::c_int,
412 buf: *mut ::shmid_ds) -> ::c_int;
92a42be0
SL
413 pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int)
414 -> ::c_int;
415 pub fn __errno_location() -> *mut ::c_int;
416
417 pub fn fopen64(filename: *const c_char,
418 mode: *const c_char) -> *mut ::FILE;
419 pub fn freopen64(filename: *const c_char, mode: *const c_char,
420 file: *mut ::FILE) -> *mut ::FILE;
421 pub fn tmpfile64() -> *mut ::FILE;
422 pub fn fgetpos64(stream: *mut ::FILE, ptr: *mut fpos64_t) -> ::c_int;
423 pub fn fsetpos64(stream: *mut ::FILE, ptr: *const fpos64_t) -> ::c_int;
424 pub fn fstat64(fildes: ::c_int, buf: *mut stat64) -> ::c_int;
425 pub fn stat64(path: *const c_char, buf: *mut stat64) -> ::c_int;
426 pub fn open64(path: *const c_char, oflag: ::c_int, ...) -> ::c_int;
427 pub fn creat64(path: *const c_char, mode: mode_t) -> ::c_int;
428 pub fn lseek64(fd: ::c_int, offset: off64_t, whence: ::c_int) -> off64_t;
429 pub fn pread64(fd: ::c_int, buf: *mut ::c_void, count: ::size_t,
430 offset: off64_t) -> ::ssize_t;
431 pub fn pwrite64(fd: ::c_int, buf: *const ::c_void, count: ::size_t,
432 offset: off64_t) -> ::ssize_t;
433 pub fn mmap64(addr: *mut ::c_void,
434 len: ::size_t,
435 prot: ::c_int,
436 flags: ::c_int,
437 fd: ::c_int,
438 offset: off64_t)
439 -> *mut ::c_void;
440 pub fn lstat64(path: *const c_char, buf: *mut stat64) -> ::c_int;
441 pub fn ftruncate64(fd: ::c_int, length: off64_t) -> ::c_int;
442 pub fn readdir64_r(dirp: *mut ::DIR, entry: *mut ::dirent64,
443 result: *mut *mut ::dirent64) -> ::c_int;
444
445 pub fn getrlimit64(resource: ::c_int, rlim: *mut rlimit64) -> ::c_int;
446 pub fn setrlimit64(resource: ::c_int, rlim: *const rlimit64) -> ::c_int;
447 pub fn fseeko64(stream: *mut ::FILE,
448 offset: ::off64_t,
449 whence: ::c_int) -> ::c_int;
450 pub fn ftello64(stream: *mut ::FILE) -> ::off64_t;
451 pub fn fallocate(fd: ::c_int, mode: ::c_int,
452 offset: ::off_t, len: ::off_t) -> ::c_int;
453 pub fn posix_fallocate(fd: ::c_int, offset: ::off_t,
454 len: ::off_t) -> ::c_int;
455 pub fn readahead(fd: ::c_int, offset: ::off64_t,
456 count: ::size_t) -> ::ssize_t;
9cc50fc6
SL
457 pub fn getxattr(path: *const c_char, name: *const c_char,
458 value: *mut ::c_void, size: ::size_t) -> ::ssize_t;
459 pub fn lgetxattr(path: *const c_char, name: *const c_char,
460 value: *mut ::c_void, size: ::size_t) -> ::ssize_t;
461 pub fn fgetxattr(filedes: ::c_int, name: *const c_char,
462 value: *mut ::c_void, size: ::size_t) -> ::ssize_t;
463 pub fn setxattr(path: *const c_char, name: *const c_char,
464 value: *const ::c_void, size: ::size_t,
465 flags: ::c_int) -> ::c_int;
466 pub fn lsetxattr(path: *const c_char, name: *const c_char,
467 value: *const ::c_void, size: ::size_t,
468 flags: ::c_int) -> ::c_int;
469 pub fn fsetxattr(filedes: ::c_int, name: *const c_char,
470 value: *const ::c_void, size: ::size_t,
471 flags: ::c_int) -> ::c_int;
472 pub fn listxattr(path: *const c_char, list: *mut c_char,
473 size: ::size_t) -> ::ssize_t;
474 pub fn llistxattr(path: *const c_char, list: *mut c_char,
475 size: ::size_t) -> ::ssize_t;
476 pub fn flistxattr(filedes: ::c_int, list: *mut c_char,
477 size: ::size_t) -> ::ssize_t;
478 pub fn removexattr(path: *const c_char, name: *const c_char) -> ::c_int;
479 pub fn lremovexattr(path: *const c_char, name: *const c_char) -> ::c_int;
480 pub fn fremovexattr(filedes: ::c_int, name: *const c_char) -> ::c_int;
481 pub fn signalfd(fd: ::c_int,
482 mask: *const ::sigset_t,
483 flags: ::c_int) -> ::c_int;
484 pub fn pwritev(fd: ::c_int,
485 iov: *const ::iovec,
486 iovcnt: ::c_int,
487 offset: ::off_t) -> ::ssize_t;
488 pub fn preadv(fd: ::c_int,
489 iov: *const ::iovec,
490 iovcnt: ::c_int,
491 offset: ::off_t) -> ::ssize_t;
492 pub fn quotactl(cmd: ::c_int,
493 special: *const ::c_char,
494 id: ::c_int,
495 data: *mut ::c_char) -> ::c_int;
496 pub fn mq_open(name: *const ::c_char, oflag: ::c_int, ...) -> ::mqd_t;
497 pub fn mq_close(mqd: ::mqd_t) -> ::c_int;
498 pub fn mq_unlink(name: *const ::c_char) -> ::c_int;
499 pub fn mq_receive(mqd: ::mqd_t,
500 msg_ptr: *mut ::c_char,
501 msg_len: ::size_t,
502 msq_prio: *mut ::c_uint) -> ::ssize_t;
503 pub fn mq_send(mqd: ::mqd_t,
504 msg_ptr: *const ::c_char,
505 msg_len: ::size_t,
506 msq_prio: ::c_uint) -> ::c_int;
507 pub fn mq_getattr(mqd: ::mqd_t, attr: *mut ::mq_attr) -> ::c_int;
508 pub fn mq_setattr(mqd: ::mqd_t,
509 newattr: *const ::mq_attr,
510 oldattr: *mut ::mq_attr) -> ::c_int;
511 pub fn sched_getaffinity(pid: ::pid_t,
512 cpusetsize: ::size_t,
513 cpuset: *mut cpu_set_t) -> ::c_int;
514 pub fn sched_setaffinity(pid: ::pid_t,
515 cpusetsize: ::size_t,
516 cpuset: *const cpu_set_t) -> ::c_int;
517 pub fn epoll_pwait(epfd: ::c_int,
518 events: *mut ::epoll_event,
519 maxevents: ::c_int,
520 timeout: ::c_int,
521 sigmask: *const ::sigset_t) -> ::c_int;
522 pub fn dup3(oldfd: ::c_int, newfd: ::c_int, flags: ::c_int) -> ::c_int;
523 pub fn unshare(flags: ::c_int) -> ::c_int;
524 pub fn sethostname(name: *const ::c_char, len: ::size_t) -> ::c_int;
7453a54e
SL
525 pub fn setns(fd: ::c_int, nstype: ::c_int) -> ::c_int;
526 pub fn mkostemp(template: *mut ::c_char, flags: ::c_int) -> ::c_int;
54a0048b
SL
527 pub fn mkostemps(template: *mut ::c_char,
528 suffixlen: ::c_int,
529 flags: ::c_int) -> ::c_int;
530 pub fn sigtimedwait(set: *const sigset_t,
531 info: *mut siginfo_t,
532 timeout: *const ::timespec) -> ::c_int;
533 pub fn sigwaitinfo(set: *const sigset_t,
534 info: *mut siginfo_t) -> ::c_int;
535 pub fn openpty(amaster: *mut ::c_int,
536 aslave: *mut ::c_int,
537 name: *mut ::c_char,
538 termp: *const termios,
539 winp: *const ::winsize) -> ::c_int;
540 pub fn forkpty(amaster: *mut ::c_int,
541 name: *mut ::c_char,
542 termp: *const termios,
543 winp: *const ::winsize) -> ::pid_t;
92a42be0
SL
544}
545
546cfg_if! {
9cc50fc6
SL
547 if #[cfg(any(target_env = "musl",
548 target_os = "emscripten"))] {
92a42be0
SL
549 mod musl;
550 pub use self::musl::*;
551 } else if #[cfg(any(target_arch = "mips", target_arch = "mipsel"))] {
552 mod mips;
553 pub use self::mips::*;
554 } else {
555 mod other;
556 pub use self::other::*;
557 }
558}