]>
git.proxmox.com Git - rustc.git/blob - vendor/libc/src/unix/mod.rs
1 //! Definitions found commonly among almost all Unix derivatives
3 //! More functions and definitions can be found in the more specific modules
4 //! according to the platform in question.
8 pub type c_short
= i16;
9 pub type c_ushort
= u16;
11 pub type c_uint
= u32;
12 pub type c_float
= f32;
13 pub type c_double
= f64;
14 pub type c_longlong
= i64;
15 pub type c_ulonglong
= u64;
16 pub type intmax_t
= i64;
17 pub type uintmax_t
= u64;
19 pub type size_t
= usize;
20 pub type ptrdiff_t
= isize;
21 pub type intptr_t
= isize;
22 pub type uintptr_t
= usize;
23 pub type ssize_t
= isize;
26 pub type in_addr_t
= u32;
27 pub type in_port_t
= u16;
28 pub type sighandler_t
= ::size_t
;
29 pub type cc_t
= ::c_uchar
;
32 if #[cfg(any(target_os = "espidf", target_os = "horizon"))] {
33 pub type uid_t
= ::c_ushort
;
34 pub type gid_t
= ::c_ushort
;
41 #[cfg_attr(feature = "extra_traits", derive(Debug))]
43 impl ::Copy
for DIR {}
44 impl ::Clone
for DIR
{
45 fn clone(&self) -> DIR
{
49 pub type locale_t
= *mut ::c_void
;
53 pub gr_name
: *mut ::c_char
,
54 pub gr_passwd
: *mut ::c_char
,
56 pub gr_mem
: *mut *mut ::c_char
,
66 pub tv_usec
: suseconds_t
,
69 // linux x32 compatibility
70 // See https://sourceware.org/bugzilla/show_bug.cgi?id=16437
73 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
75 #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
76 pub tv_nsec
: ::c_long
,
85 pub ru_utime
: timeval
,
86 pub ru_stime
: timeval
,
87 pub ru_maxrss
: c_long
,
88 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
91 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
94 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
97 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
99 pub ru_minflt
: c_long
,
100 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
102 pub ru_majflt
: c_long
,
103 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
105 pub ru_nswap
: c_long
,
106 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
108 pub ru_inblock
: c_long
,
109 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
111 pub ru_oublock
: c_long
,
112 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
114 pub ru_msgsnd
: c_long
,
115 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
117 pub ru_msgrcv
: c_long
,
118 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
120 pub ru_nsignals
: c_long
,
121 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
123 pub ru_nvcsw
: c_long
,
124 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
126 pub ru_nivcsw
: c_long
,
127 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
130 #[cfg(any(target_env = "musl", target_os = "emscripten"))]
131 __reserved
: [c_long
; 16],
134 pub struct ipv6_mreq
{
135 pub ipv6mr_multiaddr
: in6_addr
,
136 #[cfg(target_os = "android")]
137 pub ipv6mr_interface
: ::c_int
,
138 #[cfg(not(target_os = "android"))]
139 pub ipv6mr_interface
: ::c_uint
,
143 pub h_name
: *mut ::c_char
,
144 pub h_aliases
: *mut *mut ::c_char
,
145 pub h_addrtype
: ::c_int
,
146 pub h_length
: ::c_int
,
147 pub h_addr_list
: *mut *mut ::c_char
,
151 pub iov_base
: *mut ::c_void
,
152 pub iov_len
: ::size_t
,
157 pub events
: ::c_short
,
158 pub revents
: ::c_short
,
162 pub ws_row
: ::c_ushort
,
163 pub ws_col
: ::c_ushort
,
164 pub ws_xpixel
: ::c_ushort
,
165 pub ws_ypixel
: ::c_ushort
,
169 pub l_onoff
: ::c_int
,
170 pub l_linger
: ::c_int
,
174 // Actually a union of an int and a void*
175 pub sival_ptr
: *mut ::c_void
179 pub struct itimerval
{
180 pub it_interval
: ::timeval
,
181 pub it_value
: ::timeval
,
186 pub tms_utime
: ::clock_t
,
187 pub tms_stime
: ::clock_t
,
188 pub tms_cutime
: ::clock_t
,
189 pub tms_cstime
: ::clock_t
,
193 pub s_name
: *mut ::c_char
,
194 pub s_aliases
: *mut *mut ::c_char
,
196 pub s_proto
: *mut ::c_char
,
199 pub struct protoent
{
200 pub p_name
: *mut ::c_char
,
201 pub p_aliases
: *mut *mut ::c_char
,
202 pub p_proto
: ::c_int
,
206 pub const INT_MIN
: c_int
= -2147483648;
207 pub const INT_MAX
: c_int
= 2147483647;
209 pub const SIG_DFL
: sighandler_t
= 0 as sighandler_t
;
210 pub const SIG_IGN
: sighandler_t
= 1 as sighandler_t
;
211 pub const SIG_ERR
: sighandler_t
= !0 as sighandler_t
;
213 pub const DT_UNKNOWN
: u8 = 0;
214 pub const DT_FIFO
: u8 = 1;
215 pub const DT_CHR
: u8 = 2;
216 pub const DT_DIR
: u8 = 4;
217 pub const DT_BLK
: u8 = 6;
218 pub const DT_REG
: u8 = 8;
219 pub const DT_LNK
: u8 = 10;
220 pub const DT_SOCK
: u8 = 12;
223 if #[cfg(not(target_os = "redox"))] {
224 pub const FD_CLOEXEC
: ::c_int
= 0x1;
228 pub const USRQUOTA
: ::c_int
= 0;
229 pub const GRPQUOTA
: ::c_int
= 1;
231 pub const SIGIOT
: ::c_int
= 6;
233 pub const S_ISUID
: ::mode_t
= 0x800;
234 pub const S_ISGID
: ::mode_t
= 0x400;
235 pub const S_ISVTX
: ::mode_t
= 0x200;
238 if #[cfg(not(any(target_os = "haiku", target_os = "illumos",
239 target_os
= "solaris")))] {
240 pub const IF_NAMESIZE
: ::size_t
= 16;
241 pub const IFNAMSIZ
: ::size_t
= IF_NAMESIZE
;
245 pub const LOG_EMERG
: ::c_int
= 0;
246 pub const LOG_ALERT
: ::c_int
= 1;
247 pub const LOG_CRIT
: ::c_int
= 2;
248 pub const LOG_ERR
: ::c_int
= 3;
249 pub const LOG_WARNING
: ::c_int
= 4;
250 pub const LOG_NOTICE
: ::c_int
= 5;
251 pub const LOG_INFO
: ::c_int
= 6;
252 pub const LOG_DEBUG
: ::c_int
= 7;
254 pub const LOG_KERN
: ::c_int
= 0;
255 pub const LOG_USER
: ::c_int
= 1 << 3;
256 pub const LOG_MAIL
: ::c_int
= 2 << 3;
257 pub const LOG_DAEMON
: ::c_int
= 3 << 3;
258 pub const LOG_AUTH
: ::c_int
= 4 << 3;
259 pub const LOG_SYSLOG
: ::c_int
= 5 << 3;
260 pub const LOG_LPR
: ::c_int
= 6 << 3;
261 pub const LOG_NEWS
: ::c_int
= 7 << 3;
262 pub const LOG_UUCP
: ::c_int
= 8 << 3;
263 pub const LOG_LOCAL0
: ::c_int
= 16 << 3;
264 pub const LOG_LOCAL1
: ::c_int
= 17 << 3;
265 pub const LOG_LOCAL2
: ::c_int
= 18 << 3;
266 pub const LOG_LOCAL3
: ::c_int
= 19 << 3;
267 pub const LOG_LOCAL4
: ::c_int
= 20 << 3;
268 pub const LOG_LOCAL5
: ::c_int
= 21 << 3;
269 pub const LOG_LOCAL6
: ::c_int
= 22 << 3;
270 pub const LOG_LOCAL7
: ::c_int
= 23 << 3;
273 if #[cfg(not(target_os = "haiku"))] {
274 pub const LOG_PID
: ::c_int
= 0x01;
275 pub const LOG_CONS
: ::c_int
= 0x02;
276 pub const LOG_ODELAY
: ::c_int
= 0x04;
277 pub const LOG_NDELAY
: ::c_int
= 0x08;
278 pub const LOG_NOWAIT
: ::c_int
= 0x10;
281 pub const LOG_PRIMASK
: ::c_int
= 7;
282 pub const LOG_FACMASK
: ::c_int
= 0x3f8;
284 pub const PRIO_MIN
: ::c_int
= -20;
285 pub const PRIO_MAX
: ::c_int
= 20;
287 pub const IPPROTO_ICMP
: ::c_int
= 1;
288 pub const IPPROTO_ICMPV6
: ::c_int
= 58;
289 pub const IPPROTO_TCP
: ::c_int
= 6;
290 pub const IPPROTO_UDP
: ::c_int
= 17;
291 pub const IPPROTO_IP
: ::c_int
= 0;
292 pub const IPPROTO_IPV6
: ::c_int
= 41;
294 pub const INADDR_LOOPBACK
: in_addr_t
= 2130706433;
295 pub const INADDR_ANY
: in_addr_t
= 0;
296 pub const INADDR_BROADCAST
: in_addr_t
= 4294967295;
297 pub const INADDR_NONE
: in_addr_t
= 4294967295;
299 pub const ARPOP_REQUEST
: u16 = 1;
300 pub const ARPOP_REPLY
: u16 = 2;
302 pub const ATF_COM
: ::c_int
= 0x02;
303 pub const ATF_PERM
: ::c_int
= 0x04;
304 pub const ATF_PUBL
: ::c_int
= 0x08;
305 pub const ATF_USETRAILERS
: ::c_int
= 0x10;
308 if #[cfg(any(target_os = "l4re", target_os = "espidf"))] {
309 // required libraries for L4Re and the ESP-IDF framework are linked externally, ATM
310 } else if #[cfg(feature = "std")] {
311 // cargo build, don't pull in anything extra as the libstd dep
312 // already pulls in all libs.
313 } else if #[cfg(all(target_os = "linux",
314 any(target_env
= "gnu", target_env
= "uclibc"),
315 feature
= "rustc-dep-of-std"))] {
316 #[link(name = "util", kind = "static", modifiers = "-bundle",
317 cfg(target_feature
= "crt-static"))]
318 #[link(name = "rt", kind = "static", modifiers = "-bundle",
319 cfg(target_feature
= "crt-static"))]
320 #[link(name = "pthread", kind = "static", modifiers = "-bundle",
321 cfg(target_feature
= "crt-static"))]
322 #[link(name = "m", kind = "static", modifiers = "-bundle",
323 cfg(target_feature
= "crt-static"))]
324 #[link(name = "dl", kind = "static", modifiers = "-bundle",
325 cfg(target_feature
= "crt-static"))]
326 #[link(name = "c", kind = "static", modifiers = "-bundle",
327 cfg(target_feature
= "crt-static"))]
328 #[link(name = "gcc_eh", kind = "static", modifiers = "-bundle",
329 cfg(target_feature
= "crt-static"))]
330 #[link(name = "gcc", kind = "static", modifiers = "-bundle",
331 cfg(target_feature
= "crt-static"))]
332 #[link(name = "util", cfg(not(target_feature = "crt-static")))]
333 #[link(name = "rt", cfg(not(target_feature = "crt-static")))]
334 #[link(name = "pthread", cfg(not(target_feature = "crt-static")))]
335 #[link(name = "m", cfg(not(target_feature = "crt-static")))]
336 #[link(name = "dl", cfg(not(target_feature = "crt-static")))]
337 #[link(name = "c", cfg(not(target_feature = "crt-static")))]
339 } else if #[cfg(target_env = "musl")] {
340 #[cfg_attr(feature = "rustc-dep-of-std",
341 link(name
= "c", kind
= "static", modifiers
= "-bundle",
342 cfg(target_feature
= "crt-static")))]
343 #[cfg_attr(feature = "rustc-dep-of-std",
344 link(name
= "c", cfg(not(target_feature
= "crt-static"))))]
346 } else if #[cfg(target_os = "emscripten")] {
349 } else if #[cfg(all(target_os = "netbsd",
350 feature
= "rustc-dep-of-std",
351 target_vendor
= "rumprun"))] {
352 // Since we don't use -nodefaultlibs on Rumprun, libc is always pulled
353 // in automatically by the linker. We avoid passing it explicitly, as it
354 // causes some versions of binutils to crash with an assertion failure.
357 } else if #[cfg(any(target_os = "macos",
359 target_os
= "watchos",
360 target_os
= "android",
361 target_os
= "openbsd"))] {
365 } else if #[cfg(target_os = "haiku")] {
366 #[link(name = "root")]
367 #[link(name = "network")]
369 } else if #[cfg(target_env = "newlib")] {
373 } else if #[cfg(target_os = "hermit")] {
374 // no_default_libraries is set to false for HermitCore, so only a link
375 // to "pthread" needs to be added.
376 #[link(name = "pthread")]
378 } else if #[cfg(target_env = "illumos")] {
382 } else if #[cfg(target_os = "redox")] {
383 #[cfg_attr(feature = "rustc-dep-of-std",
384 link(name
= "c", kind
= "static", modifiers
= "-bundle",
385 cfg(target_feature
= "crt-static")))]
386 #[cfg_attr(feature = "rustc-dep-of-std",
387 link(name
= "c", cfg(not(target_feature
= "crt-static"))))]
393 #[link(name = "pthread")]
398 #[cfg_attr(feature = "extra_traits", derive(Debug))]
400 impl ::Copy
for FILE {}
401 impl ::Clone
for FILE
{
402 fn clone(&self) -> FILE
{
406 #[cfg_attr(feature = "extra_traits", derive(Debug))]
407 pub enum fpos_t {}
// FIXME: fill this out with a struct
408 impl ::Copy
for fpos_t {}
409 impl ::Clone
for fpos_t
{
410 fn clone(&self) -> fpos_t
{
416 pub fn isalnum(c
: c_int
) -> c_int
;
417 pub fn isalpha(c
: c_int
) -> c_int
;
418 pub fn iscntrl(c
: c_int
) -> c_int
;
419 pub fn isdigit(c
: c_int
) -> c_int
;
420 pub fn isgraph(c
: c_int
) -> c_int
;
421 pub fn islower(c
: c_int
) -> c_int
;
422 pub fn isprint(c
: c_int
) -> c_int
;
423 pub fn ispunct(c
: c_int
) -> c_int
;
424 pub fn isspace(c
: c_int
) -> c_int
;
425 pub fn isupper(c
: c_int
) -> c_int
;
426 pub fn isxdigit(c
: c_int
) -> c_int
;
427 pub fn isblank(c
: c_int
) -> c_int
;
428 pub fn tolower(c
: c_int
) -> c_int
;
429 pub fn toupper(c
: c_int
) -> c_int
;
434 compar
: ::Option
<unsafe extern "C" fn(*const c_void
, *const c_void
) -> c_int
>,
441 compar
: ::Option
<unsafe extern "C" fn(*const c_void
, *const c_void
) -> c_int
>,
444 all(target_os
= "macos", target_arch
= "x86"),
445 link_name
= "fopen$UNIX2003"
447 pub fn fopen(filename
: *const c_char
, mode
: *const c_char
) -> *mut FILE
;
449 all(target_os
= "macos", target_arch
= "x86"),
450 link_name
= "freopen$UNIX2003"
452 pub fn freopen(filename
: *const c_char
, mode
: *const c_char
, file
: *mut FILE
) -> *mut FILE
;
453 pub fn fmemopen(buf
: *mut c_void
, size
: size_t
, mode
: *const c_char
) -> *mut FILE
;
454 pub fn open_memstream(ptr
: *mut *mut c_char
, sizeloc
: *mut size_t
) -> *mut FILE
;
456 pub fn fflush(file
: *mut FILE
) -> c_int
;
457 pub fn fclose(file
: *mut FILE
) -> c_int
;
458 pub fn remove(filename
: *const c_char
) -> c_int
;
459 pub fn rename(oldname
: *const c_char
, newname
: *const c_char
) -> c_int
;
460 pub fn tmpfile() -> *mut FILE
;
461 pub fn setvbuf(stream
: *mut FILE
, buffer
: *mut c_char
, mode
: c_int
, size
: size_t
) -> c_int
;
462 pub fn setbuf(stream
: *mut FILE
, buf
: *mut c_char
);
463 pub fn getchar() -> c_int
;
464 pub fn putchar(c
: c_int
) -> c_int
;
465 pub fn fgetc(stream
: *mut FILE
) -> c_int
;
466 pub fn fgets(buf
: *mut c_char
, n
: c_int
, stream
: *mut FILE
) -> *mut c_char
;
467 pub fn fputc(c
: c_int
, stream
: *mut FILE
) -> c_int
;
469 all(target_os
= "macos", target_arch
= "x86"),
470 link_name
= "fputs$UNIX2003"
472 pub fn fputs(s
: *const c_char
, stream
: *mut FILE
) -> c_int
;
473 pub fn puts(s
: *const c_char
) -> c_int
;
474 pub fn ungetc(c
: c_int
, stream
: *mut FILE
) -> c_int
;
475 pub fn fread(ptr
: *mut c_void
, size
: size_t
, nobj
: size_t
, stream
: *mut FILE
) -> size_t
;
477 all(target_os
= "macos", target_arch
= "x86"),
478 link_name
= "fwrite$UNIX2003"
480 pub fn fwrite(ptr
: *const c_void
, size
: size_t
, nobj
: size_t
, stream
: *mut FILE
) -> size_t
;
481 pub fn fseek(stream
: *mut FILE
, offset
: c_long
, whence
: c_int
) -> c_int
;
482 pub fn ftell(stream
: *mut FILE
) -> c_long
;
483 pub fn rewind(stream
: *mut FILE
);
484 #[cfg_attr(target_os = "netbsd", link_name = "__fgetpos50")]
485 pub fn fgetpos(stream
: *mut FILE
, ptr
: *mut fpos_t
) -> c_int
;
486 #[cfg_attr(target_os = "netbsd", link_name = "__fsetpos50")]
487 pub fn fsetpos(stream
: *mut FILE
, ptr
: *const fpos_t
) -> c_int
;
488 pub fn feof(stream
: *mut FILE
) -> c_int
;
489 pub fn ferror(stream
: *mut FILE
) -> c_int
;
490 pub fn clearerr(stream
: *mut FILE
);
491 pub fn perror(s
: *const c_char
);
492 pub fn atoi(s
: *const c_char
) -> c_int
;
494 all(target_os
= "macos", target_arch
= "x86"),
495 link_name
= "strtod$UNIX2003"
497 pub fn strtod(s
: *const c_char
, endp
: *mut *mut c_char
) -> c_double
;
498 pub fn strtof(s
: *const c_char
, endp
: *mut *mut c_char
) -> c_float
;
499 pub fn strtol(s
: *const c_char
, endp
: *mut *mut c_char
, base
: c_int
) -> c_long
;
500 pub fn strtoul(s
: *const c_char
, endp
: *mut *mut c_char
, base
: c_int
) -> c_ulong
;
501 pub fn calloc(nobj
: size_t
, size
: size_t
) -> *mut c_void
;
502 pub fn malloc(size
: size_t
) -> *mut c_void
;
503 pub fn realloc(p
: *mut c_void
, size
: size_t
) -> *mut c_void
;
504 pub fn free(p
: *mut c_void
);
506 pub fn exit(status
: c_int
) -> !;
507 pub fn _exit(status
: c_int
) -> !;
508 pub fn atexit(cb
: extern "C" fn()) -> c_int
;
510 all(target_os
= "macos", target_arch
= "x86"),
511 link_name
= "system$UNIX2003"
513 pub fn system(s
: *const c_char
) -> c_int
;
514 pub fn getenv(s
: *const c_char
) -> *mut c_char
;
516 pub fn strcpy(dst
: *mut c_char
, src
: *const c_char
) -> *mut c_char
;
517 pub fn strncpy(dst
: *mut c_char
, src
: *const c_char
, n
: size_t
) -> *mut c_char
;
518 pub fn stpcpy(dst
: *mut c_char
, src
: *const c_char
) -> *mut c_char
;
519 pub fn strcat(s
: *mut c_char
, ct
: *const c_char
) -> *mut c_char
;
520 pub fn strncat(s
: *mut c_char
, ct
: *const c_char
, n
: size_t
) -> *mut c_char
;
521 pub fn strcmp(cs
: *const c_char
, ct
: *const c_char
) -> c_int
;
522 pub fn strncmp(cs
: *const c_char
, ct
: *const c_char
, n
: size_t
) -> c_int
;
523 pub fn strcoll(cs
: *const c_char
, ct
: *const c_char
) -> c_int
;
524 pub fn strchr(cs
: *const c_char
, c
: c_int
) -> *mut c_char
;
525 pub fn strrchr(cs
: *const c_char
, c
: c_int
) -> *mut c_char
;
526 pub fn strspn(cs
: *const c_char
, ct
: *const c_char
) -> size_t
;
527 pub fn strcspn(cs
: *const c_char
, ct
: *const c_char
) -> size_t
;
528 pub fn strdup(cs
: *const c_char
) -> *mut c_char
;
529 pub fn strndup(cs
: *const c_char
, n
: size_t
) -> *mut c_char
;
530 pub fn strpbrk(cs
: *const c_char
, ct
: *const c_char
) -> *mut c_char
;
531 pub fn strstr(cs
: *const c_char
, ct
: *const c_char
) -> *mut c_char
;
532 pub fn strcasecmp(s1
: *const c_char
, s2
: *const c_char
) -> c_int
;
533 pub fn strncasecmp(s1
: *const c_char
, s2
: *const c_char
, n
: size_t
) -> c_int
;
534 pub fn strlen(cs
: *const c_char
) -> size_t
;
535 pub fn strnlen(cs
: *const c_char
, maxlen
: size_t
) -> size_t
;
537 all(target_os
= "macos", target_arch
= "x86"),
538 link_name
= "strerror$UNIX2003"
540 pub fn strerror(n
: c_int
) -> *mut c_char
;
541 pub fn strtok(s
: *mut c_char
, t
: *const c_char
) -> *mut c_char
;
542 pub fn strtok_r(s
: *mut c_char
, t
: *const c_char
, p
: *mut *mut c_char
) -> *mut c_char
;
543 pub fn strxfrm(s
: *mut c_char
, ct
: *const c_char
, n
: size_t
) -> size_t
;
544 pub fn strsignal(sig
: c_int
) -> *mut c_char
;
545 pub fn wcslen(buf
: *const wchar_t
) -> size_t
;
546 pub fn wcstombs(dest
: *mut c_char
, src
: *const wchar_t
, n
: size_t
) -> ::size_t
;
548 pub fn memchr(cx
: *const c_void
, c
: c_int
, n
: size_t
) -> *mut c_void
;
549 pub fn wmemchr(cx
: *const wchar_t
, c
: wchar_t
, n
: size_t
) -> *mut wchar_t
;
550 pub fn memcmp(cx
: *const c_void
, ct
: *const c_void
, n
: size_t
) -> c_int
;
551 pub fn memcpy(dest
: *mut c_void
, src
: *const c_void
, n
: size_t
) -> *mut c_void
;
552 pub fn memmove(dest
: *mut c_void
, src
: *const c_void
, n
: size_t
) -> *mut c_void
;
553 pub fn memset(dest
: *mut c_void
, c
: c_int
, n
: size_t
) -> *mut c_void
;
557 #[cfg_attr(target_os = "netbsd", link_name = "__getpwnam50")]
558 pub fn getpwnam(name
: *const ::c_char
) -> *mut passwd
;
559 #[cfg_attr(target_os = "netbsd", link_name = "__getpwuid50")]
560 pub fn getpwuid(uid
: ::uid_t
) -> *mut passwd
;
562 pub fn fprintf(stream
: *mut ::FILE
, format
: *const ::c_char
, ...) -> ::c_int
;
563 pub fn printf(format
: *const ::c_char
, ...) -> ::c_int
;
564 pub fn snprintf(s
: *mut ::c_char
, n
: ::size_t
, format
: *const ::c_char
, ...) -> ::c_int
;
565 pub fn sprintf(s
: *mut ::c_char
, format
: *const ::c_char
, ...) -> ::c_int
;
567 all(target_os
= "linux", not(target_env
= "uclibc")),
568 link_name
= "__isoc99_fscanf"
570 pub fn fscanf(stream
: *mut ::FILE
, format
: *const ::c_char
, ...) -> ::c_int
;
572 all(target_os
= "linux", not(target_env
= "uclibc")),
573 link_name
= "__isoc99_scanf"
575 pub fn scanf(format
: *const ::c_char
, ...) -> ::c_int
;
577 all(target_os
= "linux", not(target_env
= "uclibc")),
578 link_name
= "__isoc99_sscanf"
580 pub fn sscanf(s
: *const ::c_char
, format
: *const ::c_char
, ...) -> ::c_int
;
581 pub fn getchar_unlocked() -> ::c_int
;
582 pub fn putchar_unlocked(c
: ::c_int
) -> ::c_int
;
585 libc_cfg_target_vendor
,
586 target_arch
= "powerpc",
587 target_vendor
= "nintendo"
589 #[cfg_attr(target_os = "netbsd", link_name = "__socket30")]
590 #[cfg_attr(target_os = "illumos", link_name = "__xnet_socket")]
591 #[cfg_attr(target_os = "espidf", link_name = "lwip_socket")]
592 pub fn socket(domain
: ::c_int
, ty
: ::c_int
, protocol
: ::c_int
) -> ::c_int
;
594 libc_cfg_target_vendor
,
595 target_arch
= "powerpc",
596 target_vendor
= "nintendo"
599 all(target_os
= "macos", target_arch
= "x86"),
600 link_name
= "connect$UNIX2003"
602 #[cfg_attr(target_os = "illumos", link_name = "__xnet_connect")]
603 #[cfg_attr(target_os = "espidf", link_name = "lwip_connect")]
604 pub fn connect(socket
: ::c_int
, address
: *const sockaddr
, len
: socklen_t
) -> ::c_int
;
606 all(target_os
= "macos", target_arch
= "x86"),
607 link_name
= "listen$UNIX2003"
609 #[cfg_attr(target_os = "espidf", link_name = "lwip_listen")]
610 pub fn listen(socket
: ::c_int
, backlog
: ::c_int
) -> ::c_int
;
612 libc_cfg_target_vendor
,
613 target_arch
= "powerpc",
614 target_vendor
= "nintendo"
617 all(target_os
= "macos", target_arch
= "x86"),
618 link_name
= "accept$UNIX2003"
620 #[cfg_attr(target_os = "espidf", link_name = "lwip_accept")]
621 pub fn accept(socket
: ::c_int
, address
: *mut sockaddr
, address_len
: *mut socklen_t
) -> ::c_int
;
623 libc_cfg_target_vendor
,
624 target_arch
= "powerpc",
625 target_vendor
= "nintendo"
628 all(target_os
= "macos", target_arch
= "x86"),
629 link_name
= "getpeername$UNIX2003"
631 #[cfg_attr(target_os = "espidf", link_name = "lwip_getpeername")]
634 address
: *mut sockaddr
,
635 address_len
: *mut socklen_t
,
638 libc_cfg_target_vendor
,
639 target_arch
= "powerpc",
640 target_vendor
= "nintendo"
643 all(target_os
= "macos", target_arch
= "x86"),
644 link_name
= "getsockname$UNIX2003"
646 #[cfg_attr(target_os = "espidf", link_name = "lwip_getsockname")]
649 address
: *mut sockaddr
,
650 address_len
: *mut socklen_t
,
652 #[cfg_attr(target_os = "espidf", link_name = "lwip_setsockopt")]
657 value
: *const ::c_void
,
658 option_len
: socklen_t
,
661 all(target_os
= "macos", target_arch
= "x86"),
662 link_name
= "socketpair$UNIX2003"
664 #[cfg_attr(target_os = "illumos", link_name = "__xnet_socketpair")]
669 socket_vector
: *mut ::c_int
,
672 libc_cfg_target_vendor
,
673 target_arch
= "powerpc",
674 target_vendor
= "nintendo"
677 all(target_os
= "macos", target_arch
= "x86"),
678 link_name
= "sendto$UNIX2003"
680 #[cfg_attr(target_os = "illumos", link_name = "__xnet_sendto")]
681 #[cfg_attr(target_os = "espidf", link_name = "lwip_sendto")]
684 buf
: *const ::c_void
,
687 addr
: *const sockaddr
,
690 #[cfg_attr(target_os = "espidf", link_name = "lwip_shutdown")]
691 pub fn shutdown(socket
: ::c_int
, how
: ::c_int
) -> ::c_int
;
694 all(target_os
= "macos", target_arch
= "x86"),
695 link_name
= "chmod$UNIX2003"
697 pub fn chmod(path
: *const c_char
, mode
: mode_t
) -> ::c_int
;
699 all(target_os
= "macos", target_arch
= "x86"),
700 link_name
= "fchmod$UNIX2003"
702 pub fn fchmod(fd
: ::c_int
, mode
: mode_t
) -> ::c_int
;
705 all(target_os
= "macos", not(target_arch
= "aarch64")),
706 link_name
= "fstat$INODE64"
708 #[cfg_attr(target_os = "netbsd", link_name = "__fstat50")]
710 all(target_os
= "freebsd", any(freebsd11
, freebsd10
)),
711 link_name
= "fstat@FBSD_1.0"
713 pub fn fstat(fildes
: ::c_int
, buf
: *mut stat
) -> ::c_int
;
715 pub fn mkdir(path
: *const c_char
, mode
: mode_t
) -> ::c_int
;
718 all(target_os
= "macos", not(target_arch
= "aarch64")),
719 link_name
= "stat$INODE64"
721 #[cfg_attr(target_os = "netbsd", link_name = "__stat50")]
723 all(target_os
= "freebsd", any(freebsd11
, freebsd10
)),
724 link_name
= "stat@FBSD_1.0"
726 pub fn stat(path
: *const c_char
, buf
: *mut stat
) -> ::c_int
;
728 pub fn pclose(stream
: *mut ::FILE
) -> ::c_int
;
730 all(target_os
= "macos", target_arch
= "x86"),
731 link_name
= "fdopen$UNIX2003"
733 pub fn fdopen(fd
: ::c_int
, mode
: *const c_char
) -> *mut ::FILE
;
734 pub fn fileno(stream
: *mut ::FILE
) -> ::c_int
;
737 all(target_os
= "macos", target_arch
= "x86"),
738 link_name
= "open$UNIX2003"
740 pub fn open(path
: *const c_char
, oflag
: ::c_int
, ...) -> ::c_int
;
742 all(target_os
= "macos", target_arch
= "x86"),
743 link_name
= "creat$UNIX2003"
745 pub fn creat(path
: *const c_char
, mode
: mode_t
) -> ::c_int
;
747 all(target_os
= "macos", target_arch
= "x86"),
748 link_name
= "fcntl$UNIX2003"
750 pub fn fcntl(fd
: ::c_int
, cmd
: ::c_int
, ...) -> ::c_int
;
753 all(target_os
= "macos", target_arch
= "x86_64"),
754 link_name
= "opendir$INODE64"
757 all(target_os
= "macos", target_arch
= "x86"),
758 link_name
= "opendir$INODE64$UNIX2003"
760 #[cfg_attr(target_os = "netbsd", link_name = "__opendir30")]
761 pub fn opendir(dirname
: *const c_char
) -> *mut ::DIR
;
764 all(target_os
= "macos", not(target_arch
= "aarch64")),
765 link_name
= "readdir$INODE64"
767 #[cfg_attr(target_os = "netbsd", link_name = "__readdir30")]
769 all(target_os
= "freebsd", any(freebsd11
, freebsd10
)),
770 link_name
= "readdir@FBSD_1.0"
772 pub fn readdir(dirp
: *mut ::DIR
) -> *mut ::dirent
;
774 all(target_os
= "macos", target_arch
= "x86"),
775 link_name
= "closedir$UNIX2003"
777 pub fn closedir(dirp
: *mut ::DIR
) -> ::c_int
;
779 all(target_os
= "macos", target_arch
= "x86_64"),
780 link_name
= "rewinddir$INODE64"
783 all(target_os
= "macos", target_arch
= "x86"),
784 link_name
= "rewinddir$INODE64$UNIX2003"
786 pub fn rewinddir(dirp
: *mut ::DIR
);
790 pathname
: *const ::c_char
,
794 pub fn fchown(fd
: ::c_int
, owner
: ::uid_t
, group
: ::gid_t
) -> ::c_int
;
797 pathname
: *const ::c_char
,
803 all(target_os
= "macos", not(target_arch
= "aarch64")),
804 link_name
= "fstatat$INODE64"
807 all(target_os
= "freebsd", any(freebsd11
, freebsd10
)),
808 link_name
= "fstatat@FBSD_1.1"
812 pathname
: *const ::c_char
,
818 oldpath
: *const ::c_char
,
820 newpath
: *const ::c_char
,
825 oldpath
: *const ::c_char
,
827 newpath
: *const ::c_char
,
830 target
: *const ::c_char
,
832 linkpath
: *const ::c_char
,
834 pub fn unlinkat(dirfd
: ::c_int
, pathname
: *const ::c_char
, flags
: ::c_int
) -> ::c_int
;
836 pub fn access(path
: *const c_char
, amode
: ::c_int
) -> ::c_int
;
837 pub fn alarm(seconds
: ::c_uint
) -> ::c_uint
;
838 pub fn chdir(dir
: *const c_char
) -> ::c_int
;
839 pub fn fchdir(dirfd
: ::c_int
) -> ::c_int
;
840 pub fn chown(path
: *const c_char
, uid
: uid_t
, gid
: gid_t
) -> ::c_int
;
842 all(target_os
= "macos", target_arch
= "x86"),
843 link_name
= "lchown$UNIX2003"
845 pub fn lchown(path
: *const c_char
, uid
: uid_t
, gid
: gid_t
) -> ::c_int
;
847 all(target_os
= "macos", target_arch
= "x86"),
848 link_name
= "close$NOCANCEL$UNIX2003"
851 all(target_os
= "macos", target_arch
= "x86_64"),
852 link_name
= "close$NOCANCEL"
854 pub fn close(fd
: ::c_int
) -> ::c_int
;
855 pub fn dup(fd
: ::c_int
) -> ::c_int
;
856 pub fn dup2(src
: ::c_int
, dst
: ::c_int
) -> ::c_int
;
857 pub fn execl(path
: *const c_char
, arg0
: *const c_char
, ...) -> ::c_int
;
858 pub fn execle(path
: *const ::c_char
, arg0
: *const ::c_char
, ...) -> ::c_int
;
859 pub fn execlp(file
: *const ::c_char
, arg0
: *const ::c_char
, ...) -> ::c_int
;
860 pub fn execv(prog
: *const c_char
, argv
: *const *const c_char
) -> ::c_int
;
863 argv
: *const *const c_char
,
864 envp
: *const *const c_char
,
866 pub fn execvp(c
: *const c_char
, argv
: *const *const c_char
) -> ::c_int
;
867 pub fn fork() -> pid_t
;
868 pub fn fpathconf(filedes
: ::c_int
, name
: ::c_int
) -> c_long
;
869 pub fn getcwd(buf
: *mut c_char
, size
: ::size_t
) -> *mut c_char
;
870 pub fn getegid() -> gid_t
;
871 pub fn geteuid() -> uid_t
;
872 pub fn getgid() -> gid_t
;
873 pub fn getgroups(ngroups_max
: ::c_int
, groups
: *mut gid_t
) -> ::c_int
;
874 #[cfg_attr(target_os = "illumos", link_name = "getloginx")]
875 pub fn getlogin() -> *mut c_char
;
877 all(target_os
= "macos", target_arch
= "x86"),
878 link_name
= "getopt$UNIX2003"
880 pub fn getopt(argc
: ::c_int
, argv
: *const *mut c_char
, optstr
: *const c_char
) -> ::c_int
;
881 pub fn getpgid(pid
: pid_t
) -> pid_t
;
882 pub fn getpgrp() -> pid_t
;
883 pub fn getpid() -> pid_t
;
884 pub fn getppid() -> pid_t
;
885 pub fn getuid() -> uid_t
;
886 pub fn isatty(fd
: ::c_int
) -> ::c_int
;
887 pub fn link(src
: *const c_char
, dst
: *const c_char
) -> ::c_int
;
888 pub fn lseek(fd
: ::c_int
, offset
: off_t
, whence
: ::c_int
) -> off_t
;
889 pub fn pathconf(path
: *const c_char
, name
: ::c_int
) -> c_long
;
890 pub fn pipe(fds
: *mut ::c_int
) -> ::c_int
;
891 pub fn posix_memalign(memptr
: *mut *mut ::c_void
, align
: ::size_t
, size
: ::size_t
) -> ::c_int
;
893 all(target_os
= "macos", target_arch
= "x86"),
894 link_name
= "read$UNIX2003"
896 pub fn read(fd
: ::c_int
, buf
: *mut ::c_void
, count
: ::size_t
) -> ::ssize_t
;
897 pub fn rmdir(path
: *const c_char
) -> ::c_int
;
898 pub fn seteuid(uid
: uid_t
) -> ::c_int
;
899 pub fn setegid(gid
: gid_t
) -> ::c_int
;
900 pub fn setgid(gid
: gid_t
) -> ::c_int
;
901 pub fn setpgid(pid
: pid_t
, pgid
: pid_t
) -> ::c_int
;
902 pub fn setsid() -> pid_t
;
903 pub fn setuid(uid
: uid_t
) -> ::c_int
;
905 all(target_os
= "macos", target_arch
= "x86"),
906 link_name
= "sleep$UNIX2003"
908 pub fn sleep(secs
: ::c_uint
) -> ::c_uint
;
910 all(target_os
= "macos", target_arch
= "x86"),
911 link_name
= "nanosleep$UNIX2003"
913 #[cfg_attr(target_os = "netbsd", link_name = "__nanosleep50")]
914 pub fn nanosleep(rqtp
: *const timespec
, rmtp
: *mut timespec
) -> ::c_int
;
915 pub fn tcgetpgrp(fd
: ::c_int
) -> pid_t
;
916 pub fn tcsetpgrp(fd
: ::c_int
, pgrp
: ::pid_t
) -> ::c_int
;
917 pub fn ttyname(fd
: ::c_int
) -> *mut c_char
;
919 all(target_os
= "macos", target_arch
= "x86"),
920 link_name
= "ttyname_r$UNIX2003"
922 #[cfg_attr(target_os = "illumos", link_name = "__posix_ttyname_r")]
923 pub fn ttyname_r(fd
: ::c_int
, buf
: *mut c_char
, buflen
: ::size_t
) -> ::c_int
;
924 pub fn unlink(c
: *const c_char
) -> ::c_int
;
926 all(target_os
= "macos", target_arch
= "x86"),
927 link_name
= "wait$UNIX2003"
929 pub fn wait(status
: *mut ::c_int
) -> pid_t
;
931 all(target_os
= "macos", target_arch
= "x86"),
932 link_name
= "waitpid$UNIX2003"
934 pub fn waitpid(pid
: pid_t
, status
: *mut ::c_int
, options
: ::c_int
) -> pid_t
;
936 all(target_os
= "macos", target_arch
= "x86"),
937 link_name
= "write$UNIX2003"
939 pub fn write(fd
: ::c_int
, buf
: *const ::c_void
, count
: ::size_t
) -> ::ssize_t
;
941 all(target_os
= "macos", target_arch
= "x86"),
942 link_name
= "pread$UNIX2003"
944 pub fn pread(fd
: ::c_int
, buf
: *mut ::c_void
, count
: ::size_t
, offset
: off_t
) -> ::ssize_t
;
946 all(target_os
= "macos", target_arch
= "x86"),
947 link_name
= "pwrite$UNIX2003"
949 pub fn pwrite(fd
: ::c_int
, buf
: *const ::c_void
, count
: ::size_t
, offset
: off_t
) -> ::ssize_t
;
950 pub fn umask(mask
: mode_t
) -> mode_t
;
952 #[cfg_attr(target_os = "netbsd", link_name = "__utime50")]
953 pub fn utime(file
: *const c_char
, buf
: *const utimbuf
) -> ::c_int
;
956 all(target_os
= "macos", target_arch
= "x86"),
957 link_name
= "kill$UNIX2003"
959 pub fn kill(pid
: pid_t
, sig
: ::c_int
) -> ::c_int
;
961 all(target_os
= "macos", target_arch
= "x86"),
962 link_name
= "killpg$UNIX2003"
964 pub fn killpg(pgrp
: pid_t
, sig
: ::c_int
) -> ::c_int
;
966 pub fn mlock(addr
: *const ::c_void
, len
: ::size_t
) -> ::c_int
;
967 pub fn munlock(addr
: *const ::c_void
, len
: ::size_t
) -> ::c_int
;
968 pub fn mlockall(flags
: ::c_int
) -> ::c_int
;
969 pub fn munlockall() -> ::c_int
;
972 all(target_os
= "macos", target_arch
= "x86"),
973 link_name
= "mmap$UNIX2003"
984 all(target_os
= "macos", target_arch
= "x86"),
985 link_name
= "munmap$UNIX2003"
987 pub fn munmap(addr
: *mut ::c_void
, len
: ::size_t
) -> ::c_int
;
989 pub fn if_nametoindex(ifname
: *const c_char
) -> ::c_uint
;
990 pub fn if_indextoname(ifindex
: ::c_uint
, ifname
: *mut ::c_char
) -> *mut ::c_char
;
993 all(target_os
= "macos", not(target_arch
= "aarch64")),
994 link_name
= "lstat$INODE64"
996 #[cfg_attr(target_os = "netbsd", link_name = "__lstat50")]
998 all(target_os
= "freebsd", any(freebsd11
, freebsd10
)),
999 link_name
= "lstat@FBSD_1.0"
1001 pub fn lstat(path
: *const c_char
, buf
: *mut stat
) -> ::c_int
;
1004 all(target_os
= "macos", target_arch
= "x86"),
1005 link_name
= "fsync$UNIX2003"
1007 pub fn fsync(fd
: ::c_int
) -> ::c_int
;
1010 all(target_os
= "macos", target_arch
= "x86"),
1011 link_name
= "setenv$UNIX2003"
1013 pub fn setenv(name
: *const c_char
, val
: *const c_char
, overwrite
: ::c_int
) -> ::c_int
;
1015 all(target_os
= "macos", target_arch
= "x86"),
1016 link_name
= "unsetenv$UNIX2003"
1018 #[cfg_attr(target_os = "netbsd", link_name = "__unsetenv13")]
1019 pub fn unsetenv(name
: *const c_char
) -> ::c_int
;
1021 pub fn symlink(path1
: *const c_char
, path2
: *const c_char
) -> ::c_int
;
1023 pub fn ftruncate(fd
: ::c_int
, length
: off_t
) -> ::c_int
;
1025 pub fn signal(signum
: ::c_int
, handler
: sighandler_t
) -> sighandler_t
;
1027 #[cfg_attr(target_os = "netbsd", link_name = "__getrusage50")]
1028 pub fn getrusage(resource
: ::c_int
, usage
: *mut rusage
) -> ::c_int
;
1031 any(target_os
= "macos", target_os
= "ios", target_os
= "watchos"),
1032 link_name
= "realpath$DARWIN_EXTSN"
1034 pub fn realpath(pathname
: *const ::c_char
, resolved
: *mut ::c_char
) -> *mut ::c_char
;
1036 pub fn flock(fd
: ::c_int
, operation
: ::c_int
) -> ::c_int
;
1038 #[cfg_attr(target_os = "netbsd", link_name = "__times13")]
1039 pub fn times(buf
: *mut ::tms
) -> ::clock_t
;
1041 pub fn pthread_self() -> ::pthread_t
;
1043 all(target_os
= "macos", target_arch
= "x86"),
1044 link_name
= "pthread_join$UNIX2003"
1046 pub fn pthread_join(native
: ::pthread_t
, value
: *mut *mut ::c_void
) -> ::c_int
;
1047 pub fn pthread_exit(value
: *mut ::c_void
) -> !;
1048 pub fn pthread_attr_init(attr
: *mut ::pthread_attr_t
) -> ::c_int
;
1049 pub fn pthread_attr_destroy(attr
: *mut ::pthread_attr_t
) -> ::c_int
;
1050 pub fn pthread_attr_setstacksize(attr
: *mut ::pthread_attr_t
, stack_size
: ::size_t
) -> ::c_int
;
1051 pub fn pthread_attr_setdetachstate(attr
: *mut ::pthread_attr_t
, state
: ::c_int
) -> ::c_int
;
1052 pub fn pthread_detach(thread
: ::pthread_t
) -> ::c_int
;
1053 #[cfg_attr(target_os = "netbsd", link_name = "__libc_thr_yield")]
1054 pub fn sched_yield() -> ::c_int
;
1055 pub fn pthread_key_create(
1056 key
: *mut pthread_key_t
,
1057 dtor
: ::Option
<unsafe extern "C" fn(*mut ::c_void
)>,
1059 pub fn pthread_key_delete(key
: pthread_key_t
) -> ::c_int
;
1060 pub fn pthread_getspecific(key
: pthread_key_t
) -> *mut ::c_void
;
1061 pub fn pthread_setspecific(key
: pthread_key_t
, value
: *const ::c_void
) -> ::c_int
;
1062 pub fn pthread_mutex_init(
1063 lock
: *mut pthread_mutex_t
,
1064 attr
: *const pthread_mutexattr_t
,
1066 pub fn pthread_mutex_destroy(lock
: *mut pthread_mutex_t
) -> ::c_int
;
1067 pub fn pthread_mutex_lock(lock
: *mut pthread_mutex_t
) -> ::c_int
;
1068 pub fn pthread_mutex_trylock(lock
: *mut pthread_mutex_t
) -> ::c_int
;
1069 pub fn pthread_mutex_unlock(lock
: *mut pthread_mutex_t
) -> ::c_int
;
1071 pub fn pthread_mutexattr_init(attr
: *mut pthread_mutexattr_t
) -> ::c_int
;
1073 all(target_os
= "macos", target_arch
= "x86"),
1074 link_name
= "pthread_mutexattr_destroy$UNIX2003"
1076 pub fn pthread_mutexattr_destroy(attr
: *mut pthread_mutexattr_t
) -> ::c_int
;
1077 pub fn pthread_mutexattr_settype(attr
: *mut pthread_mutexattr_t
, _type
: ::c_int
) -> ::c_int
;
1080 all(target_os
= "macos", target_arch
= "x86"),
1081 link_name
= "pthread_cond_init$UNIX2003"
1083 pub fn pthread_cond_init(cond
: *mut pthread_cond_t
, attr
: *const pthread_condattr_t
)
1086 all(target_os
= "macos", target_arch
= "x86"),
1087 link_name
= "pthread_cond_wait$UNIX2003"
1089 pub fn pthread_cond_wait(cond
: *mut pthread_cond_t
, lock
: *mut pthread_mutex_t
) -> ::c_int
;
1091 all(target_os
= "macos", target_arch
= "x86"),
1092 link_name
= "pthread_cond_timedwait$UNIX2003"
1094 pub fn pthread_cond_timedwait(
1095 cond
: *mut pthread_cond_t
,
1096 lock
: *mut pthread_mutex_t
,
1097 abstime
: *const ::timespec
,
1099 pub fn pthread_cond_signal(cond
: *mut pthread_cond_t
) -> ::c_int
;
1100 pub fn pthread_cond_broadcast(cond
: *mut pthread_cond_t
) -> ::c_int
;
1101 pub fn pthread_cond_destroy(cond
: *mut pthread_cond_t
) -> ::c_int
;
1102 pub fn pthread_condattr_init(attr
: *mut pthread_condattr_t
) -> ::c_int
;
1103 pub fn pthread_condattr_destroy(attr
: *mut pthread_condattr_t
) -> ::c_int
;
1105 all(target_os
= "macos", target_arch
= "x86"),
1106 link_name
= "pthread_rwlock_init$UNIX2003"
1108 pub fn pthread_rwlock_init(
1109 lock
: *mut pthread_rwlock_t
,
1110 attr
: *const pthread_rwlockattr_t
,
1113 all(target_os
= "macos", target_arch
= "x86"),
1114 link_name
= "pthread_rwlock_destroy$UNIX2003"
1116 pub fn pthread_rwlock_destroy(lock
: *mut pthread_rwlock_t
) -> ::c_int
;
1118 all(target_os
= "macos", target_arch
= "x86"),
1119 link_name
= "pthread_rwlock_rdlock$UNIX2003"
1121 pub fn pthread_rwlock_rdlock(lock
: *mut pthread_rwlock_t
) -> ::c_int
;
1123 all(target_os
= "macos", target_arch
= "x86"),
1124 link_name
= "pthread_rwlock_tryrdlock$UNIX2003"
1126 pub fn pthread_rwlock_tryrdlock(lock
: *mut pthread_rwlock_t
) -> ::c_int
;
1128 all(target_os
= "macos", target_arch
= "x86"),
1129 link_name
= "pthread_rwlock_wrlock$UNIX2003"
1131 pub fn pthread_rwlock_wrlock(lock
: *mut pthread_rwlock_t
) -> ::c_int
;
1133 all(target_os
= "macos", target_arch
= "x86"),
1134 link_name
= "pthread_rwlock_trywrlock$UNIX2003"
1136 pub fn pthread_rwlock_trywrlock(lock
: *mut pthread_rwlock_t
) -> ::c_int
;
1138 all(target_os
= "macos", target_arch
= "x86"),
1139 link_name
= "pthread_rwlock_unlock$UNIX2003"
1141 pub fn pthread_rwlock_unlock(lock
: *mut pthread_rwlock_t
) -> ::c_int
;
1142 pub fn pthread_rwlockattr_init(attr
: *mut pthread_rwlockattr_t
) -> ::c_int
;
1143 pub fn pthread_rwlockattr_destroy(attr
: *mut pthread_rwlockattr_t
) -> ::c_int
;
1145 #[cfg_attr(target_os = "illumos", link_name = "__xnet_getsockopt")]
1146 #[cfg_attr(target_os = "espidf", link_name = "lwip_getsockopt")]
1151 optval
: *mut ::c_void
,
1152 optlen
: *mut ::socklen_t
,
1154 pub fn raise(signum
: ::c_int
) -> ::c_int
;
1155 #[cfg_attr(target_os = "netbsd", link_name = "__sigaction14")]
1156 pub fn sigaction(signum
: ::c_int
, act
: *const sigaction
, oldact
: *mut sigaction
) -> ::c_int
;
1158 #[cfg_attr(target_os = "netbsd", link_name = "__utimes50")]
1159 pub fn utimes(filename
: *const ::c_char
, times
: *const ::timeval
) -> ::c_int
;
1160 pub fn dlopen(filename
: *const ::c_char
, flag
: ::c_int
) -> *mut ::c_void
;
1161 pub fn dlerror() -> *mut ::c_char
;
1162 pub fn dlsym(handle
: *mut ::c_void
, symbol
: *const ::c_char
) -> *mut ::c_void
;
1163 pub fn dlclose(handle
: *mut ::c_void
) -> ::c_int
;
1164 pub fn dladdr(addr
: *const ::c_void
, info
: *mut Dl_info
) -> ::c_int
;
1167 libc_cfg_target_vendor
,
1168 target_arch
= "powerpc",
1169 target_vendor
= "nintendo"
1171 #[cfg_attr(target_os = "illumos", link_name = "__xnet_getaddrinfo")]
1172 #[cfg_attr(target_os = "espidf", link_name = "lwip_getaddrinfo")]
1174 node
: *const c_char
,
1175 service
: *const c_char
,
1176 hints
: *const addrinfo
,
1177 res
: *mut *mut addrinfo
,
1180 libc_cfg_target_vendor
,
1181 target_arch
= "powerpc",
1182 target_vendor
= "nintendo"
1184 #[cfg_attr(target_os = "espidf", link_name = "lwip_freeaddrinfo")]
1185 pub fn freeaddrinfo(res
: *mut addrinfo
);
1186 pub fn hstrerror(errcode
: ::c_int
) -> *const ::c_char
;
1187 pub fn gai_strerror(errcode
: ::c_int
) -> *const ::c_char
;
1190 all(target_os
= "linux", not(target_env
= "musl")),
1191 target_os
= "freebsd",
1192 target_os
= "dragonfly",
1195 link_name
= "__res_init"
1198 any(target_os
= "macos", target_os
= "ios", target_os
= "watchos"),
1199 link_name
= "res_9_init"
1201 pub fn res_init() -> ::c_int
;
1203 #[cfg_attr(target_os = "netbsd", link_name = "__gmtime_r50")]
1204 #[cfg_attr(target_env = "musl", allow(deprecated))]
1205 // FIXME: for `time_t`
1206 pub fn gmtime_r(time_p
: *const time_t
, result
: *mut tm
) -> *mut tm
;
1207 #[cfg_attr(target_os = "netbsd", link_name = "__localtime_r50")]
1208 #[cfg_attr(target_env = "musl", allow(deprecated))]
1209 // FIXME: for `time_t`
1210 pub fn localtime_r(time_p
: *const time_t
, result
: *mut tm
) -> *mut tm
;
1212 all(target_os
= "macos", target_arch
= "x86"),
1213 link_name
= "mktime$UNIX2003"
1215 #[cfg_attr(target_os = "netbsd", link_name = "__mktime50")]
1216 #[cfg_attr(target_env = "musl", allow(deprecated))]
1217 // FIXME: for `time_t`
1218 pub fn mktime(tm
: *mut tm
) -> time_t
;
1219 #[cfg_attr(target_os = "netbsd", link_name = "__time50")]
1220 #[cfg_attr(target_env = "musl", allow(deprecated))]
1221 // FIXME: for `time_t`
1222 pub fn time(time
: *mut time_t
) -> time_t
;
1223 #[cfg_attr(target_os = "netbsd", link_name = "__gmtime50")]
1224 #[cfg_attr(target_env = "musl", allow(deprecated))]
1225 // FIXME: for `time_t`
1226 pub fn gmtime(time_p
: *const time_t
) -> *mut tm
;
1227 #[cfg_attr(target_os = "netbsd", link_name = "__locatime50")]
1228 #[cfg_attr(target_env = "musl", allow(deprecated))]
1229 // FIXME: for `time_t`
1230 pub fn localtime(time_p
: *const time_t
) -> *mut tm
;
1231 #[cfg_attr(target_os = "netbsd", link_name = "__difftime50")]
1232 #[cfg_attr(target_env = "musl", allow(deprecated))]
1233 // FIXME: for `time_t`
1234 pub fn difftime(time1
: time_t
, time0
: time_t
) -> ::c_double
;
1235 #[cfg_attr(target_os = "netbsd", link_name = "__timegm50")]
1236 #[cfg_attr(target_env = "musl", allow(deprecated))]
1237 // FIXME: for `time_t`
1238 pub fn timegm(tm
: *mut ::tm
) -> time_t
;
1240 #[cfg_attr(target_os = "netbsd", link_name = "__mknod50")]
1242 all(target_os
= "freebsd", any(freebsd11
, freebsd10
)),
1243 link_name
= "mknod@FBSD_1.0"
1245 pub fn mknod(pathname
: *const ::c_char
, mode
: ::mode_t
, dev
: ::dev_t
) -> ::c_int
;
1246 pub fn gethostname(name
: *mut ::c_char
, len
: ::size_t
) -> ::c_int
;
1247 pub fn endservent();
1248 pub fn getservbyname(name
: *const ::c_char
, proto
: *const ::c_char
) -> *mut servent
;
1249 pub fn getservbyport(port
: ::c_int
, proto
: *const ::c_char
) -> *mut servent
;
1250 pub fn getservent() -> *mut servent
;
1251 pub fn setservent(stayopen
: ::c_int
);
1252 pub fn getprotobyname(name
: *const ::c_char
) -> *mut protoent
;
1253 pub fn getprotobynumber(proto
: ::c_int
) -> *mut protoent
;
1254 pub fn chroot(name
: *const ::c_char
) -> ::c_int
;
1256 all(target_os
= "macos", target_arch
= "x86"),
1257 link_name
= "usleep$UNIX2003"
1259 pub fn usleep(secs
: ::c_uint
) -> ::c_int
;
1261 all(target_os
= "macos", target_arch
= "x86"),
1262 link_name
= "send$UNIX2003"
1264 #[cfg_attr(target_os = "espidf", link_name = "lwip_send")]
1265 pub fn send(socket
: ::c_int
, buf
: *const ::c_void
, len
: ::size_t
, flags
: ::c_int
) -> ::ssize_t
;
1267 all(target_os
= "macos", target_arch
= "x86"),
1268 link_name
= "recv$UNIX2003"
1270 #[cfg_attr(target_os = "espidf", link_name = "lwip_recv")]
1271 pub fn recv(socket
: ::c_int
, buf
: *mut ::c_void
, len
: ::size_t
, flags
: ::c_int
) -> ::ssize_t
;
1273 all(target_os
= "macos", target_arch
= "x86"),
1274 link_name
= "putenv$UNIX2003"
1276 #[cfg_attr(target_os = "netbsd", link_name = "__putenv50")]
1277 pub fn putenv(string
: *mut c_char
) -> ::c_int
;
1279 all(target_os
= "macos", target_arch
= "x86"),
1280 link_name
= "poll$UNIX2003"
1282 pub fn poll(fds
: *mut pollfd
, nfds
: nfds_t
, timeout
: ::c_int
) -> ::c_int
;
1284 all(target_os
= "macos", target_arch
= "x86_64"),
1285 link_name
= "select$1050"
1288 all(target_os
= "macos", target_arch
= "x86"),
1289 link_name
= "select$UNIX2003"
1291 #[cfg_attr(target_os = "netbsd", link_name = "__select50")]
1294 readfs
: *mut fd_set
,
1295 writefds
: *mut fd_set
,
1296 errorfds
: *mut fd_set
,
1297 timeout
: *mut timeval
,
1299 #[cfg_attr(target_os = "netbsd", link_name = "__setlocale50")]
1300 pub fn setlocale(category
: ::c_int
, locale
: *const ::c_char
) -> *mut ::c_char
;
1301 pub fn localeconv() -> *mut lconv
;
1304 all(target_os
= "macos", target_arch
= "x86"),
1305 link_name
= "sem_wait$UNIX2003"
1307 pub fn sem_wait(sem
: *mut sem_t
) -> ::c_int
;
1308 pub fn sem_trywait(sem
: *mut sem_t
) -> ::c_int
;
1309 pub fn sem_post(sem
: *mut sem_t
) -> ::c_int
;
1310 pub fn statvfs(path
: *const c_char
, buf
: *mut statvfs
) -> ::c_int
;
1311 pub fn fstatvfs(fd
: ::c_int
, buf
: *mut statvfs
) -> ::c_int
;
1313 pub fn readlink(path
: *const c_char
, buf
: *mut c_char
, bufsz
: ::size_t
) -> ::ssize_t
;
1315 #[cfg_attr(target_os = "netbsd", link_name = "__sigemptyset14")]
1316 pub fn sigemptyset(set
: *mut sigset_t
) -> ::c_int
;
1317 #[cfg_attr(target_os = "netbsd", link_name = "__sigaddset14")]
1318 pub fn sigaddset(set
: *mut sigset_t
, signum
: ::c_int
) -> ::c_int
;
1319 #[cfg_attr(target_os = "netbsd", link_name = "__sigfillset14")]
1320 pub fn sigfillset(set
: *mut sigset_t
) -> ::c_int
;
1321 #[cfg_attr(target_os = "netbsd", link_name = "__sigdelset14")]
1322 pub fn sigdelset(set
: *mut sigset_t
, signum
: ::c_int
) -> ::c_int
;
1323 #[cfg_attr(target_os = "netbsd", link_name = "__sigismember14")]
1324 pub fn sigismember(set
: *const sigset_t
, signum
: ::c_int
) -> ::c_int
;
1326 #[cfg_attr(target_os = "netbsd", link_name = "__sigprocmask14")]
1327 pub fn sigprocmask(how
: ::c_int
, set
: *const sigset_t
, oldset
: *mut sigset_t
) -> ::c_int
;
1328 #[cfg_attr(target_os = "netbsd", link_name = "__sigpending14")]
1329 pub fn sigpending(set
: *mut sigset_t
) -> ::c_int
;
1331 pub fn sysconf(name
: ::c_int
) -> ::c_long
;
1333 pub fn mkfifo(path
: *const c_char
, mode
: mode_t
) -> ::c_int
;
1336 all(target_os
= "macos", target_arch
= "x86_64"),
1337 link_name
= "pselect$1050"
1340 all(target_os
= "macos", target_arch
= "x86"),
1341 link_name
= "pselect$UNIX2003"
1343 #[cfg_attr(target_os = "netbsd", link_name = "__pselect50")]
1346 readfs
: *mut fd_set
,
1347 writefds
: *mut fd_set
,
1348 errorfds
: *mut fd_set
,
1349 timeout
: *const timespec
,
1350 sigmask
: *const sigset_t
,
1352 pub fn fseeko(stream
: *mut ::FILE
, offset
: ::off_t
, whence
: ::c_int
) -> ::c_int
;
1353 pub fn ftello(stream
: *mut ::FILE
) -> ::off_t
;
1355 all(target_os
= "macos", target_arch
= "x86"),
1356 link_name
= "tcdrain$UNIX2003"
1358 pub fn tcdrain(fd
: ::c_int
) -> ::c_int
;
1359 pub fn cfgetispeed(termios
: *const ::termios
) -> ::speed_t
;
1360 pub fn cfgetospeed(termios
: *const ::termios
) -> ::speed_t
;
1361 pub fn cfsetispeed(termios
: *mut ::termios
, speed
: ::speed_t
) -> ::c_int
;
1362 pub fn cfsetospeed(termios
: *mut ::termios
, speed
: ::speed_t
) -> ::c_int
;
1363 pub fn tcgetattr(fd
: ::c_int
, termios
: *mut ::termios
) -> ::c_int
;
1364 pub fn tcsetattr(fd
: ::c_int
, optional_actions
: ::c_int
, termios
: *const ::termios
) -> ::c_int
;
1365 pub fn tcflow(fd
: ::c_int
, action
: ::c_int
) -> ::c_int
;
1366 pub fn tcflush(fd
: ::c_int
, action
: ::c_int
) -> ::c_int
;
1367 pub fn tcgetsid(fd
: ::c_int
) -> ::pid_t
;
1368 pub fn tcsendbreak(fd
: ::c_int
, duration
: ::c_int
) -> ::c_int
;
1369 pub fn mkstemp(template
: *mut ::c_char
) -> ::c_int
;
1370 pub fn mkdtemp(template
: *mut ::c_char
) -> *mut ::c_char
;
1372 pub fn tmpnam(ptr
: *mut ::c_char
) -> *mut ::c_char
;
1374 pub fn openlog(ident
: *const ::c_char
, logopt
: ::c_int
, facility
: ::c_int
);
1376 pub fn setlogmask(maskpri
: ::c_int
) -> ::c_int
;
1377 #[cfg_attr(target_os = "macos", link_name = "syslog$DARWIN_EXTSN")]
1378 pub fn syslog(priority
: ::c_int
, message
: *const ::c_char
, ...);
1380 all(target_os
= "macos", target_arch
= "x86"),
1381 link_name
= "nice$UNIX2003"
1383 pub fn nice(incr
: ::c_int
) -> ::c_int
;
1385 pub fn grantpt(fd
: ::c_int
) -> ::c_int
;
1386 pub fn posix_openpt(flags
: ::c_int
) -> ::c_int
;
1387 pub fn ptsname(fd
: ::c_int
) -> *mut ::c_char
;
1388 pub fn unlockpt(fd
: ::c_int
) -> ::c_int
;
1390 pub fn strcasestr(cs
: *const c_char
, ct
: *const c_char
) -> *mut c_char
;
1391 pub fn getline(lineptr
: *mut *mut c_char
, n
: *mut size_t
, stream
: *mut FILE
) -> ssize_t
;
1393 pub fn lockf(fd
: ::c_int
, cmd
: ::c_int
, len
: ::off_t
) -> ::c_int
;
1397 if #[cfg(not(any(target_os = "emscripten",
1398 target_os
= "android",
1399 target_os
= "haiku")))] {
1401 pub fn adjtime(delta
: *const timeval
, olddelta
: *mut timeval
) -> ::c_int
;
1402 pub fn stpncpy(dst
: *mut c_char
, src
: *const c_char
, n
: size_t
) -> *mut c_char
;
1408 if #[cfg(not(target_env = "uclibc"))] {
1410 pub fn open_wmemstream(
1411 ptr
: *mut *mut wchar_t
,
1412 sizeloc
: *mut size_t
,
1419 if #[cfg(not(target_os = "redox"))] {
1421 pub fn getsid(pid
: pid_t
) -> pid_t
;
1422 pub fn truncate(path
: *const c_char
, length
: off_t
) -> ::c_int
;
1423 #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
1424 link_name
= "pause$UNIX2003")]
1425 pub fn pause() -> ::c_int
;
1427 pub fn readlinkat(dirfd
: ::c_int
,
1428 pathname
: *const ::c_char
,
1430 bufsiz
: ::size_t
) -> ::ssize_t
;
1431 pub fn mkdirat(dirfd
: ::c_int
, pathname
: *const ::c_char
,
1432 mode
: ::mode_t
) -> ::c_int
;
1433 pub fn openat(dirfd
: ::c_int
, pathname
: *const ::c_char
,
1434 flags
: ::c_int
, ...) -> ::c_int
;
1436 #[cfg_attr(all(target_os = "macos", target_arch = "x86_64"),
1437 link_name
= "fdopendir$INODE64")]
1438 #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
1439 link_name
= "fdopendir$INODE64$UNIX2003")]
1440 pub fn fdopendir(fd
: ::c_int
) -> *mut ::DIR
;
1442 #[cfg_attr(all(target_os = "macos", not(target_arch = "aarch64")),
1443 link_name
= "readdir_r$INODE64")]
1444 #[cfg_attr(target_os = "netbsd", link_name = "__readdir_r30")]
1446 all(target_os
= "freebsd", any(freebsd11
, freebsd10
)),
1447 link_name
= "readdir_r@FBSD_1.0"
1449 #[allow(non_autolinks)] // FIXME: `<>` breaks line length limit.
1450 /// The 64-bit libc on Solaris and illumos only has readdir_r. If a
1451 /// 32-bit Solaris or illumos target is ever created, it should use
1452 /// __posix_readdir_r. See libc(3LIB) on Solaris or illumos:
1453 /// https://illumos.org/man/3lib/libc
1454 /// https://docs.oracle.com/cd/E36784_01/html/E36873/libc-3lib.html
1455 /// https://www.unix.com/man-page/opensolaris/3LIB/libc/
1456 pub fn readdir_r(dirp
: *mut ::DIR
, entry
: *mut ::dirent
,
1457 result
: *mut *mut ::dirent
) -> ::c_int
;
1463 if #[cfg(not(any(target_os = "solaris", target_os = "illumos")))] {
1465 pub fn cfmakeraw(termios
: *mut ::termios
);
1466 pub fn cfsetspeed(termios
: *mut ::termios
,
1467 speed
: ::speed_t
) -> ::c_int
;
1473 if #[cfg(target_env = "newlib")] {
1475 pub use self::newlib
::*;
1476 } else if #[cfg(any(target_os = "linux",
1478 target_os
= "android",
1479 target_os
= "emscripten"))] {
1481 pub use self::linux_like
::*;
1482 } else if #[cfg(any(target_os = "macos",
1484 target_os
= "watchos",
1485 target_os
= "freebsd",
1486 target_os
= "dragonfly",
1487 target_os
= "openbsd",
1488 target_os
= "netbsd"))] {
1490 pub use self::bsd
::*;
1491 } else if #[cfg(any(target_os = "solaris",
1492 target_os
= "illumos"))] {
1494 pub use self::solarish
::*;
1495 } else if #[cfg(target_os = "haiku")] {
1497 pub use self::haiku
::*;
1498 } else if #[cfg(target_os = "hermit")] {
1500 pub use self::hermit
::*;
1501 } else if #[cfg(target_os = "redox")] {
1503 pub use self::redox
::*;
1505 // Unknown target_os
1510 if #[cfg(libc_core_cvoid)] {
1511 pub use ::ffi
::c_void
;
1513 // Use repr(u8) as LLVM expects `void*` to be the same as `i8*` to help
1514 // enable more optimization opportunities around it recognizing things
1515 // like malloc/free.
1517 #[allow(missing_copy_implementations)]
1518 #[allow(missing_debug_implementations)]
1520 // Two dummy variants so the #[repr] attribute can be used.
1530 if #[cfg(libc_align)] {
1532 pub use self::align
::*;
1535 pub use self::no_align
::*;