3 pub type blkcnt_t
= i32;
4 pub type blksize_t
= i32;
5 pub type clock_t
= i32;
6 pub type clockid_t
= ::c_ulong
;
8 pub type fsblkcnt_t
= u64;
9 pub type fsfilcnt_t
= u32;
12 pub type key_t
= ::c_int
;
13 pub type loff_t
= ::c_longlong
;
14 pub type mode_t
= ::c_uint
;
15 pub type nfds_t
= u32;
16 pub type nlink_t
= ::c_ushort
;
18 pub type pthread_t
= ::c_ulong
;
19 pub type pthread_key_t
= ::c_uint
;
20 pub type rlim_t
= u32;
21 pub type sa_family_t
= u8;
22 pub type socklen_t
= u32;
23 pub type speed_t
= u32;
24 pub type suseconds_t
= i32;
25 pub type tcflag_t
= ::c_uint
;
26 pub type time_t
= i32;
27 pub type useconds_t
= u32;
31 pub sa_family
: sa_family_t
,
32 pub sa_data
: [::c_char
; 14],
35 pub struct sockaddr_in
{
36 pub sin_family
: sa_family_t
,
37 pub sin_port
: ::in_port_t
,
38 pub sin_addr
: ::in_addr
,
39 pub sin_zero
: [u8; 8],
42 pub struct sockaddr_in6
{ // Unverified
43 pub sin6_family
: sa_family_t
,
44 pub sin6_port
: ::in_port_t
,
45 pub sin6_flowinfo
: u32,
46 pub sin6_addr
: ::in6_addr
,
47 pub sin6_scope_id
: u32,
50 pub struct sockaddr_storage
{
51 pub ss_family
: sa_family_t
,
52 pub __ss_padding
: [u8; 26],
56 pub ai_flags
: ::c_int
,
57 pub ai_family
: ::c_int
,
58 pub ai_socktype
: ::c_int
,
59 pub ai_protocol
: ::c_int
,
60 pub ai_addrlen
: socklen_t
,
61 pub ai_canonname
: *mut ::c_char
,
62 pub ai_addr
: *mut sockaddr
,
63 pub ai_next
: *mut addrinfo
,
67 pub imr_multiaddr
: in_addr
,
68 pub imr_interface
: in_addr
,
73 pub l_linger
: ::c_int
,
77 pub s_addr
: ::in_addr_t
,
81 pub h_name
: *mut ::c_char
,
82 pub h_aliases
: *mut *mut ::c_char
,
83 pub h_addrtype
: ::c_int
,
84 pub h_length
: ::c_int
,
85 pub h_addr_list
: *mut *mut ::c_char
,
86 pub h_addr
: *mut ::c_char
,
96 pub decimal_point
: *mut ::c_char
,
97 pub thousands_sep
: *mut ::c_char
,
98 pub grouping
: *mut ::c_char
,
99 pub int_curr_symbol
: *mut ::c_char
,
100 pub currency_symbol
: *mut ::c_char
,
101 pub mon_decimal_point
: *mut ::c_char
,
102 pub mon_thousands_sep
: *mut ::c_char
,
103 pub mon_grouping
: *mut ::c_char
,
104 pub positive_sign
: *mut ::c_char
,
105 pub negative_sign
: *mut ::c_char
,
106 pub int_frac_digits
: ::c_char
,
107 pub frac_digits
: ::c_char
,
108 pub p_cs_precedes
: ::c_char
,
109 pub p_sep_by_space
: ::c_char
,
110 pub n_cs_precedes
: ::c_char
,
111 pub n_sep_by_space
: ::c_char
,
112 pub p_sign_posn
: ::c_char
,
113 pub n_sign_posn
: ::c_char
,
114 pub int_n_cs_precedes
: ::c_char
,
115 pub int_n_sep_by_space
: ::c_char
,
116 pub int_n_sign_posn
: ::c_char
,
117 pub int_p_cs_precedes
: ::c_char
,
118 pub int_p_sep_by_space
: ::c_char
,
119 pub int_p_sign_posn
: ::c_char
,
125 pub tm_hour
: ::c_int
,
126 pub tm_mday
: ::c_int
,
128 pub tm_year
: ::c_int
,
129 pub tm_wday
: ::c_int
,
130 pub tm_yday
: ::c_int
,
131 pub tm_isdst
: ::c_int
,
137 pub st_mode
: ::mode_t
,
138 pub st_nlink
: ::nlink_t
,
143 pub st_atime
: time_t
,
144 pub st_spare1
: ::c_long
,
145 pub st_mtime
: time_t
,
146 pub st_spare2
: ::c_long
,
147 pub st_ctime
: time_t
,
148 pub st_spare3
: ::c_long
,
149 pub st_blksize
: blksize_t
,
150 pub st_blocks
: blkcnt_t
,
151 pub st_spare4
: [::c_long
; 2usize
],
155 pub f_bsize
: ::c_ulong
,
156 pub f_frsize
: ::c_ulong
,
157 pub f_blocks
: fsblkcnt_t
,
158 pub f_bfree
: fsblkcnt_t
,
159 pub f_bavail
: fsblkcnt_t
,
160 pub f_files
: fsfilcnt_t
,
161 pub f_ffree
: fsfilcnt_t
,
162 pub f_favail
: fsfilcnt_t
,
163 pub f_fsid
: ::c_ulong
,
164 pub f_flag
: ::c_ulong
,
165 pub f_namemax
: ::c_ulong
,
168 pub struct sigset_t
{
169 __val
: [::c_ulong
; 16],
172 pub struct sigaction
{
173 pub sa_handler
: extern fn(arg1
: ::c_int
),
174 pub sa_mask
: sigset_t
,
175 pub sa_flags
: ::c_int
,
180 pub d_type
: ::c_uchar
,
181 pub d_name
: [::c_char
; 256usize
],
185 pub ss_sp
: *mut ::c_void
,
186 pub ss_flags
: ::c_int
,
190 pub struct fd_set
{ // Unverified
191 fds_bits
: [::c_ulong
; FD_SETSIZE
/ ULONG_SIZE
],
194 pub struct passwd
{ // Unverified
195 pub pw_name
: *mut ::c_char
,
196 pub pw_passwd
: *mut ::c_char
,
199 pub pw_gecos
: *mut ::c_char
,
200 pub pw_dir
: *mut ::c_char
,
201 pub pw_shell
: *mut ::c_char
,
204 pub struct termios
{ // Unverified
205 pub c_iflag
: ::tcflag_t
,
206 pub c_oflag
: ::tcflag_t
,
207 pub c_cflag
: ::tcflag_t
,
208 pub c_lflag
: ::tcflag_t
,
210 pub c_cc
: [::cc_t
; ::NCCS
],
213 pub struct sem_t
{ // Unverified
214 __size
: [::c_char
; 16],
217 pub struct Dl_info
{ // Unverified
218 pub dli_fname
: *const ::c_char
,
219 pub dli_fbase
: *mut ::c_void
,
220 pub dli_sname
: *const ::c_char
,
221 pub dli_saddr
: *mut ::c_void
,
224 pub struct utsname
{ // Unverified
225 pub sysname
: [::c_char
; 65],
226 pub nodename
: [::c_char
; 65],
227 pub release
: [::c_char
; 65],
228 pub version
: [::c_char
; 65],
229 pub machine
: [::c_char
; 65],
230 pub domainname
: [::c_char
; 65]
233 pub struct cpu_set_t
{ // Unverified
237 pub struct pthread_attr_t
{ // Unverified
241 #[cfg_attr(all(feature = "align",
242 target_pointer_width
= "32",
243 any(target_arch
= "mips",
245 target_arch
= "powerpc")),
247 #[cfg_attr(all(feature = "align",
248 any(target_pointer_width
= "64",
249 not(any(target_arch
= "mips",
251 target_arch
= "powerpc")))),
253 pub struct pthread_mutex_t
{ // Unverified
254 #[cfg(all(not(feature = "align"),
255 any(target_arch
= "mips",
257 target_arch
= "powerpc")))]
258 __align
: [::c_long
; 0],
259 #[cfg(not(any(feature = "align",
260 target_arch
= "mips",
262 target_arch
= "powerpc")))]
263 __align
: [::c_longlong
; 0],
264 size
: [u8; __SIZEOF_PTHREAD_MUTEX_T
],
267 #[cfg_attr(all(feature = "align",
268 target_pointer_width
= "32",
269 any(target_arch
= "mips",
271 target_arch
= "powerpc")),
273 #[cfg_attr(all(feature = "align",
274 any(target_pointer_width
= "64",
275 not(any(target_arch
= "mips",
277 target_arch
= "powerpc")))),
279 pub struct pthread_rwlock_t
{ // Unverified
280 #[cfg(all(not(feature = "align"),
281 any(target_arch
= "mips",
283 target_arch
= "powerpc")))]
284 __align
: [::c_long
; 0],
285 #[cfg(not(any(feature = "align",
286 target_arch
= "mips",
288 target_arch
= "powerpc")))]
289 __align
: [::c_longlong
; 0],
290 size
: [u8; __SIZEOF_PTHREAD_RWLOCK_T
],
293 #[cfg_attr(all(feature = "align",
294 any(target_pointer_width
= "32",
295 target_arch
= "x86_64", target_arch
= "powerpc64",
296 target_arch
= "mips64", target_arch
= "s390x",
297 target_arch
= "sparc64")),
299 #[cfg_attr(all(feature = "align",
300 not(any(target_pointer_width
= "32",
301 target_arch
= "x86_64", target_arch
= "powerpc64",
302 target_arch
= "mips64", target_arch
= "s390x",
303 target_arch
= "sparc64"))),
305 pub struct pthread_mutexattr_t
{ // Unverified
306 #[cfg(all(not(feature = "align"),
307 any(target_arch
= "x86_64", target_arch
= "powerpc64",
308 target_arch
= "mips64", target_arch
= "s390x",
309 target_arch
= "sparc64")))]
310 __align
: [::c_int
; 0],
311 #[cfg(all(not(feature = "align"),
312 not(any(target_arch
= "x86_64", target_arch
= "powerpc64",
313 target_arch
= "mips64", target_arch
= "s390x",
314 target_arch
= "sparc64"))))]
315 __align
: [::c_long
; 0],
316 size
: [u8; __SIZEOF_PTHREAD_MUTEXATTR_T
],
319 pub struct pthread_rwlockattr_t
{ // Unverified
324 #[cfg_attr(feature = "align", repr(align(8)))]
325 pub struct pthread_cond_t
{ // Unverified
326 #[cfg(not(feature = "align"))]
327 __align
: [::c_longlong
; 0],
328 size
: [u8; __SIZEOF_PTHREAD_COND_T
],
331 #[cfg_attr(feature = "align", repr(align(4)))]
332 pub struct pthread_condattr_t
{ // Unverified
333 #[cfg(not(feature = "align"))]
334 __align
: [::c_int
; 0],
335 size
: [u8; __SIZEOF_PTHREAD_CONDATTR_T
],
340 // unverified constants
342 pub const PTHREAD_MUTEX_INITIALIZER
: pthread_mutex_t
= pthread_mutex_t
{
343 size
: [0; __SIZEOF_PTHREAD_MUTEX_T
],
345 pub const PTHREAD_COND_INITIALIZER
: pthread_cond_t
= pthread_cond_t
{
346 size
: [0; __SIZEOF_PTHREAD_COND_T
],
348 pub const PTHREAD_RWLOCK_INITIALIZER
: pthread_rwlock_t
= pthread_rwlock_t
{
349 size
: [0; __SIZEOF_PTHREAD_RWLOCK_T
],
352 pub const NCCS
: usize = 32;
353 pub const __SIZEOF_PTHREAD_ATTR_T
: usize = 56;
354 pub const __SIZEOF_PTHREAD_MUTEX_T
: usize = 40;
355 pub const __SIZEOF_PTHREAD_MUTEXATTR_T
: usize = 4;
356 pub const __SIZEOF_PTHREAD_COND_T
: usize = 48;
357 pub const __SIZEOF_PTHREAD_CONDATTR_T
: usize = 4;
358 pub const __SIZEOF_PTHREAD_RWLOCK_T
: usize = 56;
359 pub const __SIZEOF_PTHREAD_RWLOCKATTR_T
: usize = 8;
360 pub const __SIZEOF_PTHREAD_BARRIER_T
: usize = 32;
361 pub const __SIZEOF_PTHREAD_BARRIERATTR_T
: usize = 4;
362 pub const __PTHREAD_MUTEX_HAVE_PREV
: usize = 1;
363 pub const __PTHREAD_RWLOCK_INT_FLAGS_SHARED
: usize = 1;
364 pub const PTHREAD_MUTEX_NORMAL
: ::c_int
= 0;
365 pub const PTHREAD_MUTEX_RECURSIVE
: ::c_int
= 1;
366 pub const PTHREAD_MUTEX_ERRORCHECK
: ::c_int
= 2;
367 pub const FD_SETSIZE
: usize = 1024;
368 // intentionally not public, only used for fd_set
369 const ULONG_SIZE
: usize = 32;
372 pub const EPERM
: ::c_int
= 1;
373 pub const ENOENT
: ::c_int
= 2;
374 pub const ESRCH
: ::c_int
= 3;
375 pub const EINTR
: ::c_int
= 4;
376 pub const EIO
: ::c_int
= 5;
377 pub const ENXIO
: ::c_int
= 6;
378 pub const E2BIG
: ::c_int
= 7;
379 pub const ENOEXEC
: ::c_int
= 8;
380 pub const EBADF
: ::c_int
= 9;
381 pub const ECHILD
: ::c_int
= 10;
382 pub const EAGAIN
: ::c_int
= 11;
383 pub const ENOMEM
: ::c_int
= 12;
384 pub const EACCES
: ::c_int
= 13;
385 pub const EFAULT
: ::c_int
= 14;
386 pub const EBUSY
: ::c_int
= 16;
387 pub const EEXIST
: ::c_int
= 17;
388 pub const EXDEV
: ::c_int
= 18;
389 pub const ENODEV
: ::c_int
= 19;
390 pub const ENOTDIR
: ::c_int
= 20;
391 pub const EISDIR
: ::c_int
= 21;
392 pub const EINVAL
: ::c_int
= 22;
393 pub const ENFILE
: ::c_int
= 23;
394 pub const EMFILE
: ::c_int
= 24;
395 pub const ENOTTY
: ::c_int
= 25;
396 pub const ETXTBSY
: ::c_int
= 26;
397 pub const EFBIG
: ::c_int
= 27;
398 pub const ENOSPC
: ::c_int
= 28;
399 pub const ESPIPE
: ::c_int
= 29;
400 pub const EROFS
: ::c_int
= 30;
401 pub const EMLINK
: ::c_int
= 31;
402 pub const EPIPE
: ::c_int
= 32;
403 pub const EDOM
: ::c_int
= 33;
404 pub const ERANGE
: ::c_int
= 34;
405 pub const ENOMSG
: ::c_int
= 35;
406 pub const EIDRM
: ::c_int
= 36;
407 pub const EDEADLK
: ::c_int
= 45;
408 pub const ENOLCK
: ::c_int
= 46;
409 pub const ENOSTR
: ::c_int
= 60;
410 pub const ENODATA
: ::c_int
= 61;
411 pub const ETIME
: ::c_int
= 62;
412 pub const ENOSR
: ::c_int
= 63;
413 pub const ENOLINK
: ::c_int
= 67;
414 pub const EPROTO
: ::c_int
= 71;
415 pub const EMULTIHOP
: ::c_int
= 74;
416 pub const EBADMSG
: ::c_int
= 77;
417 pub const EFTYPE
: ::c_int
= 79;
418 pub const ENOSYS
: ::c_int
= 88;
419 pub const ENOTEMPTY
: ::c_int
= 90;
420 pub const ENAMETOOLONG
: ::c_int
= 91;
421 pub const ELOOP
: ::c_int
= 92;
422 pub const EOPNOTSUPP
: ::c_int
= 95;
423 pub const EPFNOSUPPORT
: ::c_int
= 96;
424 pub const ECONNRESET
: ::c_int
= 104;
425 pub const ENOBUFS
: ::c_int
= 105;
426 pub const EAFNOSUPPORT
: ::c_int
= 106;
427 pub const EPROTOTYPE
: ::c_int
= 107;
428 pub const ENOTSOCK
: ::c_int
= 108;
429 pub const ENOPROTOOPT
: ::c_int
= 109;
430 pub const ECONNREFUSED
: ::c_int
= 111;
431 pub const EADDRINUSE
: ::c_int
= 112;
432 pub const ECONNABORTED
: ::c_int
= 113;
433 pub const ENETUNREACH
: ::c_int
= 114;
434 pub const ENETDOWN
: ::c_int
= 115;
435 pub const ETIMEDOUT
: ::c_int
= 116;
436 pub const EHOSTDOWN
: ::c_int
= 117;
437 pub const EHOSTUNREACH
: ::c_int
= 118;
438 pub const EINPROGRESS
: ::c_int
= 119;
439 pub const EALREADY
: ::c_int
= 120;
440 pub const EDESTADDRREQ
: ::c_int
= 121;
441 pub const EMSGSIZE
: ::c_int
= 122;
442 pub const EPROTONOSUPPORT
: ::c_int
= 123;
443 pub const EADDRNOTAVAIL
: ::c_int
= 125;
444 pub const ENETRESET
: ::c_int
= 126;
445 pub const EISCONN
: ::c_int
= 127;
446 pub const ENOTCONN
: ::c_int
= 128;
447 pub const ETOOMANYREFS
: ::c_int
= 129;
448 pub const EDQUOT
: ::c_int
= 132;
449 pub const ESTALE
: ::c_int
= 133;
450 pub const ENOTSUP
: ::c_int
= 134;
451 pub const EILSEQ
: ::c_int
= 138;
452 pub const EOVERFLOW
: ::c_int
= 139;
453 pub const ECANCELED
: ::c_int
= 140;
454 pub const ENOTRECOVERABLE
: ::c_int
= 141;
455 pub const EOWNERDEAD
: ::c_int
= 142;
456 pub const EWOULDBLOCK
: ::c_int
= 11;
458 pub const F_DUPFD
: ::c_int
= 0;
459 pub const F_GETFD
: ::c_int
= 1;
460 pub const F_SETFD
: ::c_int
= 2;
461 pub const F_GETFL
: ::c_int
= 3;
462 pub const F_SETFL
: ::c_int
= 4;
463 pub const F_GETOWN
: ::c_int
= 5;
464 pub const F_SETOWN
: ::c_int
= 6;
465 pub const F_GETLK
: ::c_int
= 7;
466 pub const F_SETLK
: ::c_int
= 8;
467 pub const F_SETLKW
: ::c_int
= 9;
468 pub const F_RGETLK
: ::c_int
= 10;
469 pub const F_RSETLK
: ::c_int
= 11;
470 pub const F_CNVT
: ::c_int
= 12;
471 pub const F_RSETLKW
: ::c_int
= 13;
472 pub const F_DUPFD_CLOEXEC
: ::c_int
= 14;
474 pub const O_RDONLY
: ::c_int
= 0;
475 pub const O_WRONLY
: ::c_int
= 1;
476 pub const O_RDWR
: ::c_int
= 2;
477 pub const O_APPEND
: ::c_int
= 8;
478 pub const O_CREAT
: ::c_int
= 512;
479 pub const O_TRUNC
: ::c_int
= 1024;
480 pub const O_EXCL
: ::c_int
= 2048;
481 pub const O_SYNC
: ::c_int
= 8192;
482 pub const O_NONBLOCK
: ::c_int
= 16384;
484 pub const O_ACCMODE
: ::c_int
= 3;
485 pub const O_CLOEXEC
: ::c_int
= 0x80000;
487 pub const POLLIN
: ::c_short
= 0x1;
488 pub const POLLPRI
: ::c_short
= 0x2;
489 pub const POLLOUT
: ::c_short
= 0x4;
490 pub const POLLERR
: ::c_short
= 0x8;
491 pub const POLLHUP
: ::c_short
= 0x10;
492 pub const POLLNVAL
: ::c_short
= 0x20;
494 pub const RTLD_LAZY
: ::c_int
= 0x1;
496 pub const STDIN_FILENO
: ::c_int
= 0;
497 pub const STDOUT_FILENO
: ::c_int
= 1;
498 pub const STDERR_FILENO
: ::c_int
= 2;
500 pub const SEEK_SET
: ::c_int
= 0;
501 pub const SEEK_CUR
: ::c_int
= 1;
502 pub const SEEK_END
: ::c_int
= 2;
504 pub const FIONBIO
: ::c_int
= 1;
506 pub const S_BLKSIZE
: ::mode_t
= 1024;
507 pub const S_IREAD
: ::mode_t
= 256;
508 pub const S_IWRITE
: ::mode_t
= 128;
509 pub const S_IEXEC
: ::mode_t
= 64;
510 pub const S_ENFMT
: ::mode_t
= 1024;
511 pub const S_IFMT
: ::mode_t
= 61440;
512 pub const S_IFDIR
: ::mode_t
= 16384;
513 pub const S_IFCHR
: ::mode_t
= 8192;
514 pub const S_IFBLK
: ::mode_t
= 24576;
515 pub const S_IFREG
: ::mode_t
= 32768;
516 pub const S_IFLNK
: ::mode_t
= 40960;
517 pub const S_IFSOCK
: ::mode_t
= 49152;
518 pub const S_IFIFO
: ::mode_t
= 4096;
519 pub const S_IRUSR
: ::mode_t
= 256;
520 pub const S_IWUSR
: ::mode_t
= 128;
521 pub const S_IXUSR
: ::mode_t
= 64;
522 pub const S_IRGRP
: ::mode_t
= 32;
523 pub const S_IWGRP
: ::mode_t
= 16;
524 pub const S_IXGRP
: ::mode_t
= 8;
525 pub const S_IROTH
: ::mode_t
= 4;
526 pub const S_IWOTH
: ::mode_t
= 2;
527 pub const S_IXOTH
: ::mode_t
= 1;
529 pub const SOL_SOCKET
: ::c_int
= 65535;
530 pub const SOL_TCP
: ::c_int
= 6;
532 pub const PF_UNSPEC
: ::c_int
= 0;
533 pub const PF_INET
: ::c_int
= 2;
534 pub const PF_INET6
: ::c_int
= 23;
536 pub const AF_UNSPEC
: ::c_int
= 0;
537 pub const AF_INET
: ::c_int
= 2;
538 pub const AF_INET6
: ::c_int
= 23;
540 pub const SOCK_STREAM
: ::c_int
= 1;
541 pub const SOCK_DGRAM
: ::c_int
= 2;
543 pub const MSG_OOB
: ::c_int
= 1;
544 pub const MSG_PEEK
: ::c_int
= 2;
545 pub const MSG_DONTWAIT
: ::c_int
= 4;
546 pub const MSG_DONTROUTE
: ::c_int
= 0;
547 pub const MSG_WAITALL
: ::c_int
= 0;
548 pub const MSG_MORE
: ::c_int
= 0;
549 pub const MSG_NOSIGNAL
: ::c_int
= 0;
551 pub const SHUT_RD
: ::c_int
= 0;
552 pub const SHUT_WR
: ::c_int
= 1;
553 pub const SHUT_RDWR
: ::c_int
= 2;
555 pub const SO_REUSEADDR
: ::c_int
= 4;
556 pub const SO_LINGER
: ::c_int
= 128;
557 pub const SO_OOBINLINE
: ::c_int
= 256;
558 pub const SO_SNDBUF
: ::c_int
= 4097;
559 pub const SO_RCVBUF
: ::c_int
= 4098;
560 pub const SO_SNDLOWAT
: ::c_int
= 4099;
561 pub const SO_RCVLOWAT
: ::c_int
= 4100;
562 pub const SO_TYPE
: ::c_int
= 4104;
563 pub const SO_ERROR
: ::c_int
= 4105;
565 pub const SOCK_CLOEXEC
: ::c_int
= O_CLOEXEC
;
567 pub const INET_ADDRSTRLEN
: ::c_int
= 16;
570 // com/bminor/newlib/blob/master/newlib/libc/sys/linux/include/net/if.h#L121
571 pub const IFF_UP
: ::c_int
= 0x1; // interface is up
572 pub const IFF_BROADCAST
: ::c_int
= 0x2; // broadcast address valid
573 pub const IFF_DEBUG
: ::c_int
= 0x4; // turn on debugging
574 pub const IFF_LOOPBACK
: ::c_int
= 0x8; // is a loopback net
575 pub const IFF_POINTOPOINT
: ::c_int
= 0x10; // interface is point-to-point link
576 pub const IFF_NOTRAILERS
: ::c_int
= 0x20; // avoid use of trailers
577 pub const IFF_RUNNING
: ::c_int
= 0x40; // resources allocated
578 pub const IFF_NOARP
: ::c_int
= 0x80; // no address resolution protocol
579 pub const IFF_PROMISC
: ::c_int
= 0x100; // receive all packets
580 pub const IFF_ALLMULTI
: ::c_int
= 0x200; // receive all multicast packets
581 pub const IFF_OACTIVE
: ::c_int
= 0x400; // transmission in progress
582 pub const IFF_SIMPLEX
: ::c_int
= 0x800; // can't hear own transmissions
583 pub const IFF_LINK0
: ::c_int
= 0x1000; // per link layer defined bit
584 pub const IFF_LINK1
: ::c_int
= 0x2000; // per link layer defined bit
585 pub const IFF_LINK2
: ::c_int
= 0x4000; // per link layer defined bit
586 pub const IFF_ALTPHYS
: ::c_int
= IFF_LINK2
; // use alternate physical connection
587 pub const IFF_MULTICAST
: ::c_int
= 0x8000; // supports multicast
589 pub const IPPROTO_IP
: ::c_int
= 0;
590 pub const IPPROTO_UDP
: ::c_int
= 17;
591 pub const IPPROTO_TCP
: ::c_int
= 6;
593 pub const TCP_NODELAY
: ::c_int
= 8193;
594 pub const TCP_MAXSEG
: ::c_int
= 8194;
596 pub const IP_TOS
: ::c_int
= 7;
597 pub const IP_TTL
: ::c_int
= 8;
598 pub const IP_MULTICAST_LOOP
: ::c_int
= 9;
599 pub const IP_MULTICAST_TTL
: ::c_int
= 10;
600 pub const IP_ADD_MEMBERSHIP
: ::c_int
= 11;
601 pub const IP_DROP_MEMBERSHIP
: ::c_int
= 12;
603 pub const HOST_NOT_FOUND
: ::c_int
= 1;
604 pub const NO_DATA
: ::c_int
= 2;
605 pub const NO_ADDRESS
: ::c_int
= 2;
606 pub const NO_RECOVERY
: ::c_int
= 3;
607 pub const TRY_AGAIN
: ::c_int
= 4;
609 pub const AI_PASSIVE
: ::c_int
= 1;
610 pub const AI_CANONNAME
: ::c_int
= 2;
611 pub const AI_NUMERICHOST
: ::c_int
= 4;
612 pub const AI_NUMERICSERV
: ::c_int
= 0;
613 pub const AI_ADDRCONFIG
: ::c_int
= 0;
615 pub const NI_MAXHOST
: ::c_int
= 1025;
616 pub const NI_MAXSERV
: ::c_int
= 32;
617 pub const NI_NOFQDN
: ::c_int
= 1;
618 pub const NI_NUMERICHOST
: ::c_int
= 2;
619 pub const NI_NAMEREQD
: ::c_int
= 4;
620 pub const NI_NUMERICSERV
: ::c_int
= 0;
621 pub const NI_DGRAM
: ::c_int
= 0;
623 pub const EAI_FAMILY
: ::c_int
= -303;
624 pub const EAI_MEMORY
: ::c_int
= -304;
625 pub const EAI_NONAME
: ::c_int
= -305;
626 pub const EAI_SOCKTYPE
: ::c_int
= -307;
629 pub fn FD_CLR(fd
: ::c_int
, set
: *mut fd_set
) -> () {
630 let bits
= mem
::size_of_val(&(*set
).fds_bits
[0]) * 8;
631 let fd
= fd
as usize;
632 (*set
).fds_bits
[fd
/ bits
] &= !(1 << (fd
% bits
));
636 pub fn FD_ISSET(fd
: ::c_int
, set
: *mut fd_set
) -> bool
{
637 let bits
= mem
::size_of_val(&(*set
).fds_bits
[0]) * 8;
638 let fd
= fd
as usize;
639 return ((*set
).fds_bits
[fd
/ bits
] & (1 << (fd
% bits
))) != 0
642 pub fn FD_SET(fd
: ::c_int
, set
: *mut fd_set
) -> () {
643 let bits
= mem
::size_of_val(&(*set
).fds_bits
[0]) * 8;
644 let fd
= fd
as usize;
645 (*set
).fds_bits
[fd
/ bits
] |= 1 << (fd
% bits
);
649 pub fn FD_ZERO(set
: *mut fd_set
) -> () {
650 for slot
in (*set
).fds_bits
.iter_mut() {
657 pub fn abs(i
: ::c_int
) -> ::c_int
;
658 pub fn atof(s
: *const ::c_char
) -> ::c_double
;
659 pub fn labs(i
: ::c_long
) -> ::c_long
;
660 pub fn rand() -> ::c_int
;
661 pub fn srand(seed
: ::c_uint
);
663 pub fn bind(fd
: ::c_int
, addr
: *const sockaddr
, len
: socklen_t
) -> ::c_int
;
664 pub fn closesocket(sockfd
: ::c_int
) -> ::c_int
;
665 pub fn ioctl(fd
: ::c_int
, request
: ::c_ulong
, ...) -> ::c_int
;
666 pub fn recvfrom(fd
: ::c_int
, buf
: *mut ::c_void
, n
: usize, flags
: ::c_int
,
667 addr
: *mut sockaddr
, addr_len
: *mut socklen_t
) -> isize;
668 pub fn getnameinfo(sa
: *const sockaddr
, salen
: socklen_t
,
669 host
: *mut ::c_char
, hostlen
: socklen_t
,
670 serv
: *mut ::c_char
, servlen
: socklen_t
,
671 flags
: ::c_int
) -> ::c_int
;
672 pub fn memalign(align
: ::size_t
, size
: ::size_t
) -> *mut ::c_void
;
673 pub fn fexecve(fd
: ::c_int
, argv
: *const *const ::c_char
,
674 envp
: *const *const ::c_char
)
676 #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrgid_r")]
677 pub fn getgrgid_r(uid
: ::uid_t
,
681 result
: *mut *mut ::group
) -> ::c_int
;
682 #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
683 link_name
= "sigaltstack$UNIX2003")]
684 #[cfg_attr(target_os = "netbsd", link_name = "__sigaltstack14")]
685 pub fn sigaltstack(ss
: *const stack_t
,
686 oss
: *mut stack_t
) -> ::c_int
;
687 pub fn sem_close(sem
: *mut sem_t
) -> ::c_int
;
688 pub fn getdtablesize() -> ::c_int
;
689 #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrnam_r")]
690 pub fn getgrnam_r(name
: *const ::c_char
,
694 result
: *mut *mut ::group
) -> ::c_int
;
695 #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
696 link_name
= "pthread_sigmask$UNIX2003")]
697 pub fn pthread_sigmask(how
: ::c_int
, set
: *const sigset_t
,
698 oldset
: *mut sigset_t
) -> ::c_int
;
699 pub fn sem_open(name
: *const ::c_char
, oflag
: ::c_int
, ...) -> *mut sem_t
;
700 pub fn getgrnam(name
: *const ::c_char
) -> *mut ::group
;
701 pub fn pthread_kill(thread
: ::pthread_t
, sig
: ::c_int
) -> ::c_int
;
702 pub fn sem_unlink(name
: *const ::c_char
) -> ::c_int
;
703 pub fn daemon(nochdir
: ::c_int
, noclose
: ::c_int
) -> ::c_int
;
704 #[cfg_attr(target_os = "netbsd", link_name = "__getpwnam_r50")]
705 #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwnam_r")]
706 pub fn getpwnam_r(name
: *const ::c_char
,
710 result
: *mut *mut passwd
) -> ::c_int
;
711 #[cfg_attr(target_os = "netbsd", link_name = "__getpwuid_r50")]
712 #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwuid_r")]
713 pub fn getpwuid_r(uid
: ::uid_t
,
717 result
: *mut *mut passwd
) -> ::c_int
;
718 #[cfg_attr(all(target_os = "macos", target_arch ="x86"),
719 link_name
= "sigwait$UNIX2003")]
720 #[cfg_attr(target_os = "solaris", link_name = "__posix_sigwait")]
721 pub fn sigwait(set
: *const sigset_t
,
722 sig
: *mut ::c_int
) -> ::c_int
;
723 pub fn pthread_atfork(prepare
: Option
<unsafe extern fn()>,
724 parent
: Option
<unsafe extern fn()>,
725 child
: Option
<unsafe extern fn()>) -> ::c_int
;
726 pub fn getgrgid(gid
: ::gid_t
) -> *mut ::group
;
727 #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
728 link_name
= "popen$UNIX2003")]
729 pub fn popen(command
: *const c_char
,
730 mode
: *const c_char
) -> *mut ::FILE
;
731 pub fn uname(buf
: *mut ::utsname
) -> ::c_int
;
735 if #[cfg(target_arch = "arm")] {
737 pub use self::arm
::*;
738 } else if #[cfg(target_arch = "aarch64")] {
740 pub use self::aarch64
::*;
742 // Only tested on ARM so far. Other platforms might have different
743 // definitions for types and constants.
744 pub use target_arch_not_implemented
;