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