Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aienux/blob/main/vendor/libc/src/unix/newlib/espidf/mod.rs # aienux Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aienux / vendor / libc / src / unix / newlib / espidf / mod.rs` 137 lines ยท 3679 bytes Raw Blame History 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 pub const SOMAXCONN: c_int = 128; 101 102 pub const DT_UNKNOWN: u8 = 0; 103 pub const DT_REG: u8 = 1; 104 pub const DT_DIR: u8 = 2; 105 // Not used by esp-idf, but still defined in headers. 106 pub const DT_CHR: u8 = 4; 107 pub const DT_BLK: u8 = 6; 108 pub const DT_FIFO: u8 = 8; 109 pub const DT_LNK: u8 = 10; 110 pub const DT_SOCK: u8 = 12; 111 pub const DT_WHT: u8 = 14; 112 113 extern "C" { 114 pub fn pthread_create( 115 native: *mut crate::pthread_t, 116 attr: *const crate::pthread_attr_t, 117 f: extern "C" fn(_: *mut c_void) -> *mut c_void, 118 value: *mut c_void, 119 ) -> c_int; 120 121 pub fn getrandom(buf: *mut c_void, buflen: size_t, flags: c_uint) -> ssize_t; 122 123 pub fn gethostname(name: *mut c_char, namelen: ssize_t); 124 125 #[link_name = "lwip_sendmsg"] 126 pub fn sendmsg(s: c_int, msg: *const crate::msghdr, flags: c_int) -> ssize_t; 127 #[link_name = "lwip_recvmsg"] 128 pub fn recvmsg(s: c_int, msg: *mut crate::msghdr, flags: c_int) -> ssize_t; 129 130 pub fn eventfd(initval: c_uint, flags: c_int) -> c_int; 131 } 132 133 pub use crate::unix::newlib::generic::{ 134 dirent, 135 sigset_t, 136 stat, 137 };