1 | //! Definitions found commonly among almost all Unix derivatives |
2 | //! |
3 | //! More functions and definitions can be found in the more specific modules |
4 | //! according to the platform in question. |
5 | |
6 | pub type c_schar = i8; |
7 | pub type c_uchar = u8; |
8 | pub type c_short = i16; |
9 | pub type c_ushort = u16; |
10 | pub type c_int = i32; |
11 | pub type c_uint = u32; |
12 | pub type c_float = f32; |
13 | pub type c_double = f64; |
14 | pub type c_longlong = i64; |
15 | pub type c_ulonglong = u64; |
16 | pub type intmax_t = i64; |
17 | pub type uintmax_t = u64; |
18 | |
19 | pub type size_t = usize; |
20 | pub type ptrdiff_t = isize; |
21 | pub type intptr_t = isize; |
22 | pub type uintptr_t = usize; |
23 | pub type ssize_t = isize; |
24 | |
25 | pub type pid_t = i32; |
26 | pub type in_addr_t = u32; |
27 | pub type in_port_t = u16; |
28 | pub type sighandler_t = ::size_t; |
29 | pub type cc_t = ::c_uchar; |
30 | |
31 | cfg_if! { |
32 | if #[cfg(any(target_os = "espidf" , target_os = "horizon" , target_os = "vita" ))] { |
33 | pub type uid_t = ::c_ushort; |
34 | pub type gid_t = ::c_ushort; |
35 | } else if #[cfg(target_os = "nto" )] { |
36 | pub type uid_t = i32; |
37 | pub type gid_t = i32; |
38 | } else { |
39 | pub type uid_t = u32; |
40 | pub type gid_t = u32; |
41 | } |
42 | } |
43 | |
44 | missing! { |
45 | #[cfg_attr (feature = "extra_traits" , derive(Debug))] |
46 | pub enum DIR {} |
47 | } |
48 | pub type locale_t = *mut ::c_void; |
49 | |
50 | s! { |
51 | pub struct group { |
52 | pub gr_name: *mut ::c_char, |
53 | pub gr_passwd: *mut ::c_char, |
54 | pub gr_gid: ::gid_t, |
55 | pub gr_mem: *mut *mut ::c_char, |
56 | } |
57 | |
58 | pub struct utimbuf { |
59 | pub actime: time_t, |
60 | pub modtime: time_t, |
61 | } |
62 | |
63 | pub struct timeval { |
64 | pub tv_sec: time_t, |
65 | pub tv_usec: suseconds_t, |
66 | } |
67 | |
68 | // linux x32 compatibility |
69 | // See https://sourceware.org/bugzilla/show_bug.cgi?id=16437 |
70 | pub struct timespec { |
71 | pub tv_sec: time_t, |
72 | #[cfg (all(target_arch = "x86_64" , target_pointer_width = "32" ))] |
73 | pub tv_nsec: i64, |
74 | #[cfg (not(all(target_arch = "x86_64" , target_pointer_width = "32" )))] |
75 | pub tv_nsec: ::c_long, |
76 | } |
77 | |
78 | pub struct rlimit { |
79 | pub rlim_cur: rlim_t, |
80 | pub rlim_max: rlim_t, |
81 | } |
82 | |
83 | pub struct rusage { |
84 | pub ru_utime: timeval, |
85 | pub ru_stime: timeval, |
86 | pub ru_maxrss: c_long, |
87 | #[cfg (all(target_arch = "x86_64" , target_pointer_width = "32" ))] |
88 | __pad1: u32, |
89 | pub ru_ixrss: c_long, |
90 | #[cfg (all(target_arch = "x86_64" , target_pointer_width = "32" ))] |
91 | __pad2: u32, |
92 | pub ru_idrss: c_long, |
93 | #[cfg (all(target_arch = "x86_64" , target_pointer_width = "32" ))] |
94 | __pad3: u32, |
95 | pub ru_isrss: c_long, |
96 | #[cfg (all(target_arch = "x86_64" , target_pointer_width = "32" ))] |
97 | __pad4: u32, |
98 | pub ru_minflt: c_long, |
99 | #[cfg (all(target_arch = "x86_64" , target_pointer_width = "32" ))] |
100 | __pad5: u32, |
101 | pub ru_majflt: c_long, |
102 | #[cfg (all(target_arch = "x86_64" , target_pointer_width = "32" ))] |
103 | __pad6: u32, |
104 | pub ru_nswap: c_long, |
105 | #[cfg (all(target_arch = "x86_64" , target_pointer_width = "32" ))] |
106 | __pad7: u32, |
107 | pub ru_inblock: c_long, |
108 | #[cfg (all(target_arch = "x86_64" , target_pointer_width = "32" ))] |
109 | __pad8: u32, |
110 | pub ru_oublock: c_long, |
111 | #[cfg (all(target_arch = "x86_64" , target_pointer_width = "32" ))] |
112 | __pad9: u32, |
113 | pub ru_msgsnd: c_long, |
114 | #[cfg (all(target_arch = "x86_64" , target_pointer_width = "32" ))] |
115 | __pad10: u32, |
116 | pub ru_msgrcv: c_long, |
117 | #[cfg (all(target_arch = "x86_64" , target_pointer_width = "32" ))] |
118 | __pad11: u32, |
119 | pub ru_nsignals: c_long, |
120 | #[cfg (all(target_arch = "x86_64" , target_pointer_width = "32" ))] |
121 | __pad12: u32, |
122 | pub ru_nvcsw: c_long, |
123 | #[cfg (all(target_arch = "x86_64" , target_pointer_width = "32" ))] |
124 | __pad13: u32, |
125 | pub ru_nivcsw: c_long, |
126 | #[cfg (all(target_arch = "x86_64" , target_pointer_width = "32" ))] |
127 | __pad14: u32, |
128 | |
129 | #[cfg (any(target_env = "musl" , target_env = "ohos" , target_os = "emscripten" ))] |
130 | __reserved: [c_long; 16], |
131 | } |
132 | |
133 | pub struct ipv6_mreq { |
134 | pub ipv6mr_multiaddr: in6_addr, |
135 | #[cfg (target_os = "android" )] |
136 | pub ipv6mr_interface: ::c_int, |
137 | #[cfg (not(target_os = "android" ))] |
138 | pub ipv6mr_interface: ::c_uint, |
139 | } |
140 | |
141 | pub struct hostent { |
142 | pub h_name: *mut ::c_char, |
143 | pub h_aliases: *mut *mut ::c_char, |
144 | pub h_addrtype: ::c_int, |
145 | pub h_length: ::c_int, |
146 | pub h_addr_list: *mut *mut ::c_char, |
147 | } |
148 | |
149 | pub struct iovec { |
150 | pub iov_base: *mut ::c_void, |
151 | pub iov_len: ::size_t, |
152 | } |
153 | |
154 | pub struct pollfd { |
155 | pub fd: ::c_int, |
156 | pub events: ::c_short, |
157 | pub revents: ::c_short, |
158 | } |
159 | |
160 | pub struct winsize { |
161 | pub ws_row: ::c_ushort, |
162 | pub ws_col: ::c_ushort, |
163 | pub ws_xpixel: ::c_ushort, |
164 | pub ws_ypixel: ::c_ushort, |
165 | } |
166 | |
167 | pub struct linger { |
168 | pub l_onoff: ::c_int, |
169 | pub l_linger: ::c_int, |
170 | } |
171 | |
172 | pub struct sigval { |
173 | // Actually a union of an int and a void* |
174 | pub sival_ptr: *mut ::c_void |
175 | } |
176 | |
177 | // <sys/time.h> |
178 | pub struct itimerval { |
179 | pub it_interval: ::timeval, |
180 | pub it_value: ::timeval, |
181 | } |
182 | |
183 | // <sys/times.h> |
184 | pub struct tms { |
185 | pub tms_utime: ::clock_t, |
186 | pub tms_stime: ::clock_t, |
187 | pub tms_cutime: ::clock_t, |
188 | pub tms_cstime: ::clock_t, |
189 | } |
190 | |
191 | pub struct servent { |
192 | pub s_name: *mut ::c_char, |
193 | pub s_aliases: *mut *mut ::c_char, |
194 | pub s_port: ::c_int, |
195 | pub s_proto: *mut ::c_char, |
196 | } |
197 | |
198 | pub struct protoent { |
199 | pub p_name: *mut ::c_char, |
200 | pub p_aliases: *mut *mut ::c_char, |
201 | pub p_proto: ::c_int, |
202 | } |
203 | } |
204 | |
205 | pub const INT_MIN: c_int = -2147483648; |
206 | pub const INT_MAX: c_int = 2147483647; |
207 | |
208 | pub const SIG_DFL: sighandler_t = 0 as sighandler_t; |
209 | pub const SIG_IGN: sighandler_t = 1 as sighandler_t; |
210 | pub const SIG_ERR: sighandler_t = !0 as sighandler_t; |
211 | cfg_if! { |
212 | if #[cfg(not(target_os = "nto" ))] { |
213 | pub const DT_UNKNOWN: u8 = 0; |
214 | pub const DT_FIFO: u8 = 1; |
215 | pub const DT_CHR: u8 = 2; |
216 | pub const DT_DIR: u8 = 4; |
217 | pub const DT_BLK: u8 = 6; |
218 | pub const DT_REG: u8 = 8; |
219 | pub const DT_LNK: u8 = 10; |
220 | pub const DT_SOCK: u8 = 12; |
221 | } |
222 | } |
223 | cfg_if! { |
224 | if #[cfg(not(target_os = "redox" ))] { |
225 | pub const FD_CLOEXEC: ::c_int = 0x1; |
226 | } |
227 | } |
228 | |
229 | cfg_if! { |
230 | if #[cfg(not(target_os = "nto" ))] |
231 | { |
232 | pub const USRQUOTA: ::c_int = 0; |
233 | pub const GRPQUOTA: ::c_int = 1; |
234 | } |
235 | } |
236 | pub const SIGIOT: ::c_int = 6; |
237 | |
238 | pub const S_ISUID: ::mode_t = 0x800; |
239 | pub const S_ISGID: ::mode_t = 0x400; |
240 | pub const S_ISVTX: ::mode_t = 0x200; |
241 | |
242 | cfg_if! { |
243 | if #[cfg(not(any(target_os = "haiku" , target_os = "illumos" , |
244 | target_os = "solaris" )))] { |
245 | pub const IF_NAMESIZE: ::size_t = 16; |
246 | pub const IFNAMSIZ: ::size_t = IF_NAMESIZE; |
247 | } |
248 | } |
249 | |
250 | pub const LOG_EMERG: ::c_int = 0; |
251 | pub const LOG_ALERT: ::c_int = 1; |
252 | pub const LOG_CRIT: ::c_int = 2; |
253 | pub const LOG_ERR: ::c_int = 3; |
254 | pub const LOG_WARNING: ::c_int = 4; |
255 | pub const LOG_NOTICE: ::c_int = 5; |
256 | pub const LOG_INFO: ::c_int = 6; |
257 | pub const LOG_DEBUG: ::c_int = 7; |
258 | |
259 | pub const LOG_KERN: ::c_int = 0; |
260 | pub const LOG_USER: ::c_int = 1 << 3; |
261 | pub const LOG_MAIL: ::c_int = 2 << 3; |
262 | pub const LOG_DAEMON: ::c_int = 3 << 3; |
263 | pub const LOG_AUTH: ::c_int = 4 << 3; |
264 | pub const LOG_SYSLOG: ::c_int = 5 << 3; |
265 | pub const LOG_LPR: ::c_int = 6 << 3; |
266 | pub const LOG_NEWS: ::c_int = 7 << 3; |
267 | pub const LOG_UUCP: ::c_int = 8 << 3; |
268 | pub const LOG_LOCAL0: ::c_int = 16 << 3; |
269 | pub const LOG_LOCAL1: ::c_int = 17 << 3; |
270 | pub const LOG_LOCAL2: ::c_int = 18 << 3; |
271 | pub const LOG_LOCAL3: ::c_int = 19 << 3; |
272 | pub const LOG_LOCAL4: ::c_int = 20 << 3; |
273 | pub const LOG_LOCAL5: ::c_int = 21 << 3; |
274 | pub const LOG_LOCAL6: ::c_int = 22 << 3; |
275 | pub const LOG_LOCAL7: ::c_int = 23 << 3; |
276 | |
277 | cfg_if! { |
278 | if #[cfg(not(target_os = "haiku" ))] { |
279 | pub const LOG_PID: ::c_int = 0x01; |
280 | pub const LOG_CONS: ::c_int = 0x02; |
281 | pub const LOG_ODELAY: ::c_int = 0x04; |
282 | pub const LOG_NDELAY: ::c_int = 0x08; |
283 | pub const LOG_NOWAIT: ::c_int = 0x10; |
284 | } |
285 | } |
286 | pub const LOG_PRIMASK: ::c_int = 7; |
287 | pub const LOG_FACMASK: ::c_int = 0x3f8; |
288 | |
289 | cfg_if! { |
290 | if #[cfg(not(target_os = "nto" ))] |
291 | { |
292 | pub const PRIO_MIN: ::c_int = -20; |
293 | pub const PRIO_MAX: ::c_int = 20; |
294 | } |
295 | } |
296 | pub const IPPROTO_ICMP: ::c_int = 1; |
297 | pub const IPPROTO_ICMPV6: ::c_int = 58; |
298 | pub const IPPROTO_TCP: ::c_int = 6; |
299 | pub const IPPROTO_UDP: ::c_int = 17; |
300 | pub const IPPROTO_IP: ::c_int = 0; |
301 | pub const IPPROTO_IPV6: ::c_int = 41; |
302 | |
303 | pub const INADDR_LOOPBACK: in_addr_t = 2130706433; |
304 | pub const INADDR_ANY: in_addr_t = 0; |
305 | pub const INADDR_BROADCAST: in_addr_t = 4294967295; |
306 | pub const INADDR_NONE: in_addr_t = 4294967295; |
307 | |
308 | pub const ARPOP_REQUEST: u16 = 1; |
309 | pub const ARPOP_REPLY: u16 = 2; |
310 | |
311 | pub const ATF_COM: ::c_int = 0x02; |
312 | pub const ATF_PERM: ::c_int = 0x04; |
313 | pub const ATF_PUBL: ::c_int = 0x08; |
314 | pub const ATF_USETRAILERS: ::c_int = 0x10; |
315 | |
316 | cfg_if! { |
317 | if #[cfg(any(target_os = "l4re" , target_os = "espidf" ))] { |
318 | // required libraries for L4Re and the ESP-IDF framework are linked externally, ATM |
319 | } else if #[cfg(feature = "std" )] { |
320 | // cargo build, don't pull in anything extra as the std dep |
321 | // already pulls in all libs. |
322 | } else if #[cfg(all(target_os = "linux" , |
323 | any(target_env = "gnu" , target_env = "uclibc" ), |
324 | feature = "rustc-dep-of-std" ))] { |
325 | #[link (name = "util" , kind = "static" , modifiers = "-bundle" , |
326 | cfg(target_feature = "crt-static" ))] |
327 | #[link (name = "rt" , kind = "static" , modifiers = "-bundle" , |
328 | cfg(target_feature = "crt-static" ))] |
329 | #[link (name = "pthread" , kind = "static" , modifiers = "-bundle" , |
330 | cfg(target_feature = "crt-static" ))] |
331 | #[link (name = "m" , kind = "static" , modifiers = "-bundle" , |
332 | cfg(target_feature = "crt-static" ))] |
333 | #[link (name = "dl" , kind = "static" , modifiers = "-bundle" , |
334 | cfg(target_feature = "crt-static" ))] |
335 | #[link (name = "c" , kind = "static" , modifiers = "-bundle" , |
336 | cfg(target_feature = "crt-static" ))] |
337 | #[link (name = "gcc_eh" , kind = "static" , modifiers = "-bundle" , |
338 | cfg(target_feature = "crt-static" ))] |
339 | #[link (name = "gcc" , kind = "static" , modifiers = "-bundle" , |
340 | cfg(target_feature = "crt-static" ))] |
341 | #[link (name = "c" , kind = "static" , modifiers = "-bundle" , |
342 | cfg(target_feature = "crt-static" ))] |
343 | #[link (name = "util" , cfg(not(target_feature = "crt-static" )))] |
344 | #[link (name = "rt" , cfg(not(target_feature = "crt-static" )))] |
345 | #[link (name = "pthread" , cfg(not(target_feature = "crt-static" )))] |
346 | #[link (name = "m" , cfg(not(target_feature = "crt-static" )))] |
347 | #[link (name = "dl" , cfg(not(target_feature = "crt-static" )))] |
348 | #[link (name = "c" , cfg(not(target_feature = "crt-static" )))] |
349 | extern {} |
350 | } else if #[cfg(any(target_env = "musl" , target_env = "ohos" ))] { |
351 | #[cfg_attr (feature = "rustc-dep-of-std" , |
352 | link(name = "c" , kind = "static" , modifiers = "-bundle" , |
353 | cfg(target_feature = "crt-static" )))] |
354 | #[cfg_attr (feature = "rustc-dep-of-std" , |
355 | link(name = "c" , cfg(not(target_feature = "crt-static" ))))] |
356 | extern {} |
357 | } else if #[cfg(target_os = "emscripten" )] { |
358 | #[link (name = "c" )] |
359 | extern {} |
360 | } else if #[cfg(all(target_os = "android" , feature = "rustc-dep-of-std" ))] { |
361 | #[link (name = "c" , kind = "static" , modifiers = "-bundle" , |
362 | cfg(target_feature = "crt-static" ))] |
363 | #[link (name = "m" , kind = "static" , modifiers = "-bundle" , |
364 | cfg(target_feature = "crt-static" ))] |
365 | #[link (name = "m" , cfg(not(target_feature = "crt-static" )))] |
366 | #[link (name = "c" , cfg(not(target_feature = "crt-static" )))] |
367 | extern {} |
368 | } else if #[cfg(any(target_os = "macos" , |
369 | target_os = "ios" , |
370 | target_os = "tvos" , |
371 | target_os = "watchos" , |
372 | target_os = "android" , |
373 | target_os = "openbsd" , |
374 | target_os = "nto" , |
375 | ))] { |
376 | #[link (name = "c" )] |
377 | #[link (name = "m" )] |
378 | extern {} |
379 | } else if #[cfg(target_os = "haiku" )] { |
380 | #[link (name = "root" )] |
381 | #[link (name = "network" )] |
382 | extern {} |
383 | } else if #[cfg(target_env = "newlib" )] { |
384 | #[link (name = "c" )] |
385 | #[link (name = "m" )] |
386 | extern {} |
387 | } else if #[cfg(target_env = "illumos" )] { |
388 | #[link (name = "c" )] |
389 | #[link (name = "m" )] |
390 | extern {} |
391 | } else if #[cfg(target_os = "redox" )] { |
392 | #[cfg_attr (feature = "rustc-dep-of-std" , |
393 | link(name = "c" , kind = "static" , modifiers = "-bundle" , |
394 | cfg(target_feature = "crt-static" )))] |
395 | #[cfg_attr (feature = "rustc-dep-of-std" , |
396 | link(name = "c" , cfg(not(target_feature = "crt-static" ))))] |
397 | extern {} |
398 | } else if #[cfg(target_env = "aix" )] { |
399 | #[link (name = "c" )] |
400 | #[link (name = "m" )] |
401 | #[link (name = "bsd" )] |
402 | #[link (name = "pthread" )] |
403 | extern {} |
404 | } else { |
405 | #[link (name = "c" )] |
406 | #[link (name = "m" )] |
407 | #[link (name = "rt" )] |
408 | #[link (name = "pthread" )] |
409 | extern {} |
410 | } |
411 | } |
412 | |
413 | missing! { |
414 | #[cfg_attr (feature = "extra_traits" , derive(Debug))] |
415 | pub enum FILE {} |
416 | #[cfg_attr (feature = "extra_traits" , derive(Debug))] |
417 | pub enum fpos_t {} // FIXME: fill this out with a struct |
418 | } |
419 | |
420 | extern "C" { |
421 | pub fn isalnum(c: c_int) -> c_int; |
422 | pub fn isalpha(c: c_int) -> c_int; |
423 | pub fn iscntrl(c: c_int) -> c_int; |
424 | pub fn isdigit(c: c_int) -> c_int; |
425 | pub fn isgraph(c: c_int) -> c_int; |
426 | pub fn islower(c: c_int) -> c_int; |
427 | pub fn isprint(c: c_int) -> c_int; |
428 | pub fn ispunct(c: c_int) -> c_int; |
429 | pub fn isspace(c: c_int) -> c_int; |
430 | pub fn isupper(c: c_int) -> c_int; |
431 | pub fn isxdigit(c: c_int) -> c_int; |
432 | pub fn isblank(c: c_int) -> c_int; |
433 | pub fn tolower(c: c_int) -> c_int; |
434 | pub fn toupper(c: c_int) -> c_int; |
435 | pub fn qsort( |
436 | base: *mut c_void, |
437 | num: size_t, |
438 | size: size_t, |
439 | compar: ::Option<unsafe extern "C" fn(*const c_void, *const c_void) -> c_int>, |
440 | ); |
441 | pub fn bsearch( |
442 | key: *const c_void, |
443 | base: *const c_void, |
444 | num: size_t, |
445 | size: size_t, |
446 | compar: ::Option<unsafe extern "C" fn(*const c_void, *const c_void) -> c_int>, |
447 | ) -> *mut c_void; |
448 | #[cfg_attr ( |
449 | all(target_os = "macos" , target_arch = "x86" ), |
450 | link_name = "fopen$UNIX2003" |
451 | )] |
452 | pub fn fopen(filename: *const c_char, mode: *const c_char) -> *mut FILE; |
453 | #[cfg_attr ( |
454 | all(target_os = "macos" , target_arch = "x86" ), |
455 | link_name = "freopen$UNIX2003" |
456 | )] |
457 | pub fn freopen(filename: *const c_char, mode: *const c_char, file: *mut FILE) -> *mut FILE; |
458 | |
459 | pub fn fflush(file: *mut FILE) -> c_int; |
460 | pub fn fclose(file: *mut FILE) -> c_int; |
461 | pub fn remove(filename: *const c_char) -> c_int; |
462 | pub fn rename(oldname: *const c_char, newname: *const c_char) -> c_int; |
463 | pub fn tmpfile() -> *mut FILE; |
464 | pub fn setvbuf(stream: *mut FILE, buffer: *mut c_char, mode: c_int, size: size_t) -> c_int; |
465 | pub fn setbuf(stream: *mut FILE, buf: *mut c_char); |
466 | pub fn getchar() -> c_int; |
467 | pub fn putchar(c: c_int) -> c_int; |
468 | pub fn fgetc(stream: *mut FILE) -> c_int; |
469 | pub fn fgets(buf: *mut c_char, n: c_int, stream: *mut FILE) -> *mut c_char; |
470 | pub fn fputc(c: c_int, stream: *mut FILE) -> c_int; |
471 | #[cfg_attr ( |
472 | all(target_os = "macos" , target_arch = "x86" ), |
473 | link_name = "fputs$UNIX2003" |
474 | )] |
475 | pub fn fputs(s: *const c_char, stream: *mut FILE) -> c_int; |
476 | pub fn puts(s: *const c_char) -> c_int; |
477 | pub fn ungetc(c: c_int, stream: *mut FILE) -> c_int; |
478 | pub fn fread(ptr: *mut c_void, size: size_t, nobj: size_t, stream: *mut FILE) -> size_t; |
479 | #[cfg_attr ( |
480 | all(target_os = "macos" , target_arch = "x86" ), |
481 | link_name = "fwrite$UNIX2003" |
482 | )] |
483 | pub fn fwrite(ptr: *const c_void, size: size_t, nobj: size_t, stream: *mut FILE) -> size_t; |
484 | pub fn fseek(stream: *mut FILE, offset: c_long, whence: c_int) -> c_int; |
485 | pub fn ftell(stream: *mut FILE) -> c_long; |
486 | pub fn rewind(stream: *mut FILE); |
487 | #[cfg_attr (target_os = "netbsd" , link_name = "__fgetpos50" )] |
488 | pub fn fgetpos(stream: *mut FILE, ptr: *mut fpos_t) -> c_int; |
489 | #[cfg_attr (target_os = "netbsd" , link_name = "__fsetpos50" )] |
490 | pub fn fsetpos(stream: *mut FILE, ptr: *const fpos_t) -> c_int; |
491 | pub fn feof(stream: *mut FILE) -> c_int; |
492 | pub fn ferror(stream: *mut FILE) -> c_int; |
493 | pub fn clearerr(stream: *mut FILE); |
494 | pub fn perror(s: *const c_char); |
495 | pub fn atof(s: *const c_char) -> c_double; |
496 | pub fn atoi(s: *const c_char) -> c_int; |
497 | pub fn atol(s: *const c_char) -> c_long; |
498 | pub fn atoll(s: *const c_char) -> c_longlong; |
499 | #[cfg_attr ( |
500 | all(target_os = "macos" , target_arch = "x86" ), |
501 | link_name = "strtod$UNIX2003" |
502 | )] |
503 | pub fn strtod(s: *const c_char, endp: *mut *mut c_char) -> c_double; |
504 | pub fn strtof(s: *const c_char, endp: *mut *mut c_char) -> c_float; |
505 | pub fn strtol(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_long; |
506 | pub fn strtoll(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_longlong; |
507 | pub fn strtoul(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_ulong; |
508 | pub fn strtoull(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_ulonglong; |
509 | pub fn calloc(nobj: size_t, size: size_t) -> *mut c_void; |
510 | pub fn malloc(size: size_t) -> *mut c_void; |
511 | pub fn realloc(p: *mut c_void, size: size_t) -> *mut c_void; |
512 | pub fn free(p: *mut c_void); |
513 | pub fn abort() -> !; |
514 | pub fn exit(status: c_int) -> !; |
515 | pub fn _exit(status: c_int) -> !; |
516 | #[cfg_attr ( |
517 | all(target_os = "macos" , target_arch = "x86" ), |
518 | link_name = "system$UNIX2003" |
519 | )] |
520 | pub fn system(s: *const c_char) -> c_int; |
521 | pub fn getenv(s: *const c_char) -> *mut c_char; |
522 | |
523 | pub fn strcpy(dst: *mut c_char, src: *const c_char) -> *mut c_char; |
524 | pub fn strncpy(dst: *mut c_char, src: *const c_char, n: size_t) -> *mut c_char; |
525 | pub fn stpcpy(dst: *mut c_char, src: *const c_char) -> *mut c_char; |
526 | pub fn strcat(s: *mut c_char, ct: *const c_char) -> *mut c_char; |
527 | pub fn strncat(s: *mut c_char, ct: *const c_char, n: size_t) -> *mut c_char; |
528 | pub fn strcmp(cs: *const c_char, ct: *const c_char) -> c_int; |
529 | pub fn strncmp(cs: *const c_char, ct: *const c_char, n: size_t) -> c_int; |
530 | pub fn strcoll(cs: *const c_char, ct: *const c_char) -> c_int; |
531 | pub fn strchr(cs: *const c_char, c: c_int) -> *mut c_char; |
532 | pub fn strrchr(cs: *const c_char, c: c_int) -> *mut c_char; |
533 | pub fn strspn(cs: *const c_char, ct: *const c_char) -> size_t; |
534 | pub fn strcspn(cs: *const c_char, ct: *const c_char) -> size_t; |
535 | pub fn strdup(cs: *const c_char) -> *mut c_char; |
536 | pub fn strndup(cs: *const c_char, n: size_t) -> *mut c_char; |
537 | pub fn strpbrk(cs: *const c_char, ct: *const c_char) -> *mut c_char; |
538 | pub fn strstr(cs: *const c_char, ct: *const c_char) -> *mut c_char; |
539 | pub fn strcasecmp(s1: *const c_char, s2: *const c_char) -> c_int; |
540 | pub fn strncasecmp(s1: *const c_char, s2: *const c_char, n: size_t) -> c_int; |
541 | pub fn strlen(cs: *const c_char) -> size_t; |
542 | pub fn strnlen(cs: *const c_char, maxlen: size_t) -> size_t; |
543 | #[cfg_attr ( |
544 | all(target_os = "macos" , target_arch = "x86" ), |
545 | link_name = "strerror$UNIX2003" |
546 | )] |
547 | pub fn strerror(n: c_int) -> *mut c_char; |
548 | pub fn strtok(s: *mut c_char, t: *const c_char) -> *mut c_char; |
549 | pub fn strtok_r(s: *mut c_char, t: *const c_char, p: *mut *mut c_char) -> *mut c_char; |
550 | pub fn strxfrm(s: *mut c_char, ct: *const c_char, n: size_t) -> size_t; |
551 | pub fn strsignal(sig: c_int) -> *mut c_char; |
552 | pub fn wcslen(buf: *const wchar_t) -> size_t; |
553 | pub fn wcstombs(dest: *mut c_char, src: *const wchar_t, n: size_t) -> ::size_t; |
554 | |
555 | pub fn memchr(cx: *const c_void, c: c_int, n: size_t) -> *mut c_void; |
556 | pub fn wmemchr(cx: *const wchar_t, c: wchar_t, n: size_t) -> *mut wchar_t; |
557 | pub fn memcmp(cx: *const c_void, ct: *const c_void, n: size_t) -> c_int; |
558 | pub fn memcpy(dest: *mut c_void, src: *const c_void, n: size_t) -> *mut c_void; |
559 | pub fn memmove(dest: *mut c_void, src: *const c_void, n: size_t) -> *mut c_void; |
560 | pub fn memset(dest: *mut c_void, c: c_int, n: size_t) -> *mut c_void; |
561 | } |
562 | |
563 | extern "C" { |
564 | #[cfg_attr (target_os = "netbsd" , link_name = "__getpwnam50" )] |
565 | pub fn getpwnam(name: *const ::c_char) -> *mut passwd; |
566 | #[cfg_attr (target_os = "netbsd" , link_name = "__getpwuid50" )] |
567 | pub fn getpwuid(uid: ::uid_t) -> *mut passwd; |
568 | |
569 | pub fn fprintf(stream: *mut ::FILE, format: *const ::c_char, ...) -> ::c_int; |
570 | pub fn printf(format: *const ::c_char, ...) -> ::c_int; |
571 | pub fn snprintf(s: *mut ::c_char, n: ::size_t, format: *const ::c_char, ...) -> ::c_int; |
572 | pub fn sprintf(s: *mut ::c_char, format: *const ::c_char, ...) -> ::c_int; |
573 | #[cfg_attr ( |
574 | all(target_os = "linux" , not(target_env = "uclibc" )), |
575 | link_name = "__isoc99_fscanf" |
576 | )] |
577 | pub fn fscanf(stream: *mut ::FILE, format: *const ::c_char, ...) -> ::c_int; |
578 | #[cfg_attr ( |
579 | all(target_os = "linux" , not(target_env = "uclibc" )), |
580 | link_name = "__isoc99_scanf" |
581 | )] |
582 | pub fn scanf(format: *const ::c_char, ...) -> ::c_int; |
583 | #[cfg_attr ( |
584 | all(target_os = "linux" , not(target_env = "uclibc" )), |
585 | link_name = "__isoc99_sscanf" |
586 | )] |
587 | pub fn sscanf(s: *const ::c_char, format: *const ::c_char, ...) -> ::c_int; |
588 | pub fn getchar_unlocked() -> ::c_int; |
589 | pub fn putchar_unlocked(c: ::c_int) -> ::c_int; |
590 | |
591 | #[cfg (not(all( |
592 | libc_cfg_target_vendor, |
593 | target_arch = "powerpc" , |
594 | target_vendor = "nintendo" |
595 | )))] |
596 | #[cfg_attr (target_os = "netbsd" , link_name = "__socket30" )] |
597 | #[cfg_attr (target_os = "illumos" , link_name = "__xnet_socket" )] |
598 | #[cfg_attr (target_os = "espidf" , link_name = "lwip_socket" )] |
599 | pub fn socket(domain: ::c_int, ty: ::c_int, protocol: ::c_int) -> ::c_int; |
600 | #[cfg (not(all( |
601 | libc_cfg_target_vendor, |
602 | target_arch = "powerpc" , |
603 | target_vendor = "nintendo" |
604 | )))] |
605 | #[cfg_attr ( |
606 | all(target_os = "macos" , target_arch = "x86" ), |
607 | link_name = "connect$UNIX2003" |
608 | )] |
609 | #[cfg_attr (target_os = "illumos" , link_name = "__xnet_connect" )] |
610 | #[cfg_attr (target_os = "espidf" , link_name = "lwip_connect" )] |
611 | pub fn connect(socket: ::c_int, address: *const sockaddr, len: socklen_t) -> ::c_int; |
612 | #[cfg_attr ( |
613 | all(target_os = "macos" , target_arch = "x86" ), |
614 | link_name = "listen$UNIX2003" |
615 | )] |
616 | #[cfg_attr (target_os = "espidf" , link_name = "lwip_listen" )] |
617 | pub fn listen(socket: ::c_int, backlog: ::c_int) -> ::c_int; |
618 | #[cfg (not(all( |
619 | libc_cfg_target_vendor, |
620 | target_arch = "powerpc" , |
621 | target_vendor = "nintendo" |
622 | )))] |
623 | #[cfg_attr ( |
624 | all(target_os = "macos" , target_arch = "x86" ), |
625 | link_name = "accept$UNIX2003" |
626 | )] |
627 | #[cfg_attr (target_os = "espidf" , link_name = "lwip_accept" )] |
628 | pub fn accept(socket: ::c_int, address: *mut sockaddr, address_len: *mut socklen_t) -> ::c_int; |
629 | #[cfg (not(all( |
630 | libc_cfg_target_vendor, |
631 | target_arch = "powerpc" , |
632 | target_vendor = "nintendo" |
633 | )))] |
634 | #[cfg_attr ( |
635 | all(target_os = "macos" , target_arch = "x86" ), |
636 | link_name = "getpeername$UNIX2003" |
637 | )] |
638 | #[cfg_attr (target_os = "espidf" , link_name = "lwip_getpeername" )] |
639 | pub fn getpeername( |
640 | socket: ::c_int, |
641 | address: *mut sockaddr, |
642 | address_len: *mut socklen_t, |
643 | ) -> ::c_int; |
644 | #[cfg (not(all( |
645 | libc_cfg_target_vendor, |
646 | target_arch = "powerpc" , |
647 | target_vendor = "nintendo" |
648 | )))] |
649 | #[cfg_attr ( |
650 | all(target_os = "macos" , target_arch = "x86" ), |
651 | link_name = "getsockname$UNIX2003" |
652 | )] |
653 | #[cfg_attr (target_os = "espidf" , link_name = "lwip_getsockname" )] |
654 | pub fn getsockname( |
655 | socket: ::c_int, |
656 | address: *mut sockaddr, |
657 | address_len: *mut socklen_t, |
658 | ) -> ::c_int; |
659 | #[cfg_attr (target_os = "espidf" , link_name = "lwip_setsockopt" )] |
660 | pub fn setsockopt( |
661 | socket: ::c_int, |
662 | level: ::c_int, |
663 | name: ::c_int, |
664 | value: *const ::c_void, |
665 | option_len: socklen_t, |
666 | ) -> ::c_int; |
667 | #[cfg_attr ( |
668 | all(target_os = "macos" , target_arch = "x86" ), |
669 | link_name = "socketpair$UNIX2003" |
670 | )] |
671 | #[cfg_attr (target_os = "illumos" , link_name = "__xnet_socketpair" )] |
672 | pub fn socketpair( |
673 | domain: ::c_int, |
674 | type_: ::c_int, |
675 | protocol: ::c_int, |
676 | socket_vector: *mut ::c_int, |
677 | ) -> ::c_int; |
678 | #[cfg (not(all( |
679 | libc_cfg_target_vendor, |
680 | target_arch = "powerpc" , |
681 | target_vendor = "nintendo" |
682 | )))] |
683 | #[cfg_attr ( |
684 | all(target_os = "macos" , target_arch = "x86" ), |
685 | link_name = "sendto$UNIX2003" |
686 | )] |
687 | #[cfg_attr (target_os = "illumos" , link_name = "__xnet_sendto" )] |
688 | #[cfg_attr (target_os = "espidf" , link_name = "lwip_sendto" )] |
689 | pub fn sendto( |
690 | socket: ::c_int, |
691 | buf: *const ::c_void, |
692 | len: ::size_t, |
693 | flags: ::c_int, |
694 | addr: *const sockaddr, |
695 | addrlen: socklen_t, |
696 | ) -> ::ssize_t; |
697 | #[cfg_attr (target_os = "espidf" , link_name = "lwip_shutdown" )] |
698 | pub fn shutdown(socket: ::c_int, how: ::c_int) -> ::c_int; |
699 | |
700 | #[cfg_attr ( |
701 | all(target_os = "macos" , target_arch = "x86" ), |
702 | link_name = "chmod$UNIX2003" |
703 | )] |
704 | pub fn chmod(path: *const c_char, mode: mode_t) -> ::c_int; |
705 | #[cfg_attr ( |
706 | all(target_os = "macos" , target_arch = "x86" ), |
707 | link_name = "fchmod$UNIX2003" |
708 | )] |
709 | pub fn fchmod(fd: ::c_int, mode: mode_t) -> ::c_int; |
710 | |
711 | #[cfg_attr ( |
712 | all(target_os = "macos" , not(target_arch = "aarch64" )), |
713 | link_name = "fstat$INODE64" |
714 | )] |
715 | #[cfg_attr (target_os = "netbsd" , link_name = "__fstat50" )] |
716 | #[cfg_attr ( |
717 | all(target_os = "freebsd" , any(freebsd11, freebsd10)), |
718 | link_name = "fstat@FBSD_1.0" |
719 | )] |
720 | pub fn fstat(fildes: ::c_int, buf: *mut stat) -> ::c_int; |
721 | |
722 | pub fn mkdir(path: *const c_char, mode: mode_t) -> ::c_int; |
723 | |
724 | #[cfg_attr ( |
725 | all(target_os = "macos" , not(target_arch = "aarch64" )), |
726 | link_name = "stat$INODE64" |
727 | )] |
728 | #[cfg_attr (target_os = "netbsd" , link_name = "__stat50" )] |
729 | #[cfg_attr ( |
730 | all(target_os = "freebsd" , any(freebsd11, freebsd10)), |
731 | link_name = "stat@FBSD_1.0" |
732 | )] |
733 | pub fn stat(path: *const c_char, buf: *mut stat) -> ::c_int; |
734 | |
735 | pub fn pclose(stream: *mut ::FILE) -> ::c_int; |
736 | #[cfg_attr ( |
737 | all(target_os = "macos" , target_arch = "x86" ), |
738 | link_name = "fdopen$UNIX2003" |
739 | )] |
740 | pub fn fdopen(fd: ::c_int, mode: *const c_char) -> *mut ::FILE; |
741 | pub fn fileno(stream: *mut ::FILE) -> ::c_int; |
742 | |
743 | #[cfg_attr ( |
744 | all(target_os = "macos" , target_arch = "x86" ), |
745 | link_name = "open$UNIX2003" |
746 | )] |
747 | pub fn open(path: *const c_char, oflag: ::c_int, ...) -> ::c_int; |
748 | #[cfg_attr ( |
749 | all(target_os = "macos" , target_arch = "x86" ), |
750 | link_name = "creat$UNIX2003" |
751 | )] |
752 | pub fn creat(path: *const c_char, mode: mode_t) -> ::c_int; |
753 | #[cfg_attr ( |
754 | all(target_os = "macos" , target_arch = "x86" ), |
755 | link_name = "fcntl$UNIX2003" |
756 | )] |
757 | pub fn fcntl(fd: ::c_int, cmd: ::c_int, ...) -> ::c_int; |
758 | |
759 | #[cfg_attr ( |
760 | all(target_os = "macos" , target_arch = "x86_64" ), |
761 | link_name = "opendir$INODE64" |
762 | )] |
763 | #[cfg_attr ( |
764 | all(target_os = "macos" , target_arch = "x86" ), |
765 | link_name = "opendir$INODE64$UNIX2003" |
766 | )] |
767 | #[cfg_attr (target_os = "netbsd" , link_name = "__opendir30" )] |
768 | pub fn opendir(dirname: *const c_char) -> *mut ::DIR; |
769 | |
770 | #[cfg_attr ( |
771 | all(target_os = "macos" , not(target_arch = "aarch64" )), |
772 | link_name = "readdir$INODE64" |
773 | )] |
774 | #[cfg_attr (target_os = "netbsd" , link_name = "__readdir30" )] |
775 | #[cfg_attr ( |
776 | all(target_os = "freebsd" , any(freebsd11, freebsd10)), |
777 | link_name = "readdir@FBSD_1.0" |
778 | )] |
779 | pub fn readdir(dirp: *mut ::DIR) -> *mut ::dirent; |
780 | #[cfg_attr ( |
781 | all(target_os = "macos" , target_arch = "x86" ), |
782 | link_name = "closedir$UNIX2003" |
783 | )] |
784 | pub fn closedir(dirp: *mut ::DIR) -> ::c_int; |
785 | #[cfg_attr ( |
786 | all(target_os = "macos" , target_arch = "x86_64" ), |
787 | link_name = "rewinddir$INODE64" |
788 | )] |
789 | #[cfg_attr ( |
790 | all(target_os = "macos" , target_arch = "x86" ), |
791 | link_name = "rewinddir$INODE64$UNIX2003" |
792 | )] |
793 | pub fn rewinddir(dirp: *mut ::DIR); |
794 | |
795 | pub fn fchmodat( |
796 | dirfd: ::c_int, |
797 | pathname: *const ::c_char, |
798 | mode: ::mode_t, |
799 | flags: ::c_int, |
800 | ) -> ::c_int; |
801 | pub fn fchown(fd: ::c_int, owner: ::uid_t, group: ::gid_t) -> ::c_int; |
802 | pub fn fchownat( |
803 | dirfd: ::c_int, |
804 | pathname: *const ::c_char, |
805 | owner: ::uid_t, |
806 | group: ::gid_t, |
807 | flags: ::c_int, |
808 | ) -> ::c_int; |
809 | #[cfg_attr ( |
810 | all(target_os = "macos" , not(target_arch = "aarch64" )), |
811 | link_name = "fstatat$INODE64" |
812 | )] |
813 | #[cfg_attr ( |
814 | all(target_os = "freebsd" , any(freebsd11, freebsd10)), |
815 | link_name = "fstatat@FBSD_1.1" |
816 | )] |
817 | pub fn fstatat( |
818 | dirfd: ::c_int, |
819 | pathname: *const ::c_char, |
820 | buf: *mut stat, |
821 | flags: ::c_int, |
822 | ) -> ::c_int; |
823 | pub fn linkat( |
824 | olddirfd: ::c_int, |
825 | oldpath: *const ::c_char, |
826 | newdirfd: ::c_int, |
827 | newpath: *const ::c_char, |
828 | flags: ::c_int, |
829 | ) -> ::c_int; |
830 | pub fn renameat( |
831 | olddirfd: ::c_int, |
832 | oldpath: *const ::c_char, |
833 | newdirfd: ::c_int, |
834 | newpath: *const ::c_char, |
835 | ) -> ::c_int; |
836 | pub fn symlinkat( |
837 | target: *const ::c_char, |
838 | newdirfd: ::c_int, |
839 | linkpath: *const ::c_char, |
840 | ) -> ::c_int; |
841 | pub fn unlinkat(dirfd: ::c_int, pathname: *const ::c_char, flags: ::c_int) -> ::c_int; |
842 | |
843 | pub fn access(path: *const c_char, amode: ::c_int) -> ::c_int; |
844 | pub fn alarm(seconds: ::c_uint) -> ::c_uint; |
845 | pub fn chdir(dir: *const c_char) -> ::c_int; |
846 | pub fn fchdir(dirfd: ::c_int) -> ::c_int; |
847 | pub fn chown(path: *const c_char, uid: uid_t, gid: gid_t) -> ::c_int; |
848 | #[cfg_attr ( |
849 | all(target_os = "macos" , target_arch = "x86" ), |
850 | link_name = "lchown$UNIX2003" |
851 | )] |
852 | pub fn lchown(path: *const c_char, uid: uid_t, gid: gid_t) -> ::c_int; |
853 | #[cfg_attr ( |
854 | all(target_os = "macos" , target_arch = "x86" ), |
855 | link_name = "close$NOCANCEL$UNIX2003" |
856 | )] |
857 | #[cfg_attr ( |
858 | all(target_os = "macos" , target_arch = "x86_64" ), |
859 | link_name = "close$NOCANCEL" |
860 | )] |
861 | pub fn close(fd: ::c_int) -> ::c_int; |
862 | pub fn dup(fd: ::c_int) -> ::c_int; |
863 | pub fn dup2(src: ::c_int, dst: ::c_int) -> ::c_int; |
864 | pub fn execl(path: *const c_char, arg0: *const c_char, ...) -> ::c_int; |
865 | pub fn execle(path: *const ::c_char, arg0: *const ::c_char, ...) -> ::c_int; |
866 | pub fn execlp(file: *const ::c_char, arg0: *const ::c_char, ...) -> ::c_int; |
867 | pub fn execv(prog: *const c_char, argv: *const *const c_char) -> ::c_int; |
868 | pub fn execve( |
869 | prog: *const c_char, |
870 | argv: *const *const c_char, |
871 | envp: *const *const c_char, |
872 | ) -> ::c_int; |
873 | pub fn execvp(c: *const c_char, argv: *const *const c_char) -> ::c_int; |
874 | pub fn fork() -> pid_t; |
875 | pub fn fpathconf(filedes: ::c_int, name: ::c_int) -> c_long; |
876 | pub fn getcwd(buf: *mut c_char, size: ::size_t) -> *mut c_char; |
877 | pub fn getegid() -> gid_t; |
878 | pub fn geteuid() -> uid_t; |
879 | pub fn getgid() -> gid_t; |
880 | pub fn getgroups(ngroups_max: ::c_int, groups: *mut gid_t) -> ::c_int; |
881 | #[cfg_attr (target_os = "illumos" , link_name = "getloginx" )] |
882 | pub fn getlogin() -> *mut c_char; |
883 | #[cfg_attr ( |
884 | all(target_os = "macos" , target_arch = "x86" ), |
885 | link_name = "getopt$UNIX2003" |
886 | )] |
887 | pub fn getopt(argc: ::c_int, argv: *const *mut c_char, optstr: *const c_char) -> ::c_int; |
888 | pub fn getpgid(pid: pid_t) -> pid_t; |
889 | pub fn getpgrp() -> pid_t; |
890 | pub fn getpid() -> pid_t; |
891 | pub fn getppid() -> pid_t; |
892 | pub fn getuid() -> uid_t; |
893 | pub fn isatty(fd: ::c_int) -> ::c_int; |
894 | pub fn link(src: *const c_char, dst: *const c_char) -> ::c_int; |
895 | pub fn lseek(fd: ::c_int, offset: off_t, whence: ::c_int) -> off_t; |
896 | pub fn pathconf(path: *const c_char, name: ::c_int) -> c_long; |
897 | pub fn pipe(fds: *mut ::c_int) -> ::c_int; |
898 | pub fn posix_memalign(memptr: *mut *mut ::c_void, align: ::size_t, size: ::size_t) -> ::c_int; |
899 | #[cfg_attr ( |
900 | all(target_os = "macos" , target_arch = "x86" ), |
901 | link_name = "read$UNIX2003" |
902 | )] |
903 | pub fn read(fd: ::c_int, buf: *mut ::c_void, count: ::size_t) -> ::ssize_t; |
904 | pub fn rmdir(path: *const c_char) -> ::c_int; |
905 | pub fn seteuid(uid: uid_t) -> ::c_int; |
906 | pub fn setegid(gid: gid_t) -> ::c_int; |
907 | pub fn setgid(gid: gid_t) -> ::c_int; |
908 | pub fn setpgid(pid: pid_t, pgid: pid_t) -> ::c_int; |
909 | pub fn setsid() -> pid_t; |
910 | pub fn setuid(uid: uid_t) -> ::c_int; |
911 | pub fn setreuid(ruid: uid_t, euid: uid_t) -> ::c_int; |
912 | pub fn setregid(rgid: gid_t, egid: gid_t) -> ::c_int; |
913 | #[cfg_attr ( |
914 | all(target_os = "macos" , target_arch = "x86" ), |
915 | link_name = "sleep$UNIX2003" |
916 | )] |
917 | pub fn sleep(secs: ::c_uint) -> ::c_uint; |
918 | #[cfg_attr ( |
919 | all(target_os = "macos" , target_arch = "x86" ), |
920 | link_name = "nanosleep$UNIX2003" |
921 | )] |
922 | #[cfg_attr (target_os = "netbsd" , link_name = "__nanosleep50" )] |
923 | pub fn nanosleep(rqtp: *const timespec, rmtp: *mut timespec) -> ::c_int; |
924 | pub fn tcgetpgrp(fd: ::c_int) -> pid_t; |
925 | pub fn tcsetpgrp(fd: ::c_int, pgrp: ::pid_t) -> ::c_int; |
926 | pub fn ttyname(fd: ::c_int) -> *mut c_char; |
927 | #[cfg_attr ( |
928 | all(target_os = "macos" , target_arch = "x86" ), |
929 | link_name = "ttyname_r$UNIX2003" |
930 | )] |
931 | #[cfg_attr (target_os = "illumos" , link_name = "__posix_ttyname_r" )] |
932 | pub fn ttyname_r(fd: ::c_int, buf: *mut c_char, buflen: ::size_t) -> ::c_int; |
933 | pub fn unlink(c: *const c_char) -> ::c_int; |
934 | #[cfg_attr ( |
935 | all(target_os = "macos" , target_arch = "x86" ), |
936 | link_name = "wait$UNIX2003" |
937 | )] |
938 | pub fn wait(status: *mut ::c_int) -> pid_t; |
939 | #[cfg_attr ( |
940 | all(target_os = "macos" , target_arch = "x86" ), |
941 | link_name = "waitpid$UNIX2003" |
942 | )] |
943 | pub fn waitpid(pid: pid_t, status: *mut ::c_int, options: ::c_int) -> pid_t; |
944 | #[cfg_attr ( |
945 | all(target_os = "macos" , target_arch = "x86" ), |
946 | link_name = "write$UNIX2003" |
947 | )] |
948 | pub fn write(fd: ::c_int, buf: *const ::c_void, count: ::size_t) -> ::ssize_t; |
949 | #[cfg_attr ( |
950 | all(target_os = "macos" , target_arch = "x86" ), |
951 | link_name = "pread$UNIX2003" |
952 | )] |
953 | pub fn pread(fd: ::c_int, buf: *mut ::c_void, count: ::size_t, offset: off_t) -> ::ssize_t; |
954 | #[cfg_attr ( |
955 | all(target_os = "macos" , target_arch = "x86" ), |
956 | link_name = "pwrite$UNIX2003" |
957 | )] |
958 | pub fn pwrite(fd: ::c_int, buf: *const ::c_void, count: ::size_t, offset: off_t) -> ::ssize_t; |
959 | pub fn umask(mask: mode_t) -> mode_t; |
960 | |
961 | #[cfg_attr (target_os = "netbsd" , link_name = "__utime50" )] |
962 | pub fn utime(file: *const c_char, buf: *const utimbuf) -> ::c_int; |
963 | |
964 | #[cfg_attr ( |
965 | all(target_os = "macos" , target_arch = "x86" ), |
966 | link_name = "kill$UNIX2003" |
967 | )] |
968 | pub fn kill(pid: pid_t, sig: ::c_int) -> ::c_int; |
969 | #[cfg_attr ( |
970 | all(target_os = "macos" , target_arch = "x86" ), |
971 | link_name = "killpg$UNIX2003" |
972 | )] |
973 | pub fn killpg(pgrp: pid_t, sig: ::c_int) -> ::c_int; |
974 | |
975 | pub fn mlock(addr: *const ::c_void, len: ::size_t) -> ::c_int; |
976 | pub fn munlock(addr: *const ::c_void, len: ::size_t) -> ::c_int; |
977 | pub fn mlockall(flags: ::c_int) -> ::c_int; |
978 | pub fn munlockall() -> ::c_int; |
979 | |
980 | #[cfg_attr ( |
981 | all(target_os = "macos" , target_arch = "x86" ), |
982 | link_name = "mmap$UNIX2003" |
983 | )] |
984 | pub fn mmap( |
985 | addr: *mut ::c_void, |
986 | len: ::size_t, |
987 | prot: ::c_int, |
988 | flags: ::c_int, |
989 | fd: ::c_int, |
990 | offset: off_t, |
991 | ) -> *mut ::c_void; |
992 | #[cfg_attr ( |
993 | all(target_os = "macos" , target_arch = "x86" ), |
994 | link_name = "munmap$UNIX2003" |
995 | )] |
996 | pub fn munmap(addr: *mut ::c_void, len: ::size_t) -> ::c_int; |
997 | |
998 | pub fn if_nametoindex(ifname: *const c_char) -> ::c_uint; |
999 | pub fn if_indextoname(ifindex: ::c_uint, ifname: *mut ::c_char) -> *mut ::c_char; |
1000 | |
1001 | #[cfg_attr ( |
1002 | all(target_os = "macos" , not(target_arch = "aarch64" )), |
1003 | link_name = "lstat$INODE64" |
1004 | )] |
1005 | #[cfg_attr (target_os = "netbsd" , link_name = "__lstat50" )] |
1006 | #[cfg_attr ( |
1007 | all(target_os = "freebsd" , any(freebsd11, freebsd10)), |
1008 | link_name = "lstat@FBSD_1.0" |
1009 | )] |
1010 | pub fn lstat(path: *const c_char, buf: *mut stat) -> ::c_int; |
1011 | |
1012 | #[cfg_attr ( |
1013 | all(target_os = "macos" , target_arch = "x86" ), |
1014 | link_name = "fsync$UNIX2003" |
1015 | )] |
1016 | pub fn fsync(fd: ::c_int) -> ::c_int; |
1017 | |
1018 | #[cfg_attr ( |
1019 | all(target_os = "macos" , target_arch = "x86" ), |
1020 | link_name = "setenv$UNIX2003" |
1021 | )] |
1022 | pub fn setenv(name: *const c_char, val: *const c_char, overwrite: ::c_int) -> ::c_int; |
1023 | #[cfg_attr ( |
1024 | all(target_os = "macos" , target_arch = "x86" ), |
1025 | link_name = "unsetenv$UNIX2003" |
1026 | )] |
1027 | #[cfg_attr (target_os = "netbsd" , link_name = "__unsetenv13" )] |
1028 | pub fn unsetenv(name: *const c_char) -> ::c_int; |
1029 | |
1030 | pub fn symlink(path1: *const c_char, path2: *const c_char) -> ::c_int; |
1031 | |
1032 | pub fn truncate(path: *const c_char, length: off_t) -> ::c_int; |
1033 | pub fn ftruncate(fd: ::c_int, length: off_t) -> ::c_int; |
1034 | |
1035 | pub fn signal(signum: ::c_int, handler: sighandler_t) -> sighandler_t; |
1036 | |
1037 | #[cfg_attr (target_os = "netbsd" , link_name = "__getrusage50" )] |
1038 | pub fn getrusage(resource: ::c_int, usage: *mut rusage) -> ::c_int; |
1039 | |
1040 | #[cfg_attr ( |
1041 | any( |
1042 | target_os = "macos" , |
1043 | target_os = "ios" , |
1044 | target_os = "tvos" , |
1045 | target_os = "watchos" |
1046 | ), |
1047 | link_name = "realpath$DARWIN_EXTSN" |
1048 | )] |
1049 | pub fn realpath(pathname: *const ::c_char, resolved: *mut ::c_char) -> *mut ::c_char; |
1050 | |
1051 | pub fn flock(fd: ::c_int, operation: ::c_int) -> ::c_int; |
1052 | |
1053 | #[cfg_attr (target_os = "netbsd" , link_name = "__times13" )] |
1054 | pub fn times(buf: *mut ::tms) -> ::clock_t; |
1055 | |
1056 | pub fn pthread_self() -> ::pthread_t; |
1057 | #[cfg_attr ( |
1058 | all(target_os = "macos" , target_arch = "x86" ), |
1059 | link_name = "pthread_join$UNIX2003" |
1060 | )] |
1061 | pub fn pthread_join(native: ::pthread_t, value: *mut *mut ::c_void) -> ::c_int; |
1062 | pub fn pthread_exit(value: *mut ::c_void) -> !; |
1063 | pub fn pthread_attr_init(attr: *mut ::pthread_attr_t) -> ::c_int; |
1064 | pub fn pthread_attr_destroy(attr: *mut ::pthread_attr_t) -> ::c_int; |
1065 | pub fn pthread_attr_getstacksize( |
1066 | attr: *const ::pthread_attr_t, |
1067 | stacksize: *mut ::size_t, |
1068 | ) -> ::c_int; |
1069 | pub fn pthread_attr_setstacksize(attr: *mut ::pthread_attr_t, stack_size: ::size_t) -> ::c_int; |
1070 | pub fn pthread_attr_setdetachstate(attr: *mut ::pthread_attr_t, state: ::c_int) -> ::c_int; |
1071 | pub fn pthread_detach(thread: ::pthread_t) -> ::c_int; |
1072 | #[cfg_attr (target_os = "netbsd" , link_name = "__libc_thr_yield" )] |
1073 | pub fn sched_yield() -> ::c_int; |
1074 | pub fn pthread_key_create( |
1075 | key: *mut pthread_key_t, |
1076 | dtor: ::Option<unsafe extern "C" fn(*mut ::c_void)>, |
1077 | ) -> ::c_int; |
1078 | pub fn pthread_key_delete(key: pthread_key_t) -> ::c_int; |
1079 | pub fn pthread_getspecific(key: pthread_key_t) -> *mut ::c_void; |
1080 | pub fn pthread_setspecific(key: pthread_key_t, value: *const ::c_void) -> ::c_int; |
1081 | pub fn pthread_mutex_init( |
1082 | lock: *mut pthread_mutex_t, |
1083 | attr: *const pthread_mutexattr_t, |
1084 | ) -> ::c_int; |
1085 | pub fn pthread_mutex_destroy(lock: *mut pthread_mutex_t) -> ::c_int; |
1086 | pub fn pthread_mutex_lock(lock: *mut pthread_mutex_t) -> ::c_int; |
1087 | pub fn pthread_mutex_trylock(lock: *mut pthread_mutex_t) -> ::c_int; |
1088 | pub fn pthread_mutex_unlock(lock: *mut pthread_mutex_t) -> ::c_int; |
1089 | |
1090 | pub fn pthread_mutexattr_init(attr: *mut pthread_mutexattr_t) -> ::c_int; |
1091 | #[cfg_attr ( |
1092 | all(target_os = "macos" , target_arch = "x86" ), |
1093 | link_name = "pthread_mutexattr_destroy$UNIX2003" |
1094 | )] |
1095 | pub fn pthread_mutexattr_destroy(attr: *mut pthread_mutexattr_t) -> ::c_int; |
1096 | pub fn pthread_mutexattr_settype(attr: *mut pthread_mutexattr_t, _type: ::c_int) -> ::c_int; |
1097 | |
1098 | #[cfg_attr ( |
1099 | all(target_os = "macos" , target_arch = "x86" ), |
1100 | link_name = "pthread_cond_init$UNIX2003" |
1101 | )] |
1102 | pub fn pthread_cond_init(cond: *mut pthread_cond_t, attr: *const pthread_condattr_t) |
1103 | -> ::c_int; |
1104 | #[cfg_attr ( |
1105 | all(target_os = "macos" , target_arch = "x86" ), |
1106 | link_name = "pthread_cond_wait$UNIX2003" |
1107 | )] |
1108 | pub fn pthread_cond_wait(cond: *mut pthread_cond_t, lock: *mut pthread_mutex_t) -> ::c_int; |
1109 | #[cfg_attr ( |
1110 | all(target_os = "macos" , target_arch = "x86" ), |
1111 | link_name = "pthread_cond_timedwait$UNIX2003" |
1112 | )] |
1113 | pub fn pthread_cond_timedwait( |
1114 | cond: *mut pthread_cond_t, |
1115 | lock: *mut pthread_mutex_t, |
1116 | abstime: *const ::timespec, |
1117 | ) -> ::c_int; |
1118 | pub fn pthread_cond_signal(cond: *mut pthread_cond_t) -> ::c_int; |
1119 | pub fn pthread_cond_broadcast(cond: *mut pthread_cond_t) -> ::c_int; |
1120 | pub fn pthread_cond_destroy(cond: *mut pthread_cond_t) -> ::c_int; |
1121 | pub fn pthread_condattr_init(attr: *mut pthread_condattr_t) -> ::c_int; |
1122 | pub fn pthread_condattr_destroy(attr: *mut pthread_condattr_t) -> ::c_int; |
1123 | #[cfg_attr ( |
1124 | all(target_os = "macos" , target_arch = "x86" ), |
1125 | link_name = "pthread_rwlock_init$UNIX2003" |
1126 | )] |
1127 | pub fn pthread_rwlock_init( |
1128 | lock: *mut pthread_rwlock_t, |
1129 | attr: *const pthread_rwlockattr_t, |
1130 | ) -> ::c_int; |
1131 | #[cfg_attr ( |
1132 | all(target_os = "macos" , target_arch = "x86" ), |
1133 | link_name = "pthread_rwlock_destroy$UNIX2003" |
1134 | )] |
1135 | pub fn pthread_rwlock_destroy(lock: *mut pthread_rwlock_t) -> ::c_int; |
1136 | #[cfg_attr ( |
1137 | all(target_os = "macos" , target_arch = "x86" ), |
1138 | link_name = "pthread_rwlock_rdlock$UNIX2003" |
1139 | )] |
1140 | pub fn pthread_rwlock_rdlock(lock: *mut pthread_rwlock_t) -> ::c_int; |
1141 | #[cfg_attr ( |
1142 | all(target_os = "macos" , target_arch = "x86" ), |
1143 | link_name = "pthread_rwlock_tryrdlock$UNIX2003" |
1144 | )] |
1145 | pub fn pthread_rwlock_tryrdlock(lock: *mut pthread_rwlock_t) -> ::c_int; |
1146 | #[cfg_attr ( |
1147 | all(target_os = "macos" , target_arch = "x86" ), |
1148 | link_name = "pthread_rwlock_wrlock$UNIX2003" |
1149 | )] |
1150 | pub fn pthread_rwlock_wrlock(lock: *mut pthread_rwlock_t) -> ::c_int; |
1151 | #[cfg_attr ( |
1152 | all(target_os = "macos" , target_arch = "x86" ), |
1153 | link_name = "pthread_rwlock_trywrlock$UNIX2003" |
1154 | )] |
1155 | pub fn pthread_rwlock_trywrlock(lock: *mut pthread_rwlock_t) -> ::c_int; |
1156 | #[cfg_attr ( |
1157 | all(target_os = "macos" , target_arch = "x86" ), |
1158 | link_name = "pthread_rwlock_unlock$UNIX2003" |
1159 | )] |
1160 | pub fn pthread_rwlock_unlock(lock: *mut pthread_rwlock_t) -> ::c_int; |
1161 | pub fn pthread_rwlockattr_init(attr: *mut pthread_rwlockattr_t) -> ::c_int; |
1162 | pub fn pthread_rwlockattr_destroy(attr: *mut pthread_rwlockattr_t) -> ::c_int; |
1163 | |
1164 | #[cfg_attr (target_os = "illumos" , link_name = "__xnet_getsockopt" )] |
1165 | #[cfg_attr (target_os = "espidf" , link_name = "lwip_getsockopt" )] |
1166 | pub fn getsockopt( |
1167 | sockfd: ::c_int, |
1168 | level: ::c_int, |
1169 | optname: ::c_int, |
1170 | optval: *mut ::c_void, |
1171 | optlen: *mut ::socklen_t, |
1172 | ) -> ::c_int; |
1173 | pub fn raise(signum: ::c_int) -> ::c_int; |
1174 | |
1175 | #[cfg_attr (target_os = "netbsd" , link_name = "__utimes50" )] |
1176 | pub fn utimes(filename: *const ::c_char, times: *const ::timeval) -> ::c_int; |
1177 | pub fn dlopen(filename: *const ::c_char, flag: ::c_int) -> *mut ::c_void; |
1178 | pub fn dlerror() -> *mut ::c_char; |
1179 | pub fn dlsym(handle: *mut ::c_void, symbol: *const ::c_char) -> *mut ::c_void; |
1180 | pub fn dlclose(handle: *mut ::c_void) -> ::c_int; |
1181 | |
1182 | #[cfg (not(all( |
1183 | libc_cfg_target_vendor, |
1184 | target_arch = "powerpc" , |
1185 | target_vendor = "nintendo" |
1186 | )))] |
1187 | #[cfg_attr (target_os = "illumos" , link_name = "__xnet_getaddrinfo" )] |
1188 | #[cfg_attr (target_os = "espidf" , link_name = "lwip_getaddrinfo" )] |
1189 | pub fn getaddrinfo( |
1190 | node: *const c_char, |
1191 | service: *const c_char, |
1192 | hints: *const addrinfo, |
1193 | res: *mut *mut addrinfo, |
1194 | ) -> ::c_int; |
1195 | #[cfg (not(all( |
1196 | libc_cfg_target_vendor, |
1197 | target_arch = "powerpc" , |
1198 | target_vendor = "nintendo" |
1199 | )))] |
1200 | #[cfg_attr (target_os = "espidf" , link_name = "lwip_freeaddrinfo" )] |
1201 | pub fn freeaddrinfo(res: *mut addrinfo); |
1202 | pub fn hstrerror(errcode: ::c_int) -> *const ::c_char; |
1203 | pub fn gai_strerror(errcode: ::c_int) -> *const ::c_char; |
1204 | #[cfg_attr ( |
1205 | any( |
1206 | all( |
1207 | target_os = "linux" , |
1208 | not(any(target_env = "musl" , target_env = "ohos" )) |
1209 | ), |
1210 | target_os = "freebsd" , |
1211 | target_os = "dragonfly" , |
1212 | target_os = "haiku" |
1213 | ), |
1214 | link_name = "__res_init" |
1215 | )] |
1216 | #[cfg_attr ( |
1217 | any( |
1218 | target_os = "macos" , |
1219 | target_os = "ios" , |
1220 | target_os = "tvos" , |
1221 | target_os = "watchos" |
1222 | ), |
1223 | link_name = "res_9_init" |
1224 | )] |
1225 | pub fn res_init() -> ::c_int; |
1226 | |
1227 | #[cfg_attr (target_os = "netbsd" , link_name = "__gmtime_r50" )] |
1228 | #[cfg_attr (any(target_env = "musl" , target_env = "ohos" ), allow(deprecated))] |
1229 | // FIXME: for `time_t` |
1230 | pub fn gmtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm; |
1231 | #[cfg_attr (target_os = "netbsd" , link_name = "__localtime_r50" )] |
1232 | #[cfg_attr (any(target_env = "musl" , target_env = "ohos" ), allow(deprecated))] |
1233 | // FIXME: for `time_t` |
1234 | pub fn localtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm; |
1235 | #[cfg_attr ( |
1236 | all(target_os = "macos" , target_arch = "x86" ), |
1237 | link_name = "mktime$UNIX2003" |
1238 | )] |
1239 | #[cfg_attr (target_os = "netbsd" , link_name = "__mktime50" )] |
1240 | #[cfg_attr (any(target_env = "musl" , target_env = "ohos" ), allow(deprecated))] |
1241 | // FIXME: for `time_t` |
1242 | pub fn mktime(tm: *mut tm) -> time_t; |
1243 | #[cfg_attr (target_os = "netbsd" , link_name = "__time50" )] |
1244 | #[cfg_attr (any(target_env = "musl" , target_env = "ohos" ), allow(deprecated))] |
1245 | // FIXME: for `time_t` |
1246 | pub fn time(time: *mut time_t) -> time_t; |
1247 | #[cfg_attr (target_os = "netbsd" , link_name = "__gmtime50" )] |
1248 | #[cfg_attr (any(target_env = "musl" , target_env = "ohos" ), allow(deprecated))] |
1249 | // FIXME: for `time_t` |
1250 | pub fn gmtime(time_p: *const time_t) -> *mut tm; |
1251 | #[cfg_attr (target_os = "netbsd" , link_name = "__locatime50" )] |
1252 | #[cfg_attr (any(target_env = "musl" , target_env = "ohos" ), allow(deprecated))] |
1253 | // FIXME: for `time_t` |
1254 | pub fn localtime(time_p: *const time_t) -> *mut tm; |
1255 | #[cfg_attr (target_os = "netbsd" , link_name = "__difftime50" )] |
1256 | #[cfg_attr (any(target_env = "musl" , target_env = "ohos" ), allow(deprecated))] |
1257 | // FIXME: for `time_t` |
1258 | pub fn difftime(time1: time_t, time0: time_t) -> ::c_double; |
1259 | #[cfg_attr (target_os = "netbsd" , link_name = "__timegm50" )] |
1260 | #[cfg_attr (any(target_env = "musl" , target_env = "ohos" ), allow(deprecated))] |
1261 | // FIXME: for `time_t` |
1262 | pub fn timegm(tm: *mut ::tm) -> time_t; |
1263 | |
1264 | #[cfg_attr (target_os = "netbsd" , link_name = "__mknod50" )] |
1265 | #[cfg_attr ( |
1266 | all(target_os = "freebsd" , any(freebsd11, freebsd10)), |
1267 | link_name = "mknod@FBSD_1.0" |
1268 | )] |
1269 | pub fn mknod(pathname: *const ::c_char, mode: ::mode_t, dev: ::dev_t) -> ::c_int; |
1270 | pub fn gethostname(name: *mut ::c_char, len: ::size_t) -> ::c_int; |
1271 | pub fn endservent(); |
1272 | pub fn getservbyname(name: *const ::c_char, proto: *const ::c_char) -> *mut servent; |
1273 | pub fn getservbyport(port: ::c_int, proto: *const ::c_char) -> *mut servent; |
1274 | pub fn getservent() -> *mut servent; |
1275 | pub fn setservent(stayopen: ::c_int); |
1276 | pub fn getprotobyname(name: *const ::c_char) -> *mut protoent; |
1277 | pub fn getprotobynumber(proto: ::c_int) -> *mut protoent; |
1278 | pub fn chroot(name: *const ::c_char) -> ::c_int; |
1279 | #[cfg_attr ( |
1280 | all(target_os = "macos" , target_arch = "x86" ), |
1281 | link_name = "usleep$UNIX2003" |
1282 | )] |
1283 | pub fn usleep(secs: ::c_uint) -> ::c_int; |
1284 | #[cfg_attr ( |
1285 | all(target_os = "macos" , target_arch = "x86" ), |
1286 | link_name = "send$UNIX2003" |
1287 | )] |
1288 | #[cfg_attr (target_os = "espidf" , link_name = "lwip_send" )] |
1289 | pub fn send(socket: ::c_int, buf: *const ::c_void, len: ::size_t, flags: ::c_int) -> ::ssize_t; |
1290 | #[cfg_attr ( |
1291 | all(target_os = "macos" , target_arch = "x86" ), |
1292 | link_name = "recv$UNIX2003" |
1293 | )] |
1294 | #[cfg_attr (target_os = "espidf" , link_name = "lwip_recv" )] |
1295 | pub fn recv(socket: ::c_int, buf: *mut ::c_void, len: ::size_t, flags: ::c_int) -> ::ssize_t; |
1296 | #[cfg_attr ( |
1297 | all(target_os = "macos" , target_arch = "x86" ), |
1298 | link_name = "putenv$UNIX2003" |
1299 | )] |
1300 | #[cfg_attr (target_os = "netbsd" , link_name = "__putenv50" )] |
1301 | pub fn putenv(string: *mut c_char) -> ::c_int; |
1302 | #[cfg_attr ( |
1303 | all(target_os = "macos" , target_arch = "x86" ), |
1304 | link_name = "poll$UNIX2003" |
1305 | )] |
1306 | pub fn poll(fds: *mut pollfd, nfds: nfds_t, timeout: ::c_int) -> ::c_int; |
1307 | #[cfg_attr ( |
1308 | all(target_os = "macos" , target_arch = "x86_64" ), |
1309 | link_name = "select$1050" |
1310 | )] |
1311 | #[cfg_attr ( |
1312 | all(target_os = "macos" , target_arch = "x86" ), |
1313 | link_name = "select$UNIX2003" |
1314 | )] |
1315 | #[cfg_attr (target_os = "netbsd" , link_name = "__select50" )] |
1316 | pub fn select( |
1317 | nfds: ::c_int, |
1318 | readfds: *mut fd_set, |
1319 | writefds: *mut fd_set, |
1320 | errorfds: *mut fd_set, |
1321 | timeout: *mut timeval, |
1322 | ) -> ::c_int; |
1323 | #[cfg_attr (target_os = "netbsd" , link_name = "__setlocale50" )] |
1324 | pub fn setlocale(category: ::c_int, locale: *const ::c_char) -> *mut ::c_char; |
1325 | pub fn localeconv() -> *mut lconv; |
1326 | |
1327 | #[cfg_attr ( |
1328 | all(target_os = "macos" , target_arch = "x86" ), |
1329 | link_name = "sem_wait$UNIX2003" |
1330 | )] |
1331 | pub fn sem_wait(sem: *mut sem_t) -> ::c_int; |
1332 | pub fn sem_trywait(sem: *mut sem_t) -> ::c_int; |
1333 | pub fn sem_post(sem: *mut sem_t) -> ::c_int; |
1334 | pub fn statvfs(path: *const c_char, buf: *mut statvfs) -> ::c_int; |
1335 | pub fn fstatvfs(fd: ::c_int, buf: *mut statvfs) -> ::c_int; |
1336 | |
1337 | #[cfg_attr (target_os = "netbsd" , link_name = "__sigemptyset14" )] |
1338 | pub fn sigemptyset(set: *mut sigset_t) -> ::c_int; |
1339 | #[cfg_attr (target_os = "netbsd" , link_name = "__sigaddset14" )] |
1340 | pub fn sigaddset(set: *mut sigset_t, signum: ::c_int) -> ::c_int; |
1341 | #[cfg_attr (target_os = "netbsd" , link_name = "__sigfillset14" )] |
1342 | pub fn sigfillset(set: *mut sigset_t) -> ::c_int; |
1343 | #[cfg_attr (target_os = "netbsd" , link_name = "__sigdelset14" )] |
1344 | pub fn sigdelset(set: *mut sigset_t, signum: ::c_int) -> ::c_int; |
1345 | #[cfg_attr (target_os = "netbsd" , link_name = "__sigismember14" )] |
1346 | pub fn sigismember(set: *const sigset_t, signum: ::c_int) -> ::c_int; |
1347 | |
1348 | #[cfg_attr (target_os = "netbsd" , link_name = "__sigprocmask14" )] |
1349 | pub fn sigprocmask(how: ::c_int, set: *const sigset_t, oldset: *mut sigset_t) -> ::c_int; |
1350 | #[cfg_attr (target_os = "netbsd" , link_name = "__sigpending14" )] |
1351 | pub fn sigpending(set: *mut sigset_t) -> ::c_int; |
1352 | |
1353 | pub fn sysconf(name: ::c_int) -> ::c_long; |
1354 | |
1355 | pub fn mkfifo(path: *const c_char, mode: mode_t) -> ::c_int; |
1356 | |
1357 | pub fn fseeko(stream: *mut ::FILE, offset: ::off_t, whence: ::c_int) -> ::c_int; |
1358 | pub fn ftello(stream: *mut ::FILE) -> ::off_t; |
1359 | #[cfg_attr ( |
1360 | all(target_os = "macos" , target_arch = "x86" ), |
1361 | link_name = "tcdrain$UNIX2003" |
1362 | )] |
1363 | pub fn tcdrain(fd: ::c_int) -> ::c_int; |
1364 | pub fn cfgetispeed(termios: *const ::termios) -> ::speed_t; |
1365 | pub fn cfgetospeed(termios: *const ::termios) -> ::speed_t; |
1366 | pub fn cfsetispeed(termios: *mut ::termios, speed: ::speed_t) -> ::c_int; |
1367 | pub fn cfsetospeed(termios: *mut ::termios, speed: ::speed_t) -> ::c_int; |
1368 | pub fn tcgetattr(fd: ::c_int, termios: *mut ::termios) -> ::c_int; |
1369 | pub fn tcsetattr(fd: ::c_int, optional_actions: ::c_int, termios: *const ::termios) -> ::c_int; |
1370 | pub fn tcflow(fd: ::c_int, action: ::c_int) -> ::c_int; |
1371 | pub fn tcflush(fd: ::c_int, action: ::c_int) -> ::c_int; |
1372 | pub fn tcgetsid(fd: ::c_int) -> ::pid_t; |
1373 | pub fn tcsendbreak(fd: ::c_int, duration: ::c_int) -> ::c_int; |
1374 | pub fn mkstemp(template: *mut ::c_char) -> ::c_int; |
1375 | pub fn mkdtemp(template: *mut ::c_char) -> *mut ::c_char; |
1376 | |
1377 | pub fn tmpnam(ptr: *mut ::c_char) -> *mut ::c_char; |
1378 | |
1379 | pub fn openlog(ident: *const ::c_char, logopt: ::c_int, facility: ::c_int); |
1380 | pub fn closelog(); |
1381 | pub fn setlogmask(maskpri: ::c_int) -> ::c_int; |
1382 | #[cfg_attr (target_os = "macos" , link_name = "syslog$DARWIN_EXTSN" )] |
1383 | pub fn syslog(priority: ::c_int, message: *const ::c_char, ...); |
1384 | #[cfg_attr ( |
1385 | all(target_os = "macos" , target_arch = "x86" ), |
1386 | link_name = "nice$UNIX2003" |
1387 | )] |
1388 | pub fn nice(incr: ::c_int) -> ::c_int; |
1389 | |
1390 | pub fn grantpt(fd: ::c_int) -> ::c_int; |
1391 | pub fn posix_openpt(flags: ::c_int) -> ::c_int; |
1392 | pub fn ptsname(fd: ::c_int) -> *mut ::c_char; |
1393 | pub fn unlockpt(fd: ::c_int) -> ::c_int; |
1394 | |
1395 | pub fn strcasestr(cs: *const c_char, ct: *const c_char) -> *mut c_char; |
1396 | pub fn getline(lineptr: *mut *mut c_char, n: *mut size_t, stream: *mut FILE) -> ssize_t; |
1397 | |
1398 | pub fn lockf(fd: ::c_int, cmd: ::c_int, len: ::off_t) -> ::c_int; |
1399 | |
1400 | } |
1401 | |
1402 | cfg_if! { |
1403 | if #[cfg(not(any(target_os = "emscripten" , |
1404 | target_os = "android" , |
1405 | target_os = "haiku" , |
1406 | target_os = "nto" )))] { |
1407 | extern "C" { |
1408 | pub fn adjtime(delta: *const timeval, olddelta: *mut timeval) -> ::c_int; |
1409 | pub fn stpncpy(dst: *mut c_char, src: *const c_char, n: size_t) -> *mut c_char; |
1410 | } |
1411 | } |
1412 | } |
1413 | |
1414 | cfg_if! { |
1415 | if #[cfg(not(target_os = "aix" ))] { |
1416 | extern "C" { |
1417 | pub fn dladdr(addr: *const ::c_void, info: *mut Dl_info) -> ::c_int; |
1418 | } |
1419 | } |
1420 | } |
1421 | |
1422 | cfg_if! { |
1423 | if #[cfg(not(any(target_env = "uclibc" , target_os = "nto" )))] { |
1424 | extern "C" { |
1425 | pub fn open_wmemstream( |
1426 | ptr: *mut *mut wchar_t, |
1427 | sizeloc: *mut size_t, |
1428 | ) -> *mut FILE; |
1429 | } |
1430 | } |
1431 | } |
1432 | |
1433 | cfg_if! { |
1434 | if #[cfg(not(target_os = "redox" ))] { |
1435 | extern { |
1436 | pub fn getsid(pid: pid_t) -> pid_t; |
1437 | #[cfg_attr (all(target_os = "macos" , target_arch = "x86" ), |
1438 | link_name = "pause$UNIX2003" )] |
1439 | pub fn pause() -> ::c_int; |
1440 | |
1441 | pub fn mkdirat(dirfd: ::c_int, pathname: *const ::c_char, |
1442 | mode: ::mode_t) -> ::c_int; |
1443 | pub fn openat(dirfd: ::c_int, pathname: *const ::c_char, |
1444 | flags: ::c_int, ...) -> ::c_int; |
1445 | |
1446 | #[cfg_attr (all(target_os = "macos" , target_arch = "x86_64" ), |
1447 | link_name = "fdopendir$INODE64" )] |
1448 | #[cfg_attr (all(target_os = "macos" , target_arch = "x86" ), |
1449 | link_name = "fdopendir$INODE64$UNIX2003" )] |
1450 | pub fn fdopendir(fd: ::c_int) -> *mut ::DIR; |
1451 | |
1452 | #[cfg_attr (all(target_os = "macos" , not(target_arch = "aarch64" )), |
1453 | link_name = "readdir_r$INODE64" )] |
1454 | #[cfg_attr (target_os = "netbsd" , link_name = "__readdir_r30" )] |
1455 | #[cfg_attr ( |
1456 | all(target_os = "freebsd" , any(freebsd11, freebsd10)), |
1457 | link_name = "readdir_r@FBSD_1.0" |
1458 | )] |
1459 | #[allow (non_autolinks)] // FIXME: `<>` breaks line length limit. |
1460 | /// The 64-bit libc on Solaris and illumos only has readdir_r. If a |
1461 | /// 32-bit Solaris or illumos target is ever created, it should use |
1462 | /// __posix_readdir_r. See libc(3LIB) on Solaris or illumos: |
1463 | /// https://illumos.org/man/3lib/libc |
1464 | /// https://docs.oracle.com/cd/E36784_01/html/E36873/libc-3lib.html |
1465 | /// https://www.unix.com/man-page/opensolaris/3LIB/libc/ |
1466 | pub fn readdir_r(dirp: *mut ::DIR, entry: *mut ::dirent, |
1467 | result: *mut *mut ::dirent) -> ::c_int; |
1468 | } |
1469 | } |
1470 | } |
1471 | |
1472 | cfg_if! { |
1473 | if #[cfg(target_os = "nto" )] { |
1474 | extern { |
1475 | pub fn readlinkat(dirfd: ::c_int, |
1476 | pathname: *const ::c_char, |
1477 | buf: *mut ::c_char, |
1478 | bufsiz: ::size_t) -> ::c_int; |
1479 | pub fn readlink(path: *const c_char, buf: *mut c_char, bufsz: ::size_t) -> ::c_int; |
1480 | pub fn pselect( |
1481 | nfds: ::c_int, |
1482 | readfds: *mut fd_set, |
1483 | writefds: *mut fd_set, |
1484 | errorfds: *mut fd_set, |
1485 | timeout: *mut timespec, |
1486 | sigmask: *const sigset_t, |
1487 | ) -> ::c_int; |
1488 | pub fn sigaction( |
1489 | signum: ::c_int, |
1490 | act: *const sigaction, |
1491 | oldact: *mut sigaction |
1492 | ) -> ::c_int; |
1493 | } |
1494 | } else { |
1495 | extern { |
1496 | pub fn readlinkat(dirfd: ::c_int, |
1497 | pathname: *const ::c_char, |
1498 | buf: *mut ::c_char, |
1499 | bufsiz: ::size_t) -> ::ssize_t; |
1500 | pub fn fmemopen(buf: *mut c_void, size: size_t, mode: *const c_char) -> *mut FILE; |
1501 | pub fn open_memstream(ptr: *mut *mut c_char, sizeloc: *mut size_t) -> *mut FILE; |
1502 | pub fn atexit(cb: extern "C" fn()) -> c_int; |
1503 | #[cfg_attr (target_os = "netbsd" , link_name = "__sigaction14" )] |
1504 | pub fn sigaction( |
1505 | signum: ::c_int, |
1506 | act: *const sigaction, |
1507 | oldact: *mut sigaction |
1508 | ) -> ::c_int; |
1509 | pub fn readlink(path: *const c_char, buf: *mut c_char, bufsz: ::size_t) -> ::ssize_t; |
1510 | #[cfg_attr ( |
1511 | all(target_os = "macos" , target_arch = "x86_64" ), |
1512 | link_name = "pselect$1050" |
1513 | )] |
1514 | #[cfg_attr ( |
1515 | all(target_os = "macos" , target_arch = "x86" ), |
1516 | link_name = "pselect$UNIX2003" |
1517 | )] |
1518 | #[cfg_attr (target_os = "netbsd" , link_name = "__pselect50" )] |
1519 | pub fn pselect( |
1520 | nfds: ::c_int, |
1521 | readfds: *mut fd_set, |
1522 | writefds: *mut fd_set, |
1523 | errorfds: *mut fd_set, |
1524 | timeout: *const timespec, |
1525 | sigmask: *const sigset_t, |
1526 | ) -> ::c_int; |
1527 | } |
1528 | } |
1529 | } |
1530 | |
1531 | cfg_if! { |
1532 | if #[cfg(not(any(target_os = "solaris" , |
1533 | target_os = "illumos" , |
1534 | target_os = "nto" , |
1535 | )))] { |
1536 | extern { |
1537 | pub fn cfmakeraw(termios: *mut ::termios); |
1538 | pub fn cfsetspeed(termios: *mut ::termios, |
1539 | speed: ::speed_t) -> ::c_int; |
1540 | } |
1541 | } |
1542 | } |
1543 | |
1544 | cfg_if! { |
1545 | if #[cfg(target_env = "newlib" )] { |
1546 | mod newlib; |
1547 | pub use self::newlib::*; |
1548 | } else if #[cfg(any(target_os = "linux" , |
1549 | target_os = "l4re" , |
1550 | target_os = "android" , |
1551 | target_os = "emscripten" ))] { |
1552 | mod linux_like; |
1553 | pub use self::linux_like::*; |
1554 | } else if #[cfg(any(target_os = "macos" , |
1555 | target_os = "ios" , |
1556 | target_os = "tvos" , |
1557 | target_os = "watchos" , |
1558 | target_os = "freebsd" , |
1559 | target_os = "dragonfly" , |
1560 | target_os = "openbsd" , |
1561 | target_os = "netbsd" ))] { |
1562 | mod bsd; |
1563 | pub use self::bsd::*; |
1564 | } else if #[cfg(any(target_os = "solaris" , |
1565 | target_os = "illumos" ))] { |
1566 | mod solarish; |
1567 | pub use self::solarish::*; |
1568 | } else if #[cfg(target_os = "haiku" )] { |
1569 | mod haiku; |
1570 | pub use self::haiku::*; |
1571 | } else if #[cfg(target_os = "redox" )] { |
1572 | mod redox; |
1573 | pub use self::redox::*; |
1574 | } else if #[cfg(target_os = "nto" )] { |
1575 | mod nto; |
1576 | pub use self::nto::*; |
1577 | } else if #[cfg(target_os = "aix" )] { |
1578 | mod aix; |
1579 | pub use self::aix::*; |
1580 | } else if #[cfg(target_os = "hurd" )] { |
1581 | mod hurd; |
1582 | pub use self::hurd::*; |
1583 | } else { |
1584 | // Unknown target_os |
1585 | } |
1586 | } |
1587 | |
1588 | cfg_if! { |
1589 | if #[cfg(libc_core_cvoid)] { |
1590 | pub use ::ffi::c_void; |
1591 | } else { |
1592 | // Use repr(u8) as LLVM expects `void*` to be the same as `i8*` to help |
1593 | // enable more optimization opportunities around it recognizing things |
1594 | // like malloc/free. |
1595 | #[repr (u8)] |
1596 | #[allow (missing_copy_implementations)] |
1597 | #[allow (missing_debug_implementations)] |
1598 | pub enum c_void { |
1599 | // Two dummy variants so the #[repr] attribute can be used. |
1600 | #[doc (hidden)] |
1601 | __variant1, |
1602 | #[doc (hidden)] |
1603 | __variant2, |
1604 | } |
1605 | } |
1606 | } |
1607 | |
1608 | cfg_if! { |
1609 | if #[cfg(libc_align)] { |
1610 | mod align; |
1611 | pub use self::align::*; |
1612 | } else { |
1613 | mod no_align; |
1614 | pub use self::no_align::*; |
1615 | } |
1616 | } |
1617 | |