diff options
Diffstat (limited to 'libc/src/unix/notbsd/emscripten.rs')
-rw-r--r-- | libc/src/unix/notbsd/emscripten.rs | 94 |
1 files changed, 54 insertions, 40 deletions
diff --git a/libc/src/unix/notbsd/emscripten.rs b/libc/src/unix/notbsd/emscripten.rs index 90c056c..28791d8 100644 --- a/libc/src/unix/notbsd/emscripten.rs +++ b/libc/src/unix/notbsd/emscripten.rs @@ -72,42 +72,47 @@ s! { __unused5: *mut ::c_void, } - pub struct ifaddrs { - pub ifa_next: *mut ifaddrs, - pub ifa_name: *mut c_char, - pub ifa_flags: ::c_uint, - pub ifa_addr: *mut ::sockaddr, - pub ifa_netmask: *mut ::sockaddr, - pub ifa_ifu: *mut ::sockaddr, // FIXME This should be a union - pub ifa_data: *mut ::c_void - } - + #[cfg_attr(feature = "align", repr(align(4)))] pub struct pthread_mutex_t { + #[cfg(not(feature = "align"))] __align: [::c_long; 0], size: [u8; __SIZEOF_PTHREAD_MUTEX_T], } + #[cfg_attr(feature = "align", repr(align(4)))] pub struct pthread_rwlock_t { + #[cfg(not(feature = "align"))] __align: [::c_long; 0], size: [u8; __SIZEOF_PTHREAD_RWLOCK_T], } + #[cfg_attr(feature = "align", repr(align(4)))] pub struct pthread_mutexattr_t { + #[cfg(not(feature = "align"))] __align: [::c_int; 0], size: [u8; __SIZEOF_PTHREAD_MUTEXATTR_T], } + #[cfg_attr(feature = "align", repr(align(4)))] pub struct pthread_rwlockattr_t { + #[cfg(not(feature = "align"))] __align: [::c_int; 0], size: [u8; __SIZEOF_PTHREAD_RWLOCKATTR_T], } + #[cfg_attr(all(feature = "align", target_pointer_width = "32"), + repr(align(4)))] + #[cfg_attr(all(feature = "align", target_pointer_width = "64"), + repr(align(8)))] pub struct pthread_cond_t { + #[cfg(not(feature = "align"))] __align: [*const ::c_void; 0], size: [u8; __SIZEOF_PTHREAD_COND_T], } + #[cfg_attr(feature = "align", repr(align(4)))] pub struct pthread_condattr_t { + #[cfg(not(feature = "align"))] __align: [::c_int; 0], size: [u8; __SIZEOF_PTHREAD_CONDATTR_T], } @@ -179,7 +184,12 @@ s! { pub ssi_utime: ::uint64_t, pub ssi_stime: ::uint64_t, pub ssi_addr: ::uint64_t, - _pad: [::uint8_t; 48], + pub ssi_addr_lsb: ::uint16_t, + _pad2: ::uint16_t, + pub ssi_syscall: ::int32_t, + pub ssi_call_addr: ::uint64_t, + pub ssi_arch: ::uint32_t, + _pad: [::uint8_t; 28], } pub struct fsid_t { @@ -461,6 +471,15 @@ s! { pub f_namemax: ::c_ulong, __f_spare: [::c_int; 6], } + + pub struct arpd_request { + pub req: ::c_ushort, + pub ip: u32, + pub dev: ::c_ulong, + pub stamp: ::c_ulong, + pub updated: ::c_ulong, + pub ha: [::c_uchar; ::MAX_ADDR_LEN], + } } pub const ABDAY_1: ::nl_item = 0x20000; @@ -748,18 +767,18 @@ pub const RTLD_NOW: ::c_int = 0x2; pub const TCP_MD5SIG: ::c_int = 14; -pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t { - __align: [], - size: [0; __SIZEOF_PTHREAD_MUTEX_T], -}; -pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t { - __align: [], - size: [0; __SIZEOF_PTHREAD_COND_T], -}; -pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t { - __align: [], - size: [0; __SIZEOF_PTHREAD_RWLOCK_T], -}; +align_const! { + pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t { + size: [0; __SIZEOF_PTHREAD_MUTEX_T], + }; + pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t { + size: [0; __SIZEOF_PTHREAD_COND_T], + }; + pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t { + size: [0; __SIZEOF_PTHREAD_RWLOCK_T], + }; +} + pub const PTHREAD_MUTEX_NORMAL: ::c_int = 0; pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 1; pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 2; @@ -1484,6 +1503,12 @@ pub const TIOCM_CD: ::c_int = TIOCM_CAR; pub const TIOCM_RI: ::c_int = TIOCM_RNG; pub const O_TMPFILE: ::c_int = 0x400000; +pub const MAX_ADDR_LEN: usize = 7; +pub const ARPD_UPDATE: ::c_ushort = 0x01; +pub const ARPD_LOOKUP: ::c_ushort = 0x02; +pub const ARPD_FLUSH: ::c_ushort = 0x03; +pub const ATF_MAGIC: ::c_int = 0x80; + f! { pub fn CPU_ZERO(cpuset: &mut cpu_set_t) -> () { for slot in cpuset.bits.iter_mut() { @@ -1548,6 +1573,12 @@ f! { } extern { + pub fn abs(i: ::c_int) -> ::c_int; + pub fn atof(s: *const ::c_char) -> ::c_double; + pub fn labs(i: ::c_long) -> ::c_long; + pub fn rand() -> ::c_int; + pub fn srand(seed: ::c_uint); + pub fn setpwent(); pub fn endpwent(); pub fn getpwent() -> *mut passwd; @@ -1600,8 +1631,6 @@ extern { mode: ::mode_t) -> ::c_int; pub fn if_nameindex() -> *mut if_nameindex; pub fn if_freenameindex(ptr: *mut if_nameindex); - pub fn getifaddrs(ifap: *mut *mut ::ifaddrs) -> ::c_int; - pub fn freeifaddrs(ifa: *mut ::ifaddrs); pub fn mremap(addr: *mut ::c_void, len: ::size_t, @@ -1635,21 +1664,6 @@ extern { pub fn mkstemps(template: *mut ::c_char, suffixlen: ::c_int) -> ::c_int; pub fn nl_langinfo(item: ::nl_item) -> *mut ::c_char; - pub fn bind(socket: ::c_int, address: *const ::sockaddr, - address_len: ::socklen_t) -> ::c_int; - - pub fn writev(fd: ::c_int, - iov: *const ::iovec, - iovcnt: ::c_int) -> ::ssize_t; - pub fn readv(fd: ::c_int, - iov: *const ::iovec, - iovcnt: ::c_int) -> ::ssize_t; - - pub fn sendmsg(fd: ::c_int, - msg: *const ::msghdr, - flags: ::c_int) -> ::ssize_t; - pub fn recvmsg(fd: ::c_int, msg: *mut ::msghdr, flags: ::c_int) - -> ::ssize_t; pub fn getdomainname(name: *mut ::c_char, len: ::size_t) -> ::c_int; pub fn setdomainname(name: *const ::c_char, len: ::size_t) -> ::c_int; pub fn sendmmsg(sockfd: ::c_int, msgvec: *mut mmsghdr, vlen: ::c_uint, |