| 1 |
use crate::prelude::*; |
| 2 |
|
| 3 |
pub type clock_t = c_ulong; |
| 4 |
pub type wchar_t = u32; |
| 5 |
|
| 6 |
s! { |
| 7 |
pub struct cmsghdr { |
| 8 |
pub cmsg_len: crate::socklen_t, |
| 9 |
pub cmsg_level: c_int, |
| 10 |
pub cmsg_type: c_int, |
| 11 |
} |
| 12 |
|
| 13 |
pub struct msghdr { |
| 14 |
pub msg_name: *mut c_void, |
| 15 |
pub msg_namelen: crate::socklen_t, |
| 16 |
pub msg_iov: *mut crate::iovec, |
| 17 |
pub msg_iovlen: c_int, |
| 18 |
pub msg_control: *mut c_void, |
| 19 |
pub msg_controllen: crate::socklen_t, |
| 20 |
pub msg_flags: c_int, |
| 21 |
} |
| 22 |
|
| 23 |
pub struct sockaddr_un { |
| 24 |
pub sun_family: crate::sa_family_t, |
| 25 |
pub sun_path: [c_char; 108], |
| 26 |
} |
| 27 |
|
| 28 |
pub struct sockaddr { |
| 29 |
pub sa_len: u8, |
| 30 |
pub sa_family: crate::sa_family_t, |
| 31 |
pub sa_data: [c_char; 14], |
| 32 |
} |
| 33 |
|
| 34 |
pub struct sockaddr_in6 { |
| 35 |
pub sin6_len: u8, |
| 36 |
pub sin6_family: crate::sa_family_t, |
| 37 |
pub sin6_port: crate::in_port_t, |
| 38 |
pub sin6_flowinfo: u32, |
| 39 |
pub sin6_addr: crate::in6_addr, |
| 40 |
pub sin6_scope_id: u32, |
| 41 |
} |
| 42 |
|
| 43 |
pub struct sockaddr_in { |
| 44 |
pub sin_len: u8, |
| 45 |
pub sin_family: crate::sa_family_t, |
| 46 |
pub sin_port: crate::in_port_t, |
| 47 |
pub sin_addr: crate::in_addr, |
| 48 |
pub sin_zero: [c_char; 8], |
| 49 |
} |
| 50 |
|
| 51 |
pub struct sockaddr_storage { |
| 52 |
pub s2_len: u8, |
| 53 |
pub ss_family: crate::sa_family_t, |
| 54 |
pub s2_data1: [c_char; 2], |
| 55 |
pub s2_data2: [u32; 3], |
| 56 |
pub s2_data3: [u32; 3], |
| 57 |
} |
| 58 |
} |
| 59 |
|
| 60 |
pub const AF_UNIX: c_int = 1; |
| 61 |
pub const AF_INET6: c_int = 10; |
| 62 |
|
| 63 |
pub const FIONBIO: c_ulong = 2147772030; |
| 64 |
|
| 65 |
pub const POLLIN: c_short = 1 << 0; |
| 66 |
pub const POLLRDNORM: c_short = 1 << 1; |
| 67 |
pub const POLLRDBAND: c_short = 1 << 2; |
| 68 |
pub const POLLPRI: c_short = POLLRDBAND; |
| 69 |
pub const POLLOUT: c_short = 1 << 3; |
| 70 |
pub const POLLWRNORM: c_short = POLLOUT; |
| 71 |
pub const POLLWRBAND: c_short = 1 << 4; |
| 72 |
pub const POLLERR: c_short = 1 << 5; |
| 73 |
pub const POLLHUP: c_short = 1 << 6; |
| 74 |
|
| 75 |
pub const SOL_SOCKET: c_int = 0xfff; |
| 76 |
|
| 77 |
pub const MSG_OOB: c_int = 0x04; |
| 78 |
pub const MSG_PEEK: c_int = 0x01; |
| 79 |
pub const MSG_DONTWAIT: c_int = 0x08; |
| 80 |
pub const MSG_DONTROUTE: c_int = 0x4; |
| 81 |
pub const MSG_WAITALL: c_int = 0x02; |
| 82 |
pub const MSG_MORE: c_int = 0x10; |
| 83 |
pub const MSG_NOSIGNAL: c_int = 0x20; |
| 84 |
pub const MSG_TRUNC: c_int = 0x04; |
| 85 |
pub const MSG_CTRUNC: c_int = 0x08; |
| 86 |
pub const MSG_EOR: c_int = 0x08; |
| 87 |
|
| 88 |
pub const PTHREAD_STACK_MIN: size_t = 768; |
| 89 |
|
| 90 |
pub const SIGABRT: c_int = 6; |
| 91 |
pub const SIGFPE: c_int = 8; |
| 92 |
pub const SIGILL: c_int = 4; |
| 93 |
pub const SIGINT: c_int = 2; |
| 94 |
pub const SIGSEGV: c_int = 11; |
| 95 |
pub const SIGTERM: c_int = 15; |
| 96 |
pub const SIGHUP: c_int = 1; |
| 97 |
pub const SIGQUIT: c_int = 3; |
| 98 |
pub const NSIG: size_t = 32; |
| 99 |
|
| 100 |
extern "C" { |
| 101 |
pub fn pthread_create( |
| 102 |
native: *mut crate::pthread_t, |
| 103 |
attr: *const crate::pthread_attr_t, |
| 104 |
f: extern "C" fn(_: *mut c_void) -> *mut c_void, |
| 105 |
value: *mut c_void, |
| 106 |
) -> c_int; |
| 107 |
|
| 108 |
pub fn getrandom(buf: *mut c_void, buflen: size_t, flags: c_uint) -> ssize_t; |
| 109 |
|
| 110 |
pub fn gethostname(name: *mut c_char, namelen: ssize_t); |
| 111 |
|
| 112 |
#[link_name = "lwip_sendmsg"] |
| 113 |
pub fn sendmsg(s: c_int, msg: *const crate::msghdr, flags: c_int) -> ssize_t; |
| 114 |
#[link_name = "lwip_recvmsg"] |
| 115 |
pub fn recvmsg(s: c_int, msg: *mut crate::msghdr, flags: c_int) -> ssize_t; |
| 116 |
|
| 117 |
pub fn eventfd(initval: c_uint, flags: c_int) -> c_int; |
| 118 |
} |
| 119 |
|
| 120 |
pub use crate::unix::newlib::generic::{dirent, sigset_t, stat}; |