]>
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;
28 pub type in_addr_t
= u32;
29 pub type in_port_t
= u16;
30 pub type sighandler_t
= ::size_t
;
31 pub type cc_t
= ::c_uchar
;
33 #[cfg_attr(feature = "extra_traits", derive(Debug))]
35 impl ::Copy
for DIR {}
36 impl ::Clone
for DIR
{
37 fn clone(&self) -> DIR
{
41 pub type locale_t
= *mut ::c_void
;
45 pub gr_name
: *mut ::c_char
,
46 pub gr_passwd
: *mut ::c_char
,
48 pub gr_mem
: *mut *mut ::c_char
,
58 pub tv_usec
: suseconds_t
,
61 // linux x32 compatibility
62 // See https://sourceware.org/bugzilla/show_bug.cgi?id=16437
65 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
67 #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
68 pub tv_nsec
: ::c_long
,
77 pub ru_utime
: timeval
,
78 pub ru_stime
: timeval
,
79 pub ru_maxrss
: c_long
,
80 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
83 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
86 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
89 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
91 pub ru_minflt
: c_long
,
92 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
94 pub ru_majflt
: c_long
,
95 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
98 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
100 pub ru_inblock
: c_long
,
101 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
103 pub ru_oublock
: c_long
,
104 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
106 pub ru_msgsnd
: c_long
,
107 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
109 pub ru_msgrcv
: c_long
,
110 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
112 pub ru_nsignals
: c_long
,
113 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
115 pub ru_nvcsw
: c_long
,
116 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
118 pub ru_nivcsw
: c_long
,
119 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
122 #[cfg(any(target_env = "musl", target_os = "emscripten"))]
123 __reserved
: [c_long
; 16],
126 pub struct ipv6_mreq
{
127 pub ipv6mr_multiaddr
: in6_addr
,
128 #[cfg(target_os = "android")]
129 pub ipv6mr_interface
: ::c_int
,
130 #[cfg(not(target_os = "android"))]
131 pub ipv6mr_interface
: ::c_uint
,
135 pub h_name
: *mut ::c_char
,
136 pub h_aliases
: *mut *mut ::c_char
,
137 pub h_addrtype
: ::c_int
,
138 pub h_length
: ::c_int
,
139 pub h_addr_list
: *mut *mut ::c_char
,
143 pub iov_base
: *mut ::c_void
,
144 pub iov_len
: ::size_t
,
149 pub events
: ::c_short
,
150 pub revents
: ::c_short
,
154 pub ws_row
: ::c_ushort
,
155 pub ws_col
: ::c_ushort
,
156 pub ws_xpixel
: ::c_ushort
,
157 pub ws_ypixel
: ::c_ushort
,
161 pub l_onoff
: ::c_int
,
162 pub l_linger
: ::c_int
,
166 // Actually a union of an int and a void*
167 pub sival_ptr
: *mut ::c_void
171 pub struct itimerval
{
172 pub it_interval
: ::timeval
,
173 pub it_value
: ::timeval
,
178 pub tms_utime
: ::clock_t
,
179 pub tms_stime
: ::clock_t
,
180 pub tms_cutime
: ::clock_t
,
181 pub tms_cstime
: ::clock_t
,
185 pub s_name
: *mut ::c_char
,
186 pub s_aliases
: *mut *mut ::c_char
,
188 pub s_proto
: *mut ::c_char
,
191 pub struct protoent
{
192 pub p_name
: *mut ::c_char
,
193 pub p_aliases
: *mut *mut ::c_char
,
194 pub p_proto
: ::c_int
,
198 pub const INT_MIN
: c_int
= -2147483648;
199 pub const INT_MAX
: c_int
= 2147483647;
201 pub const SIG_DFL
: sighandler_t
= 0 as sighandler_t
;
202 pub const SIG_IGN
: sighandler_t
= 1 as sighandler_t
;
203 pub const SIG_ERR
: sighandler_t
= !0 as sighandler_t
;
205 pub const DT_UNKNOWN
: u8 = 0;
206 pub const DT_FIFO
: u8 = 1;
207 pub const DT_CHR
: u8 = 2;
208 pub const DT_DIR
: u8 = 4;
209 pub const DT_BLK
: u8 = 6;
210 pub const DT_REG
: u8 = 8;
211 pub const DT_LNK
: u8 = 10;
212 pub const DT_SOCK
: u8 = 12;
215 if #[cfg(not(target_os = "redox"))] {
216 pub const FD_CLOEXEC
: ::c_int
= 0x1;
220 pub const USRQUOTA
: ::c_int
= 0;
221 pub const GRPQUOTA
: ::c_int
= 1;
223 pub const SIGIOT
: ::c_int
= 6;
225 pub const S_ISUID
: ::mode_t
= 0x800;
226 pub const S_ISGID
: ::mode_t
= 0x400;
227 pub const S_ISVTX
: ::mode_t
= 0x200;
230 if #[cfg(not(any(target_os = "illumos", target_os = "solaris")))] {
231 pub const IF_NAMESIZE
: ::size_t
= 16;
232 pub const IFNAMSIZ
: ::size_t
= IF_NAMESIZE
;
236 pub const LOG_EMERG
: ::c_int
= 0;
237 pub const LOG_ALERT
: ::c_int
= 1;
238 pub const LOG_CRIT
: ::c_int
= 2;
239 pub const LOG_ERR
: ::c_int
= 3;
240 pub const LOG_WARNING
: ::c_int
= 4;
241 pub const LOG_NOTICE
: ::c_int
= 5;
242 pub const LOG_INFO
: ::c_int
= 6;
243 pub const LOG_DEBUG
: ::c_int
= 7;
245 pub const LOG_KERN
: ::c_int
= 0;
246 pub const LOG_USER
: ::c_int
= 1 << 3;
247 pub const LOG_MAIL
: ::c_int
= 2 << 3;
248 pub const LOG_DAEMON
: ::c_int
= 3 << 3;
249 pub const LOG_AUTH
: ::c_int
= 4 << 3;
250 pub const LOG_SYSLOG
: ::c_int
= 5 << 3;
251 pub const LOG_LPR
: ::c_int
= 6 << 3;
252 pub const LOG_NEWS
: ::c_int
= 7 << 3;
253 pub const LOG_UUCP
: ::c_int
= 8 << 3;
254 pub const LOG_LOCAL0
: ::c_int
= 16 << 3;
255 pub const LOG_LOCAL1
: ::c_int
= 17 << 3;
256 pub const LOG_LOCAL2
: ::c_int
= 18 << 3;
257 pub const LOG_LOCAL3
: ::c_int
= 19 << 3;
258 pub const LOG_LOCAL4
: ::c_int
= 20 << 3;
259 pub const LOG_LOCAL5
: ::c_int
= 21 << 3;
260 pub const LOG_LOCAL6
: ::c_int
= 22 << 3;
261 pub const LOG_LOCAL7
: ::c_int
= 23 << 3;
263 pub const LOG_PID
: ::c_int
= 0x01;
264 pub const LOG_CONS
: ::c_int
= 0x02;
265 pub const LOG_ODELAY
: ::c_int
= 0x04;
266 pub const LOG_NDELAY
: ::c_int
= 0x08;
267 pub const LOG_NOWAIT
: ::c_int
= 0x10;
269 pub const LOG_PRIMASK
: ::c_int
= 7;
270 pub const LOG_FACMASK
: ::c_int
= 0x3f8;
272 pub const PRIO_MIN
: ::c_int
= -20;
273 pub const PRIO_MAX
: ::c_int
= 20;
275 pub const IPPROTO_ICMP
: ::c_int
= 1;
276 pub const IPPROTO_ICMPV6
: ::c_int
= 58;
277 pub const IPPROTO_TCP
: ::c_int
= 6;
278 pub const IPPROTO_UDP
: ::c_int
= 17;
279 pub const IPPROTO_IP
: ::c_int
= 0;
280 pub const IPPROTO_IPV6
: ::c_int
= 41;
282 pub const INADDR_LOOPBACK
: in_addr_t
= 2130706433;
283 pub const INADDR_ANY
: in_addr_t
= 0;
284 pub const INADDR_BROADCAST
: in_addr_t
= 4294967295;
285 pub const INADDR_NONE
: in_addr_t
= 4294967295;
287 pub const ARPOP_REQUEST
: u16 = 1;
288 pub const ARPOP_REPLY
: u16 = 2;
290 pub const ATF_COM
: ::c_int
= 0x02;
291 pub const ATF_PERM
: ::c_int
= 0x04;
292 pub const ATF_PUBL
: ::c_int
= 0x08;
293 pub const ATF_USETRAILERS
: ::c_int
= 0x10;
296 if #[cfg(target_os = "l4re")] {
297 // required libraries for L4Re are linked externally, ATM
298 } else if #[cfg(feature = "std")] {
299 // cargo build, don't pull in anything extra as the libstd dep
300 // already pulls in all libs.
301 } else if #[cfg(all(target_os = "linux",
303 feature
= "rustc-dep-of-std"))] {
304 #[link(name = "util", kind = "static-nobundle",
305 cfg(target_feature
= "crt-static"))]
306 #[link(name = "rt", kind = "static-nobundle",
307 cfg(target_feature
= "crt-static"))]
308 #[link(name = "pthread", kind = "static-nobundle",
309 cfg(target_feature
= "crt-static"))]
310 #[link(name = "m", kind = "static-nobundle",
311 cfg(target_feature
= "crt-static"))]
312 #[link(name = "dl", kind = "static-nobundle",
313 cfg(target_feature
= "crt-static"))]
314 #[link(name = "c", kind = "static-nobundle",
315 cfg(target_feature
= "crt-static"))]
316 #[link(name = "gcc_eh", kind = "static-nobundle",
317 cfg(target_feature
= "crt-static"))]
318 #[link(name = "gcc", kind = "static-nobundle",
319 cfg(target_feature
= "crt-static"))]
320 #[link(name = "util", cfg(not(target_feature = "crt-static")))]
321 #[link(name = "rt", cfg(not(target_feature = "crt-static")))]
322 #[link(name = "pthread", cfg(not(target_feature = "crt-static")))]
323 #[link(name = "m", cfg(not(target_feature = "crt-static")))]
324 #[link(name = "dl", cfg(not(target_feature = "crt-static")))]
325 #[link(name = "c", cfg(not(target_feature = "crt-static")))]
327 } else if #[cfg(target_env = "musl")] {
328 #[cfg_attr(feature = "rustc-dep-of-std",
329 link(name
= "c", kind
= "static",
330 cfg(target_feature
= "crt-static")))]
331 #[cfg_attr(feature = "rustc-dep-of-std",
332 link(name
= "c", cfg(not(target_feature
= "crt-static"))))]
334 } else if #[cfg(target_os = "emscripten")] {
337 } else if #[cfg(all(target_os = "netbsd",
338 feature
= "rustc-dep-of-std",
339 target_vendor
= "rumprun"))] {
340 // Since we don't use -nodefaultlibs on Rumprun, libc is always pulled
341 // in automatically by the linker. We avoid passing it explicitly, as it
342 // causes some versions of binutils to crash with an assertion failure.
345 } else if #[cfg(any(target_os = "macos",
347 target_os
= "android",
348 target_os
= "openbsd"))] {
352 } else if #[cfg(target_os = "haiku")] {
353 #[link(name = "root")]
354 #[link(name = "network")]
356 } else if #[cfg(target_env = "newlib")] {
360 } else if #[cfg(target_os = "hermit")] {
361 // no_default_libraries is set to false for HermitCore, so only a link
362 // to "pthread" needs to be added.
363 #[link(name = "pthread")]
365 } else if #[cfg(target_env = "illumos")] {
369 } else if #[cfg(target_os = "redox")] {
370 #[cfg_attr(feature = "rustc-dep-of-std",
371 link(name
= "c", kind
= "static-nobundle",
372 cfg(target_feature
= "crt-static")))]
373 #[cfg_attr(feature = "rustc-dep-of-std",
374 link(name
= "c", cfg(not(target_feature
= "crt-static"))))]
380 #[link(name = "pthread")]
385 #[cfg_attr(feature = "extra_traits", derive(Debug))]
387 impl ::Copy
for FILE {}
388 impl ::Clone
for FILE
{
389 fn clone(&self) -> FILE
{
393 #[cfg_attr(feature = "extra_traits", derive(Debug))]
394 pub enum fpos_t {}
// FIXME: fill this out with a struct
395 impl ::Copy
for fpos_t {}
396 impl ::Clone
for fpos_t
{
397 fn clone(&self) -> fpos_t
{
403 pub fn isalnum(c
: c_int
) -> c_int
;
404 pub fn isalpha(c
: c_int
) -> c_int
;
405 pub fn iscntrl(c
: c_int
) -> c_int
;
406 pub fn isdigit(c
: c_int
) -> c_int
;
407 pub fn isgraph(c
: c_int
) -> c_int
;
408 pub fn islower(c
: c_int
) -> c_int
;
409 pub fn isprint(c
: c_int
) -> c_int
;
410 pub fn ispunct(c
: c_int
) -> c_int
;
411 pub fn isspace(c
: c_int
) -> c_int
;
412 pub fn isupper(c
: c_int
) -> c_int
;
413 pub fn isxdigit(c
: c_int
) -> c_int
;
414 pub fn isblank(c
: c_int
) -> c_int
;
415 pub fn tolower(c
: c_int
) -> c_int
;
416 pub fn toupper(c
: c_int
) -> c_int
;
422 unsafe extern "C" fn(*const c_void
, *const c_void
) -> c_int
,
431 unsafe extern "C" fn(*const c_void
, *const c_void
) -> c_int
,
435 all(target_os
= "macos", target_arch
= "x86"),
436 link_name
= "fopen$UNIX2003"
438 pub fn fopen(filename
: *const c_char
, mode
: *const c_char
) -> *mut FILE
;
440 all(target_os
= "macos", target_arch
= "x86"),
441 link_name
= "freopen$UNIX2003"
444 filename
: *const c_char
,
453 pub fn open_memstream(
454 ptr
: *mut *mut c_char
,
455 sizeloc
: *mut size_t
,
457 pub fn open_wmemstream(
458 ptr
: *mut *mut wchar_t
,
459 sizeloc
: *mut size_t
,
461 pub fn fflush(file
: *mut FILE
) -> c_int
;
462 pub fn fclose(file
: *mut FILE
) -> c_int
;
463 pub fn remove(filename
: *const c_char
) -> c_int
;
464 pub fn rename(oldname
: *const c_char
, newname
: *const c_char
) -> c_int
;
465 pub fn tmpfile() -> *mut FILE
;
472 pub fn setbuf(stream
: *mut FILE
, buf
: *mut c_char
);
473 pub fn getchar() -> c_int
;
474 pub fn putchar(c
: c_int
) -> c_int
;
475 pub fn fgetc(stream
: *mut FILE
) -> c_int
;
476 pub fn fgets(buf
: *mut c_char
, n
: c_int
, stream
: *mut FILE
)
478 pub fn fputc(c
: c_int
, stream
: *mut FILE
) -> c_int
;
480 all(target_os
= "macos", target_arch
= "x86"),
481 link_name
= "fputs$UNIX2003"
483 pub fn fputs(s
: *const c_char
, stream
: *mut FILE
) -> c_int
;
484 pub fn puts(s
: *const c_char
) -> c_int
;
485 pub fn ungetc(c
: c_int
, stream
: *mut FILE
) -> c_int
;
493 all(target_os
= "macos", target_arch
= "x86"),
494 link_name
= "fwrite$UNIX2003"
502 pub fn fseek(stream
: *mut FILE
, offset
: c_long
, whence
: c_int
) -> c_int
;
503 pub fn ftell(stream
: *mut FILE
) -> c_long
;
504 pub fn rewind(stream
: *mut FILE
);
505 #[cfg_attr(target_os = "netbsd", link_name = "__fgetpos50")]
506 pub fn fgetpos(stream
: *mut FILE
, ptr
: *mut fpos_t
) -> c_int
;
507 #[cfg_attr(target_os = "netbsd", link_name = "__fsetpos50")]
508 pub fn fsetpos(stream
: *mut FILE
, ptr
: *const fpos_t
) -> c_int
;
509 pub fn feof(stream
: *mut FILE
) -> c_int
;
510 pub fn ferror(stream
: *mut FILE
) -> c_int
;
511 pub fn clearerr(stream
: *mut FILE
);
512 pub fn perror(s
: *const c_char
);
513 pub fn atoi(s
: *const c_char
) -> c_int
;
515 all(target_os
= "macos", target_arch
= "x86"),
516 link_name
= "strtod$UNIX2003"
518 pub fn strtod(s
: *const c_char
, endp
: *mut *mut c_char
) -> c_double
;
521 endp
: *mut *mut c_char
,
526 endp
: *mut *mut c_char
,
529 pub fn calloc(nobj
: size_t
, size
: size_t
) -> *mut c_void
;
530 pub fn malloc(size
: size_t
) -> *mut c_void
;
531 pub fn realloc(p
: *mut c_void
, size
: size_t
) -> *mut c_void
;
532 pub fn free(p
: *mut c_void
);
534 pub fn exit(status
: c_int
) -> !;
535 pub fn _exit(status
: c_int
) -> !;
536 pub fn atexit(cb
: extern "C" fn()) -> c_int
;
538 all(target_os
= "macos", target_arch
= "x86"),
539 link_name
= "system$UNIX2003"
541 pub fn system(s
: *const c_char
) -> c_int
;
542 pub fn getenv(s
: *const c_char
) -> *mut c_char
;
544 pub fn strcpy(dst
: *mut c_char
, src
: *const c_char
) -> *mut c_char
;
550 pub fn strcat(s
: *mut c_char
, ct
: *const c_char
) -> *mut c_char
;
556 pub fn strcmp(cs
: *const c_char
, ct
: *const c_char
) -> c_int
;
557 pub fn strncmp(cs
: *const c_char
, ct
: *const c_char
, n
: size_t
) -> c_int
;
558 pub fn strcoll(cs
: *const c_char
, ct
: *const c_char
) -> c_int
;
559 pub fn strchr(cs
: *const c_char
, c
: c_int
) -> *mut c_char
;
560 pub fn strrchr(cs
: *const c_char
, c
: c_int
) -> *mut c_char
;
561 pub fn strspn(cs
: *const c_char
, ct
: *const c_char
) -> size_t
;
562 pub fn strcspn(cs
: *const c_char
, ct
: *const c_char
) -> size_t
;
563 pub fn strdup(cs
: *const c_char
) -> *mut c_char
;
564 pub fn strndup(cs
: *const c_char
, n
: size_t
) -> *mut c_char
;
565 pub fn strpbrk(cs
: *const c_char
, ct
: *const c_char
) -> *mut c_char
;
566 pub fn strstr(cs
: *const c_char
, ct
: *const c_char
) -> *mut c_char
;
567 pub fn strcasecmp(s1
: *const c_char
, s2
: *const c_char
) -> c_int
;
573 pub fn strlen(cs
: *const c_char
) -> size_t
;
574 pub fn strnlen(cs
: *const c_char
, maxlen
: size_t
) -> size_t
;
576 all(target_os
= "macos", target_arch
= "x86"),
577 link_name
= "strerror$UNIX2003"
579 pub fn strerror(n
: c_int
) -> *mut c_char
;
580 pub fn strtok(s
: *mut c_char
, t
: *const c_char
) -> *mut c_char
;
581 pub fn strxfrm(s
: *mut c_char
, ct
: *const c_char
, n
: size_t
) -> size_t
;
582 pub fn strsignal(sig
: c_int
) -> *mut c_char
;
583 pub fn wcslen(buf
: *const wchar_t
) -> size_t
;
590 pub fn memchr(cx
: *const c_void
, c
: c_int
, n
: size_t
) -> *mut c_void
;
591 pub fn wmemchr(cx
: *const wchar_t
, c
: wchar_t
, n
: size_t
) -> *mut wchar_t
;
592 pub fn memcmp(cx
: *const c_void
, ct
: *const c_void
, n
: size_t
) -> c_int
;
603 pub fn memset(dest
: *mut c_void
, c
: c_int
, n
: size_t
) -> *mut c_void
;
607 #[cfg_attr(target_os = "netbsd", link_name = "__getpwnam50")]
608 pub fn getpwnam(name
: *const ::c_char
) -> *mut passwd
;
609 #[cfg_attr(target_os = "netbsd", link_name = "__getpwuid50")]
610 pub fn getpwuid(uid
: ::uid_t
) -> *mut passwd
;
614 format
: *const ::c_char
,
617 pub fn printf(format
: *const ::c_char
, ...) -> ::c_int
;
621 format
: *const ::c_char
,
624 pub fn sprintf(s
: *mut ::c_char
, format
: *const ::c_char
, ...) -> ::c_int
;
625 #[cfg_attr(target_os = "linux", link_name = "__isoc99_fscanf")]
628 format
: *const ::c_char
,
631 #[cfg_attr(target_os = "linux", link_name = "__isoc99_scanf")]
632 pub fn scanf(format
: *const ::c_char
, ...) -> ::c_int
;
633 #[cfg_attr(target_os = "linux", link_name = "__isoc99_sscanf")]
634 pub fn sscanf(s
: *const ::c_char
, format
: *const ::c_char
, ...)
636 pub fn getchar_unlocked() -> ::c_int
;
637 pub fn putchar_unlocked(c
: ::c_int
) -> ::c_int
;
639 #[cfg(not(all(libc_cfg_target_vendor, target_arch = "powerpc",
640 target_vendor
= "nintendo")))]
641 #[cfg_attr(target_os = "netbsd", link_name = "__socket30")]
642 #[cfg_attr(target_os = "illumos", link_name = "__xnet_socket")]
643 pub fn socket(domain
: ::c_int
, ty
: ::c_int
, protocol
: ::c_int
) -> ::c_int
;
644 #[cfg(not(all(libc_cfg_target_vendor, target_arch = "powerpc",
645 target_vendor
= "nintendo")))]
647 all(target_os
= "macos", target_arch
= "x86"),
648 link_name
= "connect$UNIX2003"
650 #[cfg_attr(target_os = "illumos", link_name = "__xnet_connect")]
653 address
: *const sockaddr
,
657 all(target_os
= "macos", target_arch
= "x86"),
658 link_name
= "listen$UNIX2003"
660 pub fn listen(socket
: ::c_int
, backlog
: ::c_int
) -> ::c_int
;
661 #[cfg(not(all(libc_cfg_target_vendor, target_arch = "powerpc",
662 target_vendor
= "nintendo")))]
664 all(target_os
= "macos", target_arch
= "x86"),
665 link_name
= "accept$UNIX2003"
669 address
: *mut sockaddr
,
670 address_len
: *mut socklen_t
,
672 #[cfg(not(all(libc_cfg_target_vendor, target_arch = "powerpc",
673 target_vendor
= "nintendo")))]
675 all(target_os
= "macos", target_arch
= "x86"),
676 link_name
= "getpeername$UNIX2003"
680 address
: *mut sockaddr
,
681 address_len
: *mut socklen_t
,
683 #[cfg(not(all(libc_cfg_target_vendor, target_arch = "powerpc",
684 target_vendor
= "nintendo")))]
686 all(target_os
= "macos", target_arch
= "x86"),
687 link_name
= "getsockname$UNIX2003"
691 address
: *mut sockaddr
,
692 address_len
: *mut socklen_t
,
698 value
: *const ::c_void
,
699 option_len
: socklen_t
,
702 all(target_os
= "macos", target_arch
= "x86"),
703 link_name
= "socketpair$UNIX2003"
705 #[cfg_attr(target_os = "illumos", link_name = "__xnet_socketpair")]
710 socket_vector
: *mut ::c_int
,
712 #[cfg(not(all(libc_cfg_target_vendor, target_arch = "powerpc",
713 target_vendor
= "nintendo")))]
715 all(target_os
= "macos", target_arch
= "x86"),
716 link_name
= "sendto$UNIX2003"
718 #[cfg_attr(target_os = "illumos", link_name = "__xnet_sendto")]
721 buf
: *const ::c_void
,
724 addr
: *const sockaddr
,
727 pub fn shutdown(socket
: ::c_int
, how
: ::c_int
) -> ::c_int
;
730 all(target_os
= "macos", target_arch
= "x86"),
731 link_name
= "chmod$UNIX2003"
733 pub fn chmod(path
: *const c_char
, mode
: mode_t
) -> ::c_int
;
735 all(target_os
= "macos", target_arch
= "x86"),
736 link_name
= "fchmod$UNIX2003"
738 pub fn fchmod(fd
: ::c_int
, mode
: mode_t
) -> ::c_int
;
741 all(target_os
= "macos", not(target_arch
= "aarch64")),
742 link_name
= "fstat$INODE64"
744 #[cfg_attr(target_os = "netbsd", link_name = "__fstat50")]
746 all(target_os
= "freebsd", any(freebsd11
, freebsd10
)),
747 link_name
= "fstat@FBSD_1.0"
749 pub fn fstat(fildes
: ::c_int
, buf
: *mut stat
) -> ::c_int
;
751 pub fn mkdir(path
: *const c_char
, mode
: mode_t
) -> ::c_int
;
754 all(target_os
= "macos", not(target_arch
= "aarch64")),
755 link_name
= "stat$INODE64"
757 #[cfg_attr(target_os = "netbsd", link_name = "__stat50")]
759 all(target_os
= "freebsd", any(freebsd11
, freebsd10
)),
760 link_name
= "stat@FBSD_1.0"
762 pub fn stat(path
: *const c_char
, buf
: *mut stat
) -> ::c_int
;
764 pub fn pclose(stream
: *mut ::FILE
) -> ::c_int
;
766 all(target_os
= "macos", target_arch
= "x86"),
767 link_name
= "fdopen$UNIX2003"
769 pub fn fdopen(fd
: ::c_int
, mode
: *const c_char
) -> *mut ::FILE
;
770 pub fn fileno(stream
: *mut ::FILE
) -> ::c_int
;
773 all(target_os
= "macos", target_arch
= "x86"),
774 link_name
= "open$UNIX2003"
776 pub fn open(path
: *const c_char
, oflag
: ::c_int
, ...) -> ::c_int
;
778 all(target_os
= "macos", target_arch
= "x86"),
779 link_name
= "creat$UNIX2003"
781 pub fn creat(path
: *const c_char
, mode
: mode_t
) -> ::c_int
;
783 all(target_os
= "macos", target_arch
= "x86"),
784 link_name
= "fcntl$UNIX2003"
786 pub fn fcntl(fd
: ::c_int
, cmd
: ::c_int
, ...) -> ::c_int
;
789 all(target_os
= "macos", target_arch
= "x86_64"),
790 link_name
= "opendir$INODE64"
793 all(target_os
= "macos", target_arch
= "x86"),
794 link_name
= "opendir$INODE64$UNIX2003"
796 #[cfg_attr(target_os = "netbsd", link_name = "__opendir30")]
797 pub fn opendir(dirname
: *const c_char
) -> *mut ::DIR
;
800 all(target_os
= "macos", not(target_arch
= "aarch64")),
801 link_name
= "readdir$INODE64"
803 #[cfg_attr(target_os = "netbsd", link_name = "__readdir30")]
805 all(target_os
= "freebsd", any(freebsd11
, freebsd10
)),
806 link_name
= "readdir@FBSD_1.0"
808 pub fn readdir(dirp
: *mut ::DIR
) -> *mut ::dirent
;
810 all(target_os
= "macos", target_arch
= "x86"),
811 link_name
= "closedir$UNIX2003"
813 pub fn closedir(dirp
: *mut ::DIR
) -> ::c_int
;
815 all(target_os
= "macos", target_arch
= "x86_64"),
816 link_name
= "rewinddir$INODE64"
819 all(target_os
= "macos", target_arch
= "x86"),
820 link_name
= "rewinddir$INODE64$UNIX2003"
822 pub fn rewinddir(dirp
: *mut ::DIR
);
826 pathname
: *const ::c_char
,
830 pub fn fchown(fd
: ::c_int
, owner
: ::uid_t
, group
: ::gid_t
) -> ::c_int
;
833 pathname
: *const ::c_char
,
839 all(target_os
= "macos", not(target_arch
= "aarch64")),
840 link_name
= "fstatat$INODE64"
843 all(target_os
= "freebsd", any(freebsd11
, freebsd10
)),
844 link_name
= "fstatat@FBSD_1.1"
848 pathname
: *const ::c_char
,
854 oldpath
: *const ::c_char
,
856 newpath
: *const ::c_char
,
861 oldpath
: *const ::c_char
,
863 newpath
: *const ::c_char
,
866 target
: *const ::c_char
,
868 linkpath
: *const ::c_char
,
872 pathname
: *const ::c_char
,
876 pub fn access(path
: *const c_char
, amode
: ::c_int
) -> ::c_int
;
877 pub fn alarm(seconds
: ::c_uint
) -> ::c_uint
;
878 pub fn chdir(dir
: *const c_char
) -> ::c_int
;
879 pub fn fchdir(dirfd
: ::c_int
) -> ::c_int
;
880 pub fn chown(path
: *const c_char
, uid
: uid_t
, gid
: gid_t
) -> ::c_int
;
882 all(target_os
= "macos", target_arch
= "x86"),
883 link_name
= "lchown$UNIX2003"
885 pub fn lchown(path
: *const c_char
, uid
: uid_t
, gid
: gid_t
) -> ::c_int
;
887 all(target_os
= "macos", target_arch
= "x86"),
888 link_name
= "close$NOCANCEL$UNIX2003"
891 all(target_os
= "macos", target_arch
= "x86_64"),
892 link_name
= "close$NOCANCEL"
894 pub fn close(fd
: ::c_int
) -> ::c_int
;
895 pub fn dup(fd
: ::c_int
) -> ::c_int
;
896 pub fn dup2(src
: ::c_int
, dst
: ::c_int
) -> ::c_int
;
897 pub fn execl(path
: *const c_char
, arg0
: *const c_char
, ...) -> ::c_int
;
899 path
: *const ::c_char
,
900 arg0
: *const ::c_char
,
904 file
: *const ::c_char
,
905 arg0
: *const ::c_char
,
908 pub fn execv(prog
: *const c_char
, argv
: *const *const c_char
) -> ::c_int
;
911 argv
: *const *const c_char
,
912 envp
: *const *const c_char
,
914 pub fn execvp(c
: *const c_char
, argv
: *const *const c_char
) -> ::c_int
;
915 pub fn fork() -> pid_t
;
916 pub fn fpathconf(filedes
: ::c_int
, name
: ::c_int
) -> c_long
;
917 pub fn getcwd(buf
: *mut c_char
, size
: ::size_t
) -> *mut c_char
;
918 pub fn getegid() -> gid_t
;
919 pub fn geteuid() -> uid_t
;
920 pub fn getgid() -> gid_t
;
921 pub fn getgroups(ngroups_max
: ::c_int
, groups
: *mut gid_t
) -> ::c_int
;
922 #[cfg_attr(target_os = "illumos", link_name = "getloginx")]
923 pub fn getlogin() -> *mut c_char
;
925 all(target_os
= "macos", target_arch
= "x86"),
926 link_name
= "getopt$UNIX2003"
930 argv
: *const *mut c_char
,
931 optstr
: *const c_char
,
933 pub fn getpgid(pid
: pid_t
) -> pid_t
;
934 pub fn getpgrp() -> pid_t
;
935 pub fn getpid() -> pid_t
;
936 pub fn getppid() -> pid_t
;
937 pub fn getuid() -> uid_t
;
938 pub fn isatty(fd
: ::c_int
) -> ::c_int
;
939 pub fn link(src
: *const c_char
, dst
: *const c_char
) -> ::c_int
;
940 pub fn lseek(fd
: ::c_int
, offset
: off_t
, whence
: ::c_int
) -> off_t
;
941 pub fn pathconf(path
: *const c_char
, name
: ::c_int
) -> c_long
;
942 pub fn pipe(fds
: *mut ::c_int
) -> ::c_int
;
943 pub fn posix_memalign(
944 memptr
: *mut *mut ::c_void
,
949 all(target_os
= "macos", target_arch
= "x86"),
950 link_name
= "read$UNIX2003"
952 pub fn read(fd
: ::c_int
, buf
: *mut ::c_void
, count
: ::size_t
)
954 pub fn rmdir(path
: *const c_char
) -> ::c_int
;
955 pub fn seteuid(uid
: uid_t
) -> ::c_int
;
956 pub fn setegid(gid
: gid_t
) -> ::c_int
;
957 pub fn setgid(gid
: gid_t
) -> ::c_int
;
958 pub fn setpgid(pid
: pid_t
, pgid
: pid_t
) -> ::c_int
;
959 pub fn setsid() -> pid_t
;
960 pub fn setuid(uid
: uid_t
) -> ::c_int
;
962 all(target_os
= "macos", target_arch
= "x86"),
963 link_name
= "sleep$UNIX2003"
965 pub fn sleep(secs
: ::c_uint
) -> ::c_uint
;
967 all(target_os
= "macos", target_arch
= "x86"),
968 link_name
= "nanosleep$UNIX2003"
970 #[cfg_attr(target_os = "netbsd", link_name = "__nanosleep50")]
971 pub fn nanosleep(rqtp
: *const timespec
, rmtp
: *mut timespec
) -> ::c_int
;
972 pub fn tcgetpgrp(fd
: ::c_int
) -> pid_t
;
973 pub fn tcsetpgrp(fd
: ::c_int
, pgrp
: ::pid_t
) -> ::c_int
;
974 pub fn ttyname(fd
: ::c_int
) -> *mut c_char
;
976 all(target_os
= "macos", target_arch
= "x86"),
977 link_name
= "ttyname_r$UNIX2003"
979 #[cfg_attr(target_os = "illumos", link_name = "__posix_ttyname_r")]
985 pub fn unlink(c
: *const c_char
) -> ::c_int
;
987 all(target_os
= "macos", target_arch
= "x86"),
988 link_name
= "wait$UNIX2003"
990 pub fn wait(status
: *mut ::c_int
) -> pid_t
;
992 all(target_os
= "macos", target_arch
= "x86"),
993 link_name
= "waitpid$UNIX2003"
997 status
: *mut ::c_int
,
1001 all(target_os
= "macos", target_arch
= "x86"),
1002 link_name
= "write$UNIX2003"
1006 buf
: *const ::c_void
,
1010 all(target_os
= "macos", target_arch
= "x86"),
1011 link_name
= "pread$UNIX2003"
1020 all(target_os
= "macos", target_arch
= "x86"),
1021 link_name
= "pwrite$UNIX2003"
1025 buf
: *const ::c_void
,
1029 pub fn umask(mask
: mode_t
) -> mode_t
;
1031 #[cfg_attr(target_os = "netbsd", link_name = "__utime50")]
1032 pub fn utime(file
: *const c_char
, buf
: *const utimbuf
) -> ::c_int
;
1035 all(target_os
= "macos", target_arch
= "x86"),
1036 link_name
= "kill$UNIX2003"
1038 pub fn kill(pid
: pid_t
, sig
: ::c_int
) -> ::c_int
;
1040 all(target_os
= "macos", target_arch
= "x86"),
1041 link_name
= "killpg$UNIX2003"
1043 pub fn killpg(pgrp
: pid_t
, sig
: ::c_int
) -> ::c_int
;
1045 pub fn mlock(addr
: *const ::c_void
, len
: ::size_t
) -> ::c_int
;
1046 pub fn munlock(addr
: *const ::c_void
, len
: ::size_t
) -> ::c_int
;
1047 pub fn mlockall(flags
: ::c_int
) -> ::c_int
;
1048 pub fn munlockall() -> ::c_int
;
1051 all(target_os
= "macos", target_arch
= "x86"),
1052 link_name
= "mmap$UNIX2003"
1055 addr
: *mut ::c_void
,
1063 all(target_os
= "macos", target_arch
= "x86"),
1064 link_name
= "munmap$UNIX2003"
1066 pub fn munmap(addr
: *mut ::c_void
, len
: ::size_t
) -> ::c_int
;
1068 pub fn if_nametoindex(ifname
: *const c_char
) -> ::c_uint
;
1069 pub fn if_indextoname(
1071 ifname
: *mut ::c_char
,
1075 all(target_os
= "macos", not(target_arch
= "aarch64")),
1076 link_name
= "lstat$INODE64"
1078 #[cfg_attr(target_os = "netbsd", link_name = "__lstat50")]
1080 all(target_os
= "freebsd", any(freebsd11
, freebsd10
)),
1081 link_name
= "lstat@FBSD_1.0"
1083 pub fn lstat(path
: *const c_char
, buf
: *mut stat
) -> ::c_int
;
1086 all(target_os
= "macos", target_arch
= "x86"),
1087 link_name
= "fsync$UNIX2003"
1089 pub fn fsync(fd
: ::c_int
) -> ::c_int
;
1092 all(target_os
= "macos", target_arch
= "x86"),
1093 link_name
= "setenv$UNIX2003"
1096 name
: *const c_char
,
1101 all(target_os
= "macos", target_arch
= "x86"),
1102 link_name
= "unsetenv$UNIX2003"
1104 #[cfg_attr(target_os = "netbsd", link_name = "__unsetenv13")]
1105 pub fn unsetenv(name
: *const c_char
) -> ::c_int
;
1107 pub fn symlink(path1
: *const c_char
, path2
: *const c_char
) -> ::c_int
;
1109 pub fn ftruncate(fd
: ::c_int
, length
: off_t
) -> ::c_int
;
1111 pub fn signal(signum
: ::c_int
, handler
: sighandler_t
) -> sighandler_t
;
1113 #[cfg_attr(target_os = "netbsd", link_name = "__getrusage50")]
1114 pub fn getrusage(resource
: ::c_int
, usage
: *mut rusage
) -> ::c_int
;
1117 any(target_os
= "macos", target_os
= "ios"),
1118 link_name
= "realpath$DARWIN_EXTSN"
1121 pathname
: *const ::c_char
,
1122 resolved
: *mut ::c_char
,
1125 pub fn flock(fd
: ::c_int
, operation
: ::c_int
) -> ::c_int
;
1127 #[cfg_attr(target_os = "netbsd", link_name = "__times13")]
1128 pub fn times(buf
: *mut ::tms
) -> ::clock_t
;
1130 pub fn pthread_self() -> ::pthread_t
;
1132 all(target_os
= "macos", target_arch
= "x86"),
1133 link_name
= "pthread_join$UNIX2003"
1135 pub fn pthread_join(
1136 native
: ::pthread_t
,
1137 value
: *mut *mut ::c_void
,
1139 pub fn pthread_exit(value
: *mut ::c_void
) -> !;
1140 pub fn pthread_attr_init(attr
: *mut ::pthread_attr_t
) -> ::c_int
;
1141 pub fn pthread_attr_destroy(attr
: *mut ::pthread_attr_t
) -> ::c_int
;
1142 pub fn pthread_attr_setstacksize(
1143 attr
: *mut ::pthread_attr_t
,
1144 stack_size
: ::size_t
,
1146 pub fn pthread_attr_setdetachstate(
1147 attr
: *mut ::pthread_attr_t
,
1150 pub fn pthread_detach(thread
: ::pthread_t
) -> ::c_int
;
1151 #[cfg_attr(target_os = "netbsd", link_name = "__libc_thr_yield")]
1152 pub fn sched_yield() -> ::c_int
;
1153 pub fn pthread_key_create(
1154 key
: *mut pthread_key_t
,
1155 dtor
: ::Option
<unsafe extern "C" fn(*mut ::c_void
)>,
1157 pub fn pthread_key_delete(key
: pthread_key_t
) -> ::c_int
;
1158 pub fn pthread_getspecific(key
: pthread_key_t
) -> *mut ::c_void
;
1159 pub fn pthread_setspecific(
1161 value
: *const ::c_void
,
1163 pub fn pthread_mutex_init(
1164 lock
: *mut pthread_mutex_t
,
1165 attr
: *const pthread_mutexattr_t
,
1167 pub fn pthread_mutex_destroy(lock
: *mut pthread_mutex_t
) -> ::c_int
;
1168 pub fn pthread_mutex_lock(lock
: *mut pthread_mutex_t
) -> ::c_int
;
1169 pub fn pthread_mutex_trylock(lock
: *mut pthread_mutex_t
) -> ::c_int
;
1170 pub fn pthread_mutex_unlock(lock
: *mut pthread_mutex_t
) -> ::c_int
;
1172 pub fn pthread_mutexattr_init(attr
: *mut pthread_mutexattr_t
) -> ::c_int
;
1174 all(target_os
= "macos", target_arch
= "x86"),
1175 link_name
= "pthread_mutexattr_destroy$UNIX2003"
1177 pub fn pthread_mutexattr_destroy(
1178 attr
: *mut pthread_mutexattr_t
,
1180 pub fn pthread_mutexattr_settype(
1181 attr
: *mut pthread_mutexattr_t
,
1186 all(target_os
= "macos", target_arch
= "x86"),
1187 link_name
= "pthread_cond_init$UNIX2003"
1189 pub fn pthread_cond_init(
1190 cond
: *mut pthread_cond_t
,
1191 attr
: *const pthread_condattr_t
,
1194 all(target_os
= "macos", target_arch
= "x86"),
1195 link_name
= "pthread_cond_wait$UNIX2003"
1197 pub fn pthread_cond_wait(
1198 cond
: *mut pthread_cond_t
,
1199 lock
: *mut pthread_mutex_t
,
1202 all(target_os
= "macos", target_arch
= "x86"),
1203 link_name
= "pthread_cond_timedwait$UNIX2003"
1205 pub fn pthread_cond_timedwait(
1206 cond
: *mut pthread_cond_t
,
1207 lock
: *mut pthread_mutex_t
,
1208 abstime
: *const ::timespec
,
1210 pub fn pthread_cond_signal(cond
: *mut pthread_cond_t
) -> ::c_int
;
1211 pub fn pthread_cond_broadcast(cond
: *mut pthread_cond_t
) -> ::c_int
;
1212 pub fn pthread_cond_destroy(cond
: *mut pthread_cond_t
) -> ::c_int
;
1213 pub fn pthread_condattr_init(attr
: *mut pthread_condattr_t
) -> ::c_int
;
1214 pub fn pthread_condattr_destroy(attr
: *mut pthread_condattr_t
) -> ::c_int
;
1216 all(target_os
= "macos", target_arch
= "x86"),
1217 link_name
= "pthread_rwlock_init$UNIX2003"
1219 pub fn pthread_rwlock_init(
1220 lock
: *mut pthread_rwlock_t
,
1221 attr
: *const pthread_rwlockattr_t
,
1224 all(target_os
= "macos", target_arch
= "x86"),
1225 link_name
= "pthread_rwlock_destroy$UNIX2003"
1227 pub fn pthread_rwlock_destroy(lock
: *mut pthread_rwlock_t
) -> ::c_int
;
1229 all(target_os
= "macos", target_arch
= "x86"),
1230 link_name
= "pthread_rwlock_rdlock$UNIX2003"
1232 pub fn pthread_rwlock_rdlock(lock
: *mut pthread_rwlock_t
) -> ::c_int
;
1234 all(target_os
= "macos", target_arch
= "x86"),
1235 link_name
= "pthread_rwlock_tryrdlock$UNIX2003"
1237 pub fn pthread_rwlock_tryrdlock(lock
: *mut pthread_rwlock_t
) -> ::c_int
;
1239 all(target_os
= "macos", target_arch
= "x86"),
1240 link_name
= "pthread_rwlock_wrlock$UNIX2003"
1242 pub fn pthread_rwlock_wrlock(lock
: *mut pthread_rwlock_t
) -> ::c_int
;
1244 all(target_os
= "macos", target_arch
= "x86"),
1245 link_name
= "pthread_rwlock_trywrlock$UNIX2003"
1247 pub fn pthread_rwlock_trywrlock(lock
: *mut pthread_rwlock_t
) -> ::c_int
;
1249 all(target_os
= "macos", target_arch
= "x86"),
1250 link_name
= "pthread_rwlock_unlock$UNIX2003"
1252 pub fn pthread_rwlock_unlock(lock
: *mut pthread_rwlock_t
) -> ::c_int
;
1253 pub fn pthread_rwlockattr_init(attr
: *mut pthread_rwlockattr_t
)
1255 pub fn pthread_rwlockattr_destroy(
1256 attr
: *mut pthread_rwlockattr_t
,
1259 #[cfg_attr(target_os = "illumos", link_name = "__xnet_getsockopt")]
1264 optval
: *mut ::c_void
,
1265 optlen
: *mut ::socklen_t
,
1267 pub fn raise(signum
: ::c_int
) -> ::c_int
;
1268 #[cfg_attr(target_os = "netbsd", link_name = "__sigaction14")]
1271 act
: *const sigaction
,
1272 oldact
: *mut sigaction
,
1275 #[cfg_attr(target_os = "netbsd", link_name = "__utimes50")]
1277 filename
: *const ::c_char
,
1278 times
: *const ::timeval
,
1280 pub fn dlopen(filename
: *const ::c_char
, flag
: ::c_int
) -> *mut ::c_void
;
1281 pub fn dlerror() -> *mut ::c_char
;
1283 handle
: *mut ::c_void
,
1284 symbol
: *const ::c_char
,
1286 pub fn dlclose(handle
: *mut ::c_void
) -> ::c_int
;
1287 pub fn dladdr(addr
: *const ::c_void
, info
: *mut Dl_info
) -> ::c_int
;
1289 #[cfg(not(all(libc_cfg_target_vendor, target_arch = "powerpc",
1290 target_vendor
= "nintendo")))]
1291 #[cfg_attr(target_os = "illumos", link_name = "__xnet_getaddrinfo")]
1293 node
: *const c_char
,
1294 service
: *const c_char
,
1295 hints
: *const addrinfo
,
1296 res
: *mut *mut addrinfo
,
1298 #[cfg(not(all(libc_cfg_target_vendor, target_arch = "powerpc",
1299 target_vendor
= "nintendo")))]
1300 pub fn freeaddrinfo(res
: *mut addrinfo
);
1301 pub fn gai_strerror(errcode
: ::c_int
) -> *const ::c_char
;
1304 all(target_os
= "linux", not(target_env
= "musl")),
1305 target_os
= "freebsd",
1306 target_os
= "dragonfly",
1309 link_name
= "__res_init"
1312 any(target_os
= "macos", target_os
= "ios"),
1313 link_name
= "res_9_init"
1315 pub fn res_init() -> ::c_int
;
1317 #[cfg_attr(target_os = "netbsd", link_name = "__gmtime_r50")]
1318 #[cfg_attr(target_env = "musl", allow(deprecated))] // FIXME: for `time_t`
1319 pub fn gmtime_r(time_p
: *const time_t
, result
: *mut tm
) -> *mut tm
;
1320 #[cfg_attr(target_os = "netbsd", link_name = "__localtime_r50")]
1321 #[cfg_attr(target_env = "musl", allow(deprecated))] // FIXME: for `time_t`
1322 pub fn localtime_r(time_p
: *const time_t
, result
: *mut tm
) -> *mut tm
;
1324 all(target_os
= "macos", target_arch
= "x86"),
1325 link_name
= "mktime$UNIX2003"
1327 #[cfg_attr(target_os = "netbsd", link_name = "__mktime50")]
1328 #[cfg_attr(target_env = "musl", allow(deprecated))] // FIXME: for `time_t`
1329 pub fn mktime(tm
: *mut tm
) -> time_t
;
1330 #[cfg_attr(target_os = "netbsd", link_name = "__time50")]
1331 #[cfg_attr(target_env = "musl", allow(deprecated))] // FIXME: for `time_t`
1332 pub fn time(time
: *mut time_t
) -> time_t
;
1333 #[cfg_attr(target_os = "netbsd", link_name = "__gmtime50")]
1334 #[cfg_attr(target_env = "musl", allow(deprecated))] // FIXME: for `time_t`
1335 pub fn gmtime(time_p
: *const time_t
) -> *mut tm
;
1336 #[cfg_attr(target_os = "netbsd", link_name = "__locatime50")]
1337 #[cfg_attr(target_env = "musl", allow(deprecated))] // FIXME: for `time_t`
1338 pub fn localtime(time_p
: *const time_t
) -> *mut tm
;
1339 #[cfg_attr(target_os = "netbsd", link_name = "__difftime50")]
1340 #[cfg_attr(target_env = "musl", allow(deprecated))] // FIXME: for `time_t`
1341 pub fn difftime(time1
: time_t
, time0
: time_t
) -> ::c_double
;
1342 #[cfg_attr(target_os = "netbsd", link_name = "__timegm50")]
1343 #[cfg_attr(target_env = "musl", allow(deprecated))] // FIXME: for `time_t`
1344 pub fn timegm(tm
: *mut ::tm
) -> time_t
;
1346 #[cfg_attr(target_os = "netbsd", link_name = "__mknod50")]
1348 all(target_os
= "freebsd", any(freebsd11
, freebsd10
)),
1349 link_name
= "mknod@FBSD_1.0"
1352 pathname
: *const ::c_char
,
1356 pub fn gethostname(name
: *mut ::c_char
, len
: ::size_t
) -> ::c_int
;
1357 pub fn getservbyname(
1358 name
: *const ::c_char
,
1359 proto
: *const ::c_char
,
1361 pub fn getprotobyname(name
: *const ::c_char
) -> *mut protoent
;
1362 pub fn getprotobynumber(proto
: ::c_int
) -> *mut protoent
;
1363 pub fn chroot(name
: *const ::c_char
) -> ::c_int
;
1365 all(target_os
= "macos", target_arch
= "x86"),
1366 link_name
= "usleep$UNIX2003"
1368 pub fn usleep(secs
: ::c_uint
) -> ::c_int
;
1370 all(target_os
= "macos", target_arch
= "x86"),
1371 link_name
= "send$UNIX2003"
1375 buf
: *const ::c_void
,
1380 all(target_os
= "macos", target_arch
= "x86"),
1381 link_name
= "recv$UNIX2003"
1390 all(target_os
= "macos", target_arch
= "x86"),
1391 link_name
= "putenv$UNIX2003"
1393 #[cfg_attr(target_os = "netbsd", link_name = "__putenv50")]
1394 pub fn putenv(string
: *mut c_char
) -> ::c_int
;
1396 all(target_os
= "macos", target_arch
= "x86"),
1397 link_name
= "poll$UNIX2003"
1399 pub fn poll(fds
: *mut pollfd
, nfds
: nfds_t
, timeout
: ::c_int
) -> ::c_int
;
1401 all(target_os
= "macos", target_arch
= "x86_64"),
1402 link_name
= "select$1050"
1405 all(target_os
= "macos", target_arch
= "x86"),
1406 link_name
= "select$UNIX2003"
1408 #[cfg_attr(target_os = "netbsd", link_name = "__select50")]
1411 readfs
: *mut fd_set
,
1412 writefds
: *mut fd_set
,
1413 errorfds
: *mut fd_set
,
1414 timeout
: *mut timeval
,
1416 #[cfg_attr(target_os = "netbsd", link_name = "__setlocale50")]
1419 locale
: *const ::c_char
,
1421 pub fn localeconv() -> *mut lconv
;
1424 all(target_os
= "macos", target_arch
= "x86"),
1425 link_name
= "sem_wait$UNIX2003"
1427 pub fn sem_wait(sem
: *mut sem_t
) -> ::c_int
;
1428 pub fn sem_trywait(sem
: *mut sem_t
) -> ::c_int
;
1429 pub fn sem_post(sem
: *mut sem_t
) -> ::c_int
;
1430 pub fn statvfs(path
: *const c_char
, buf
: *mut statvfs
) -> ::c_int
;
1431 pub fn fstatvfs(fd
: ::c_int
, buf
: *mut statvfs
) -> ::c_int
;
1434 path
: *const c_char
,
1439 #[cfg_attr(target_os = "netbsd", link_name = "__sigemptyset14")]
1440 pub fn sigemptyset(set
: *mut sigset_t
) -> ::c_int
;
1441 #[cfg_attr(target_os = "netbsd", link_name = "__sigaddset14")]
1442 pub fn sigaddset(set
: *mut sigset_t
, signum
: ::c_int
) -> ::c_int
;
1443 #[cfg_attr(target_os = "netbsd", link_name = "__sigfillset14")]
1444 pub fn sigfillset(set
: *mut sigset_t
) -> ::c_int
;
1445 #[cfg_attr(target_os = "netbsd", link_name = "__sigdelset14")]
1446 pub fn sigdelset(set
: *mut sigset_t
, signum
: ::c_int
) -> ::c_int
;
1447 #[cfg_attr(target_os = "netbsd", link_name = "__sigismember14")]
1448 pub fn sigismember(set
: *const sigset_t
, signum
: ::c_int
) -> ::c_int
;
1450 #[cfg_attr(target_os = "netbsd", link_name = "__sigprocmask14")]
1453 set
: *const sigset_t
,
1454 oldset
: *mut sigset_t
,
1456 #[cfg_attr(target_os = "netbsd", link_name = "__sigpending14")]
1457 pub fn sigpending(set
: *mut sigset_t
) -> ::c_int
;
1459 pub fn sysconf(name
: ::c_int
) -> ::c_long
;
1461 pub fn mkfifo(path
: *const c_char
, mode
: mode_t
) -> ::c_int
;
1464 all(target_os
= "macos", target_arch
= "x86_64"),
1465 link_name
= "pselect$1050"
1468 all(target_os
= "macos", target_arch
= "x86"),
1469 link_name
= "pselect$UNIX2003"
1471 #[cfg_attr(target_os = "netbsd", link_name = "__pselect50")]
1474 readfs
: *mut fd_set
,
1475 writefds
: *mut fd_set
,
1476 errorfds
: *mut fd_set
,
1477 timeout
: *const timespec
,
1478 sigmask
: *const sigset_t
,
1481 stream
: *mut ::FILE
,
1485 pub fn ftello(stream
: *mut ::FILE
) -> ::off_t
;
1487 all(target_os
= "macos", target_arch
= "x86"),
1488 link_name
= "tcdrain$UNIX2003"
1490 pub fn tcdrain(fd
: ::c_int
) -> ::c_int
;
1491 pub fn cfgetispeed(termios
: *const ::termios
) -> ::speed_t
;
1492 pub fn cfgetospeed(termios
: *const ::termios
) -> ::speed_t
;
1493 pub fn cfsetispeed(termios
: *mut ::termios
, speed
: ::speed_t
) -> ::c_int
;
1494 pub fn cfsetospeed(termios
: *mut ::termios
, speed
: ::speed_t
) -> ::c_int
;
1495 pub fn tcgetattr(fd
: ::c_int
, termios
: *mut ::termios
) -> ::c_int
;
1498 optional_actions
: ::c_int
,
1499 termios
: *const ::termios
,
1501 pub fn tcflow(fd
: ::c_int
, action
: ::c_int
) -> ::c_int
;
1502 pub fn tcflush(fd
: ::c_int
, action
: ::c_int
) -> ::c_int
;
1503 pub fn tcgetsid(fd
: ::c_int
) -> ::pid_t
;
1504 pub fn tcsendbreak(fd
: ::c_int
, duration
: ::c_int
) -> ::c_int
;
1505 pub fn mkstemp(template
: *mut ::c_char
) -> ::c_int
;
1506 pub fn mkdtemp(template
: *mut ::c_char
) -> *mut ::c_char
;
1508 pub fn tmpnam(ptr
: *mut ::c_char
) -> *mut ::c_char
;
1510 pub fn openlog(ident
: *const ::c_char
, logopt
: ::c_int
, facility
: ::c_int
);
1512 pub fn setlogmask(maskpri
: ::c_int
) -> ::c_int
;
1513 #[cfg_attr(target_os = "macos", link_name = "syslog$DARWIN_EXTSN")]
1514 pub fn syslog(priority
: ::c_int
, message
: *const ::c_char
, ...);
1516 all(target_os
= "macos", target_arch
= "x86"),
1517 link_name
= "nice$UNIX2003"
1519 pub fn nice(incr
: ::c_int
) -> ::c_int
;
1521 pub fn grantpt(fd
: ::c_int
) -> ::c_int
;
1522 pub fn posix_openpt(flags
: ::c_int
) -> ::c_int
;
1523 pub fn ptsname(fd
: ::c_int
) -> *mut ::c_char
;
1524 pub fn unlockpt(fd
: ::c_int
) -> ::c_int
;
1526 pub fn strcasestr(cs
: *const c_char
, ct
: *const c_char
) -> *mut c_char
;
1528 lineptr
: *mut *mut c_char
,
1541 if #[cfg(not(target_os = "redox"))] {
1543 pub fn getsid(pid
: pid_t
) -> pid_t
;
1544 pub fn truncate(path
: *const c_char
, length
: off_t
) -> ::c_int
;
1545 #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
1546 link_name
= "pause$UNIX2003")]
1547 pub fn pause() -> ::c_int
;
1549 pub fn readlinkat(dirfd
: ::c_int
,
1550 pathname
: *const ::c_char
,
1552 bufsiz
: ::size_t
) -> ::ssize_t
;
1553 pub fn mkdirat(dirfd
: ::c_int
, pathname
: *const ::c_char
,
1554 mode
: ::mode_t
) -> ::c_int
;
1555 pub fn openat(dirfd
: ::c_int
, pathname
: *const ::c_char
,
1556 flags
: ::c_int
, ...) -> ::c_int
;
1558 #[cfg_attr(all(target_os = "macos", target_arch = "x86_64"),
1559 link_name
= "fdopendir$INODE64")]
1560 #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
1561 link_name
= "fdopendir$INODE64$UNIX2003")]
1562 pub fn fdopendir(fd
: ::c_int
) -> *mut ::DIR
;
1564 #[cfg_attr(all(target_os = "macos", not(target_arch = "aarch64")),
1565 link_name
= "readdir_r$INODE64")]
1566 #[cfg_attr(target_os = "netbsd", link_name = "__readdir_r30")]
1568 all(target_os
= "freebsd", any(freebsd11
, freebsd10
)),
1569 link_name
= "readdir_r@FBSD_1.0"
1571 /// The 64-bit libc on Solaris and illumos only has readdir_r. If a
1572 /// 32-bit Solaris or illumos target is ever created, it should use
1573 /// __posix_readdir_r. See libc(3LIB) on Solaris or illumos:
1574 /// https://illumos.org/man/3lib/libc
1575 /// https://docs.oracle.com/cd/E36784_01/html/E36873/libc-3lib.html
1576 /// https://www.unix.com/man-page/opensolaris/3LIB/libc/
1577 pub fn readdir_r(dirp
: *mut ::DIR
, entry
: *mut ::dirent
,
1578 result
: *mut *mut ::dirent
) -> ::c_int
;
1584 if #[cfg(not(any(target_os = "solaris", target_os = "illumos")))] {
1586 pub fn cfmakeraw(termios
: *mut ::termios
);
1587 pub fn cfsetspeed(termios
: *mut ::termios
,
1588 speed
: ::speed_t
) -> ::c_int
;
1594 if #[cfg(target_env = "uclibc")] {
1596 pub use self::uclibc
::*;
1597 } else if #[cfg(target_env = "newlib")] {
1599 pub use self::newlib
::*;
1600 } else if #[cfg(any(target_os = "linux",
1601 target_os
= "android",
1602 target_os
= "emscripten"))] {
1604 pub use self::linux_like
::*;
1605 } else if #[cfg(any(target_os = "macos",
1607 target_os
= "freebsd",
1608 target_os
= "dragonfly",
1609 target_os
= "openbsd",
1610 target_os
= "netbsd"))] {
1612 pub use self::bsd
::*;
1613 } else if #[cfg(any(target_os = "solaris",
1614 target_os
= "illumos"))] {
1616 pub use self::solarish
::*;
1617 } else if #[cfg(target_os = "haiku")] {
1619 pub use self::haiku
::*;
1620 } else if #[cfg(target_os = "hermit")] {
1622 pub use self::hermit
::*;
1623 } else if #[cfg(target_os = "redox")] {
1625 pub use self::redox
::*;
1627 // Unknown target_os
1632 if #[cfg(libc_core_cvoid)] {
1633 pub use ::ffi
::c_void
;
1635 // Use repr(u8) as LLVM expects `void*` to be the same as `i8*` to help
1636 // enable more optimization opportunities around it recognizing things
1637 // like malloc/free.
1639 #[allow(missing_copy_implementations)]
1640 #[allow(missing_debug_implementations)]
1642 // Two dummy variants so the #[repr] attribute can be used.
1652 if #[cfg(libc_align)] {
1654 pub use self::align
::*;
1657 pub use self::no_align
::*;