1 pub type shmatt_t = ::c_ulong;
2 pub type msgqnum_t = ::c_ulong;
3 pub type msglen_t = ::c_ulong;
4 pub type regoff_t = ::c_int;
5 
6 s! {
7     pub struct statvfs {  // Different than GNU!
8         pub f_bsize: ::c_ulong,
9         pub f_frsize: ::c_ulong,
10         pub f_blocks: ::fsblkcnt_t,
11         pub f_bfree: ::fsblkcnt_t,
12         pub f_bavail: ::fsblkcnt_t,
13         pub f_files: ::fsfilcnt_t,
14         pub f_ffree: ::fsfilcnt_t,
15         pub f_favail: ::fsfilcnt_t,
16         #[cfg(target_endian = "little")]
17         pub f_fsid: ::c_ulong,
18         #[cfg(target_pointer_width = "32")]
19         __f_unused: ::c_int,
20         #[cfg(target_endian = "big")]
21         pub f_fsid: ::c_ulong,
22         pub f_flag: ::c_ulong,
23         pub f_namemax: ::c_ulong,
24         __f_spare: [::c_int; 6],
25     }
26 
27     pub struct regex_t {
28         __buffer: *mut ::c_void,
29         __allocated: ::size_t,
30         __used: ::size_t,
31         __syntax: ::c_ulong,
32         __fastmap: *mut ::c_char,
33         __translate: *mut ::c_char,
34         __re_nsub: ::size_t,
35         __bitfield: u8,
36     }
37 }
38 
39 pub const MCL_CURRENT: ::c_int = 0x0001;
40 pub const MCL_FUTURE: ::c_int = 0x0002;
41 
42 pub const SIGEV_THREAD_ID: ::c_int = 4;
43 
44 pub const ADFS_SUPER_MAGIC: ::c_long = 0x0000adf5;
45 pub const AFFS_SUPER_MAGIC: ::c_long = 0x0000adff;
46 pub const AFS_SUPER_MAGIC: ::c_long = 0x5346414f;
47 pub const AUTOFS_SUPER_MAGIC: ::c_long = 0x0187;
48 pub const BINDERFS_SUPER_MAGIC: ::c_long = 0x6c6f6f70;
49 pub const BPF_FS_MAGIC: ::c_long = 0xcafe4a11;
50 pub const BTRFS_SUPER_MAGIC: ::c_long = 0x9123683e;
51 pub const CGROUP2_SUPER_MAGIC: ::c_long = 0x63677270;
52 pub const CGROUP_SUPER_MAGIC: ::c_long = 0x27e0eb;
53 pub const CODA_SUPER_MAGIC: ::c_long = 0x73757245;
54 pub const CRAMFS_MAGIC: ::c_long = 0x28cd3d45;
55 pub const DEBUGFS_MAGIC: ::c_long = 0x64626720;
56 pub const DEVPTS_SUPER_MAGIC: ::c_long = 0x1cd1;
57 pub const ECRYPTFS_SUPER_MAGIC: ::c_long = 0xf15f;
58 pub const EFS_SUPER_MAGIC: ::c_long = 0x00414a53;
59 pub const EXT2_SUPER_MAGIC: ::c_long = 0x0000ef53;
60 pub const EXT3_SUPER_MAGIC: ::c_long = 0x0000ef53;
61 pub const EXT4_SUPER_MAGIC: ::c_long = 0x0000ef53;
62 pub const F2FS_SUPER_MAGIC: ::c_long = 0xf2f52010;
63 pub const FUTEXFS_SUPER_MAGIC: ::c_long = 0xbad1dea;
64 pub const HOSTFS_SUPER_MAGIC: ::c_long = 0x00c0ffee;
65 pub const HPFS_SUPER_MAGIC: ::c_long = 0xf995e849;
66 pub const HUGETLBFS_MAGIC: ::c_long = 0x958458f6;
67 pub const ISOFS_SUPER_MAGIC: ::c_long = 0x00009660;
68 pub const JFFS2_SUPER_MAGIC: ::c_long = 0x000072b6;
69 pub const MINIX2_SUPER_MAGIC2: ::c_long = 0x00002478;
70 pub const MINIX2_SUPER_MAGIC: ::c_long = 0x00002468;
71 pub const MINIX3_SUPER_MAGIC: ::c_long = 0x4d5a;
72 pub const MINIX_SUPER_MAGIC2: ::c_long = 0x0000138f;
73 pub const MINIX_SUPER_MAGIC: ::c_long = 0x0000137f;
74 pub const MSDOS_SUPER_MAGIC: ::c_long = 0x00004d44;
75 pub const NCP_SUPER_MAGIC: ::c_long = 0x0000564c;
76 pub const NFS_SUPER_MAGIC: ::c_long = 0x00006969;
77 pub const NILFS_SUPER_MAGIC: ::c_long = 0x3434;
78 pub const OCFS2_SUPER_MAGIC: ::c_long = 0x7461636f;
79 pub const OPENPROM_SUPER_MAGIC: ::c_long = 0x00009fa1;
80 pub const OVERLAYFS_SUPER_MAGIC: ::c_long = 0x794c7630;
81 pub const PROC_SUPER_MAGIC: ::c_long = 0x00009fa0;
82 pub const QNX4_SUPER_MAGIC: ::c_long = 0x0000002f;
83 pub const QNX6_SUPER_MAGIC: ::c_long = 0x68191122;
84 pub const RDTGROUP_SUPER_MAGIC: ::c_long = 0x7655821;
85 pub const REISERFS_SUPER_MAGIC: ::c_long = 0x52654973;
86 pub const SMB_SUPER_MAGIC: ::c_long = 0x0000517b;
87 pub const SYSFS_MAGIC: ::c_long = 0x62656572;
88 pub const TMPFS_MAGIC: ::c_long = 0x01021994;
89 pub const TRACEFS_MAGIC: ::c_long = 0x74726163;
90 pub const UDF_SUPER_MAGIC: ::c_long = 0x15013346;
91 pub const USBDEVICE_SUPER_MAGIC: ::c_long = 0x00009fa2;
92 pub const XENFS_SUPER_MAGIC: ::c_long = 0xabba1974;
93 pub const XFS_SUPER_MAGIC: ::c_long = 0x58465342;
94 
95 pub const PTRACE_TRACEME: ::c_int = 0;
96 pub const PTRACE_PEEKTEXT: ::c_int = 1;
97 pub const PTRACE_PEEKDATA: ::c_int = 2;
98 pub const PTRACE_PEEKUSER: ::c_int = 3;
99 pub const PTRACE_POKETEXT: ::c_int = 4;
100 pub const PTRACE_POKEDATA: ::c_int = 5;
101 pub const PTRACE_POKEUSER: ::c_int = 6;
102 pub const PTRACE_CONT: ::c_int = 7;
103 pub const PTRACE_KILL: ::c_int = 8;
104 pub const PTRACE_SINGLESTEP: ::c_int = 9;
105 pub const PTRACE_GETREGS: ::c_int = 12;
106 pub const PTRACE_SETREGS: ::c_int = 13;
107 pub const PTRACE_GETFPREGS: ::c_int = 14;
108 pub const PTRACE_SETFPREGS: ::c_int = 15;
109 pub const PTRACE_ATTACH: ::c_int = 16;
110 pub const PTRACE_DETACH: ::c_int = 17;
111 pub const PTRACE_GETFPXREGS: ::c_int = 18;
112 pub const PTRACE_SETFPXREGS: ::c_int = 19;
113 pub const PTRACE_SYSCALL: ::c_int = 24;
114 pub const PTRACE_SETOPTIONS: ::c_int = 0x4200;
115 pub const PTRACE_GETEVENTMSG: ::c_int = 0x4201;
116 pub const PTRACE_GETSIGINFO: ::c_int = 0x4202;
117 pub const PTRACE_SETSIGINFO: ::c_int = 0x4203;
118 pub const PTRACE_GETREGSET: ::c_int = 0x4204;
119 pub const PTRACE_SETREGSET: ::c_int = 0x4205;
120 pub const PTRACE_SEIZE: ::c_int = 0x4206;
121 pub const PTRACE_INTERRUPT: ::c_int = 0x4207;
122 pub const PTRACE_LISTEN: ::c_int = 0x4208;
123 pub const PTRACE_O_MASK: ::c_int = 0x000000ff;
124 
125 pub const POSIX_FADV_DONTNEED: ::c_int = 4;
126 pub const POSIX_FADV_NOREUSE: ::c_int = 5;
127 
128 pub const RLIMIT_CPU: ::c_int = 0;
129 pub const RLIMIT_FSIZE: ::c_int = 1;
130 pub const RLIMIT_DATA: ::c_int = 2;
131 pub const RLIMIT_STACK: ::c_int = 3;
132 pub const RLIMIT_CORE: ::c_int = 4;
133 pub const RLIMIT_LOCKS: ::c_int = 10;
134 pub const RLIMIT_SIGPENDING: ::c_int = 11;
135 pub const RLIMIT_MSGQUEUE: ::c_int = 12;
136 pub const RLIMIT_NICE: ::c_int = 13;
137 pub const RLIMIT_RTPRIO: ::c_int = 14;
138 
139 // These are different than GNU!
140 pub const LC_CTYPE: ::c_int = 0;
141 pub const LC_NUMERIC: ::c_int = 1;
142 pub const LC_TIME: ::c_int = 3;
143 pub const LC_COLLATE: ::c_int = 4;
144 pub const LC_MONETARY: ::c_int = 2;
145 pub const LC_MESSAGES: ::c_int = 5;
146 pub const LC_ALL: ::c_int = 6;
147 // end different section
148 
149 // MS_ flags for mount(2)
150 pub const MS_RMT_MASK: ::c_ulong = ::MS_RDONLY | ::MS_SYNCHRONOUS | ::MS_MANDLOCK | ::MS_I_VERSION;
151 
152 pub const ENOTSUP: ::c_int = EOPNOTSUPP;
153 
154 pub const IPV6_JOIN_GROUP: ::c_int = 20;
155 pub const IPV6_LEAVE_GROUP: ::c_int = 21;
156 
157 // These are different from GNU
158 pub const ABDAY_1: ::nl_item = 0x300;
159 pub const ABDAY_2: ::nl_item = 0x301;
160 pub const ABDAY_3: ::nl_item = 0x302;
161 pub const ABDAY_4: ::nl_item = 0x303;
162 pub const ABDAY_5: ::nl_item = 0x304;
163 pub const ABDAY_6: ::nl_item = 0x305;
164 pub const ABDAY_7: ::nl_item = 0x306;
165 pub const DAY_1: ::nl_item = 0x307;
166 pub const DAY_2: ::nl_item = 0x308;
167 pub const DAY_3: ::nl_item = 0x309;
168 pub const DAY_4: ::nl_item = 0x30A;
169 pub const DAY_5: ::nl_item = 0x30B;
170 pub const DAY_6: ::nl_item = 0x30C;
171 pub const DAY_7: ::nl_item = 0x30D;
172 pub const ABMON_1: ::nl_item = 0x30E;
173 pub const ABMON_2: ::nl_item = 0x30F;
174 pub const ABMON_3: ::nl_item = 0x310;
175 pub const ABMON_4: ::nl_item = 0x311;
176 pub const ABMON_5: ::nl_item = 0x312;
177 pub const ABMON_6: ::nl_item = 0x313;
178 pub const ABMON_7: ::nl_item = 0x314;
179 pub const ABMON_8: ::nl_item = 0x315;
180 pub const ABMON_9: ::nl_item = 0x316;
181 pub const ABMON_10: ::nl_item = 0x317;
182 pub const ABMON_11: ::nl_item = 0x318;
183 pub const ABMON_12: ::nl_item = 0x319;
184 pub const MON_1: ::nl_item = 0x31A;
185 pub const MON_2: ::nl_item = 0x31B;
186 pub const MON_3: ::nl_item = 0x31C;
187 pub const MON_4: ::nl_item = 0x31D;
188 pub const MON_5: ::nl_item = 0x31E;
189 pub const MON_6: ::nl_item = 0x31F;
190 pub const MON_7: ::nl_item = 0x320;
191 pub const MON_8: ::nl_item = 0x321;
192 pub const MON_9: ::nl_item = 0x322;
193 pub const MON_10: ::nl_item = 0x323;
194 pub const MON_11: ::nl_item = 0x324;
195 pub const MON_12: ::nl_item = 0x325;
196 pub const AM_STR: ::nl_item = 0x326;
197 pub const PM_STR: ::nl_item = 0x327;
198 pub const D_T_FMT: ::nl_item = 0x328;
199 pub const D_FMT: ::nl_item = 0x329;
200 pub const T_FMT: ::nl_item = 0x32A;
201 pub const T_FMT_AMPM: ::nl_item = 0x32B;
202 pub const ERA: ::nl_item = 0x32C;
203 pub const ERA_D_FMT: ::nl_item = 0x32E;
204 pub const ALT_DIGITS: ::nl_item = 0x32F;
205 pub const ERA_D_T_FMT: ::nl_item = 0x330;
206 pub const ERA_T_FMT: ::nl_item = 0x331;
207 pub const CODESET: ::nl_item = 10;
208 pub const CRNCYSTR: ::nl_item = 0x215;
209 pub const RADIXCHAR: ::nl_item = 0x100;
210 pub const THOUSEP: ::nl_item = 0x101;
211 pub const NOEXPR: ::nl_item = 0x501;
212 pub const YESSTR: ::nl_item = 0x502;
213 pub const NOSTR: ::nl_item = 0x503;
214 
215 // Different than Gnu.
216 pub const FILENAME_MAX: ::c_uint = 4095;
217 
218 pub const PRIO_PROCESS: ::c_int = 0;
219 pub const PRIO_PGRP: ::c_int = 1;
220 pub const PRIO_USER: ::c_int = 2;
221 
222 pub const ST_RELATIME: ::c_ulong = 4096;
223 
224 extern "C" {
gettimeofday(tp: *mut ::timeval, tz: *mut ::timezone) -> ::c_int225     pub fn gettimeofday(tp: *mut ::timeval, tz: *mut ::timezone) -> ::c_int;
226 
pthread_rwlockattr_getkind_np( attr: *const ::pthread_rwlockattr_t, val: *mut ::c_int, ) -> ::c_int227     pub fn pthread_rwlockattr_getkind_np(
228         attr: *const ::pthread_rwlockattr_t,
229         val: *mut ::c_int,
230     ) -> ::c_int;
pthread_rwlockattr_setkind_np( attr: *mut ::pthread_rwlockattr_t, val: ::c_int, ) -> ::c_int231     pub fn pthread_rwlockattr_setkind_np(
232         attr: *mut ::pthread_rwlockattr_t,
233         val: ::c_int,
234     ) -> ::c_int;
235 
ptrace(request: ::c_uint, ...) -> ::c_long236     pub fn ptrace(request: ::c_uint, ...) -> ::c_long;
237 
sendmmsg( sockfd: ::c_int, msgvec: *mut ::mmsghdr, vlen: ::c_uint, flags: ::c_int, ) -> ::c_int238     pub fn sendmmsg(
239         sockfd: ::c_int,
240         msgvec: *mut ::mmsghdr,
241         vlen: ::c_uint,
242         flags: ::c_int,
243     ) -> ::c_int;
recvmmsg( sockfd: ::c_int, msgvec: *mut ::mmsghdr, vlen: ::c_uint, flags: ::c_int, timeout: *mut ::timespec, ) -> ::c_int244     pub fn recvmmsg(
245         sockfd: ::c_int,
246         msgvec: *mut ::mmsghdr,
247         vlen: ::c_uint,
248         flags: ::c_int,
249         timeout: *mut ::timespec,
250     ) -> ::c_int;
251 
openpty( amaster: *mut ::c_int, aslave: *mut ::c_int, name: *mut ::c_char, termp: *mut termios, winp: *mut ::winsize, ) -> ::c_int252     pub fn openpty(
253         amaster: *mut ::c_int,
254         aslave: *mut ::c_int,
255         name: *mut ::c_char,
256         termp: *mut termios,
257         winp: *mut ::winsize,
258     ) -> ::c_int;
forkpty( amaster: *mut ::c_int, name: *mut ::c_char, termp: *mut termios, winp: *mut ::winsize, ) -> ::pid_t259     pub fn forkpty(
260         amaster: *mut ::c_int,
261         name: *mut ::c_char,
262         termp: *mut termios,
263         winp: *mut ::winsize,
264     ) -> ::pid_t;
265 
getnameinfo( sa: *const ::sockaddr, salen: ::socklen_t, host: *mut ::c_char, hostlen: ::socklen_t, serv: *mut ::c_char, sevlen: ::socklen_t, flags: ::c_int, ) -> ::c_int266     pub fn getnameinfo(
267         sa: *const ::sockaddr,
268         salen: ::socklen_t,
269         host: *mut ::c_char,
270         hostlen: ::socklen_t,
271         serv: *mut ::c_char,
272         sevlen: ::socklen_t,
273         flags: ::c_int,
274     ) -> ::c_int;
275 
pwritev( fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int, offset: ::off64_t, ) -> ::ssize_t276     pub fn pwritev(
277         fd: ::c_int,
278         iov: *const ::iovec,
279         iovcnt: ::c_int,
280         offset: ::off64_t,
281     ) -> ::ssize_t;
preadv( fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int, offset: ::off64_t, ) -> ::ssize_t282     pub fn preadv(
283         fd: ::c_int,
284         iov: *const ::iovec,
285         iovcnt: ::c_int,
286         offset: ::off64_t,
287     ) -> ::ssize_t;
288 }
289 
290 cfg_if! {
291     if #[cfg(any(target_arch = "mips", target_arch = "mips64"))] {
292         mod mips;
293         pub use self::mips::*;
294     } else if #[cfg(target_arch = "x86_64")] {
295         mod x86_64;
296         pub use self::x86_64::*;
297     } else if #[cfg(target_arch = "arm")] {
298         mod arm;
299         pub use self::arm::*;
300     } else {
301         pub use unsupported_target;
302     }
303 }
304