]>
Commit | Line | Data |
---|---|---|
7453a54e SL |
1 | pub type clock_t = c_long; |
2 | pub type time_t = c_long; | |
3 | pub type suseconds_t = c_long; | |
4 | pub type ino_t = u64; | |
5 | pub type off_t = i64; | |
6 | pub type blkcnt_t = i64; | |
7 | ||
abe05a73 XL |
8 | pub type shmatt_t = ::c_ulong; |
9 | pub type msgqnum_t = ::c_ulong; | |
10 | pub type msglen_t = ::c_ulong; | |
7453a54e SL |
11 | pub type fsblkcnt_t = ::c_ulonglong; |
12 | pub type fsfilcnt_t = ::c_ulonglong; | |
13 | pub type rlim_t = ::c_ulonglong; | |
14 | ||
15 | s! { | |
476ff2be SL |
16 | pub struct aiocb { |
17 | pub aio_fildes: ::c_int, | |
18 | pub aio_lio_opcode: ::c_int, | |
19 | pub aio_reqprio: ::c_int, | |
20 | pub aio_buf: *mut ::c_void, | |
21 | pub aio_nbytes: ::size_t, | |
22 | pub aio_sigevent: ::sigevent, | |
23 | __td: *mut ::c_void, | |
24 | __lock: [::c_int; 2], | |
25 | __err: ::c_int, | |
26 | __ret: ::ssize_t, | |
27 | pub aio_offset: off_t, | |
28 | __next: *mut ::c_void, | |
29 | __prev: *mut ::c_void, | |
30 | #[cfg(target_pointer_width = "32")] | |
31 | __dummy4: [::c_char; 24], | |
32 | #[cfg(target_pointer_width = "64")] | |
33 | __dummy4: [::c_char; 16], | |
34 | } | |
35 | ||
7453a54e SL |
36 | pub struct sigaction { |
37 | pub sa_sigaction: ::sighandler_t, | |
38 | pub sa_mask: ::sigset_t, | |
39 | pub sa_flags: ::c_int, | |
7cac9316 | 40 | pub sa_restorer: ::dox::Option<extern fn()>, |
7453a54e SL |
41 | } |
42 | ||
8faf50e0 XL |
43 | pub struct statvfs { |
44 | pub f_bsize: ::c_ulong, | |
45 | pub f_frsize: ::c_ulong, | |
46 | pub f_blocks: ::fsblkcnt_t, | |
47 | pub f_bfree: ::fsblkcnt_t, | |
48 | pub f_bavail: ::fsblkcnt_t, | |
49 | pub f_files: ::fsfilcnt_t, | |
50 | pub f_ffree: ::fsfilcnt_t, | |
51 | pub f_favail: ::fsfilcnt_t, | |
52 | #[cfg(target_endian = "little")] | |
53 | pub f_fsid: ::c_ulong, | |
54 | #[cfg(target_pointer_width = "32")] | |
55 | __f_unused: ::c_int, | |
56 | #[cfg(target_endian = "big")] | |
57 | pub f_fsid: ::c_ulong, | |
58 | pub f_flag: ::c_ulong, | |
59 | pub f_namemax: ::c_ulong, | |
60 | __f_spare: [::c_int; 6], | |
61 | } | |
62 | ||
7453a54e SL |
63 | pub struct termios { |
64 | pub c_iflag: ::tcflag_t, | |
65 | pub c_oflag: ::tcflag_t, | |
66 | pub c_cflag: ::tcflag_t, | |
67 | pub c_lflag: ::tcflag_t, | |
68 | pub c_line: ::cc_t, | |
69 | pub c_cc: [::cc_t; ::NCCS], | |
70 | pub __c_ispeed: ::speed_t, | |
71 | pub __c_ospeed: ::speed_t, | |
72 | } | |
73 | ||
74 | pub struct flock { | |
75 | pub l_type: ::c_short, | |
76 | pub l_whence: ::c_short, | |
77 | pub l_start: ::off_t, | |
78 | pub l_len: ::off_t, | |
79 | pub l_pid: ::pid_t, | |
80 | } | |
3157f602 XL |
81 | |
82 | pub struct sysinfo { | |
83 | pub uptime: ::c_ulong, | |
84 | pub loads: [::c_ulong; 3], | |
85 | pub totalram: ::c_ulong, | |
86 | pub freeram: ::c_ulong, | |
87 | pub sharedram: ::c_ulong, | |
88 | pub bufferram: ::c_ulong, | |
89 | pub totalswap: ::c_ulong, | |
90 | pub freeswap: ::c_ulong, | |
91 | pub procs: ::c_ushort, | |
92 | pub pad: ::c_ushort, | |
93 | pub totalhigh: ::c_ulong, | |
94 | pub freehigh: ::c_ulong, | |
95 | pub mem_unit: ::c_uint, | |
96 | pub __reserved: [::c_char; 256], | |
97 | } | |
7453a54e SL |
98 | } |
99 | ||
32a655c1 SL |
100 | pub const SFD_CLOEXEC: ::c_int = 0x080000; |
101 | ||
102 | pub const NCCS: usize = 32; | |
103 | ||
104 | pub const O_TRUNC: ::c_int = 512; | |
3b2f2976 | 105 | pub const O_NOATIME: ::c_int = 0o1000000; |
32a655c1 | 106 | pub const O_CLOEXEC: ::c_int = 0x80000; |
abe05a73 | 107 | pub const O_TMPFILE: ::c_int = 0o20000000 | O_DIRECTORY; |
32a655c1 SL |
108 | |
109 | pub const EBFONT: ::c_int = 59; | |
110 | pub const ENOSTR: ::c_int = 60; | |
111 | pub const ENODATA: ::c_int = 61; | |
112 | pub const ETIME: ::c_int = 62; | |
113 | pub const ENOSR: ::c_int = 63; | |
114 | pub const ENONET: ::c_int = 64; | |
115 | pub const ENOPKG: ::c_int = 65; | |
116 | pub const EREMOTE: ::c_int = 66; | |
117 | pub const ENOLINK: ::c_int = 67; | |
118 | pub const EADV: ::c_int = 68; | |
119 | pub const ESRMNT: ::c_int = 69; | |
120 | pub const ECOMM: ::c_int = 70; | |
121 | pub const EPROTO: ::c_int = 71; | |
122 | pub const EDOTDOT: ::c_int = 73; | |
123 | ||
124 | pub const SA_NODEFER: ::c_int = 0x40000000; | |
125 | pub const SA_RESETHAND: ::c_int = 0x80000000; | |
126 | pub const SA_RESTART: ::c_int = 0x10000000; | |
127 | pub const SA_NOCLDSTOP: ::c_int = 0x00000001; | |
128 | ||
129 | pub const EPOLL_CLOEXEC: ::c_int = 0x80000; | |
130 | ||
131 | pub const EFD_CLOEXEC: ::c_int = 0x80000; | |
132 | ||
7453a54e SL |
133 | pub const BUFSIZ: ::c_uint = 1024; |
134 | pub const TMP_MAX: ::c_uint = 10000; | |
135 | pub const FOPEN_MAX: ::c_uint = 1000; | |
cc61c64b XL |
136 | pub const O_PATH: ::c_int = 0o10000000; |
137 | pub const O_EXEC: ::c_int = 0o10000000; | |
138 | pub const O_SEARCH: ::c_int = 0o10000000; | |
7453a54e SL |
139 | pub const O_ACCMODE: ::c_int = 0o10000003; |
140 | pub const O_NDELAY: ::c_int = O_NONBLOCK; | |
7453a54e SL |
141 | pub const NI_MAXHOST: ::socklen_t = 255; |
142 | pub const PTHREAD_STACK_MIN: ::size_t = 2048; | |
9e0c209e SL |
143 | pub const POSIX_FADV_DONTNEED: ::c_int = 4; |
144 | pub const POSIX_FADV_NOREUSE: ::c_int = 5; | |
145 | ||
146 | pub const POSIX_MADV_DONTNEED: ::c_int = 4; | |
7453a54e SL |
147 | |
148 | pub const RLIM_INFINITY: ::rlim_t = !0; | |
149 | pub const RLIMIT_RTTIME: ::c_int = 15; | |
7453a54e SL |
150 | |
151 | pub const MAP_ANONYMOUS: ::c_int = MAP_ANON; | |
152 | ||
abe05a73 XL |
153 | pub const SOCK_DCCP: ::c_int = 6; |
154 | pub const SOCK_PACKET: ::c_int = 10; | |
155 | ||
7453a54e SL |
156 | pub const TCP_COOKIE_TRANSACTIONS: ::c_int = 15; |
157 | pub const TCP_THIN_LINEAR_TIMEOUTS: ::c_int = 16; | |
158 | pub const TCP_THIN_DUPACK: ::c_int = 17; | |
159 | pub const TCP_USER_TIMEOUT: ::c_int = 18; | |
160 | pub const TCP_REPAIR: ::c_int = 19; | |
161 | pub const TCP_REPAIR_QUEUE: ::c_int = 20; | |
162 | pub const TCP_QUEUE_SEQ: ::c_int = 21; | |
163 | pub const TCP_REPAIR_OPTIONS: ::c_int = 22; | |
164 | pub const TCP_FASTOPEN: ::c_int = 23; | |
165 | pub const TCP_TIMESTAMP: ::c_int = 24; | |
166 | ||
167 | pub const SIGUNUSED: ::c_int = ::SIGSYS; | |
168 | ||
5bcae85e | 169 | pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4; |
7453a54e | 170 | pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4; |
3b2f2976 | 171 | pub const __SIZEOF_PTHREAD_RWLOCKATTR_T: usize = 8; |
7453a54e SL |
172 | |
173 | pub const CPU_SETSIZE: ::c_int = 128; | |
174 | ||
7453a54e SL |
175 | pub const PTRACE_TRACEME: ::c_int = 0; |
176 | pub const PTRACE_PEEKTEXT: ::c_int = 1; | |
177 | pub const PTRACE_PEEKDATA: ::c_int = 2; | |
178 | pub const PTRACE_PEEKUSER: ::c_int = 3; | |
179 | pub const PTRACE_POKETEXT: ::c_int = 4; | |
180 | pub const PTRACE_POKEDATA: ::c_int = 5; | |
181 | pub const PTRACE_POKEUSER: ::c_int = 6; | |
182 | pub const PTRACE_CONT: ::c_int = 7; | |
183 | pub const PTRACE_KILL: ::c_int = 8; | |
184 | pub const PTRACE_SINGLESTEP: ::c_int = 9; | |
3b2f2976 XL |
185 | pub const PTRACE_GETREGS: ::c_int = 12; |
186 | pub const PTRACE_SETREGS: ::c_int = 13; | |
187 | pub const PTRACE_GETFPREGS: ::c_int = 14; | |
188 | pub const PTRACE_SETFPREGS: ::c_int = 15; | |
7453a54e SL |
189 | pub const PTRACE_ATTACH: ::c_int = 16; |
190 | pub const PTRACE_DETACH: ::c_int = 17; | |
3b2f2976 XL |
191 | pub const PTRACE_GETFPXREGS: ::c_int = 18; |
192 | pub const PTRACE_SETFPXREGS: ::c_int = 19; | |
7453a54e SL |
193 | pub const PTRACE_SYSCALL: ::c_int = 24; |
194 | pub const PTRACE_SETOPTIONS: ::c_int = 0x4200; | |
195 | pub const PTRACE_GETEVENTMSG: ::c_int = 0x4201; | |
196 | pub const PTRACE_GETSIGINFO: ::c_int = 0x4202; | |
197 | pub const PTRACE_SETSIGINFO: ::c_int = 0x4203; | |
198 | pub const PTRACE_GETREGSET: ::c_int = 0x4204; | |
199 | pub const PTRACE_SETREGSET: ::c_int = 0x4205; | |
200 | pub const PTRACE_SEIZE: ::c_int = 0x4206; | |
201 | pub const PTRACE_INTERRUPT: ::c_int = 0x4207; | |
202 | pub const PTRACE_LISTEN: ::c_int = 0x4208; | |
203 | pub const PTRACE_PEEKSIGINFO: ::c_int = 0x4209; | |
204 | ||
7453a54e SL |
205 | pub const EPOLLWAKEUP: ::c_int = 0x20000000; |
206 | ||
7453a54e SL |
207 | pub const EFD_NONBLOCK: ::c_int = ::O_NONBLOCK; |
208 | ||
209 | pub const SFD_NONBLOCK: ::c_int = ::O_NONBLOCK; | |
210 | ||
211 | pub const TCSANOW: ::c_int = 0; | |
212 | pub const TCSADRAIN: ::c_int = 1; | |
213 | pub const TCSAFLUSH: ::c_int = 2; | |
214 | ||
7453a54e SL |
215 | pub const RTLD_GLOBAL: ::c_int = 0x100; |
216 | pub const RTLD_NOLOAD: ::c_int = 0x4; | |
217 | ||
54a0048b SL |
218 | // TODO(#247) Temporarily musl-specific (available since musl 0.9.12 / Linux |
219 | // kernel 3.10). See also notbsd/mod.rs | |
220 | pub const CLOCK_SGI_CYCLE: ::clockid_t = 10; | |
221 | pub const CLOCK_TAI: ::clockid_t = 11; | |
222 | ||
cc61c64b XL |
223 | pub const B0: ::speed_t = 0o000000; |
224 | pub const B50: ::speed_t = 0o000001; | |
225 | pub const B75: ::speed_t = 0o000002; | |
226 | pub const B110: ::speed_t = 0o000003; | |
227 | pub const B134: ::speed_t = 0o000004; | |
228 | pub const B150: ::speed_t = 0o000005; | |
229 | pub const B200: ::speed_t = 0o000006; | |
230 | pub const B300: ::speed_t = 0o000007; | |
231 | pub const B600: ::speed_t = 0o000010; | |
232 | pub const B1200: ::speed_t = 0o000011; | |
233 | pub const B1800: ::speed_t = 0o000012; | |
234 | pub const B2400: ::speed_t = 0o000013; | |
235 | pub const B4800: ::speed_t = 0o000014; | |
236 | pub const B9600: ::speed_t = 0o000015; | |
237 | pub const B19200: ::speed_t = 0o000016; | |
238 | pub const B38400: ::speed_t = 0o000017; | |
239 | pub const EXTA: ::speed_t = B19200; | |
240 | pub const EXTB: ::speed_t = B38400; | |
cc61c64b | 241 | |
3b2f2976 XL |
242 | pub const SO_BINDTODEVICE: ::c_int = 25; |
243 | pub const SO_TIMESTAMP: ::c_int = 29; | |
244 | pub const SO_MARK: ::c_int = 36; | |
245 | pub const SO_RXQ_OVFL: ::c_int = 40; | |
246 | pub const SO_PEEK_OFF: ::c_int = 42; | |
247 | pub const SO_BUSY_POLL: ::c_int = 46; | |
248 | ||
7453a54e | 249 | extern { |
7453a54e | 250 | pub fn ptrace(request: ::c_int, ...) -> ::c_long; |
3157f602 XL |
251 | pub fn getpriority(which: ::c_int, who: ::id_t) -> ::c_int; |
252 | pub fn setpriority(which: ::c_int, who: ::id_t, prio: ::c_int) -> ::c_int; | |
7453a54e SL |
253 | } |
254 | ||
255 | cfg_if! { | |
abe05a73 XL |
256 | if #[cfg(any(target_arch = "x86_64", |
257 | target_arch = "aarch64", | |
258 | target_arch = "powerpc64"))] { | |
7453a54e SL |
259 | mod b64; |
260 | pub use self::b64::*; | |
261 | } else if #[cfg(any(target_arch = "x86", | |
262 | target_arch = "mips", | |
b7449926 XL |
263 | target_arch = "arm", |
264 | target_arch = "powerpc"))] { | |
7453a54e SL |
265 | mod b32; |
266 | pub use self::b32::*; | |
267 | } else { } | |
268 | } |