libc_interface/unix/notbsd/linux/other/b32/
mod.rs

1//! 32-bit specific definitions for linux-like values
2
3use pthread_mutex_t;
4
5pub type c_long = i32;
6pub type c_ulong = u32;
7pub type clock_t = i32;
8pub type time_t = i32;
9pub type suseconds_t = i32;
10pub type ino_t = u32;
11pub type off_t = i32;
12pub type blkcnt_t = i32;
13pub type __fsword_t = i32;
14
15pub type fsblkcnt_t = ::c_ulong;
16pub type fsfilcnt_t = ::c_ulong;
17pub type rlim_t = c_ulong;
18pub type shmatt_t = ::c_ulong;
19pub type msgqnum_t = ::c_ulong;
20pub type msglen_t = ::c_ulong;
21pub type blksize_t = i32;
22pub type nlink_t = u32;
23pub type __u64 = ::c_ulonglong;
24
25s! {
26    pub struct stat {
27        pub st_dev: ::dev_t,
28        __pad1: ::c_short,
29        pub st_ino: ::ino_t,
30        pub st_mode: ::mode_t,
31        pub st_nlink: ::nlink_t,
32        pub st_uid: ::uid_t,
33        pub st_gid: ::gid_t,
34        pub st_rdev: ::dev_t,
35        __pad2: ::c_short,
36        pub st_size: ::off_t,
37        pub st_blksize: ::blksize_t,
38        pub st_blocks: ::blkcnt_t,
39        pub st_atime: ::time_t,
40        pub st_atime_nsec: ::c_long,
41        pub st_mtime: ::time_t,
42        pub st_mtime_nsec: ::c_long,
43        pub st_ctime: ::time_t,
44        pub st_ctime_nsec: ::c_long,
45        __unused4: ::c_long,
46        __unused5: ::c_long,
47    }
48
49    pub struct statvfs {
50        pub f_bsize: ::c_ulong,
51        pub f_frsize: ::c_ulong,
52        pub f_blocks: ::fsblkcnt_t,
53        pub f_bfree: ::fsblkcnt_t,
54        pub f_bavail: ::fsblkcnt_t,
55        pub f_files: ::fsfilcnt_t,
56        pub f_ffree: ::fsfilcnt_t,
57        pub f_favail: ::fsfilcnt_t,
58        pub f_fsid: ::c_ulong,
59        __f_unused: ::c_int,
60        pub f_flag: ::c_ulong,
61        pub f_namemax: ::c_ulong,
62        __f_spare: [::c_int; 6],
63    }
64
65    pub struct pthread_attr_t {
66        __size: [u32; 9]
67    }
68
69    pub struct sigset_t {
70        __val: [::c_ulong; 32],
71    }
72
73    pub struct sysinfo {
74        pub uptime: ::c_long,
75        pub loads: [::c_ulong; 3],
76        pub totalram: ::c_ulong,
77        pub freeram: ::c_ulong,
78        pub sharedram: ::c_ulong,
79        pub bufferram: ::c_ulong,
80        pub totalswap: ::c_ulong,
81        pub freeswap: ::c_ulong,
82        pub procs: ::c_ushort,
83        pub pad: ::c_ushort,
84        pub totalhigh: ::c_ulong,
85        pub freehigh: ::c_ulong,
86        pub mem_unit: ::c_uint,
87        pub _f: [::c_char; 8],
88    }
89}
90
91pub const TIOCGSOFTCAR: ::c_ulong = 0x5419;
92pub const TIOCSSOFTCAR: ::c_ulong = 0x541A;
93
94pub const RLIMIT_NOFILE: ::c_int = 7;
95pub const RLIMIT_NPROC: ::c_int = 6;
96
97pub const O_APPEND: ::c_int = 1024;
98pub const O_CREAT: ::c_int = 64;
99pub const O_EXCL: ::c_int = 128;
100pub const O_NOCTTY: ::c_int = 256;
101pub const O_NONBLOCK: ::c_int = 2048;
102pub const O_SYNC: ::c_int = 1052672;
103pub const O_RSYNC: ::c_int = 1052672;
104pub const O_DSYNC: ::c_int = 4096;
105pub const O_FSYNC: ::c_int = 0x101000;
106pub const O_NOATIME: ::c_int = 0o1000000;
107pub const O_PATH: ::c_int = 0o10000000;
108pub const O_TMPFILE: ::c_int = 0o20000000 | O_DIRECTORY;
109
110pub const MAP_GROWSDOWN: ::c_int = 0x0100;
111
112pub const EDEADLK: ::c_int = 35;
113pub const ENAMETOOLONG: ::c_int = 36;
114pub const ENOLCK: ::c_int = 37;
115pub const ENOSYS: ::c_int = 38;
116pub const ENOTEMPTY: ::c_int = 39;
117pub const ELOOP: ::c_int = 40;
118pub const ENOMSG: ::c_int = 42;
119pub const EIDRM: ::c_int = 43;
120pub const ECHRNG: ::c_int = 44;
121pub const EL2NSYNC: ::c_int = 45;
122pub const EL3HLT: ::c_int = 46;
123pub const EL3RST: ::c_int = 47;
124pub const ELNRNG: ::c_int = 48;
125pub const EUNATCH: ::c_int = 49;
126pub const ENOCSI: ::c_int = 50;
127pub const EL2HLT: ::c_int = 51;
128pub const EBADE: ::c_int = 52;
129pub const EBADR: ::c_int = 53;
130pub const EXFULL: ::c_int = 54;
131pub const ENOANO: ::c_int = 55;
132pub const EBADRQC: ::c_int = 56;
133pub const EBADSLT: ::c_int = 57;
134pub const EMULTIHOP: ::c_int = 72;
135pub const EOVERFLOW: ::c_int = 75;
136pub const ENOTUNIQ: ::c_int = 76;
137pub const EBADFD: ::c_int = 77;
138pub const EBADMSG: ::c_int = 74;
139pub const EREMCHG: ::c_int = 78;
140pub const ELIBACC: ::c_int = 79;
141pub const ELIBBAD: ::c_int = 80;
142pub const ELIBSCN: ::c_int = 81;
143pub const ELIBMAX: ::c_int = 82;
144pub const ELIBEXEC: ::c_int = 83;
145pub const EILSEQ: ::c_int = 84;
146pub const ERESTART: ::c_int = 85;
147pub const ESTRPIPE: ::c_int = 86;
148pub const EUSERS: ::c_int = 87;
149pub const ENOTSOCK: ::c_int = 88;
150pub const EDESTADDRREQ: ::c_int = 89;
151pub const EMSGSIZE: ::c_int = 90;
152pub const EPROTOTYPE: ::c_int = 91;
153pub const ENOPROTOOPT: ::c_int = 92;
154pub const EPROTONOSUPPORT: ::c_int = 93;
155pub const ESOCKTNOSUPPORT: ::c_int = 94;
156pub const EOPNOTSUPP: ::c_int = 95;
157pub const EPFNOSUPPORT: ::c_int = 96;
158pub const EAFNOSUPPORT: ::c_int = 97;
159pub const EADDRINUSE: ::c_int = 98;
160pub const EADDRNOTAVAIL: ::c_int = 99;
161pub const ENETDOWN: ::c_int = 100;
162pub const ENETUNREACH: ::c_int = 101;
163pub const ENETRESET: ::c_int = 102;
164pub const ECONNABORTED: ::c_int = 103;
165pub const ECONNRESET: ::c_int = 104;
166pub const ENOBUFS: ::c_int = 105;
167pub const EISCONN: ::c_int = 106;
168pub const ENOTCONN: ::c_int = 107;
169pub const ESHUTDOWN: ::c_int = 108;
170pub const ETOOMANYREFS: ::c_int = 109;
171pub const ETIMEDOUT: ::c_int = 110;
172pub const ECONNREFUSED: ::c_int = 111;
173pub const EHOSTDOWN: ::c_int = 112;
174pub const EHOSTUNREACH: ::c_int = 113;
175pub const EALREADY: ::c_int = 114;
176pub const EINPROGRESS: ::c_int = 115;
177pub const ESTALE: ::c_int = 116;
178pub const EDQUOT: ::c_int = 122;
179pub const ENOMEDIUM: ::c_int = 123;
180pub const EMEDIUMTYPE: ::c_int = 124;
181pub const ECANCELED: ::c_int = 125;
182pub const ENOKEY: ::c_int = 126;
183pub const EKEYEXPIRED: ::c_int = 127;
184pub const EKEYREVOKED: ::c_int = 128;
185pub const EKEYREJECTED: ::c_int = 129;
186pub const EOWNERDEAD: ::c_int = 130;
187pub const ENOTRECOVERABLE: ::c_int = 131;
188pub const EHWPOISON: ::c_int = 133;
189pub const ERFKILL: ::c_int = 132;
190
191pub const SOL_SOCKET: ::c_int = 1;
192
193pub const SO_REUSEADDR: ::c_int = 2;
194pub const SO_TYPE: ::c_int = 3;
195pub const SO_ERROR: ::c_int = 4;
196pub const SO_DONTROUTE: ::c_int = 5;
197pub const SO_BROADCAST: ::c_int = 6;
198pub const SO_SNDBUF: ::c_int = 7;
199pub const SO_RCVBUF: ::c_int = 8;
200pub const SO_KEEPALIVE: ::c_int = 9;
201pub const SO_OOBINLINE: ::c_int = 10;
202pub const SO_PRIORITY: ::c_int = 12;
203pub const SO_LINGER: ::c_int = 13;
204pub const SO_BSDCOMPAT: ::c_int = 14;
205pub const SO_REUSEPORT: ::c_int = 15;
206pub const SO_BINDTODEVICE: ::c_int = 25;
207pub const SO_TIMESTAMP: ::c_int = 29;
208pub const SO_ACCEPTCONN: ::c_int = 30;
209pub const SO_MARK: ::c_int = 36;
210pub const SO_PROTOCOL: ::c_int = 38;
211pub const SO_DOMAIN: ::c_int = 39;
212pub const SO_RXQ_OVFL: ::c_int = 40;
213pub const SO_PEEK_OFF: ::c_int = 42;
214pub const SO_BUSY_POLL: ::c_int = 46;
215
216pub const SA_ONSTACK: ::c_int = 0x08000000;
217pub const SA_SIGINFO: ::c_int = 0x00000004;
218pub const SA_NOCLDWAIT: ::c_int = 0x00000002;
219
220pub const SIGCHLD: ::c_int = 17;
221pub const SIGBUS: ::c_int = 7;
222pub const SIGUSR1: ::c_int = 10;
223pub const SIGUSR2: ::c_int = 12;
224pub const SIGCONT: ::c_int = 18;
225pub const SIGSTOP: ::c_int = 19;
226pub const SIGTSTP: ::c_int = 20;
227pub const SIGURG: ::c_int = 23;
228pub const SIGIO: ::c_int = 29;
229pub const SIGSYS: ::c_int = 31;
230pub const SIGSTKFLT: ::c_int = 16;
231pub const SIGUNUSED: ::c_int = 31;
232pub const SIGPOLL: ::c_int = 29;
233pub const SIGPWR: ::c_int = 30;
234pub const SIG_SETMASK: ::c_int = 2;
235pub const SIG_BLOCK: ::c_int = 0x000000;
236pub const SIG_UNBLOCK: ::c_int = 0x01;
237
238pub const POLLWRNORM: ::c_short = 0x100;
239pub const POLLWRBAND: ::c_short = 0x200;
240
241pub const O_ASYNC: ::c_int = 0x2000;
242pub const O_NDELAY: ::c_int = 0x800;
243
244pub const PTRACE_DETACH: ::c_uint = 17;
245
246pub const EFD_NONBLOCK: ::c_int = 0x800;
247
248pub const F_GETLK: ::c_int = 5;
249pub const F_GETOWN: ::c_int = 9;
250pub const F_SETOWN: ::c_int = 8;
251pub const F_SETLK: ::c_int = 6;
252pub const F_SETLKW: ::c_int = 7;
253
254pub const SFD_NONBLOCK: ::c_int = 0x0800;
255
256pub const TIOCEXCL: ::c_ulong = 0x540C;
257pub const TIOCNXCL: ::c_ulong = 0x540D;
258pub const TIOCSCTTY: ::c_ulong = 0x540E;
259pub const TIOCSTI: ::c_ulong = 0x5412;
260pub const TIOCMGET: ::c_ulong = 0x5415;
261pub const TIOCMBIS: ::c_ulong = 0x5416;
262pub const TIOCMBIC: ::c_ulong = 0x5417;
263pub const TIOCMSET: ::c_ulong = 0x5418;
264pub const TIOCCONS: ::c_ulong = 0x541D;
265
266pub const SFD_CLOEXEC: ::c_int = 0x080000;
267
268pub const NCCS: usize = 32;
269
270pub const O_TRUNC: ::c_int = 512;
271
272pub const O_CLOEXEC: ::c_int = 0x80000;
273
274pub const EBFONT: ::c_int = 59;
275pub const ENOSTR: ::c_int = 60;
276pub const ENODATA: ::c_int = 61;
277pub const ETIME: ::c_int = 62;
278pub const ENOSR: ::c_int = 63;
279pub const ENONET: ::c_int = 64;
280pub const ENOPKG: ::c_int = 65;
281pub const EREMOTE: ::c_int = 66;
282pub const ENOLINK: ::c_int = 67;
283pub const EADV: ::c_int = 68;
284pub const ESRMNT: ::c_int = 69;
285pub const ECOMM: ::c_int = 70;
286pub const EPROTO: ::c_int = 71;
287pub const EDOTDOT: ::c_int = 73;
288
289pub const SA_NODEFER: ::c_int = 0x40000000;
290pub const SA_RESETHAND: ::c_int = 0x80000000;
291pub const SA_RESTART: ::c_int = 0x10000000;
292pub const SA_NOCLDSTOP: ::c_int = 0x00000001;
293
294pub const EPOLL_CLOEXEC: ::c_int = 0x80000;
295
296pub const EFD_CLOEXEC: ::c_int = 0x80000;
297
298pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4;
299pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 24;
300pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 32;
301pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4;
302pub const __SIZEOF_PTHREAD_RWLOCKATTR_T: usize = 8;
303
304align_const! {
305    #[cfg(target_endian = "little")]
306    pub const PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
307        pthread_mutex_t {
308            size: [
309                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
310                0, 0, 0,
311            ],
312        };
313    #[cfg(target_endian = "little")]
314    pub const PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
315        pthread_mutex_t {
316            size: [
317                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0,
318                0, 0, 0,
319            ],
320        };
321    #[cfg(target_endian = "little")]
322    pub const PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
323        pthread_mutex_t {
324            size: [
325                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0,
326                0, 0, 0,
327            ],
328        };
329    #[cfg(target_endian = "big")]
330    pub const PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
331        pthread_mutex_t {
332            size: [
333                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
334                0, 0, 0,
335            ],
336        };
337    #[cfg(target_endian = "big")]
338    pub const PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
339        pthread_mutex_t {
340            size: [
341                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0,
342                0, 0, 0,
343            ],
344        };
345    #[cfg(target_endian = "big")]
346    pub const PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
347        pthread_mutex_t {
348            size: [
349                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0,
350                0, 0, 0,
351            ],
352        };
353}
354
355pub const PTRACE_GETFPREGS: ::c_uint = 14;
356pub const PTRACE_SETFPREGS: ::c_uint = 15;
357pub const PTRACE_GETREGS: ::c_uint = 12;
358pub const PTRACE_SETREGS: ::c_uint = 13;
359
360cfg_if! {
361    if #[cfg(target_arch = "x86")] {
362        mod x86;
363        pub use self::x86::*;
364    } else if #[cfg(target_arch = "arm")] {
365        mod arm;
366        pub use self::arm::*;
367    } else if #[cfg(target_arch = "powerpc")] {
368        mod powerpc;
369        pub use self::powerpc::*;
370    } else {
371        // Unknown target_arch
372    }
373}