/rust/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.184/src/unix/mod.rs
Line | Count | Source |
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 | | use crate::prelude::*; |
7 | | |
8 | | pub type intmax_t = i64; |
9 | | pub type uintmax_t = u64; |
10 | | |
11 | | pub type size_t = usize; |
12 | | pub type ptrdiff_t = isize; |
13 | | pub type intptr_t = isize; |
14 | | pub type uintptr_t = usize; |
15 | | pub type ssize_t = isize; |
16 | | |
17 | | pub type pid_t = i32; |
18 | | pub type in_addr_t = u32; |
19 | | pub type in_port_t = u16; |
20 | | pub type sighandler_t = size_t; |
21 | | pub type cc_t = c_uchar; |
22 | | |
23 | | cfg_if! { |
24 | | if #[cfg(any( |
25 | | target_os = "espidf", |
26 | | target_os = "horizon", |
27 | | target_os = "vita" |
28 | | ))] { |
29 | | pub type uid_t = c_ushort; |
30 | | pub type gid_t = c_ushort; |
31 | | } else if #[cfg(target_os = "nto")] { |
32 | | pub type uid_t = i32; |
33 | | pub type gid_t = i32; |
34 | | } else { |
35 | | pub type uid_t = u32; |
36 | | pub type gid_t = u32; |
37 | | } |
38 | | } |
39 | | |
40 | | extern_ty! { |
41 | | pub enum DIR {} |
42 | | } |
43 | | |
44 | | #[cfg(not(target_os = "nuttx"))] |
45 | | pub type locale_t = *mut c_void; |
46 | | |
47 | | s! { |
48 | | pub struct group { |
49 | | pub gr_name: *mut c_char, |
50 | | pub gr_passwd: *mut c_char, |
51 | | pub gr_gid: crate::gid_t, |
52 | | pub gr_mem: *mut *mut c_char, |
53 | | } |
54 | | |
55 | | pub struct utimbuf { |
56 | | pub actime: time_t, |
57 | | pub modtime: time_t, |
58 | | } |
59 | | |
60 | | #[derive(Default)] |
61 | | pub struct timeval { |
62 | | pub tv_sec: time_t, |
63 | | #[cfg(not(gnu_time_bits64))] |
64 | | pub tv_usec: crate::suseconds_t, |
65 | | // For 64 bit time on 32 bit linux glibc, suseconds_t is still |
66 | | // a 32 bit type. Use __suseconds64_t instead |
67 | | #[cfg(gnu_time_bits64)] |
68 | | pub tv_usec: __suseconds64_t, |
69 | | } |
70 | | |
71 | | // linux x32 compatibility |
72 | | // See https://sourceware.org/bugzilla/show_bug.cgi?id=16437 |
73 | | #[derive(Default)] |
74 | | #[cfg(not(target_env = "gnu"))] |
75 | | pub struct timespec { |
76 | | pub tv_sec: time_t, |
77 | | #[cfg(all(musl32_time64, target_endian = "big"))] |
78 | | __pad0: Padding<u32>, |
79 | | #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] |
80 | | pub tv_nsec: i64, |
81 | | #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] |
82 | | pub tv_nsec: c_long, |
83 | | #[cfg(all(musl32_time64, target_endian = "little"))] |
84 | | __pad0: Padding<u32>, |
85 | | } |
86 | | |
87 | | pub struct rlimit { |
88 | | pub rlim_cur: rlim_t, |
89 | | pub rlim_max: rlim_t, |
90 | | } |
91 | | |
92 | | pub struct rusage { |
93 | | pub ru_utime: timeval, |
94 | | pub ru_stime: timeval, |
95 | | pub ru_maxrss: c_long, |
96 | | #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] |
97 | | __pad1: Padding<u32>, |
98 | | pub ru_ixrss: c_long, |
99 | | #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] |
100 | | __pad2: Padding<u32>, |
101 | | pub ru_idrss: c_long, |
102 | | #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] |
103 | | __pad3: Padding<u32>, |
104 | | pub ru_isrss: c_long, |
105 | | #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] |
106 | | __pad4: Padding<u32>, |
107 | | pub ru_minflt: c_long, |
108 | | #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] |
109 | | __pad5: Padding<u32>, |
110 | | pub ru_majflt: c_long, |
111 | | #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] |
112 | | __pad6: Padding<u32>, |
113 | | pub ru_nswap: c_long, |
114 | | #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] |
115 | | __pad7: Padding<u32>, |
116 | | pub ru_inblock: c_long, |
117 | | #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] |
118 | | __pad8: Padding<u32>, |
119 | | pub ru_oublock: c_long, |
120 | | #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] |
121 | | __pad9: Padding<u32>, |
122 | | pub ru_msgsnd: c_long, |
123 | | #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] |
124 | | __pad10: Padding<u32>, |
125 | | pub ru_msgrcv: c_long, |
126 | | #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] |
127 | | __pad11: Padding<u32>, |
128 | | pub ru_nsignals: c_long, |
129 | | #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] |
130 | | __pad12: Padding<u32>, |
131 | | pub ru_nvcsw: c_long, |
132 | | #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] |
133 | | __pad13: Padding<u32>, |
134 | | pub ru_nivcsw: c_long, |
135 | | #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] |
136 | | __pad14: Padding<u32>, |
137 | | |
138 | | #[cfg(any(target_env = "musl", target_env = "ohos", target_os = "emscripten"))] |
139 | | __reserved: Padding<[c_long; 16]>, |
140 | | } |
141 | | |
142 | | #[cfg(not(target_os = "nuttx"))] |
143 | | pub struct ipv6_mreq { |
144 | | pub ipv6mr_multiaddr: in6_addr, |
145 | | #[cfg(target_os = "android")] |
146 | | pub ipv6mr_interface: c_int, |
147 | | #[cfg(not(target_os = "android"))] |
148 | | pub ipv6mr_interface: c_uint, |
149 | | } |
150 | | |
151 | | #[cfg(all(not(target_os = "cygwin"), not(target_os = "horizon")))] |
152 | | pub struct hostent { |
153 | | pub h_name: *mut c_char, |
154 | | pub h_aliases: *mut *mut c_char, |
155 | | pub h_addrtype: c_int, |
156 | | pub h_length: c_int, |
157 | | pub h_addr_list: *mut *mut c_char, |
158 | | } |
159 | | |
160 | | pub struct iovec { |
161 | | pub iov_base: *mut c_void, |
162 | | pub iov_len: size_t, |
163 | | } |
164 | | |
165 | | #[cfg(not(target_os = "horizon"))] |
166 | | pub struct pollfd { |
167 | | pub fd: c_int, |
168 | | pub events: c_short, |
169 | | pub revents: c_short, |
170 | | } |
171 | | |
172 | | pub struct winsize { |
173 | | pub ws_row: c_ushort, |
174 | | pub ws_col: c_ushort, |
175 | | pub ws_xpixel: c_ushort, |
176 | | pub ws_ypixel: c_ushort, |
177 | | } |
178 | | |
179 | | #[cfg(not(target_os = "cygwin"))] |
180 | | pub struct linger { |
181 | | pub l_onoff: c_int, |
182 | | pub l_linger: c_int, |
183 | | } |
184 | | |
185 | | pub struct sigval { |
186 | | // Actually a union of an int and a void* |
187 | | pub sival_ptr: *mut c_void, |
188 | | } |
189 | | |
190 | | // <sys/time.h> |
191 | | pub struct itimerval { |
192 | | pub it_interval: crate::timeval, |
193 | | pub it_value: crate::timeval, |
194 | | } |
195 | | |
196 | | // <sys/times.h> |
197 | | pub struct tms { |
198 | | pub tms_utime: crate::clock_t, |
199 | | pub tms_stime: crate::clock_t, |
200 | | pub tms_cutime: crate::clock_t, |
201 | | pub tms_cstime: crate::clock_t, |
202 | | } |
203 | | |
204 | | pub struct servent { |
205 | | pub s_name: *mut c_char, |
206 | | pub s_aliases: *mut *mut c_char, |
207 | | #[cfg(target_os = "cygwin")] |
208 | | pub s_port: c_short, |
209 | | #[cfg(not(target_os = "cygwin"))] |
210 | | pub s_port: c_int, |
211 | | pub s_proto: *mut c_char, |
212 | | } |
213 | | |
214 | | pub struct protoent { |
215 | | pub p_name: *mut c_char, |
216 | | pub p_aliases: *mut *mut c_char, |
217 | | #[cfg(not(target_os = "cygwin"))] |
218 | | pub p_proto: c_int, |
219 | | #[cfg(target_os = "cygwin")] |
220 | | pub p_proto: c_short, |
221 | | } |
222 | | |
223 | | #[repr(align(4))] |
224 | | pub struct in6_addr { |
225 | | pub s6_addr: [u8; 16], |
226 | | } |
227 | | } |
228 | | |
229 | | pub const INT_MIN: c_int = -2147483648; |
230 | | pub const INT_MAX: c_int = 2147483647; |
231 | | |
232 | | pub const SIG_DFL: sighandler_t = 0 as sighandler_t; |
233 | | pub const SIG_IGN: sighandler_t = 1 as sighandler_t; |
234 | | pub const SIG_ERR: sighandler_t = !0 as sighandler_t; |
235 | | |
236 | | cfg_if! { |
237 | | if #[cfg(all( |
238 | | not(target_os = "nto"), |
239 | | not(target_os = "aix"), |
240 | | not(target_os = "espidf") |
241 | | ))] { |
242 | | pub const DT_UNKNOWN: u8 = 0; |
243 | | pub const DT_FIFO: u8 = 1; |
244 | | pub const DT_CHR: u8 = 2; |
245 | | pub const DT_DIR: u8 = 4; |
246 | | pub const DT_BLK: u8 = 6; |
247 | | pub const DT_REG: u8 = 8; |
248 | | pub const DT_LNK: u8 = 10; |
249 | | pub const DT_SOCK: u8 = 12; |
250 | | } |
251 | | } |
252 | | cfg_if! { |
253 | | if #[cfg(not(target_os = "redox"))] { |
254 | | pub const FD_CLOEXEC: c_int = 0x1; |
255 | | } |
256 | | } |
257 | | |
258 | | cfg_if! { |
259 | | if #[cfg(not(any(target_os = "nto", target_os = "l4re")))] { |
260 | | pub const USRQUOTA: c_int = 0; |
261 | | pub const GRPQUOTA: c_int = 1; |
262 | | } |
263 | | } |
264 | | pub const SIGIOT: c_int = 6; |
265 | | |
266 | | pub const S_ISUID: mode_t = 0o4000; |
267 | | pub const S_ISGID: mode_t = 0o2000; |
268 | | pub const S_ISVTX: mode_t = 0o1000; |
269 | | |
270 | | cfg_if! { |
271 | | if #[cfg(not(any( |
272 | | target_os = "haiku", |
273 | | target_os = "illumos", |
274 | | target_os = "solaris", |
275 | | target_os = "cygwin" |
276 | | )))] { |
277 | | pub const IF_NAMESIZE: size_t = 16; |
278 | | pub const IFNAMSIZ: size_t = IF_NAMESIZE; |
279 | | } |
280 | | } |
281 | | |
282 | | pub const LOG_EMERG: c_int = 0; |
283 | | pub const LOG_ALERT: c_int = 1; |
284 | | pub const LOG_CRIT: c_int = 2; |
285 | | pub const LOG_ERR: c_int = 3; |
286 | | pub const LOG_WARNING: c_int = 4; |
287 | | pub const LOG_NOTICE: c_int = 5; |
288 | | pub const LOG_INFO: c_int = 6; |
289 | | pub const LOG_DEBUG: c_int = 7; |
290 | | |
291 | | pub const LOG_KERN: c_int = 0; |
292 | | pub const LOG_USER: c_int = 1 << 3; |
293 | | pub const LOG_MAIL: c_int = 2 << 3; |
294 | | pub const LOG_DAEMON: c_int = 3 << 3; |
295 | | pub const LOG_AUTH: c_int = 4 << 3; |
296 | | pub const LOG_SYSLOG: c_int = 5 << 3; |
297 | | pub const LOG_LPR: c_int = 6 << 3; |
298 | | pub const LOG_NEWS: c_int = 7 << 3; |
299 | | pub const LOG_UUCP: c_int = 8 << 3; |
300 | | pub const LOG_LOCAL0: c_int = 16 << 3; |
301 | | pub const LOG_LOCAL1: c_int = 17 << 3; |
302 | | pub const LOG_LOCAL2: c_int = 18 << 3; |
303 | | pub const LOG_LOCAL3: c_int = 19 << 3; |
304 | | pub const LOG_LOCAL4: c_int = 20 << 3; |
305 | | pub const LOG_LOCAL5: c_int = 21 << 3; |
306 | | pub const LOG_LOCAL6: c_int = 22 << 3; |
307 | | pub const LOG_LOCAL7: c_int = 23 << 3; |
308 | | |
309 | | cfg_if! { |
310 | | if #[cfg(not(target_os = "haiku"))] { |
311 | | pub const LOG_PID: c_int = 0x01; |
312 | | pub const LOG_CONS: c_int = 0x02; |
313 | | pub const LOG_ODELAY: c_int = 0x04; |
314 | | pub const LOG_NDELAY: c_int = 0x08; |
315 | | pub const LOG_NOWAIT: c_int = 0x10; |
316 | | } |
317 | | } |
318 | | pub const LOG_PRIMASK: c_int = 7; |
319 | | pub const LOG_FACMASK: c_int = 0x3f8; |
320 | | |
321 | | cfg_if! { |
322 | | if #[cfg(not(target_os = "nto"))] { |
323 | | pub const PRIO_MIN: c_int = -20; |
324 | | pub const PRIO_MAX: c_int = 20; |
325 | | } |
326 | | } |
327 | | pub const IPPROTO_ICMP: c_int = 1; |
328 | | pub const IPPROTO_ICMPV6: c_int = 58; |
329 | | pub const IPPROTO_TCP: c_int = 6; |
330 | | pub const IPPROTO_UDP: c_int = 17; |
331 | | pub const IPPROTO_IP: c_int = 0; |
332 | | pub const IPPROTO_IPV6: c_int = 41; |
333 | | |
334 | | pub const INADDR_LOOPBACK: in_addr_t = 2130706433; |
335 | | pub const INADDR_ANY: in_addr_t = 0; |
336 | | pub const INADDR_BROADCAST: in_addr_t = 4294967295; |
337 | | pub const INADDR_NONE: in_addr_t = 4294967295; |
338 | | |
339 | | pub const IN6ADDR_LOOPBACK_INIT: in6_addr = in6_addr { |
340 | | s6_addr: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], |
341 | | }; |
342 | | |
343 | | pub const IN6ADDR_ANY_INIT: in6_addr = in6_addr { |
344 | | s6_addr: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], |
345 | | }; |
346 | | |
347 | | pub const ARPOP_REQUEST: u16 = 1; |
348 | | pub const ARPOP_REPLY: u16 = 2; |
349 | | |
350 | | pub const ATF_COM: c_int = 0x02; |
351 | | pub const ATF_PERM: c_int = 0x04; |
352 | | pub const ATF_PUBL: c_int = 0x08; |
353 | | pub const ATF_USETRAILERS: c_int = 0x10; |
354 | | |
355 | | cfg_if! { |
356 | | if #[cfg(any(target_os = "nto", target_os = "aix"))] { |
357 | | pub const FNM_PERIOD: c_int = 1 << 1; |
358 | | } else { |
359 | | pub const FNM_PERIOD: c_int = 1 << 2; |
360 | | } |
361 | | } |
362 | | pub const FNM_NOMATCH: c_int = 1; |
363 | | |
364 | | cfg_if! { |
365 | | if #[cfg(any( |
366 | | target_os = "illumos", |
367 | | target_os = "solaris", |
368 | | target_os = "netbsd" |
369 | | ))] { |
370 | | pub const FNM_CASEFOLD: c_int = 1 << 3; |
371 | | } else if #[cfg(not(target_os = "aix"))] { |
372 | | pub const FNM_CASEFOLD: c_int = 1 << 4; |
373 | | } |
374 | | } |
375 | | |
376 | | cfg_if! { |
377 | | if #[cfg(any( |
378 | | target_os = "macos", |
379 | | target_os = "freebsd", |
380 | | target_os = "android", |
381 | | target_os = "openbsd", |
382 | | target_os = "cygwin", |
383 | | target_os = "netbsd", |
384 | | ))] { |
385 | | pub const FNM_PATHNAME: c_int = 1 << 1; |
386 | | } else { |
387 | | pub const FNM_PATHNAME: c_int = 1 << 0; |
388 | | } |
389 | | } |
390 | | |
391 | | cfg_if! { |
392 | | if #[cfg(any( |
393 | | target_os = "macos", |
394 | | target_os = "freebsd", |
395 | | target_os = "android", |
396 | | target_os = "openbsd", |
397 | | target_os = "netbsd", |
398 | | target_os = "cygwin", |
399 | | ))] { |
400 | | pub const FNM_NOESCAPE: c_int = 1 << 0; |
401 | | } else if #[cfg(target_os = "nto")] { |
402 | | pub const FNM_NOESCAPE: c_int = 1 << 2; |
403 | | } else if #[cfg(target_os = "aix")] { |
404 | | pub const FNM_NOESCAPE: c_int = 1 << 3; |
405 | | } else { |
406 | | pub const FNM_NOESCAPE: c_int = 1 << 1; |
407 | | } |
408 | | } |
409 | | |
410 | | extern "C" { |
411 | | pub static in6addr_loopback: in6_addr; |
412 | | pub static in6addr_any: in6_addr; |
413 | | } |
414 | | |
415 | | cfg_if! { |
416 | | if #[cfg(any( |
417 | | target_os = "l4re", |
418 | | target_os = "espidf", |
419 | | target_os = "nuttx" |
420 | | ))] { |
421 | | // required libraries are linked externally for these platforms: |
422 | | // * L4Re |
423 | | // * ESP-IDF |
424 | | // * NuttX |
425 | | } else if #[cfg(feature = "std")] { |
426 | | // cargo build, don't pull in anything extra as the std dep |
427 | | // already pulls in all libs. |
428 | | } else if #[cfg(all( |
429 | | any( |
430 | | all( |
431 | | target_os = "linux", |
432 | | any(target_env = "gnu", target_env = "uclibc") |
433 | | ), |
434 | | target_os = "cygwin" |
435 | | ), |
436 | | feature = "rustc-dep-of-std" |
437 | | ))] { |
438 | | #[link( |
439 | | name = "util", |
440 | | kind = "static", |
441 | | modifiers = "-bundle", |
442 | | cfg(target_feature = "crt-static") |
443 | | )] |
444 | | #[link( |
445 | | name = "rt", |
446 | | kind = "static", |
447 | | modifiers = "-bundle", |
448 | | cfg(target_feature = "crt-static") |
449 | | )] |
450 | | #[link( |
451 | | name = "pthread", |
452 | | kind = "static", |
453 | | modifiers = "-bundle", |
454 | | cfg(target_feature = "crt-static") |
455 | | )] |
456 | | #[link( |
457 | | name = "m", |
458 | | kind = "static", |
459 | | modifiers = "-bundle", |
460 | | cfg(target_feature = "crt-static") |
461 | | )] |
462 | | #[link( |
463 | | name = "dl", |
464 | | kind = "static", |
465 | | modifiers = "-bundle", |
466 | | cfg(target_feature = "crt-static") |
467 | | )] |
468 | | #[link( |
469 | | name = "c", |
470 | | kind = "static", |
471 | | modifiers = "-bundle", |
472 | | cfg(target_feature = "crt-static") |
473 | | )] |
474 | | #[link( |
475 | | name = "gcc_eh", |
476 | | kind = "static", |
477 | | modifiers = "-bundle", |
478 | | cfg(target_feature = "crt-static") |
479 | | )] |
480 | | #[link( |
481 | | name = "gcc", |
482 | | kind = "static", |
483 | | modifiers = "-bundle", |
484 | | cfg(target_feature = "crt-static") |
485 | | )] |
486 | | #[link( |
487 | | name = "c", |
488 | | kind = "static", |
489 | | modifiers = "-bundle", |
490 | | cfg(target_feature = "crt-static") |
491 | | )] |
492 | | #[link(name = "util", cfg(not(target_feature = "crt-static")))] |
493 | | #[link(name = "rt", cfg(not(target_feature = "crt-static")))] |
494 | | #[link(name = "pthread", cfg(not(target_feature = "crt-static")))] |
495 | | #[link(name = "m", cfg(not(target_feature = "crt-static")))] |
496 | | #[link(name = "dl", cfg(not(target_feature = "crt-static")))] |
497 | | #[link(name = "c", cfg(not(target_feature = "crt-static")))] |
498 | | extern "C" {} |
499 | | } else if #[cfg(any(target_env = "musl", target_env = "ohos"))] { |
500 | | #[cfg_attr( |
501 | | feature = "rustc-dep-of-std", |
502 | | link( |
503 | | name = "c", |
504 | | kind = "static", |
505 | | modifiers = "-bundle", |
506 | | cfg(target_feature = "crt-static") |
507 | | ) |
508 | | )] |
509 | | #[cfg_attr( |
510 | | feature = "rustc-dep-of-std", |
511 | | link(name = "c", cfg(not(target_feature = "crt-static"))) |
512 | | )] |
513 | | extern "C" {} |
514 | | } else if #[cfg(target_os = "emscripten")] { |
515 | | // Don't pass -lc to Emscripten, it breaks. See: |
516 | | // https://github.com/emscripten-core/emscripten/issues/22758 |
517 | | } else if #[cfg(all(target_os = "android", feature = "rustc-dep-of-std"))] { |
518 | | #[link( |
519 | | name = "c", |
520 | | kind = "static", |
521 | | modifiers = "-bundle", |
522 | | cfg(target_feature = "crt-static") |
523 | | )] |
524 | | #[link( |
525 | | name = "m", |
526 | | kind = "static", |
527 | | modifiers = "-bundle", |
528 | | cfg(target_feature = "crt-static") |
529 | | )] |
530 | | #[link(name = "m", cfg(not(target_feature = "crt-static")))] |
531 | | #[link(name = "c", cfg(not(target_feature = "crt-static")))] |
532 | | extern "C" {} |
533 | | } else if #[cfg(any( |
534 | | target_os = "macos", |
535 | | target_os = "ios", |
536 | | target_os = "tvos", |
537 | | target_os = "watchos", |
538 | | target_os = "visionos", |
539 | | target_os = "android", |
540 | | target_os = "openbsd", |
541 | | target_os = "nto", |
542 | | ))] { |
543 | | #[link(name = "c")] |
544 | | #[link(name = "m")] |
545 | | extern "C" {} |
546 | | } else if #[cfg(target_os = "haiku")] { |
547 | | #[link(name = "root")] |
548 | | #[link(name = "network")] |
549 | | extern "C" {} |
550 | | } else if #[cfg(target_env = "newlib")] { |
551 | | #[link(name = "c")] |
552 | | #[link(name = "m")] |
553 | | extern "C" {} |
554 | | } else if #[cfg(target_env = "illumos")] { |
555 | | #[link(name = "c")] |
556 | | #[link(name = "m")] |
557 | | extern "C" {} |
558 | | } else if #[cfg(target_os = "redox")] { |
559 | | #[cfg_attr( |
560 | | feature = "rustc-dep-of-std", |
561 | | link( |
562 | | name = "c", |
563 | | kind = "static", |
564 | | modifiers = "-bundle", |
565 | | cfg(target_feature = "crt-static") |
566 | | ) |
567 | | )] |
568 | | #[cfg_attr( |
569 | | feature = "rustc-dep-of-std", |
570 | | link(name = "c", cfg(not(target_feature = "crt-static"))) |
571 | | )] |
572 | | extern "C" {} |
573 | | } else if #[cfg(target_os = "aix")] { |
574 | | #[link(name = "c")] |
575 | | #[link(name = "m")] |
576 | | #[link(name = "bsd")] |
577 | | #[link(name = "pthread")] |
578 | | extern "C" {} |
579 | | } else { |
580 | | #[link(name = "c")] |
581 | | #[link(name = "m")] |
582 | | #[link(name = "rt")] |
583 | | #[link(name = "pthread")] |
584 | | extern "C" {} |
585 | | } |
586 | | } |
587 | | |
588 | | cfg_if! { |
589 | | if #[cfg(not(all(target_os = "linux", target_env = "gnu")))] { |
590 | | extern_ty! { |
591 | | pub enum fpos_t {} // FIXME(unix): fill this out with a struct |
592 | | } |
593 | | } |
594 | | } |
595 | | |
596 | | extern_ty! { |
597 | | pub enum FILE {} |
598 | | } |
599 | | |
600 | | extern "C" { |
601 | | pub fn isalnum(c: c_int) -> c_int; |
602 | | pub fn isalpha(c: c_int) -> c_int; |
603 | | pub fn iscntrl(c: c_int) -> c_int; |
604 | | pub fn isdigit(c: c_int) -> c_int; |
605 | | pub fn isgraph(c: c_int) -> c_int; |
606 | | pub fn islower(c: c_int) -> c_int; |
607 | | pub fn isprint(c: c_int) -> c_int; |
608 | | pub fn ispunct(c: c_int) -> c_int; |
609 | | pub fn isspace(c: c_int) -> c_int; |
610 | | pub fn isupper(c: c_int) -> c_int; |
611 | | pub fn isxdigit(c: c_int) -> c_int; |
612 | | pub fn isblank(c: c_int) -> c_int; |
613 | | pub fn tolower(c: c_int) -> c_int; |
614 | | pub fn toupper(c: c_int) -> c_int; |
615 | | pub fn qsort( |
616 | | base: *mut c_void, |
617 | | num: size_t, |
618 | | size: size_t, |
619 | | compar: Option<unsafe extern "C" fn(*const c_void, *const c_void) -> c_int>, |
620 | | ); |
621 | | pub fn bsearch( |
622 | | key: *const c_void, |
623 | | base: *const c_void, |
624 | | num: size_t, |
625 | | size: size_t, |
626 | | compar: Option<unsafe extern "C" fn(*const c_void, *const c_void) -> c_int>, |
627 | | ) -> *mut c_void; |
628 | | #[cfg_attr( |
629 | | all(target_os = "macos", target_arch = "x86"), |
630 | | link_name = "fopen$UNIX2003" |
631 | | )] |
632 | | #[cfg_attr(gnu_file_offset_bits64, link_name = "fopen64")] |
633 | | pub fn fopen(filename: *const c_char, mode: *const c_char) -> *mut FILE; |
634 | | #[cfg_attr( |
635 | | all(target_os = "macos", target_arch = "x86"), |
636 | | link_name = "freopen$UNIX2003" |
637 | | )] |
638 | | #[cfg_attr(gnu_file_offset_bits64, link_name = "freopen64")] |
639 | | pub fn freopen(filename: *const c_char, mode: *const c_char, file: *mut FILE) -> *mut FILE; |
640 | | |
641 | | pub fn fflush(file: *mut FILE) -> c_int; |
642 | | pub fn fclose(file: *mut FILE) -> c_int; |
643 | | pub fn remove(filename: *const c_char) -> c_int; |
644 | | pub fn rename(oldname: *const c_char, newname: *const c_char) -> c_int; |
645 | | #[cfg_attr(gnu_file_offset_bits64, link_name = "tmpfile64")] |
646 | | pub fn tmpfile() -> *mut FILE; |
647 | | pub fn setvbuf(stream: *mut FILE, buffer: *mut c_char, mode: c_int, size: size_t) -> c_int; |
648 | | pub fn setbuf(stream: *mut FILE, buf: *mut c_char); |
649 | | pub fn getchar() -> c_int; |
650 | | pub fn putchar(c: c_int) -> c_int; |
651 | | pub fn fgetc(stream: *mut FILE) -> c_int; |
652 | | pub fn fgets(buf: *mut c_char, n: c_int, stream: *mut FILE) -> *mut c_char; |
653 | | pub fn fputc(c: c_int, stream: *mut FILE) -> c_int; |
654 | | #[cfg_attr( |
655 | | all(target_os = "macos", target_arch = "x86"), |
656 | | link_name = "fputs$UNIX2003" |
657 | | )] |
658 | | pub fn fputs(s: *const c_char, stream: *mut FILE) -> c_int; |
659 | | pub fn puts(s: *const c_char) -> c_int; |
660 | | pub fn ungetc(c: c_int, stream: *mut FILE) -> c_int; |
661 | | pub fn fread(ptr: *mut c_void, size: size_t, nobj: size_t, stream: *mut FILE) -> size_t; |
662 | | #[cfg_attr( |
663 | | all(target_os = "macos", target_arch = "x86"), |
664 | | link_name = "fwrite$UNIX2003" |
665 | | )] |
666 | | pub fn fwrite(ptr: *const c_void, size: size_t, nobj: size_t, stream: *mut FILE) -> size_t; |
667 | | pub fn fseek(stream: *mut FILE, offset: c_long, whence: c_int) -> c_int; |
668 | | pub fn ftell(stream: *mut FILE) -> c_long; |
669 | | pub fn rewind(stream: *mut FILE); |
670 | | #[cfg_attr(target_os = "netbsd", link_name = "__fgetpos50")] |
671 | | #[cfg_attr(gnu_file_offset_bits64, link_name = "fgetpos64")] |
672 | | pub fn fgetpos(stream: *mut FILE, ptr: *mut fpos_t) -> c_int; |
673 | | #[cfg_attr(target_os = "netbsd", link_name = "__fsetpos50")] |
674 | | #[cfg_attr(gnu_file_offset_bits64, link_name = "fsetpos64")] |
675 | | pub fn fsetpos(stream: *mut FILE, ptr: *const fpos_t) -> c_int; |
676 | | pub fn feof(stream: *mut FILE) -> c_int; |
677 | | pub fn ferror(stream: *mut FILE) -> c_int; |
678 | | pub fn clearerr(stream: *mut FILE); |
679 | | pub fn perror(s: *const c_char); |
680 | | pub fn atof(s: *const c_char) -> c_double; |
681 | | pub fn atoi(s: *const c_char) -> c_int; |
682 | | pub fn atol(s: *const c_char) -> c_long; |
683 | | pub fn atoll(s: *const c_char) -> c_longlong; |
684 | | #[cfg_attr( |
685 | | all(target_os = "macos", target_arch = "x86"), |
686 | | link_name = "strtod$UNIX2003" |
687 | | )] |
688 | | pub fn strtod(s: *const c_char, endp: *mut *mut c_char) -> c_double; |
689 | | pub fn strtof(s: *const c_char, endp: *mut *mut c_char) -> c_float; |
690 | | pub fn strtol(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_long; |
691 | | pub fn strtoll(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_longlong; |
692 | | pub fn strtoul(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_ulong; |
693 | | pub fn strtoull(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_ulonglong; |
694 | | #[cfg_attr(target_os = "aix", link_name = "vec_calloc")] |
695 | | pub fn calloc(nobj: size_t, size: size_t) -> *mut c_void; |
696 | | #[cfg_attr(target_os = "aix", link_name = "vec_malloc")] |
697 | | pub fn malloc(size: size_t) -> *mut c_void; |
698 | | pub fn realloc(p: *mut c_void, size: size_t) -> *mut c_void; |
699 | | pub fn free(p: *mut c_void); |
700 | | pub fn abort() -> !; |
701 | | pub fn exit(status: c_int) -> !; |
702 | | pub fn _exit(status: c_int) -> !; |
703 | | #[cfg_attr( |
704 | | all(target_os = "macos", target_arch = "x86"), |
705 | | link_name = "system$UNIX2003" |
706 | | )] |
707 | | pub fn system(s: *const c_char) -> c_int; |
708 | | pub fn getenv(s: *const c_char) -> *mut c_char; |
709 | | |
710 | | pub fn strcpy(dst: *mut c_char, src: *const c_char) -> *mut c_char; |
711 | | pub fn strncpy(dst: *mut c_char, src: *const c_char, n: size_t) -> *mut c_char; |
712 | | pub fn stpcpy(dst: *mut c_char, src: *const c_char) -> *mut c_char; |
713 | | pub fn strcat(s: *mut c_char, ct: *const c_char) -> *mut c_char; |
714 | | pub fn strncat(s: *mut c_char, ct: *const c_char, n: size_t) -> *mut c_char; |
715 | | pub fn strcmp(cs: *const c_char, ct: *const c_char) -> c_int; |
716 | | pub fn strncmp(cs: *const c_char, ct: *const c_char, n: size_t) -> c_int; |
717 | | pub fn strcoll(cs: *const c_char, ct: *const c_char) -> c_int; |
718 | | pub fn strchr(cs: *const c_char, c: c_int) -> *mut c_char; |
719 | | pub fn strrchr(cs: *const c_char, c: c_int) -> *mut c_char; |
720 | | pub fn strspn(cs: *const c_char, ct: *const c_char) -> size_t; |
721 | | pub fn strcspn(cs: *const c_char, ct: *const c_char) -> size_t; |
722 | | pub fn strdup(cs: *const c_char) -> *mut c_char; |
723 | | pub fn strndup(cs: *const c_char, n: size_t) -> *mut c_char; |
724 | | pub fn strpbrk(cs: *const c_char, ct: *const c_char) -> *mut c_char; |
725 | | pub fn strstr(cs: *const c_char, ct: *const c_char) -> *mut c_char; |
726 | | pub fn strcasecmp(s1: *const c_char, s2: *const c_char) -> c_int; |
727 | | pub fn strncasecmp(s1: *const c_char, s2: *const c_char, n: size_t) -> c_int; |
728 | | pub fn strlen(cs: *const c_char) -> size_t; |
729 | | pub fn strnlen(cs: *const c_char, maxlen: size_t) -> size_t; |
730 | | #[cfg_attr( |
731 | | all(target_os = "macos", target_arch = "x86"), |
732 | | link_name = "strerror$UNIX2003" |
733 | | )] |
734 | | pub fn strerror(n: c_int) -> *mut c_char; |
735 | | pub fn strtok(s: *mut c_char, t: *const c_char) -> *mut c_char; |
736 | | pub fn strtok_r(s: *mut c_char, t: *const c_char, p: *mut *mut c_char) -> *mut c_char; |
737 | | pub fn strxfrm(s: *mut c_char, ct: *const c_char, n: size_t) -> size_t; |
738 | | pub fn strsignal(sig: c_int) -> *mut c_char; |
739 | | pub fn wcslen(buf: *const wchar_t) -> size_t; |
740 | | pub fn wcstombs(dest: *mut c_char, src: *const wchar_t, n: size_t) -> size_t; |
741 | | |
742 | | pub fn memchr(cx: *const c_void, c: c_int, n: size_t) -> *mut c_void; |
743 | | pub fn wmemchr(cx: *const wchar_t, c: wchar_t, n: size_t) -> *mut wchar_t; |
744 | | pub fn memcmp(cx: *const c_void, ct: *const c_void, n: size_t) -> c_int; |
745 | | pub fn memcpy(dest: *mut c_void, src: *const c_void, n: size_t) -> *mut c_void; |
746 | | pub fn memmove(dest: *mut c_void, src: *const c_void, n: size_t) -> *mut c_void; |
747 | | pub fn memset(dest: *mut c_void, c: c_int, n: size_t) -> *mut c_void; |
748 | | pub fn memccpy(dest: *mut c_void, src: *const c_void, c: c_int, n: size_t) -> *mut c_void; |
749 | | } |
750 | | |
751 | | extern "C" { |
752 | | #[cfg_attr(target_os = "netbsd", link_name = "__getpwnam50")] |
753 | | pub fn getpwnam(name: *const c_char) -> *mut passwd; |
754 | | #[cfg_attr(target_os = "netbsd", link_name = "__getpwuid50")] |
755 | | pub fn getpwuid(uid: crate::uid_t) -> *mut passwd; |
756 | | |
757 | | pub fn fprintf(stream: *mut crate::FILE, format: *const c_char, ...) -> c_int; |
758 | | pub fn printf(format: *const c_char, ...) -> c_int; |
759 | | pub fn snprintf(s: *mut c_char, n: size_t, format: *const c_char, ...) -> c_int; |
760 | | pub fn sprintf(s: *mut c_char, format: *const c_char, ...) -> c_int; |
761 | | #[cfg_attr( |
762 | | all(target_os = "linux", not(target_env = "uclibc")), |
763 | | link_name = "__isoc99_fscanf" |
764 | | )] |
765 | | pub fn fscanf(stream: *mut crate::FILE, format: *const c_char, ...) -> c_int; |
766 | | #[cfg_attr( |
767 | | all(target_os = "linux", not(target_env = "uclibc")), |
768 | | link_name = "__isoc99_scanf" |
769 | | )] |
770 | | pub fn scanf(format: *const c_char, ...) -> c_int; |
771 | | #[cfg_attr( |
772 | | all(target_os = "linux", not(target_env = "uclibc")), |
773 | | link_name = "__isoc99_sscanf" |
774 | | )] |
775 | | pub fn sscanf(s: *const c_char, format: *const c_char, ...) -> c_int; |
776 | | pub fn getchar_unlocked() -> c_int; |
777 | | pub fn putchar_unlocked(c: c_int) -> c_int; |
778 | | |
779 | | #[cfg(not(all(target_arch = "powerpc", target_vendor = "nintendo")))] |
780 | | #[cfg_attr(target_os = "netbsd", link_name = "__socket30")] |
781 | | #[cfg_attr(target_os = "illumos", link_name = "__xnet_socket")] |
782 | | #[cfg_attr(target_os = "solaris", link_name = "__xnet7_socket")] |
783 | | #[cfg_attr(target_os = "espidf", link_name = "lwip_socket")] |
784 | | pub fn socket(domain: c_int, ty: c_int, protocol: c_int) -> c_int; |
785 | | #[cfg(not(all(target_arch = "powerpc", target_vendor = "nintendo")))] |
786 | | #[cfg_attr( |
787 | | all(target_os = "macos", target_arch = "x86"), |
788 | | link_name = "connect$UNIX2003" |
789 | | )] |
790 | | #[cfg_attr( |
791 | | any(target_os = "illumos", target_os = "solaris"), |
792 | | link_name = "__xnet_connect" |
793 | | )] |
794 | | #[cfg_attr(target_os = "espidf", link_name = "lwip_connect")] |
795 | | pub fn connect(socket: c_int, address: *const sockaddr, len: socklen_t) -> c_int; |
796 | | #[cfg_attr( |
797 | | all(target_os = "macos", target_arch = "x86"), |
798 | | link_name = "listen$UNIX2003" |
799 | | )] |
800 | | #[cfg_attr(target_os = "espidf", link_name = "lwip_listen")] |
801 | | pub fn listen(socket: c_int, backlog: c_int) -> c_int; |
802 | | #[cfg(not(all(target_arch = "powerpc", target_vendor = "nintendo")))] |
803 | | #[cfg_attr( |
804 | | all(target_os = "macos", target_arch = "x86"), |
805 | | link_name = "accept$UNIX2003" |
806 | | )] |
807 | | #[cfg_attr(target_os = "espidf", link_name = "lwip_accept")] |
808 | | #[cfg_attr(target_os = "aix", link_name = "naccept")] |
809 | | pub fn accept(socket: c_int, address: *mut sockaddr, address_len: *mut socklen_t) -> c_int; |
810 | | #[cfg(not(all(target_arch = "powerpc", target_vendor = "nintendo")))] |
811 | | #[cfg_attr( |
812 | | all(target_os = "macos", target_arch = "x86"), |
813 | | link_name = "getpeername$UNIX2003" |
814 | | )] |
815 | | #[cfg_attr(target_os = "espidf", link_name = "lwip_getpeername")] |
816 | | #[cfg_attr(target_os = "aix", link_name = "ngetpeername")] |
817 | | pub fn getpeername(socket: c_int, address: *mut sockaddr, address_len: *mut socklen_t) |
818 | | -> c_int; |
819 | | #[cfg(not(all(target_arch = "powerpc", target_vendor = "nintendo")))] |
820 | | #[cfg_attr( |
821 | | all(target_os = "macos", target_arch = "x86"), |
822 | | link_name = "getsockname$UNIX2003" |
823 | | )] |
824 | | #[cfg_attr(target_os = "espidf", link_name = "lwip_getsockname")] |
825 | | #[cfg_attr(target_os = "aix", link_name = "ngetsockname")] |
826 | | pub fn getsockname(socket: c_int, address: *mut sockaddr, address_len: *mut socklen_t) |
827 | | -> c_int; |
828 | | #[cfg_attr(target_os = "espidf", link_name = "lwip_setsockopt")] |
829 | | #[cfg_attr(gnu_time_bits64, link_name = "__setsockopt64")] |
830 | | pub fn setsockopt( |
831 | | socket: c_int, |
832 | | level: c_int, |
833 | | name: c_int, |
834 | | value: *const c_void, |
835 | | option_len: socklen_t, |
836 | | ) -> c_int; |
837 | | #[cfg_attr( |
838 | | all(target_os = "macos", target_arch = "x86"), |
839 | | link_name = "socketpair$UNIX2003" |
840 | | )] |
841 | | #[cfg_attr( |
842 | | any(target_os = "illumos", target_os = "solaris"), |
843 | | link_name = "__xnet_socketpair" |
844 | | )] |
845 | | pub fn socketpair( |
846 | | domain: c_int, |
847 | | type_: c_int, |
848 | | protocol: c_int, |
849 | | socket_vector: *mut c_int, |
850 | | ) -> c_int; |
851 | | #[cfg(not(all(target_arch = "powerpc", target_vendor = "nintendo")))] |
852 | | #[cfg_attr( |
853 | | all(target_os = "macos", target_arch = "x86"), |
854 | | link_name = "sendto$UNIX2003" |
855 | | )] |
856 | | #[cfg_attr( |
857 | | any(target_os = "illumos", target_os = "solaris"), |
858 | | link_name = "__xnet_sendto" |
859 | | )] |
860 | | #[cfg_attr(target_os = "espidf", link_name = "lwip_sendto")] |
861 | | pub fn sendto( |
862 | | socket: c_int, |
863 | | buf: *const c_void, |
864 | | len: size_t, |
865 | | flags: c_int, |
866 | | addr: *const sockaddr, |
867 | | addrlen: socklen_t, |
868 | | ) -> ssize_t; |
869 | | #[cfg_attr(target_os = "espidf", link_name = "lwip_shutdown")] |
870 | | pub fn shutdown(socket: c_int, how: c_int) -> c_int; |
871 | | |
872 | | #[cfg_attr( |
873 | | all(target_os = "macos", target_arch = "x86"), |
874 | | link_name = "chmod$UNIX2003" |
875 | | )] |
876 | | pub fn chmod(path: *const c_char, mode: mode_t) -> c_int; |
877 | | #[cfg_attr( |
878 | | all(target_os = "macos", target_arch = "x86"), |
879 | | link_name = "fchmod$UNIX2003" |
880 | | )] |
881 | | pub fn fchmod(fd: c_int, mode: mode_t) -> c_int; |
882 | | |
883 | | #[cfg_attr( |
884 | | all(target_os = "macos", not(target_arch = "aarch64")), |
885 | | link_name = "fstat$INODE64" |
886 | | )] |
887 | | #[cfg_attr(target_os = "netbsd", link_name = "__fstat50")] |
888 | | #[cfg_attr( |
889 | | all(target_os = "freebsd", any(freebsd11, freebsd10)), |
890 | | link_name = "fstat@FBSD_1.0" |
891 | | )] |
892 | | #[cfg_attr(gnu_time_bits64, link_name = "__fstat64_time64")] |
893 | | #[cfg_attr( |
894 | | all(not(gnu_time_bits64), gnu_file_offset_bits64), |
895 | | link_name = "fstat64" |
896 | | )] |
897 | | #[cfg_attr(musl32_time64, link_name = "__fstat_time64")] |
898 | | pub fn fstat(fildes: c_int, buf: *mut stat) -> c_int; |
899 | | |
900 | | pub fn mkdir(path: *const c_char, mode: mode_t) -> c_int; |
901 | | |
902 | | #[cfg_attr( |
903 | | all(target_os = "macos", not(target_arch = "aarch64")), |
904 | | link_name = "stat$INODE64" |
905 | | )] |
906 | | #[cfg_attr(target_os = "netbsd", link_name = "__stat50")] |
907 | | #[cfg_attr( |
908 | | all(target_os = "freebsd", any(freebsd11, freebsd10)), |
909 | | link_name = "stat@FBSD_1.0" |
910 | | )] |
911 | | #[cfg_attr(gnu_time_bits64, link_name = "__stat64_time64")] |
912 | | #[cfg_attr( |
913 | | all(not(gnu_time_bits64), gnu_file_offset_bits64), |
914 | | link_name = "stat64" |
915 | | )] |
916 | | #[cfg_attr(musl32_time64, link_name = "__stat_time64")] |
917 | | pub fn stat(path: *const c_char, buf: *mut stat) -> c_int; |
918 | | |
919 | | pub fn pclose(stream: *mut crate::FILE) -> c_int; |
920 | | #[cfg_attr( |
921 | | all(target_os = "macos", target_arch = "x86"), |
922 | | link_name = "fdopen$UNIX2003" |
923 | | )] |
924 | | pub fn fdopen(fd: c_int, mode: *const c_char) -> *mut crate::FILE; |
925 | | pub fn fileno(stream: *mut crate::FILE) -> c_int; |
926 | | |
927 | | #[cfg_attr( |
928 | | all(target_os = "macos", target_arch = "x86"), |
929 | | link_name = "open$UNIX2003" |
930 | | )] |
931 | | #[cfg_attr(gnu_file_offset_bits64, link_name = "open64")] |
932 | | pub fn open(path: *const c_char, oflag: c_int, ...) -> c_int; |
933 | | #[cfg_attr( |
934 | | all(target_os = "macos", target_arch = "x86"), |
935 | | link_name = "creat$UNIX2003" |
936 | | )] |
937 | | #[cfg_attr(gnu_file_offset_bits64, link_name = "creat64")] |
938 | | pub fn creat(path: *const c_char, mode: mode_t) -> c_int; |
939 | | #[cfg_attr( |
940 | | all(target_os = "macos", target_arch = "x86"), |
941 | | link_name = "fcntl$UNIX2003" |
942 | | )] |
943 | | #[cfg_attr(gnu_time_bits64, link_name = "__fcntl_time64")] |
944 | | #[cfg_attr( |
945 | | all(not(gnu_time_bits64), gnu_file_offset_bits64), |
946 | | link_name = "__fcntl_time64" |
947 | | )] |
948 | | pub fn fcntl(fd: c_int, cmd: c_int, ...) -> c_int; |
949 | | |
950 | | #[cfg_attr( |
951 | | all(target_os = "macos", target_arch = "x86_64"), |
952 | | link_name = "opendir$INODE64" |
953 | | )] |
954 | | #[cfg_attr( |
955 | | all(target_os = "macos", target_arch = "x86"), |
956 | | link_name = "opendir$INODE64$UNIX2003" |
957 | | )] |
958 | | #[cfg_attr(target_os = "netbsd", link_name = "__opendir30")] |
959 | | pub fn opendir(dirname: *const c_char) -> *mut crate::DIR; |
960 | | |
961 | | #[cfg_attr( |
962 | | all(target_os = "macos", not(target_arch = "aarch64")), |
963 | | link_name = "readdir$INODE64" |
964 | | )] |
965 | | #[cfg_attr(target_os = "netbsd", link_name = "__readdir30")] |
966 | | #[cfg_attr( |
967 | | all(target_os = "freebsd", any(freebsd11, freebsd10)), |
968 | | link_name = "readdir@FBSD_1.0" |
969 | | )] |
970 | | #[cfg_attr(gnu_file_offset_bits64, link_name = "readdir64")] |
971 | | pub fn readdir(dirp: *mut crate::DIR) -> *mut crate::dirent; |
972 | | #[cfg_attr( |
973 | | all(target_os = "macos", target_arch = "x86"), |
974 | | link_name = "closedir$UNIX2003" |
975 | | )] |
976 | | pub fn closedir(dirp: *mut crate::DIR) -> c_int; |
977 | | #[cfg_attr( |
978 | | all(target_os = "macos", target_arch = "x86_64"), |
979 | | link_name = "rewinddir$INODE64" |
980 | | )] |
981 | | #[cfg_attr( |
982 | | all(target_os = "macos", target_arch = "x86"), |
983 | | link_name = "rewinddir$INODE64$UNIX2003" |
984 | | )] |
985 | | pub fn rewinddir(dirp: *mut crate::DIR); |
986 | | |
987 | | pub fn fchmodat(dirfd: c_int, pathname: *const c_char, mode: mode_t, flags: c_int) -> c_int; |
988 | | pub fn fchown(fd: c_int, owner: crate::uid_t, group: crate::gid_t) -> c_int; |
989 | | #[cfg(not(target_os = "l4re"))] |
990 | | pub fn fchownat( |
991 | | dirfd: c_int, |
992 | | pathname: *const c_char, |
993 | | owner: crate::uid_t, |
994 | | group: crate::gid_t, |
995 | | flags: c_int, |
996 | | ) -> c_int; |
997 | | #[cfg_attr( |
998 | | all(target_os = "macos", not(target_arch = "aarch64")), |
999 | | link_name = "fstatat$INODE64" |
1000 | | )] |
1001 | | #[cfg_attr( |
1002 | | all(target_os = "freebsd", any(freebsd11, freebsd10)), |
1003 | | link_name = "fstatat@FBSD_1.1" |
1004 | | )] |
1005 | | #[cfg_attr(gnu_time_bits64, link_name = "__fstatat64_time64")] |
1006 | | #[cfg_attr( |
1007 | | all(not(gnu_time_bits64), gnu_file_offset_bits64), |
1008 | | link_name = "fstatat64" |
1009 | | )] |
1010 | | #[cfg(not(target_os = "l4re"))] |
1011 | | #[cfg_attr(musl32_time64, link_name = "__fstatat_time64")] |
1012 | | pub fn fstatat(dirfd: c_int, pathname: *const c_char, buf: *mut stat, flags: c_int) -> c_int; |
1013 | | #[cfg(not(target_os = "l4re"))] |
1014 | | pub fn linkat( |
1015 | | olddirfd: c_int, |
1016 | | oldpath: *const c_char, |
1017 | | newdirfd: c_int, |
1018 | | newpath: *const c_char, |
1019 | | flags: c_int, |
1020 | | ) -> c_int; |
1021 | | #[cfg(not(target_os = "l4re"))] |
1022 | | pub fn renameat( |
1023 | | olddirfd: c_int, |
1024 | | oldpath: *const c_char, |
1025 | | newdirfd: c_int, |
1026 | | newpath: *const c_char, |
1027 | | ) -> c_int; |
1028 | | #[cfg(not(target_os = "l4re"))] |
1029 | | pub fn symlinkat(target: *const c_char, newdirfd: c_int, linkpath: *const c_char) -> c_int; |
1030 | | #[cfg(not(target_os = "l4re"))] |
1031 | | pub fn unlinkat(dirfd: c_int, pathname: *const c_char, flags: c_int) -> c_int; |
1032 | | |
1033 | | pub fn access(path: *const c_char, amode: c_int) -> c_int; |
1034 | | pub fn alarm(seconds: c_uint) -> c_uint; |
1035 | | pub fn chdir(dir: *const c_char) -> c_int; |
1036 | | pub fn fchdir(dirfd: c_int) -> c_int; |
1037 | | pub fn chown(path: *const c_char, uid: uid_t, gid: gid_t) -> c_int; |
1038 | | #[cfg_attr( |
1039 | | all(target_os = "macos", target_arch = "x86"), |
1040 | | link_name = "lchown$UNIX2003" |
1041 | | )] |
1042 | | pub fn lchown(path: *const c_char, uid: uid_t, gid: gid_t) -> c_int; |
1043 | | #[cfg_attr( |
1044 | | all(target_os = "macos", target_arch = "x86"), |
1045 | | link_name = "close$NOCANCEL$UNIX2003" |
1046 | | )] |
1047 | | #[cfg_attr( |
1048 | | all(target_os = "macos", target_arch = "x86_64"), |
1049 | | link_name = "close$NOCANCEL" |
1050 | | )] |
1051 | | pub fn close(fd: c_int) -> c_int; |
1052 | | pub fn dup(fd: c_int) -> c_int; |
1053 | | pub fn dup2(src: c_int, dst: c_int) -> c_int; |
1054 | | |
1055 | | pub fn execl(path: *const c_char, arg0: *const c_char, ...) -> c_int; |
1056 | | pub fn execle(path: *const c_char, arg0: *const c_char, ...) -> c_int; |
1057 | | pub fn execlp(file: *const c_char, arg0: *const c_char, ...) -> c_int; |
1058 | | |
1059 | | // DIFF(main): changed to `*const *mut` in e77f551de9 |
1060 | | pub fn execv(prog: *const c_char, argv: *const *const c_char) -> c_int; |
1061 | | pub fn execve( |
1062 | | prog: *const c_char, |
1063 | | argv: *const *const c_char, |
1064 | | envp: *const *const c_char, |
1065 | | ) -> c_int; |
1066 | | pub fn execvp(c: *const c_char, argv: *const *const c_char) -> c_int; |
1067 | | |
1068 | | pub fn fork() -> pid_t; |
1069 | | pub fn fpathconf(filedes: c_int, name: c_int) -> c_long; |
1070 | | pub fn getcwd(buf: *mut c_char, size: size_t) -> *mut c_char; |
1071 | | pub fn getegid() -> gid_t; |
1072 | | pub fn geteuid() -> uid_t; |
1073 | | pub fn getgid() -> gid_t; |
1074 | | pub fn getgroups(ngroups_max: c_int, groups: *mut gid_t) -> c_int; |
1075 | | #[cfg_attr(target_os = "illumos", link_name = "getloginx")] |
1076 | | pub fn getlogin() -> *mut c_char; |
1077 | | #[cfg_attr( |
1078 | | all(target_os = "macos", target_arch = "x86"), |
1079 | | link_name = "getopt$UNIX2003" |
1080 | | )] |
1081 | | pub fn getopt(argc: c_int, argv: *const *mut c_char, optstr: *const c_char) -> c_int; |
1082 | | pub fn getpgid(pid: pid_t) -> pid_t; |
1083 | | pub fn getpgrp() -> pid_t; |
1084 | | pub fn getpid() -> pid_t; |
1085 | | pub fn getppid() -> pid_t; |
1086 | | pub fn getuid() -> uid_t; |
1087 | | pub fn isatty(fd: c_int) -> c_int; |
1088 | | #[cfg_attr(target_os = "solaris", link_name = "__link_xpg4")] |
1089 | | pub fn link(src: *const c_char, dst: *const c_char) -> c_int; |
1090 | | #[cfg_attr(gnu_file_offset_bits64, link_name = "lseek64")] |
1091 | | pub fn lseek(fd: c_int, offset: off_t, whence: c_int) -> off_t; |
1092 | | pub fn pathconf(path: *const c_char, name: c_int) -> c_long; |
1093 | | pub fn pipe(fds: *mut c_int) -> c_int; |
1094 | | pub fn posix_memalign(memptr: *mut *mut c_void, align: size_t, size: size_t) -> c_int; |
1095 | | pub fn aligned_alloc(alignment: size_t, size: size_t) -> *mut c_void; |
1096 | | #[cfg_attr( |
1097 | | all(target_os = "macos", target_arch = "x86"), |
1098 | | link_name = "read$UNIX2003" |
1099 | | )] |
1100 | | pub fn read(fd: c_int, buf: *mut c_void, count: size_t) -> ssize_t; |
1101 | | pub fn rmdir(path: *const c_char) -> c_int; |
1102 | | pub fn seteuid(uid: uid_t) -> c_int; |
1103 | | pub fn setegid(gid: gid_t) -> c_int; |
1104 | | pub fn setgid(gid: gid_t) -> c_int; |
1105 | | pub fn setpgid(pid: pid_t, pgid: pid_t) -> c_int; |
1106 | | pub fn setsid() -> pid_t; |
1107 | | pub fn setuid(uid: uid_t) -> c_int; |
1108 | | pub fn setreuid(ruid: uid_t, euid: uid_t) -> c_int; |
1109 | | pub fn setregid(rgid: gid_t, egid: gid_t) -> c_int; |
1110 | | #[cfg_attr( |
1111 | | all(target_os = "macos", target_arch = "x86"), |
1112 | | link_name = "sleep$UNIX2003" |
1113 | | )] |
1114 | | pub fn sleep(secs: c_uint) -> c_uint; |
1115 | | #[cfg_attr( |
1116 | | all(target_os = "macos", target_arch = "x86"), |
1117 | | link_name = "nanosleep$UNIX2003" |
1118 | | )] |
1119 | | #[cfg_attr(target_os = "netbsd", link_name = "__nanosleep50")] |
1120 | | #[cfg_attr(gnu_time_bits64, link_name = "__nanosleep64")] |
1121 | | #[cfg_attr(musl32_time64, link_name = "__nanosleep_time64")] |
1122 | | pub fn nanosleep(rqtp: *const timespec, rmtp: *mut timespec) -> c_int; |
1123 | | pub fn tcgetpgrp(fd: c_int) -> pid_t; |
1124 | | pub fn tcsetpgrp(fd: c_int, pgrp: crate::pid_t) -> c_int; |
1125 | | pub fn ttyname(fd: c_int) -> *mut c_char; |
1126 | | #[cfg_attr( |
1127 | | all(target_os = "macos", target_arch = "x86"), |
1128 | | link_name = "ttyname_r$UNIX2003" |
1129 | | )] |
1130 | | #[cfg_attr( |
1131 | | any(target_os = "illumos", target_os = "solaris"), |
1132 | | link_name = "__posix_ttyname_r" |
1133 | | )] |
1134 | | pub fn ttyname_r(fd: c_int, buf: *mut c_char, buflen: size_t) -> c_int; |
1135 | | pub fn unlink(c: *const c_char) -> c_int; |
1136 | | #[cfg_attr( |
1137 | | all(target_os = "macos", target_arch = "x86"), |
1138 | | link_name = "wait$UNIX2003" |
1139 | | )] |
1140 | | pub fn wait(status: *mut c_int) -> pid_t; |
1141 | | #[cfg_attr( |
1142 | | all(target_os = "macos", target_arch = "x86"), |
1143 | | link_name = "waitpid$UNIX2003" |
1144 | | )] |
1145 | | pub fn waitpid(pid: pid_t, status: *mut c_int, options: c_int) -> pid_t; |
1146 | | #[cfg_attr( |
1147 | | all(target_os = "macos", target_arch = "x86"), |
1148 | | link_name = "write$UNIX2003" |
1149 | | )] |
1150 | | pub fn write(fd: c_int, buf: *const c_void, count: size_t) -> ssize_t; |
1151 | | #[cfg_attr( |
1152 | | all(target_os = "macos", target_arch = "x86"), |
1153 | | link_name = "pread$UNIX2003" |
1154 | | )] |
1155 | | #[cfg_attr(gnu_file_offset_bits64, link_name = "pread64")] |
1156 | | pub fn pread(fd: c_int, buf: *mut c_void, count: size_t, offset: off_t) -> ssize_t; |
1157 | | #[cfg_attr( |
1158 | | all(target_os = "macos", target_arch = "x86"), |
1159 | | link_name = "pwrite$UNIX2003" |
1160 | | )] |
1161 | | #[cfg_attr(gnu_file_offset_bits64, link_name = "pwrite64")] |
1162 | | pub fn pwrite(fd: c_int, buf: *const c_void, count: size_t, offset: off_t) -> ssize_t; |
1163 | | pub fn umask(mask: mode_t) -> mode_t; |
1164 | | |
1165 | | #[cfg_attr(target_os = "netbsd", link_name = "__utime50")] |
1166 | | #[cfg_attr(any(gnu_time_bits64, musl32_time64), link_name = "__utime64")] |
1167 | | pub fn utime(file: *const c_char, buf: *const utimbuf) -> c_int; |
1168 | | |
1169 | | #[cfg_attr( |
1170 | | all(target_os = "macos", target_arch = "x86"), |
1171 | | link_name = "kill$UNIX2003" |
1172 | | )] |
1173 | | pub fn kill(pid: pid_t, sig: c_int) -> c_int; |
1174 | | #[cfg_attr( |
1175 | | all(target_os = "macos", target_arch = "x86"), |
1176 | | link_name = "killpg$UNIX2003" |
1177 | | )] |
1178 | | pub fn killpg(pgrp: pid_t, sig: c_int) -> c_int; |
1179 | | |
1180 | | pub fn mlock(addr: *const c_void, len: size_t) -> c_int; |
1181 | | pub fn munlock(addr: *const c_void, len: size_t) -> c_int; |
1182 | | pub fn mlockall(flags: c_int) -> c_int; |
1183 | | pub fn munlockall() -> c_int; |
1184 | | |
1185 | | #[cfg_attr( |
1186 | | all(target_os = "macos", target_arch = "x86"), |
1187 | | link_name = "mmap$UNIX2003" |
1188 | | )] |
1189 | | #[cfg_attr(gnu_file_offset_bits64, link_name = "mmap64")] |
1190 | | pub fn mmap( |
1191 | | addr: *mut c_void, |
1192 | | len: size_t, |
1193 | | prot: c_int, |
1194 | | flags: c_int, |
1195 | | fd: c_int, |
1196 | | offset: off_t, |
1197 | | ) -> *mut c_void; |
1198 | | #[cfg_attr( |
1199 | | all(target_os = "macos", target_arch = "x86"), |
1200 | | link_name = "munmap$UNIX2003" |
1201 | | )] |
1202 | | pub fn munmap(addr: *mut c_void, len: size_t) -> c_int; |
1203 | | |
1204 | | pub fn if_nametoindex(ifname: *const c_char) -> c_uint; |
1205 | | pub fn if_indextoname(ifindex: c_uint, ifname: *mut c_char) -> *mut c_char; |
1206 | | |
1207 | | #[cfg_attr( |
1208 | | all(target_os = "macos", not(target_arch = "aarch64")), |
1209 | | link_name = "lstat$INODE64" |
1210 | | )] |
1211 | | #[cfg_attr(target_os = "netbsd", link_name = "__lstat50")] |
1212 | | #[cfg_attr( |
1213 | | all(target_os = "freebsd", any(freebsd11, freebsd10)), |
1214 | | link_name = "lstat@FBSD_1.0" |
1215 | | )] |
1216 | | #[cfg_attr(gnu_time_bits64, link_name = "__lstat64_time64")] |
1217 | | #[cfg_attr( |
1218 | | all(not(gnu_time_bits64), gnu_file_offset_bits64), |
1219 | | link_name = "lstat64" |
1220 | | )] |
1221 | | #[cfg_attr(musl32_time64, link_name = "__lstat_time64")] |
1222 | | pub fn lstat(path: *const c_char, buf: *mut stat) -> c_int; |
1223 | | |
1224 | | #[cfg_attr( |
1225 | | all(target_os = "macos", target_arch = "x86"), |
1226 | | link_name = "fsync$UNIX2003" |
1227 | | )] |
1228 | | pub fn fsync(fd: c_int) -> c_int; |
1229 | | |
1230 | | #[cfg_attr( |
1231 | | all(target_os = "macos", target_arch = "x86"), |
1232 | | link_name = "setenv$UNIX2003" |
1233 | | )] |
1234 | | pub fn setenv(name: *const c_char, val: *const c_char, overwrite: c_int) -> c_int; |
1235 | | #[cfg_attr( |
1236 | | all(target_os = "macos", target_arch = "x86"), |
1237 | | link_name = "unsetenv$UNIX2003" |
1238 | | )] |
1239 | | #[cfg_attr(target_os = "netbsd", link_name = "__unsetenv13")] |
1240 | | pub fn unsetenv(name: *const c_char) -> c_int; |
1241 | | |
1242 | | pub fn symlink(path1: *const c_char, path2: *const c_char) -> c_int; |
1243 | | |
1244 | | #[cfg_attr(gnu_file_offset_bits64, link_name = "truncate64")] |
1245 | | pub fn truncate(path: *const c_char, length: off_t) -> c_int; |
1246 | | #[cfg_attr(gnu_file_offset_bits64, link_name = "ftruncate64")] |
1247 | | pub fn ftruncate(fd: c_int, length: off_t) -> c_int; |
1248 | | |
1249 | | pub fn signal(signum: c_int, handler: sighandler_t) -> sighandler_t; |
1250 | | |
1251 | | #[cfg_attr(target_os = "netbsd", link_name = "__getrusage50")] |
1252 | | #[cfg_attr(gnu_time_bits64, link_name = "__getrusage64")] |
1253 | | #[cfg_attr(musl32_time64, link_name = "__getrusage_time64")] |
1254 | | pub fn getrusage(resource: c_int, usage: *mut rusage) -> c_int; |
1255 | | |
1256 | | #[cfg_attr( |
1257 | | any( |
1258 | | target_os = "macos", |
1259 | | target_os = "ios", |
1260 | | target_os = "tvos", |
1261 | | target_os = "watchos", |
1262 | | target_os = "visionos" |
1263 | | ), |
1264 | | link_name = "realpath$DARWIN_EXTSN" |
1265 | | )] |
1266 | | pub fn realpath(pathname: *const c_char, resolved: *mut c_char) -> *mut c_char; |
1267 | | |
1268 | | #[cfg_attr(target_os = "netbsd", link_name = "__times13")] |
1269 | | pub fn times(buf: *mut crate::tms) -> crate::clock_t; |
1270 | | |
1271 | | pub fn pthread_self() -> crate::pthread_t; |
1272 | | pub fn pthread_equal(t1: crate::pthread_t, t2: crate::pthread_t) -> c_int; |
1273 | | #[cfg_attr( |
1274 | | all(target_os = "macos", target_arch = "x86"), |
1275 | | link_name = "pthread_join$UNIX2003" |
1276 | | )] |
1277 | | pub fn pthread_join(native: crate::pthread_t, value: *mut *mut c_void) -> c_int; |
1278 | | pub fn pthread_exit(value: *mut c_void) -> !; |
1279 | | pub fn pthread_attr_init(attr: *mut crate::pthread_attr_t) -> c_int; |
1280 | | pub fn pthread_attr_destroy(attr: *mut crate::pthread_attr_t) -> c_int; |
1281 | | pub fn pthread_attr_getstacksize( |
1282 | | attr: *const crate::pthread_attr_t, |
1283 | | stacksize: *mut size_t, |
1284 | | ) -> c_int; |
1285 | | pub fn pthread_attr_setstacksize(attr: *mut crate::pthread_attr_t, stack_size: size_t) |
1286 | | -> c_int; |
1287 | | pub fn pthread_attr_setdetachstate(attr: *mut crate::pthread_attr_t, state: c_int) -> c_int; |
1288 | | pub fn pthread_detach(thread: crate::pthread_t) -> c_int; |
1289 | | #[cfg_attr(target_os = "netbsd", link_name = "__libc_thr_yield")] |
1290 | | pub fn sched_yield() -> c_int; |
1291 | | pub fn pthread_key_create( |
1292 | | key: *mut crate::pthread_key_t, |
1293 | | dtor: Option<unsafe extern "C" fn(*mut c_void)>, |
1294 | | ) -> c_int; |
1295 | | pub fn pthread_key_delete(key: crate::pthread_key_t) -> c_int; |
1296 | | pub fn pthread_getspecific(key: crate::pthread_key_t) -> *mut c_void; |
1297 | | pub fn pthread_setspecific(key: crate::pthread_key_t, value: *const c_void) -> c_int; |
1298 | | pub fn pthread_mutex_init( |
1299 | | lock: *mut crate::pthread_mutex_t, |
1300 | | attr: *const crate::pthread_mutexattr_t, |
1301 | | ) -> c_int; |
1302 | | pub fn pthread_mutex_destroy(lock: *mut crate::pthread_mutex_t) -> c_int; |
1303 | | pub fn pthread_mutex_lock(lock: *mut crate::pthread_mutex_t) -> c_int; |
1304 | | pub fn pthread_mutex_trylock(lock: *mut crate::pthread_mutex_t) -> c_int; |
1305 | | pub fn pthread_mutex_unlock(lock: *mut crate::pthread_mutex_t) -> c_int; |
1306 | | |
1307 | | pub fn pthread_mutexattr_init(attr: *mut crate::pthread_mutexattr_t) -> c_int; |
1308 | | #[cfg_attr( |
1309 | | all(target_os = "macos", target_arch = "x86"), |
1310 | | link_name = "pthread_mutexattr_destroy$UNIX2003" |
1311 | | )] |
1312 | | pub fn pthread_mutexattr_destroy(attr: *mut crate::pthread_mutexattr_t) -> c_int; |
1313 | | pub fn pthread_mutexattr_settype(attr: *mut crate::pthread_mutexattr_t, _type: c_int) -> c_int; |
1314 | | |
1315 | | #[cfg_attr( |
1316 | | all(target_os = "macos", target_arch = "x86"), |
1317 | | link_name = "pthread_cond_init$UNIX2003" |
1318 | | )] |
1319 | | pub fn pthread_cond_init( |
1320 | | cond: *mut crate::pthread_cond_t, |
1321 | | attr: *const crate::pthread_condattr_t, |
1322 | | ) -> c_int; |
1323 | | #[cfg_attr( |
1324 | | all(target_os = "macos", target_arch = "x86"), |
1325 | | link_name = "pthread_cond_wait$UNIX2003" |
1326 | | )] |
1327 | | pub fn pthread_cond_wait( |
1328 | | cond: *mut crate::pthread_cond_t, |
1329 | | lock: *mut crate::pthread_mutex_t, |
1330 | | ) -> c_int; |
1331 | | #[cfg_attr( |
1332 | | all(target_os = "macos", target_arch = "x86"), |
1333 | | link_name = "pthread_cond_timedwait$UNIX2003" |
1334 | | )] |
1335 | | #[cfg_attr(gnu_time_bits64, link_name = "__pthread_cond_timedwait64")] |
1336 | | #[cfg_attr(musl32_time64, link_name = "__pthread_cond_timedwait_time64")] |
1337 | | pub fn pthread_cond_timedwait( |
1338 | | cond: *mut crate::pthread_cond_t, |
1339 | | lock: *mut crate::pthread_mutex_t, |
1340 | | abstime: *const crate::timespec, |
1341 | | ) -> c_int; |
1342 | | pub fn pthread_cond_signal(cond: *mut crate::pthread_cond_t) -> c_int; |
1343 | | pub fn pthread_cond_broadcast(cond: *mut crate::pthread_cond_t) -> c_int; |
1344 | | pub fn pthread_cond_destroy(cond: *mut crate::pthread_cond_t) -> c_int; |
1345 | | pub fn pthread_condattr_init(attr: *mut crate::pthread_condattr_t) -> c_int; |
1346 | | pub fn pthread_condattr_destroy(attr: *mut crate::pthread_condattr_t) -> c_int; |
1347 | | #[cfg_attr( |
1348 | | all(target_os = "macos", target_arch = "x86"), |
1349 | | link_name = "pthread_rwlock_init$UNIX2003" |
1350 | | )] |
1351 | | pub fn pthread_rwlock_init( |
1352 | | lock: *mut crate::pthread_rwlock_t, |
1353 | | attr: *const crate::pthread_rwlockattr_t, |
1354 | | ) -> c_int; |
1355 | | #[cfg_attr( |
1356 | | all(target_os = "macos", target_arch = "x86"), |
1357 | | link_name = "pthread_rwlock_destroy$UNIX2003" |
1358 | | )] |
1359 | | pub fn pthread_rwlock_destroy(lock: *mut crate::pthread_rwlock_t) -> c_int; |
1360 | | #[cfg_attr( |
1361 | | all(target_os = "macos", target_arch = "x86"), |
1362 | | link_name = "pthread_rwlock_rdlock$UNIX2003" |
1363 | | )] |
1364 | | pub fn pthread_rwlock_rdlock(lock: *mut crate::pthread_rwlock_t) -> c_int; |
1365 | | #[cfg_attr( |
1366 | | all(target_os = "macos", target_arch = "x86"), |
1367 | | link_name = "pthread_rwlock_tryrdlock$UNIX2003" |
1368 | | )] |
1369 | | pub fn pthread_rwlock_tryrdlock(lock: *mut crate::pthread_rwlock_t) -> c_int; |
1370 | | #[cfg_attr( |
1371 | | all(target_os = "macos", target_arch = "x86"), |
1372 | | link_name = "pthread_rwlock_wrlock$UNIX2003" |
1373 | | )] |
1374 | | pub fn pthread_rwlock_wrlock(lock: *mut crate::pthread_rwlock_t) -> c_int; |
1375 | | #[cfg_attr( |
1376 | | all(target_os = "macos", target_arch = "x86"), |
1377 | | link_name = "pthread_rwlock_trywrlock$UNIX2003" |
1378 | | )] |
1379 | | pub fn pthread_rwlock_trywrlock(lock: *mut crate::pthread_rwlock_t) -> c_int; |
1380 | | #[cfg_attr( |
1381 | | all(target_os = "macos", target_arch = "x86"), |
1382 | | link_name = "pthread_rwlock_unlock$UNIX2003" |
1383 | | )] |
1384 | | pub fn pthread_rwlock_unlock(lock: *mut crate::pthread_rwlock_t) -> c_int; |
1385 | | pub fn pthread_rwlockattr_init(attr: *mut crate::pthread_rwlockattr_t) -> c_int; |
1386 | | pub fn pthread_rwlockattr_destroy(attr: *mut crate::pthread_rwlockattr_t) -> c_int; |
1387 | | |
1388 | | #[cfg_attr( |
1389 | | any(target_os = "illumos", target_os = "solaris"), |
1390 | | link_name = "__xnet_getsockopt" |
1391 | | )] |
1392 | | #[cfg_attr(target_os = "espidf", link_name = "lwip_getsockopt")] |
1393 | | #[cfg_attr(gnu_time_bits64, link_name = "__getsockopt64")] |
1394 | | pub fn getsockopt( |
1395 | | sockfd: c_int, |
1396 | | level: c_int, |
1397 | | optname: c_int, |
1398 | | optval: *mut c_void, |
1399 | | optlen: *mut crate::socklen_t, |
1400 | | ) -> c_int; |
1401 | | pub fn raise(signum: c_int) -> c_int; |
1402 | | |
1403 | | #[cfg_attr(target_os = "netbsd", link_name = "__utimes50")] |
1404 | | #[cfg_attr(gnu_time_bits64, link_name = "__utimes64")] |
1405 | | #[cfg_attr(musl32_time64, link_name = "__utimes_time64")] |
1406 | | pub fn utimes(filename: *const c_char, times: *const crate::timeval) -> c_int; |
1407 | | pub fn dlopen(filename: *const c_char, flag: c_int) -> *mut c_void; |
1408 | | pub fn dlerror() -> *mut c_char; |
1409 | | #[cfg_attr(musl32_time64, link_name = "__dlsym_time64")] |
1410 | | pub fn dlsym(handle: *mut c_void, symbol: *const c_char) -> *mut c_void; |
1411 | | pub fn dlclose(handle: *mut c_void) -> c_int; |
1412 | | |
1413 | | #[cfg(not(all(target_arch = "powerpc", target_vendor = "nintendo")))] |
1414 | | #[cfg_attr( |
1415 | | any(target_os = "illumos", target_os = "solaris"), |
1416 | | link_name = "__xnet_getaddrinfo" |
1417 | | )] |
1418 | | #[cfg_attr(target_os = "espidf", link_name = "lwip_getaddrinfo")] |
1419 | | pub fn getaddrinfo( |
1420 | | node: *const c_char, |
1421 | | service: *const c_char, |
1422 | | hints: *const addrinfo, |
1423 | | res: *mut *mut addrinfo, |
1424 | | ) -> c_int; |
1425 | | #[cfg(not(all(target_arch = "powerpc", target_vendor = "nintendo")))] |
1426 | | #[cfg_attr(target_os = "espidf", link_name = "lwip_freeaddrinfo")] |
1427 | | pub fn freeaddrinfo(res: *mut addrinfo); |
1428 | | pub fn hstrerror(errcode: c_int) -> *const c_char; |
1429 | | pub fn gai_strerror(errcode: c_int) -> *const c_char; |
1430 | | #[cfg_attr( |
1431 | | any( |
1432 | | all( |
1433 | | target_os = "linux", |
1434 | | not(any(target_env = "musl", target_env = "ohos")) |
1435 | | ), |
1436 | | target_os = "freebsd", |
1437 | | target_os = "cygwin", |
1438 | | target_os = "dragonfly", |
1439 | | target_os = "haiku" |
1440 | | ), |
1441 | | link_name = "__res_init" |
1442 | | )] |
1443 | | #[cfg_attr( |
1444 | | any( |
1445 | | target_os = "macos", |
1446 | | target_os = "ios", |
1447 | | target_os = "tvos", |
1448 | | target_os = "watchos", |
1449 | | target_os = "visionos" |
1450 | | ), |
1451 | | link_name = "res_9_init" |
1452 | | )] |
1453 | | #[cfg_attr(target_os = "aix", link_name = "_res_init")] |
1454 | | #[cfg(not(target_os = "l4re"))] |
1455 | | pub fn res_init() -> c_int; |
1456 | | |
1457 | | #[cfg_attr(target_os = "netbsd", link_name = "__gmtime_r50")] |
1458 | | #[cfg_attr(gnu_time_bits64, link_name = "__gmtime64_r")] |
1459 | | #[cfg_attr(not(musl32_time64), allow(deprecated))] |
1460 | | #[cfg_attr(musl32_time64, link_name = "__gmtime64_r")] |
1461 | | pub fn gmtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm; |
1462 | | #[cfg_attr(target_os = "netbsd", link_name = "__localtime_r50")] |
1463 | | #[cfg_attr(gnu_time_bits64, link_name = "__localtime64_r")] |
1464 | | #[cfg_attr(not(musl32_time64), allow(deprecated))] |
1465 | | #[cfg_attr(musl32_time64, link_name = "__localtime64_r")] |
1466 | | pub fn localtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm; |
1467 | | #[cfg_attr( |
1468 | | all(target_os = "macos", target_arch = "x86"), |
1469 | | link_name = "mktime$UNIX2003" |
1470 | | )] |
1471 | | #[cfg_attr(target_os = "netbsd", link_name = "__mktime50")] |
1472 | | #[cfg_attr(any(gnu_time_bits64, musl32_time64), link_name = "__mktime64")] |
1473 | | #[cfg_attr(not(musl32_time64), allow(deprecated))] |
1474 | | pub fn mktime(tm: *mut tm) -> time_t; |
1475 | | #[cfg_attr(target_os = "netbsd", link_name = "__time50")] |
1476 | | #[cfg_attr(any(gnu_time_bits64, musl32_time64), link_name = "__time64")] |
1477 | | #[cfg_attr(not(musl32_time64), allow(deprecated))] |
1478 | | pub fn time(time: *mut time_t) -> time_t; |
1479 | | #[cfg_attr(target_os = "netbsd", link_name = "__gmtime50")] |
1480 | | #[cfg_attr(any(gnu_time_bits64, musl32_time64), link_name = "__gmtime64")] |
1481 | | #[cfg_attr(not(musl32_time64), allow(deprecated))] |
1482 | | pub fn gmtime(time_p: *const time_t) -> *mut tm; |
1483 | | #[cfg_attr(target_os = "netbsd", link_name = "__locatime50")] |
1484 | | #[cfg_attr(any(gnu_time_bits64, musl32_time64), link_name = "__localtime64")] |
1485 | | #[cfg_attr(not(musl32_time64), allow(deprecated))] |
1486 | | pub fn localtime(time_p: *const time_t) -> *mut tm; |
1487 | | #[cfg_attr(target_os = "netbsd", link_name = "__difftime50")] |
1488 | | #[cfg_attr(any(gnu_time_bits64, musl32_time64), link_name = "__difftime64")] |
1489 | | #[cfg_attr(not(musl32_time64), allow(deprecated))] |
1490 | | pub fn difftime(time1: time_t, time0: time_t) -> c_double; |
1491 | | #[cfg(not(target_os = "aix"))] |
1492 | | #[cfg_attr(target_os = "netbsd", link_name = "__timegm50")] |
1493 | | #[cfg_attr(gnu_time_bits64, link_name = "__timegm64")] |
1494 | | #[cfg_attr(not(musl32_time64), allow(deprecated))] |
1495 | | #[cfg_attr(musl32_time64, link_name = "__timegm_time64")] |
1496 | | pub fn timegm(tm: *mut crate::tm) -> time_t; |
1497 | | |
1498 | | #[cfg_attr(target_os = "netbsd", link_name = "__mknod50")] |
1499 | | #[cfg_attr( |
1500 | | all(target_os = "freebsd", any(freebsd11, freebsd10)), |
1501 | | link_name = "mknod@FBSD_1.0" |
1502 | | )] |
1503 | | pub fn mknod(pathname: *const c_char, mode: mode_t, dev: crate::dev_t) -> c_int; |
1504 | | #[cfg(not(target_os = "espidf"))] |
1505 | | pub fn gethostname(name: *mut c_char, len: size_t) -> c_int; |
1506 | | pub fn endservent(); |
1507 | | pub fn getservbyname(name: *const c_char, proto: *const c_char) -> *mut servent; |
1508 | | pub fn getservbyport(port: c_int, proto: *const c_char) -> *mut servent; |
1509 | | pub fn getservent() -> *mut servent; |
1510 | | pub fn setservent(stayopen: c_int); |
1511 | | pub fn getprotobyname(name: *const c_char) -> *mut protoent; |
1512 | | pub fn getprotobynumber(proto: c_int) -> *mut protoent; |
1513 | | pub fn chroot(name: *const c_char) -> c_int; |
1514 | | #[cfg(target_os = "cygwin")] |
1515 | | pub fn usleep(secs: useconds_t) -> c_int; |
1516 | | #[cfg_attr( |
1517 | | all(target_os = "macos", target_arch = "x86"), |
1518 | | link_name = "usleep$UNIX2003" |
1519 | | )] |
1520 | | #[cfg(not(target_os = "cygwin"))] |
1521 | | pub fn usleep(secs: c_uint) -> c_int; |
1522 | | #[cfg_attr( |
1523 | | all(target_os = "macos", target_arch = "x86"), |
1524 | | link_name = "send$UNIX2003" |
1525 | | )] |
1526 | | #[cfg_attr(target_os = "espidf", link_name = "lwip_send")] |
1527 | | pub fn send(socket: c_int, buf: *const c_void, len: size_t, flags: c_int) -> ssize_t; |
1528 | | #[cfg_attr( |
1529 | | all(target_os = "macos", target_arch = "x86"), |
1530 | | link_name = "recv$UNIX2003" |
1531 | | )] |
1532 | | #[cfg_attr(target_os = "espidf", link_name = "lwip_recv")] |
1533 | | pub fn recv(socket: c_int, buf: *mut c_void, len: size_t, flags: c_int) -> ssize_t; |
1534 | | #[cfg_attr( |
1535 | | all(target_os = "macos", target_arch = "x86"), |
1536 | | link_name = "putenv$UNIX2003" |
1537 | | )] |
1538 | | #[cfg_attr(target_os = "netbsd", link_name = "__putenv50")] |
1539 | | pub fn putenv(string: *mut c_char) -> c_int; |
1540 | | #[cfg_attr( |
1541 | | all(target_os = "macos", target_arch = "x86"), |
1542 | | link_name = "poll$UNIX2003" |
1543 | | )] |
1544 | | pub fn poll(fds: *mut pollfd, nfds: nfds_t, timeout: c_int) -> c_int; |
1545 | | #[cfg_attr( |
1546 | | all(target_os = "macos", target_arch = "x86_64"), |
1547 | | link_name = "select$1050" |
1548 | | )] |
1549 | | #[cfg_attr( |
1550 | | all(target_os = "macos", target_arch = "x86"), |
1551 | | link_name = "select$UNIX2003" |
1552 | | )] |
1553 | | #[cfg_attr(target_os = "netbsd", link_name = "__select50")] |
1554 | | #[cfg_attr(target_os = "aix", link_name = "__fd_select")] |
1555 | | #[cfg_attr(gnu_time_bits64, link_name = "__select64")] |
1556 | | #[cfg_attr(musl32_time64, link_name = "__select_time64")] |
1557 | | pub fn select( |
1558 | | nfds: c_int, |
1559 | | readfds: *mut fd_set, |
1560 | | writefds: *mut fd_set, |
1561 | | errorfds: *mut fd_set, |
1562 | | timeout: *mut timeval, |
1563 | | ) -> c_int; |
1564 | | #[cfg_attr(target_os = "netbsd", link_name = "__setlocale50")] |
1565 | | pub fn setlocale(category: c_int, locale: *const c_char) -> *mut c_char; |
1566 | | pub fn localeconv() -> *mut lconv; |
1567 | | |
1568 | | #[cfg_attr( |
1569 | | all(target_os = "macos", target_arch = "x86"), |
1570 | | link_name = "sem_wait$UNIX2003" |
1571 | | )] |
1572 | | pub fn sem_wait(sem: *mut sem_t) -> c_int; |
1573 | | pub fn sem_trywait(sem: *mut sem_t) -> c_int; |
1574 | | pub fn sem_post(sem: *mut sem_t) -> c_int; |
1575 | | #[cfg_attr(gnu_file_offset_bits64, link_name = "statvfs64")] |
1576 | | pub fn statvfs(path: *const c_char, buf: *mut crate::statvfs) -> c_int; |
1577 | | #[cfg_attr(gnu_file_offset_bits64, link_name = "fstatvfs64")] |
1578 | | pub fn fstatvfs(fd: c_int, buf: *mut crate::statvfs) -> c_int; |
1579 | | |
1580 | | #[cfg_attr(target_os = "netbsd", link_name = "__sigemptyset14")] |
1581 | | pub fn sigemptyset(set: *mut sigset_t) -> c_int; |
1582 | | #[cfg_attr(target_os = "netbsd", link_name = "__sigaddset14")] |
1583 | | pub fn sigaddset(set: *mut sigset_t, signum: c_int) -> c_int; |
1584 | | #[cfg_attr(target_os = "netbsd", link_name = "__sigfillset14")] |
1585 | | pub fn sigfillset(set: *mut sigset_t) -> c_int; |
1586 | | #[cfg_attr(target_os = "netbsd", link_name = "__sigdelset14")] |
1587 | | pub fn sigdelset(set: *mut sigset_t, signum: c_int) -> c_int; |
1588 | | #[cfg_attr(target_os = "netbsd", link_name = "__sigismember14")] |
1589 | | pub fn sigismember(set: *const sigset_t, signum: c_int) -> c_int; |
1590 | | |
1591 | | #[cfg_attr(target_os = "netbsd", link_name = "__sigprocmask14")] |
1592 | | pub fn sigprocmask(how: c_int, set: *const sigset_t, oldset: *mut sigset_t) -> c_int; |
1593 | | #[cfg_attr(target_os = "netbsd", link_name = "__sigpending14")] |
1594 | | pub fn sigpending(set: *mut sigset_t) -> c_int; |
1595 | | |
1596 | | #[cfg_attr(target_os = "solaris", link_name = "__sysconf_xpg7")] |
1597 | | pub fn sysconf(name: c_int) -> c_long; |
1598 | | |
1599 | | pub fn mkfifo(path: *const c_char, mode: mode_t) -> c_int; |
1600 | | |
1601 | | #[cfg_attr(gnu_file_offset_bits64, link_name = "fseeko64")] |
1602 | | pub fn fseeko(stream: *mut crate::FILE, offset: off_t, whence: c_int) -> c_int; |
1603 | | #[cfg_attr(gnu_file_offset_bits64, link_name = "ftello64")] |
1604 | | pub fn ftello(stream: *mut crate::FILE) -> off_t; |
1605 | | #[cfg_attr( |
1606 | | all(target_os = "macos", target_arch = "x86"), |
1607 | | link_name = "tcdrain$UNIX2003" |
1608 | | )] |
1609 | | pub fn tcdrain(fd: c_int) -> c_int; |
1610 | | #[cfg_attr( |
1611 | | all(target_os = "linux", target_env = "gnu", target_arch = "arm"), |
1612 | | link_name = "cfgetispeed@GLIBC_2.4" |
1613 | | )] |
1614 | | #[cfg_attr( |
1615 | | all(target_os = "linux", target_env = "gnu", target_arch = "csky"), |
1616 | | link_name = "cfgetispeed@GLIBC_2.29" |
1617 | | )] |
1618 | | #[cfg_attr( |
1619 | | all(target_os = "linux", target_env = "gnu", target_arch = "m68k"), |
1620 | | link_name = "cfgetispeed@GLIBC_2.0" |
1621 | | )] |
1622 | | #[cfg_attr( |
1623 | | all( |
1624 | | target_os = "linux", |
1625 | | target_env = "gnu", |
1626 | | any(target_arch = "mips", target_arch = "mips32r6") |
1627 | | ), |
1628 | | link_name = "cfgetispeed@GLIBC_2.0" |
1629 | | )] |
1630 | | #[cfg_attr( |
1631 | | all(target_os = "linux", target_env = "gnu", target_arch = "powerpc"), |
1632 | | link_name = "cfgetispeed@GLIBC_2.0" |
1633 | | )] |
1634 | | #[cfg_attr( |
1635 | | all(target_os = "linux", target_env = "gnu", target_arch = "riscv32"), |
1636 | | link_name = "cfgetispeed@GLIBC_2.33" |
1637 | | )] |
1638 | | #[cfg_attr( |
1639 | | all(target_os = "linux", target_env = "gnu", target_arch = "sparc"), |
1640 | | link_name = "cfgetispeed@GLIBC_2.0" |
1641 | | )] |
1642 | | #[cfg_attr( |
1643 | | all(target_os = "linux", target_env = "gnu", target_arch = "x86"), |
1644 | | link_name = "cfgetispeed@GLIBC_2.0" |
1645 | | )] |
1646 | | #[cfg_attr( |
1647 | | all(target_os = "linux", target_env = "gnu", target_arch = "aarch64"), |
1648 | | link_name = "cfgetispeed@GLIBC_2.17" |
1649 | | )] |
1650 | | #[cfg_attr( |
1651 | | all(target_os = "linux", target_env = "gnu", target_arch = "loongarch64"), |
1652 | | link_name = "cfgetispeed@GLIBC_2.36" |
1653 | | )] |
1654 | | #[cfg_attr( |
1655 | | all( |
1656 | | target_os = "linux", |
1657 | | target_env = "gnu", |
1658 | | any(target_arch = "mips64", target_arch = "mips64r6") |
1659 | | ), |
1660 | | link_name = "cfgetispeed@GLIBC_2.0" |
1661 | | )] |
1662 | | #[cfg_attr( |
1663 | | all( |
1664 | | target_os = "linux", |
1665 | | target_env = "gnu", |
1666 | | target_arch = "powerpc64", |
1667 | | target_endian = "big" |
1668 | | ), |
1669 | | link_name = "cfgetispeed@GLIBC_2.3" |
1670 | | )] |
1671 | | #[cfg_attr( |
1672 | | all( |
1673 | | target_os = "linux", |
1674 | | target_env = "gnu", |
1675 | | target_arch = "powerpc64", |
1676 | | target_endian = "little" |
1677 | | ), |
1678 | | link_name = "cfgetispeed@GLIBC_2.17" |
1679 | | )] |
1680 | | #[cfg_attr( |
1681 | | all(target_os = "linux", target_env = "gnu", target_arch = "riscv64"), |
1682 | | link_name = "cfgetispeed@GLIBC_2.27" |
1683 | | )] |
1684 | | #[cfg_attr( |
1685 | | all(target_os = "linux", target_env = "gnu", target_arch = "s390x"), |
1686 | | link_name = "cfgetispeed@GLIBC_2.2" |
1687 | | )] |
1688 | | #[cfg_attr( |
1689 | | all(target_os = "linux", target_env = "gnu", target_arch = "sparc64"), |
1690 | | link_name = "cfgetispeed@GLIBC_2.2" |
1691 | | )] |
1692 | | #[cfg_attr( |
1693 | | all( |
1694 | | target_os = "linux", |
1695 | | target_env = "gnu", |
1696 | | target_arch = "x86_64", |
1697 | | target_pointer_width = "64" |
1698 | | ), |
1699 | | link_name = "cfgetispeed@GLIBC_2.2.5" |
1700 | | )] |
1701 | | #[cfg_attr( |
1702 | | all( |
1703 | | target_os = "linux", |
1704 | | target_env = "gnu", |
1705 | | target_arch = "x86_64", |
1706 | | target_pointer_width = "32" |
1707 | | ), |
1708 | | link_name = "cfgetispeed@GLIBC_2.16" |
1709 | | )] |
1710 | | pub fn cfgetispeed(termios: *const crate::termios) -> crate::speed_t; |
1711 | | #[cfg_attr( |
1712 | | all(target_os = "linux", target_env = "gnu", target_arch = "arm"), |
1713 | | link_name = "cfgetospeed@GLIBC_2.4" |
1714 | | )] |
1715 | | #[cfg_attr( |
1716 | | all(target_os = "linux", target_env = "gnu", target_arch = "csky"), |
1717 | | link_name = "cfgetospeed@GLIBC_2.29" |
1718 | | )] |
1719 | | #[cfg_attr( |
1720 | | all(target_os = "linux", target_env = "gnu", target_arch = "m68k"), |
1721 | | link_name = "cfgetospeed@GLIBC_2.0" |
1722 | | )] |
1723 | | #[cfg_attr( |
1724 | | all( |
1725 | | target_os = "linux", |
1726 | | target_env = "gnu", |
1727 | | any(target_arch = "mips", target_arch = "mips32r6") |
1728 | | ), |
1729 | | link_name = "cfgetospeed@GLIBC_2.0" |
1730 | | )] |
1731 | | #[cfg_attr( |
1732 | | all(target_os = "linux", target_env = "gnu", target_arch = "powerpc"), |
1733 | | link_name = "cfgetospeed@GLIBC_2.0" |
1734 | | )] |
1735 | | #[cfg_attr( |
1736 | | all(target_os = "linux", target_env = "gnu", target_arch = "riscv32"), |
1737 | | link_name = "cfgetospeed@GLIBC_2.33" |
1738 | | )] |
1739 | | #[cfg_attr( |
1740 | | all(target_os = "linux", target_env = "gnu", target_arch = "sparc"), |
1741 | | link_name = "cfgetospeed@GLIBC_2.0" |
1742 | | )] |
1743 | | #[cfg_attr( |
1744 | | all(target_os = "linux", target_env = "gnu", target_arch = "x86"), |
1745 | | link_name = "cfgetospeed@GLIBC_2.0" |
1746 | | )] |
1747 | | #[cfg_attr( |
1748 | | all(target_os = "linux", target_env = "gnu", target_arch = "aarch64"), |
1749 | | link_name = "cfgetospeed@GLIBC_2.17" |
1750 | | )] |
1751 | | #[cfg_attr( |
1752 | | all(target_os = "linux", target_env = "gnu", target_arch = "loongarch64"), |
1753 | | link_name = "cfgetospeed@GLIBC_2.36" |
1754 | | )] |
1755 | | #[cfg_attr( |
1756 | | all( |
1757 | | target_os = "linux", |
1758 | | target_env = "gnu", |
1759 | | any(target_arch = "mips64", target_arch = "mips64r6") |
1760 | | ), |
1761 | | link_name = "cfgetospeed@GLIBC_2.0" |
1762 | | )] |
1763 | | #[cfg_attr( |
1764 | | all( |
1765 | | target_os = "linux", |
1766 | | target_env = "gnu", |
1767 | | target_arch = "powerpc64", |
1768 | | target_endian = "big" |
1769 | | ), |
1770 | | link_name = "cfgetospeed@GLIBC_2.3" |
1771 | | )] |
1772 | | #[cfg_attr( |
1773 | | all( |
1774 | | target_os = "linux", |
1775 | | target_env = "gnu", |
1776 | | target_arch = "powerpc64", |
1777 | | target_endian = "little" |
1778 | | ), |
1779 | | link_name = "cfgetospeed@GLIBC_2.17" |
1780 | | )] |
1781 | | #[cfg_attr( |
1782 | | all(target_os = "linux", target_env = "gnu", target_arch = "riscv64"), |
1783 | | link_name = "cfgetospeed@GLIBC_2.27" |
1784 | | )] |
1785 | | #[cfg_attr( |
1786 | | all(target_os = "linux", target_env = "gnu", target_arch = "s390x"), |
1787 | | link_name = "cfgetospeed@GLIBC_2.2" |
1788 | | )] |
1789 | | #[cfg_attr( |
1790 | | all(target_os = "linux", target_env = "gnu", target_arch = "sparc64"), |
1791 | | link_name = "cfgetospeed@GLIBC_2.2" |
1792 | | )] |
1793 | | #[cfg_attr( |
1794 | | all( |
1795 | | target_os = "linux", |
1796 | | target_env = "gnu", |
1797 | | target_arch = "x86_64", |
1798 | | target_pointer_width = "64" |
1799 | | ), |
1800 | | link_name = "cfgetospeed@GLIBC_2.2.5" |
1801 | | )] |
1802 | | #[cfg_attr( |
1803 | | all( |
1804 | | target_os = "linux", |
1805 | | target_env = "gnu", |
1806 | | target_arch = "x86_64", |
1807 | | target_pointer_width = "32" |
1808 | | ), |
1809 | | link_name = "cfgetospeed@GLIBC_2.16" |
1810 | | )] |
1811 | | pub fn cfgetospeed(termios: *const crate::termios) -> crate::speed_t; |
1812 | | #[cfg_attr( |
1813 | | all(target_os = "linux", target_env = "gnu", target_arch = "arm"), |
1814 | | link_name = "cfsetispeed@GLIBC_2.4" |
1815 | | )] |
1816 | | #[cfg_attr( |
1817 | | all(target_os = "linux", target_env = "gnu", target_arch = "csky"), |
1818 | | link_name = "cfsetispeed@GLIBC_2.29" |
1819 | | )] |
1820 | | #[cfg_attr( |
1821 | | all(target_os = "linux", target_env = "gnu", target_arch = "m68k"), |
1822 | | link_name = "cfsetispeed@GLIBC_2.0" |
1823 | | )] |
1824 | | #[cfg_attr( |
1825 | | all( |
1826 | | target_os = "linux", |
1827 | | target_env = "gnu", |
1828 | | any(target_arch = "mips", target_arch = "mips32r6") |
1829 | | ), |
1830 | | link_name = "cfsetispeed@GLIBC_2.0" |
1831 | | )] |
1832 | | #[cfg_attr( |
1833 | | all(target_os = "linux", target_env = "gnu", target_arch = "powerpc"), |
1834 | | link_name = "cfsetispeed@GLIBC_2.0" |
1835 | | )] |
1836 | | #[cfg_attr( |
1837 | | all(target_os = "linux", target_env = "gnu", target_arch = "riscv32"), |
1838 | | link_name = "cfsetispeed@GLIBC_2.33" |
1839 | | )] |
1840 | | #[cfg_attr( |
1841 | | all(target_os = "linux", target_env = "gnu", target_arch = "sparc"), |
1842 | | link_name = "cfsetispeed@GLIBC_2.0" |
1843 | | )] |
1844 | | #[cfg_attr( |
1845 | | all(target_os = "linux", target_env = "gnu", target_arch = "x86"), |
1846 | | link_name = "cfsetispeed@GLIBC_2.0" |
1847 | | )] |
1848 | | #[cfg_attr( |
1849 | | all(target_os = "linux", target_env = "gnu", target_arch = "aarch64"), |
1850 | | link_name = "cfsetispeed@GLIBC_2.17" |
1851 | | )] |
1852 | | #[cfg_attr( |
1853 | | all(target_os = "linux", target_env = "gnu", target_arch = "loongarch64"), |
1854 | | link_name = "cfsetispeed@GLIBC_2.36" |
1855 | | )] |
1856 | | #[cfg_attr( |
1857 | | all( |
1858 | | target_os = "linux", |
1859 | | target_env = "gnu", |
1860 | | any(target_arch = "mips64", target_arch = "mips64r6") |
1861 | | ), |
1862 | | link_name = "cfsetispeed@GLIBC_2.0" |
1863 | | )] |
1864 | | #[cfg_attr( |
1865 | | all( |
1866 | | target_os = "linux", |
1867 | | target_env = "gnu", |
1868 | | target_arch = "powerpc64", |
1869 | | target_endian = "big" |
1870 | | ), |
1871 | | link_name = "cfsetispeed@GLIBC_2.3" |
1872 | | )] |
1873 | | #[cfg_attr( |
1874 | | all( |
1875 | | target_os = "linux", |
1876 | | target_env = "gnu", |
1877 | | target_arch = "powerpc64", |
1878 | | target_endian = "little" |
1879 | | ), |
1880 | | link_name = "cfsetispeed@GLIBC_2.17" |
1881 | | )] |
1882 | | #[cfg_attr( |
1883 | | all(target_os = "linux", target_env = "gnu", target_arch = "riscv64"), |
1884 | | link_name = "cfsetispeed@GLIBC_2.27" |
1885 | | )] |
1886 | | #[cfg_attr( |
1887 | | all(target_os = "linux", target_env = "gnu", target_arch = "s390x"), |
1888 | | link_name = "cfsetispeed@GLIBC_2.2" |
1889 | | )] |
1890 | | #[cfg_attr( |
1891 | | all(target_os = "linux", target_env = "gnu", target_arch = "sparc64"), |
1892 | | link_name = "cfsetispeed@GLIBC_2.2" |
1893 | | )] |
1894 | | #[cfg_attr( |
1895 | | all( |
1896 | | target_os = "linux", |
1897 | | target_env = "gnu", |
1898 | | target_arch = "x86_64", |
1899 | | target_pointer_width = "64" |
1900 | | ), |
1901 | | link_name = "cfsetispeed@GLIBC_2.2.5" |
1902 | | )] |
1903 | | #[cfg_attr( |
1904 | | all( |
1905 | | target_os = "linux", |
1906 | | target_env = "gnu", |
1907 | | target_arch = "x86_64", |
1908 | | target_pointer_width = "32" |
1909 | | ), |
1910 | | link_name = "cfsetispeed@GLIBC_2.16" |
1911 | | )] |
1912 | | pub fn cfsetispeed(termios: *mut crate::termios, speed: crate::speed_t) -> c_int; |
1913 | | #[cfg_attr( |
1914 | | all(target_os = "linux", target_env = "gnu", target_arch = "arm"), |
1915 | | link_name = "cfsetospeed@GLIBC_2.4" |
1916 | | )] |
1917 | | #[cfg_attr( |
1918 | | all(target_os = "linux", target_env = "gnu", target_arch = "csky"), |
1919 | | link_name = "cfsetospeed@GLIBC_2.29" |
1920 | | )] |
1921 | | #[cfg_attr( |
1922 | | all(target_os = "linux", target_env = "gnu", target_arch = "m68k"), |
1923 | | link_name = "cfsetospeed@GLIBC_2.0" |
1924 | | )] |
1925 | | #[cfg_attr( |
1926 | | all( |
1927 | | target_os = "linux", |
1928 | | target_env = "gnu", |
1929 | | any(target_arch = "mips", target_arch = "mips32r6") |
1930 | | ), |
1931 | | link_name = "cfsetospeed@GLIBC_2.0" |
1932 | | )] |
1933 | | #[cfg_attr( |
1934 | | all(target_os = "linux", target_env = "gnu", target_arch = "powerpc"), |
1935 | | link_name = "cfsetospeed@GLIBC_2.0" |
1936 | | )] |
1937 | | #[cfg_attr( |
1938 | | all(target_os = "linux", target_env = "gnu", target_arch = "riscv32"), |
1939 | | link_name = "cfsetospeed@GLIBC_2.33" |
1940 | | )] |
1941 | | #[cfg_attr( |
1942 | | all(target_os = "linux", target_env = "gnu", target_arch = "sparc"), |
1943 | | link_name = "cfsetospeed@GLIBC_2.0" |
1944 | | )] |
1945 | | #[cfg_attr( |
1946 | | all(target_os = "linux", target_env = "gnu", target_arch = "x86"), |
1947 | | link_name = "cfsetospeed@GLIBC_2.0" |
1948 | | )] |
1949 | | #[cfg_attr( |
1950 | | all(target_os = "linux", target_env = "gnu", target_arch = "aarch64"), |
1951 | | link_name = "cfsetospeed@GLIBC_2.17" |
1952 | | )] |
1953 | | #[cfg_attr( |
1954 | | all(target_os = "linux", target_env = "gnu", target_arch = "loongarch64"), |
1955 | | link_name = "cfsetospeed@GLIBC_2.36" |
1956 | | )] |
1957 | | #[cfg_attr( |
1958 | | all( |
1959 | | target_os = "linux", |
1960 | | target_env = "gnu", |
1961 | | any(target_arch = "mips64", target_arch = "mips64r6") |
1962 | | ), |
1963 | | link_name = "cfsetospeed@GLIBC_2.0" |
1964 | | )] |
1965 | | #[cfg_attr( |
1966 | | all( |
1967 | | target_os = "linux", |
1968 | | target_env = "gnu", |
1969 | | target_arch = "powerpc64", |
1970 | | target_endian = "big" |
1971 | | ), |
1972 | | link_name = "cfsetospeed@GLIBC_2.3" |
1973 | | )] |
1974 | | #[cfg_attr( |
1975 | | all( |
1976 | | target_os = "linux", |
1977 | | target_env = "gnu", |
1978 | | target_arch = "powerpc64", |
1979 | | target_endian = "little" |
1980 | | ), |
1981 | | link_name = "cfsetospeed@GLIBC_2.17" |
1982 | | )] |
1983 | | #[cfg_attr( |
1984 | | all(target_os = "linux", target_env = "gnu", target_arch = "riscv64"), |
1985 | | link_name = "cfsetospeed@GLIBC_2.27" |
1986 | | )] |
1987 | | #[cfg_attr( |
1988 | | all(target_os = "linux", target_env = "gnu", target_arch = "s390x"), |
1989 | | link_name = "cfsetospeed@GLIBC_2.2" |
1990 | | )] |
1991 | | #[cfg_attr( |
1992 | | all(target_os = "linux", target_env = "gnu", target_arch = "sparc64"), |
1993 | | link_name = "cfsetospeed@GLIBC_2.2" |
1994 | | )] |
1995 | | #[cfg_attr( |
1996 | | all( |
1997 | | target_os = "linux", |
1998 | | target_env = "gnu", |
1999 | | target_arch = "x86_64", |
2000 | | target_pointer_width = "64" |
2001 | | ), |
2002 | | link_name = "cfsetospeed@GLIBC_2.2.5" |
2003 | | )] |
2004 | | #[cfg_attr( |
2005 | | all( |
2006 | | target_os = "linux", |
2007 | | target_env = "gnu", |
2008 | | target_arch = "x86_64", |
2009 | | target_pointer_width = "32" |
2010 | | ), |
2011 | | link_name = "cfsetospeed@GLIBC_2.16" |
2012 | | )] |
2013 | | pub fn cfsetospeed(termios: *mut crate::termios, speed: crate::speed_t) -> c_int; |
2014 | | #[cfg_attr( |
2015 | | all( |
2016 | | target_os = "linux", |
2017 | | target_env = "gnu", |
2018 | | any( |
2019 | | target_arch = "mips", |
2020 | | target_arch = "mips32r6", |
2021 | | target_arch = "mips64", |
2022 | | target_arch = "mips64r6", |
2023 | | target_arch = "sparc" |
2024 | | ), |
2025 | | ), |
2026 | | link_name = "tcgetattr@GLIBC_2.0" |
2027 | | )] |
2028 | | #[cfg_attr( |
2029 | | all(target_os = "linux", target_env = "gnu", target_arch = "sparc64"), |
2030 | | link_name = "tcgetattr@GLIBC_2.2" |
2031 | | )] |
2032 | | pub fn tcgetattr(fd: c_int, termios: *mut crate::termios) -> c_int; |
2033 | | #[cfg_attr( |
2034 | | all( |
2035 | | target_os = "linux", |
2036 | | target_env = "gnu", |
2037 | | any( |
2038 | | target_arch = "mips", |
2039 | | target_arch = "mips32r6", |
2040 | | target_arch = "mips64", |
2041 | | target_arch = "mips64r6", |
2042 | | target_arch = "sparc" |
2043 | | ), |
2044 | | ), |
2045 | | link_name = "tcsetattr@GLIBC_2.0" |
2046 | | )] |
2047 | | #[cfg_attr( |
2048 | | all(target_os = "linux", target_env = "gnu", target_arch = "sparc64"), |
2049 | | link_name = "tcsetattr@GLIBC_2.2" |
2050 | | )] |
2051 | | pub fn tcsetattr(fd: c_int, optional_actions: c_int, termios: *const crate::termios) -> c_int; |
2052 | | pub fn tcflow(fd: c_int, action: c_int) -> c_int; |
2053 | | pub fn tcflush(fd: c_int, action: c_int) -> c_int; |
2054 | | pub fn tcgetsid(fd: c_int) -> crate::pid_t; |
2055 | | pub fn tcsendbreak(fd: c_int, duration: c_int) -> c_int; |
2056 | | #[cfg_attr(gnu_file_offset_bits64, link_name = "mkstemp64")] |
2057 | | pub fn mkstemp(template: *mut c_char) -> c_int; |
2058 | | pub fn mkdtemp(template: *mut c_char) -> *mut c_char; |
2059 | | |
2060 | | pub fn tmpnam(ptr: *mut c_char) -> *mut c_char; |
2061 | | |
2062 | | pub fn openlog(ident: *const c_char, logopt: c_int, facility: c_int); |
2063 | | pub fn closelog(); |
2064 | | pub fn setlogmask(maskpri: c_int) -> c_int; |
2065 | | #[cfg_attr(target_os = "macos", link_name = "syslog$DARWIN_EXTSN")] |
2066 | | pub fn syslog(priority: c_int, message: *const c_char, ...); |
2067 | | #[cfg_attr( |
2068 | | all(target_os = "macos", target_arch = "x86"), |
2069 | | link_name = "nice$UNIX2003" |
2070 | | )] |
2071 | | pub fn nice(incr: c_int) -> c_int; |
2072 | | |
2073 | | #[cfg(not(target_os = "l4re"))] |
2074 | | pub fn grantpt(fd: c_int) -> c_int; |
2075 | | #[cfg(not(target_os = "l4re"))] |
2076 | | pub fn posix_openpt(flags: c_int) -> c_int; |
2077 | | #[cfg(not(target_os = "l4re"))] |
2078 | | pub fn ptsname(fd: c_int) -> *mut c_char; |
2079 | | #[cfg(not(target_os = "l4re"))] |
2080 | | pub fn unlockpt(fd: c_int) -> c_int; |
2081 | | |
2082 | | #[cfg(not(target_os = "aix"))] |
2083 | | pub fn strcasestr(cs: *const c_char, ct: *const c_char) -> *mut c_char; |
2084 | | pub fn getline(lineptr: *mut *mut c_char, n: *mut size_t, stream: *mut FILE) -> ssize_t; |
2085 | | |
2086 | | #[cfg_attr(gnu_file_offset_bits64, link_name = "lockf64")] |
2087 | | pub fn lockf(fd: c_int, cmd: c_int, len: off_t) -> c_int; |
2088 | | |
2089 | | } |
2090 | | |
2091 | | safe_f! { |
2092 | | // It seems htonl, etc are macros on macOS. So we have to reimplement them. So let's |
2093 | | // reimplement them for all UNIX platforms |
2094 | 0 | pub const fn htonl(hostlong: u32) -> u32 { |
2095 | 0 | u32::to_be(hostlong) |
2096 | | } |
2097 | 0 | pub const fn htons(hostshort: u16) -> u16 { |
2098 | 0 | u16::to_be(hostshort) |
2099 | | } |
2100 | 0 | pub const fn ntohl(netlong: u32) -> u32 { |
2101 | 0 | u32::from_be(netlong) |
2102 | | } |
2103 | 0 | pub const fn ntohs(netshort: u16) -> u16 { |
2104 | 0 | u16::from_be(netshort) |
2105 | | } |
2106 | | } |
2107 | | |
2108 | | cfg_if! { |
2109 | | if #[cfg(not(any( |
2110 | | target_os = "emscripten", |
2111 | | target_os = "android", |
2112 | | target_os = "haiku", |
2113 | | target_os = "nto", |
2114 | | target_os = "solaris", |
2115 | | target_os = "cygwin", |
2116 | | target_os = "aix", |
2117 | | target_os = "l4re", |
2118 | | )))] { |
2119 | | extern "C" { |
2120 | | #[cfg_attr(target_os = "netbsd", link_name = "__adjtime50")] |
2121 | | #[cfg_attr(any(gnu_time_bits64, musl32_time64), link_name = "__adjtime64")] |
2122 | | pub fn adjtime(delta: *const timeval, olddelta: *mut timeval) -> c_int; |
2123 | | } |
2124 | | } else if #[cfg(target_os = "solaris")] { |
2125 | | extern "C" { |
2126 | | pub fn adjtime(delta: *mut timeval, olddelta: *mut timeval) -> c_int; |
2127 | | } |
2128 | | } |
2129 | | } |
2130 | | |
2131 | | cfg_if! { |
2132 | | if #[cfg(not(any( |
2133 | | target_os = "emscripten", |
2134 | | target_os = "android", |
2135 | | target_os = "nto" |
2136 | | )))] { |
2137 | | extern "C" { |
2138 | | pub fn stpncpy(dst: *mut c_char, src: *const c_char, n: size_t) -> *mut c_char; |
2139 | | } |
2140 | | } |
2141 | | } |
2142 | | |
2143 | | cfg_if! { |
2144 | | if #[cfg(not(any( |
2145 | | target_os = "dragonfly", |
2146 | | target_os = "emscripten", |
2147 | | target_os = "hurd", |
2148 | | target_os = "macos", |
2149 | | target_os = "openbsd", |
2150 | | target_os = "l4re", |
2151 | | )))] { |
2152 | | extern "C" { |
2153 | | pub fn sigqueue(pid: pid_t, sig: c_int, value: crate::sigval) -> c_int; |
2154 | | } |
2155 | | } |
2156 | | } |
2157 | | |
2158 | | cfg_if! { |
2159 | | if #[cfg(not(target_os = "android"))] { |
2160 | | extern "C" { |
2161 | | #[cfg_attr( |
2162 | | all(target_os = "macos", target_arch = "x86"), |
2163 | | link_name = "confstr$UNIX2003" |
2164 | | )] |
2165 | | #[cfg_attr(target_os = "solaris", link_name = "__confstr_xpg7")] |
2166 | | pub fn confstr(name: c_int, buf: *mut c_char, len: size_t) -> size_t; |
2167 | | } |
2168 | | } |
2169 | | } |
2170 | | |
2171 | | cfg_if! { |
2172 | | if #[cfg(not(target_os = "aix"))] { |
2173 | | extern "C" { |
2174 | | pub fn dladdr(addr: *const c_void, info: *mut Dl_info) -> c_int; |
2175 | | } |
2176 | | } |
2177 | | } |
2178 | | |
2179 | | cfg_if! { |
2180 | | if #[cfg(not(target_os = "solaris"))] { |
2181 | | extern "C" { |
2182 | | pub fn flock(fd: c_int, operation: c_int) -> c_int; |
2183 | | } |
2184 | | } |
2185 | | } |
2186 | | |
2187 | | cfg_if! { |
2188 | | if #[cfg(not(any(target_env = "uclibc", target_os = "nto")))] { |
2189 | | extern "C" { |
2190 | | pub fn open_wmemstream(ptr: *mut *mut wchar_t, sizeloc: *mut size_t) -> *mut FILE; |
2191 | | } |
2192 | | } |
2193 | | } |
2194 | | |
2195 | | cfg_if! { |
2196 | | if #[cfg(not(target_os = "redox"))] { |
2197 | | extern "C" { |
2198 | | pub fn getsid(pid: pid_t) -> pid_t; |
2199 | | #[cfg_attr( |
2200 | | all(target_os = "macos", target_arch = "x86"), |
2201 | | link_name = "pause$UNIX2003" |
2202 | | )] |
2203 | | pub fn pause() -> c_int; |
2204 | | |
2205 | | #[cfg(not(target_os = "l4re"))] |
2206 | | pub fn mkdirat(dirfd: c_int, pathname: *const c_char, mode: mode_t) -> c_int; |
2207 | | #[cfg_attr(gnu_file_offset_bits64, link_name = "openat64")] |
2208 | | pub fn openat(dirfd: c_int, pathname: *const c_char, flags: c_int, ...) -> c_int; |
2209 | | |
2210 | | #[cfg_attr( |
2211 | | all(target_os = "macos", target_arch = "x86_64"), |
2212 | | link_name = "fdopendir$INODE64" |
2213 | | )] |
2214 | | #[cfg_attr( |
2215 | | all(target_os = "macos", target_arch = "x86"), |
2216 | | link_name = "fdopendir$INODE64$UNIX2003" |
2217 | | )] |
2218 | | pub fn fdopendir(fd: c_int) -> *mut crate::DIR; |
2219 | | |
2220 | | #[cfg_attr( |
2221 | | all(target_os = "macos", not(target_arch = "aarch64")), |
2222 | | link_name = "readdir_r$INODE64" |
2223 | | )] |
2224 | | #[cfg_attr(target_os = "netbsd", link_name = "__readdir_r30")] |
2225 | | #[cfg_attr( |
2226 | | all(target_os = "freebsd", any(freebsd11, freebsd10)), |
2227 | | link_name = "readdir_r@FBSD_1.0" |
2228 | | )] |
2229 | | #[cfg_attr( |
2230 | | all(target_os = "freebsd", not(any(freebsd11, freebsd10))), |
2231 | | link_name = "readdir_r@FBSD_1.5" |
2232 | | )] |
2233 | | #[allow(non_autolinks)] // FIXME(docs): `<>` breaks line length limit. |
2234 | | /// The 64-bit libc on Solaris and illumos only has readdir_r. If a |
2235 | | /// 32-bit Solaris or illumos target is ever created, it should use |
2236 | | /// __posix_readdir_r. See libc(3LIB) on Solaris or illumos: |
2237 | | /// https://illumos.org/man/3lib/libc |
2238 | | /// https://docs.oracle.com/cd/E36784_01/html/E36873/libc-3lib.html |
2239 | | /// https://www.unix.com/man-page/opensolaris/3LIB/libc/ |
2240 | | #[cfg_attr(gnu_file_offset_bits64, link_name = "readdir64_r")] |
2241 | | pub fn readdir_r( |
2242 | | dirp: *mut crate::DIR, |
2243 | | entry: *mut crate::dirent, |
2244 | | result: *mut *mut crate::dirent, |
2245 | | ) -> c_int; |
2246 | | } |
2247 | | } |
2248 | | } |
2249 | | |
2250 | | cfg_if! { |
2251 | | if #[cfg(target_os = "nto")] { |
2252 | | extern "C" { |
2253 | | pub fn readlinkat( |
2254 | | dirfd: c_int, |
2255 | | pathname: *const c_char, |
2256 | | buf: *mut c_char, |
2257 | | bufsiz: size_t, |
2258 | | ) -> c_int; |
2259 | | pub fn readlink(path: *const c_char, buf: *mut c_char, bufsz: size_t) -> c_int; |
2260 | | pub fn pselect( |
2261 | | nfds: c_int, |
2262 | | readfds: *mut fd_set, |
2263 | | writefds: *mut fd_set, |
2264 | | errorfds: *mut fd_set, |
2265 | | timeout: *mut timespec, |
2266 | | sigmask: *const sigset_t, |
2267 | | ) -> c_int; |
2268 | | pub fn sigaction(signum: c_int, act: *const sigaction, oldact: *mut sigaction) |
2269 | | -> c_int; |
2270 | | } |
2271 | | } else { |
2272 | | extern "C" { |
2273 | | #[cfg(not(target_os = "l4re"))] |
2274 | | pub fn readlinkat( |
2275 | | dirfd: c_int, |
2276 | | pathname: *const c_char, |
2277 | | buf: *mut c_char, |
2278 | | bufsiz: size_t, |
2279 | | ) -> ssize_t; |
2280 | | #[cfg(not(target_os = "l4re"))] |
2281 | | pub fn fmemopen(buf: *mut c_void, size: size_t, mode: *const c_char) -> *mut FILE; |
2282 | | #[cfg(not(target_os = "l4re"))] |
2283 | | pub fn open_memstream(ptr: *mut *mut c_char, sizeloc: *mut size_t) -> *mut FILE; |
2284 | | pub fn atexit(cb: extern "C" fn()) -> c_int; |
2285 | | #[cfg_attr(target_os = "netbsd", link_name = "__sigaction14")] |
2286 | | pub fn sigaction(signum: c_int, act: *const sigaction, oldact: *mut sigaction) |
2287 | | -> c_int; |
2288 | | pub fn readlink(path: *const c_char, buf: *mut c_char, bufsz: size_t) -> ssize_t; |
2289 | | #[cfg_attr( |
2290 | | all(target_os = "macos", target_arch = "x86_64"), |
2291 | | link_name = "pselect$1050" |
2292 | | )] |
2293 | | #[cfg_attr( |
2294 | | all(target_os = "macos", target_arch = "x86"), |
2295 | | link_name = "pselect$UNIX2003" |
2296 | | )] |
2297 | | #[cfg_attr(target_os = "netbsd", link_name = "__pselect50")] |
2298 | | #[cfg_attr(gnu_time_bits64, link_name = "__pselect64")] |
2299 | | #[cfg_attr(musl32_time64, link_name = "__pselect_time64")] |
2300 | | pub fn pselect( |
2301 | | nfds: c_int, |
2302 | | readfds: *mut fd_set, |
2303 | | writefds: *mut fd_set, |
2304 | | errorfds: *mut fd_set, |
2305 | | timeout: *const timespec, |
2306 | | sigmask: *const sigset_t, |
2307 | | ) -> c_int; |
2308 | | } |
2309 | | } |
2310 | | } |
2311 | | |
2312 | | cfg_if! { |
2313 | | if #[cfg(any(target_os = "aix", target_os = "nto"))] { |
2314 | | extern "C" { |
2315 | | pub fn cfmakeraw(termios: *mut crate::termios) -> c_int; |
2316 | | } |
2317 | | } else if #[cfg(not(any(target_os = "solaris", target_os = "illumos",)))] { |
2318 | | extern "C" { |
2319 | | pub fn cfmakeraw(termios: *mut crate::termios); |
2320 | | } |
2321 | | } |
2322 | | } |
2323 | | |
2324 | | cfg_if! { |
2325 | | if #[cfg(any( |
2326 | | target_os = "aix", |
2327 | | all(target_os = "nto", target_env = "nto80") |
2328 | | ))] { |
2329 | | extern "C" { |
2330 | | pub fn cfsetspeed(termios: *mut crate::termios, speed: crate::speed_t) -> c_int; |
2331 | | } |
2332 | | } else if #[cfg(not(any( |
2333 | | target_os = "solaris", |
2334 | | target_os = "illumos", |
2335 | | target_os = "nto" |
2336 | | )))] { |
2337 | | extern "C" { |
2338 | | #[cfg(not(target_os = "l4re"))] |
2339 | | #[cfg_attr( |
2340 | | all(target_os = "linux", target_env = "gnu", target_arch = "arm"), |
2341 | | link_name = "cfsetspeed@GLIBC_2.4" |
2342 | | )] |
2343 | | #[cfg_attr( |
2344 | | all(target_os = "linux", target_env = "gnu", target_arch = "csky"), |
2345 | | link_name = "cfsetspeed@GLIBC_2.29" |
2346 | | )] |
2347 | | #[cfg_attr( |
2348 | | all(target_os = "linux", target_env = "gnu", target_arch = "m68k"), |
2349 | | link_name = "cfsetspeed@GLIBC_2.0" |
2350 | | )] |
2351 | | #[cfg_attr( |
2352 | | all( |
2353 | | target_os = "linux", |
2354 | | target_env = "gnu", |
2355 | | any(target_arch = "mips", target_arch = "mips32r6") |
2356 | | ), |
2357 | | link_name = "cfsetspeed@GLIBC_2.0" |
2358 | | )] |
2359 | | #[cfg_attr( |
2360 | | all(target_os = "linux", target_env = "gnu", target_arch = "powerpc"), |
2361 | | link_name = "cfsetspeed@GLIBC_2.0" |
2362 | | )] |
2363 | | #[cfg_attr( |
2364 | | all(target_os = "linux", target_env = "gnu", target_arch = "riscv32"), |
2365 | | link_name = "cfsetspeed@GLIBC_2.33" |
2366 | | )] |
2367 | | #[cfg_attr( |
2368 | | all(target_os = "linux", target_env = "gnu", target_arch = "sparc"), |
2369 | | link_name = "cfsetspeed@GLIBC_2.0" |
2370 | | )] |
2371 | | #[cfg_attr( |
2372 | | all(target_os = "linux", target_env = "gnu", target_arch = "x86"), |
2373 | | link_name = "cfsetspeed@GLIBC_2.0" |
2374 | | )] |
2375 | | #[cfg_attr( |
2376 | | all(target_os = "linux", target_env = "gnu", target_arch = "aarch64"), |
2377 | | link_name = "cfsetspeed@GLIBC_2.17" |
2378 | | )] |
2379 | | #[cfg_attr( |
2380 | | all(target_os = "linux", target_env = "gnu", target_arch = "loongarch64"), |
2381 | | link_name = "cfsetspeed@GLIBC_2.36" |
2382 | | )] |
2383 | | #[cfg_attr( |
2384 | | all( |
2385 | | target_os = "linux", |
2386 | | target_env = "gnu", |
2387 | | any(target_arch = "mips64", target_arch = "mips64r6") |
2388 | | ), |
2389 | | link_name = "cfsetspeed@GLIBC_2.0" |
2390 | | )] |
2391 | | #[cfg_attr( |
2392 | | all( |
2393 | | target_os = "linux", |
2394 | | target_env = "gnu", |
2395 | | target_arch = "powerpc64", |
2396 | | target_endian = "big" |
2397 | | ), |
2398 | | link_name = "cfsetspeed@GLIBC_2.3" |
2399 | | )] |
2400 | | #[cfg_attr( |
2401 | | all( |
2402 | | target_os = "linux", |
2403 | | target_env = "gnu", |
2404 | | target_arch = "powerpc64", |
2405 | | target_endian = "little" |
2406 | | ), |
2407 | | link_name = "cfsetspeed@GLIBC_2.17" |
2408 | | )] |
2409 | | #[cfg_attr( |
2410 | | all(target_os = "linux", target_env = "gnu", target_arch = "riscv64"), |
2411 | | link_name = "cfsetspeed@GLIBC_2.27" |
2412 | | )] |
2413 | | #[cfg_attr( |
2414 | | all(target_os = "linux", target_env = "gnu", target_arch = "s390x"), |
2415 | | link_name = "cfsetspeed@GLIBC_2.2" |
2416 | | )] |
2417 | | #[cfg_attr( |
2418 | | all(target_os = "linux", target_env = "gnu", target_arch = "sparc64"), |
2419 | | link_name = "cfsetspeed@GLIBC_2.2" |
2420 | | )] |
2421 | | #[cfg_attr( |
2422 | | all( |
2423 | | target_os = "linux", |
2424 | | target_env = "gnu", |
2425 | | target_arch = "x86_64", |
2426 | | target_pointer_width = "64" |
2427 | | ), |
2428 | | link_name = "cfsetspeed@GLIBC_2.2.5" |
2429 | | )] |
2430 | | #[cfg_attr( |
2431 | | all( |
2432 | | target_os = "linux", |
2433 | | target_env = "gnu", |
2434 | | target_arch = "x86_64", |
2435 | | target_pointer_width = "32" |
2436 | | ), |
2437 | | link_name = "cfsetspeed@GLIBC_2.16" |
2438 | | )] |
2439 | | pub fn cfsetspeed(termios: *mut crate::termios, speed: crate::speed_t) -> c_int; |
2440 | | } |
2441 | | } |
2442 | | } |
2443 | | |
2444 | | extern "C" { |
2445 | | pub fn fnmatch(pattern: *const c_char, name: *const c_char, flags: c_int) -> c_int; |
2446 | | } |
2447 | | |
2448 | | cfg_if! { |
2449 | | if #[cfg(target_env = "newlib")] { |
2450 | | mod newlib; |
2451 | | pub use self::newlib::*; |
2452 | | } else if #[cfg(any( |
2453 | | target_os = "linux", |
2454 | | target_os = "l4re", |
2455 | | target_os = "android", |
2456 | | target_os = "emscripten" |
2457 | | ))] { |
2458 | | mod linux_like; |
2459 | | pub use self::linux_like::*; |
2460 | | } else if #[cfg(any( |
2461 | | target_os = "macos", |
2462 | | target_os = "ios", |
2463 | | target_os = "tvos", |
2464 | | target_os = "watchos", |
2465 | | target_os = "visionos", |
2466 | | target_os = "freebsd", |
2467 | | target_os = "dragonfly", |
2468 | | target_os = "openbsd", |
2469 | | target_os = "netbsd" |
2470 | | ))] { |
2471 | | mod bsd; |
2472 | | pub use self::bsd::*; |
2473 | | } else if #[cfg(any(target_os = "solaris", target_os = "illumos"))] { |
2474 | | mod solarish; |
2475 | | pub use self::solarish::*; |
2476 | | } else if #[cfg(target_os = "haiku")] { |
2477 | | mod haiku; |
2478 | | pub use self::haiku::*; |
2479 | | } else if #[cfg(target_os = "redox")] { |
2480 | | mod redox; |
2481 | | pub use self::redox::*; |
2482 | | } else if #[cfg(target_os = "cygwin")] { |
2483 | | mod cygwin; |
2484 | | pub use self::cygwin::*; |
2485 | | } else if #[cfg(target_os = "nto")] { |
2486 | | mod nto; |
2487 | | pub use self::nto::*; |
2488 | | } else if #[cfg(target_os = "aix")] { |
2489 | | mod aix; |
2490 | | pub use self::aix::*; |
2491 | | } else if #[cfg(target_os = "hurd")] { |
2492 | | mod hurd; |
2493 | | pub use self::hurd::*; |
2494 | | } else if #[cfg(target_os = "nuttx")] { |
2495 | | mod nuttx; |
2496 | | pub use self::nuttx::*; |
2497 | | } else { |
2498 | | // Unknown target_os |
2499 | | } |
2500 | | } |