aienux
Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.
Brought by drakestapleton
aienux / vendor / libc / src / hermit.rs
| 1 | //! Hermit C type definitions |
| 2 | |
| 3 | use crate::prelude::*; |
| 4 | |
| 5 | pub type intmax_t = i64; |
| 6 | pub type uintmax_t = u64; |
| 7 | pub type intptr_t = isize; |
| 8 | pub type uintptr_t = usize; |
| 9 | |
| 10 | pub type size_t = usize; |
| 11 | pub type ssize_t = isize; |
| 12 | pub type ptrdiff_t = isize; |
| 13 | |
| 14 | pub type clockid_t = i32; |
| 15 | pub type in_addr_t = u32; |
| 16 | pub type in_port_t = u16; |
| 17 | pub type mode_t = u32; |
| 18 | pub type nfds_t = usize; |
| 19 | pub type pid_t = i32; |
| 20 | pub type sa_family_t = u8; |
| 21 | pub type socklen_t = u32; |
| 22 | pub type time_t = i64; |
| 23 | |
| 24 | s! { |
| 25 | pub struct addrinfo { |
| 26 | pub ai_flags: i32, |
| 27 | pub ai_family: i32, |
| 28 | pub ai_socktype: i32, |
| 29 | pub ai_protocol: i32, |
| 30 | pub ai_addrlen: socklen_t, |
| 31 | pub ai_canonname: *mut c_char, |
| 32 | pub ai_addr: *mut sockaddr, |
| 33 | pub ai_next: *mut addrinfo, |
| 34 | } |
| 35 | |
| 36 | pub struct dirent64 { |
| 37 | pub d_ino: u64, |
| 38 | pub d_off: i64, |
| 39 | pub d_reclen: u16, |
| 40 | pub d_type: u8, |
| 41 | pub d_name: [c_char; 256], |
| 42 | } |
| 43 | |
| 44 | #[repr(align(4))] |
| 45 | pub struct in6_addr { |
| 46 | pub s6_addr: [u8; 16], |
| 47 | } |
| 48 | |
| 49 | pub struct in_addr { |
| 50 | pub s_addr: in_addr_t, |
| 51 | } |
| 52 | |
| 53 | pub struct iovec { |
| 54 | iov_base: *mut c_void, |
| 55 | iov_len: usize, |
| 56 | } |
| 57 | |
| 58 | pub struct pollfd { |
| 59 | pub fd: i32, |
| 60 | pub events: i16, |
| 61 | pub revents: i16, |
| 62 | } |
| 63 | |
| 64 | pub struct sockaddr { |
| 65 | pub sa_len: u8, |
| 66 | pub sa_family: sa_family_t, |
| 67 | pub sa_data: [c_char; 14], |
| 68 | } |
| 69 | |
| 70 | pub struct sockaddr_in { |
| 71 | pub sin_len: u8, |
| 72 | pub sin_family: sa_family_t, |
| 73 | pub sin_port: in_port_t, |
| 74 | pub sin_addr: in_addr, |
| 75 | pub sin_zero: [c_char; 8], |
| 76 | } |
| 77 | |
| 78 | pub struct sockaddr_in6 { |
| 79 | pub sin6_len: u8, |
| 80 | pub sin6_family: sa_family_t, |
| 81 | pub sin6_port: in_port_t, |
| 82 | pub sin6_flowinfo: u32, |
| 83 | pub sin6_addr: in6_addr, |
| 84 | pub sin6_scope_id: u32, |
| 85 | } |
| 86 | |
| 87 | pub struct sockaddr_storage { |
| 88 | pub ss_len: u8, |
| 89 | pub ss_family: sa_family_t, |
| 90 | __ss_pad1: Padding<[u8; 6]>, |
| 91 | __ss_align: i64, |
| 92 | __ss_pad2: Padding<[u8; 112]>, |
| 93 | } |
| 94 | |
| 95 | pub struct stat { |
| 96 | pub st_dev: u64, |
| 97 | pub st_ino: u64, |
| 98 | pub st_nlink: u64, |
| 99 | pub st_mode: mode_t, |
| 100 | pub st_uid: u32, |
| 101 | pub st_gid: u32, |
| 102 | pub st_rdev: u64, |
| 103 | pub st_size: i64, |
| 104 | pub st_blksize: i64, |
| 105 | pub st_blocks: i64, |
| 106 | pub st_atim: timespec, |
| 107 | pub st_mtim: timespec, |
| 108 | pub st_ctim: timespec, |
| 109 | } |
| 110 | |
| 111 | #[derive(Default)] |
| 112 | pub struct timespec { |
| 113 | pub tv_sec: time_t, |
| 114 | pub tv_nsec: i32, |
| 115 | } |
| 116 | } |
| 117 | |
| 118 | pub const AF_UNSPEC: i32 = 0; |
| 119 | pub const AF_INET: i32 = 3; |
| 120 | pub const AF_INET6: i32 = 1; |
| 121 | pub const AF_VSOCK: i32 = 2; |
| 122 | |
| 123 | pub const CLOCK_REALTIME: clockid_t = 1; |
| 124 | pub const CLOCK_MONOTONIC: clockid_t = 4; |
| 125 | |
| 126 | pub const DT_UNKNOWN: u8 = 0; |
| 127 | pub const DT_FIFO: u8 = 1; |
| 128 | pub const DT_CHR: u8 = 2; |
| 129 | pub const DT_DIR: u8 = 4; |
| 130 | pub const DT_BLK: u8 = 6; |
| 131 | pub const DT_REG: u8 = 8; |
| 132 | pub const DT_LNK: u8 = 10; |
| 133 | pub const DT_SOCK: u8 = 12; |
| 134 | pub const DT_WHT: u8 = 14; |
| 135 | |
| 136 | pub const EAI_AGAIN: i32 = 2; |
| 137 | pub const EAI_BADFLAGS: i32 = 3; |
| 138 | pub const EAI_FAIL: i32 = 4; |
| 139 | pub const EAI_FAMILY: i32 = 5; |
| 140 | pub const EAI_MEMORY: i32 = 6; |
| 141 | pub const EAI_NODATA: i32 = 7; |
| 142 | pub const EAI_NONAME: i32 = 8; |
| 143 | pub const EAI_SERVICE: i32 = 9; |
| 144 | pub const EAI_SOCKTYPE: i32 = 10; |
| 145 | pub const EAI_SYSTEM: i32 = 11; |
| 146 | pub const EAI_OVERFLOW: i32 = 14; |
| 147 | |
| 148 | pub const EFD_SEMAPHORE: i16 = 0o1; |
| 149 | pub const EFD_NONBLOCK: i16 = 0o4000; |
| 150 | pub const EFD_CLOEXEC: i16 = 0o40000; |
| 151 | |
| 152 | pub const F_DUPFD: i32 = 0; |
| 153 | pub const F_GETFD: i32 = 1; |
| 154 | pub const F_SETFD: i32 = 2; |
| 155 | pub const F_GETFL: i32 = 3; |
| 156 | pub const F_SETFL: i32 = 4; |
| 157 | |
| 158 | pub const FD_CLOEXEC: i32 = 1; |
| 159 | |
| 160 | pub const FIONBIO: i32 = u32_cast_int(0x8008667e); |
| 161 | |
| 162 | pub const FUTEX_RELATIVE_TIMEOUT: u32 = 1; |
| 163 | |
| 164 | pub const IP_TOS: i32 = 1; |
| 165 | pub const IP_TTL: i32 = 2; |
| 166 | pub const IP_ADD_MEMBERSHIP: i32 = 3; |
| 167 | pub const IP_DROP_MEMBERSHIP: i32 = 4; |
| 168 | pub const IP_MULTICAST_TTL: i32 = 5; |
| 169 | pub const IP_MULTICAST_LOOP: i32 = 7; |
| 170 | |
| 171 | pub const IPPROTO_IP: i32 = 0; |
| 172 | pub const IPPROTO_TCP: i32 = 6; |
| 173 | pub const IPPROTO_UDP: i32 = 17; |
| 174 | pub const IPPROTO_IPV6: i32 = 41; |
| 175 | |
| 176 | pub const IPV6_ADD_MEMBERSHIP: i32 = 12; |
| 177 | pub const IPV6_DROP_MEMBERSHIP: i32 = 13; |
| 178 | pub const IPV6_MULTICAST_LOOP: i32 = 19; |
| 179 | pub const IPV6_V6ONLY: i32 = 27; |
| 180 | |
| 181 | pub const MSG_PEEK: i32 = 1; |
| 182 | |
| 183 | pub const O_RDONLY: i32 = 0o0; |
| 184 | pub const O_WRONLY: i32 = 0o1; |
| 185 | pub const O_RDWR: i32 = 0o2; |
| 186 | pub const O_CREAT: i32 = 0o100; |
| 187 | pub const O_EXCL: i32 = 0o200; |
| 188 | pub const O_TRUNC: i32 = 0o1000; |
| 189 | pub const O_APPEND: i32 = 0o2000; |
| 190 | pub const O_NONBLOCK: i32 = 0o4000; |
| 191 | pub const O_DIRECTORY: i32 = 0o200000; |
| 192 | |
| 193 | pub const POLLIN: i16 = 0x1; |
| 194 | pub const POLLPRI: i16 = 0x2; |
| 195 | pub const POLLOUT: i16 = 0x4; |
| 196 | pub const POLLERR: i16 = 0x8; |
| 197 | pub const POLLHUP: i16 = 0x10; |
| 198 | pub const POLLNVAL: i16 = 0x20; |
| 199 | pub const POLLRDNORM: i16 = 0x040; |
| 200 | pub const POLLRDBAND: i16 = 0x080; |
| 201 | pub const POLLWRNORM: i16 = 0x0100; |
| 202 | pub const POLLWRBAND: i16 = 0x0200; |
| 203 | pub const POLLRDHUP: i16 = 0x2000; |
| 204 | |
| 205 | pub const S_IRWXU: mode_t = 0o0700; |
| 206 | pub const S_IRUSR: mode_t = 0o0400; |
| 207 | pub const S_IWUSR: mode_t = 0o0200; |
| 208 | pub const S_IXUSR: mode_t = 0o0100; |
| 209 | pub const S_IRWXG: mode_t = 0o0070; |
| 210 | pub const S_IRGRP: mode_t = 0o0040; |
| 211 | pub const S_IWGRP: mode_t = 0o0020; |
| 212 | pub const S_IXGRP: mode_t = 0o0010; |
| 213 | pub const S_IRWXO: mode_t = 0o0007; |
| 214 | pub const S_IROTH: mode_t = 0o0004; |
| 215 | pub const S_IWOTH: mode_t = 0o0002; |
| 216 | pub const S_IXOTH: mode_t = 0o0001; |
| 217 | |
| 218 | pub const S_IFMT: mode_t = 0o17_0000; |
| 219 | pub const S_IFSOCK: mode_t = 0o14_0000; |
| 220 | pub const S_IFLNK: mode_t = 0o12_0000; |
| 221 | pub const S_IFREG: mode_t = 0o10_0000; |
| 222 | pub const S_IFBLK: mode_t = 0o6_0000; |
| 223 | pub const S_IFDIR: mode_t = 0o4_0000; |
| 224 | pub const S_IFCHR: mode_t = 0o2_0000; |
| 225 | pub const S_IFIFO: mode_t = 0o1_0000; |
| 226 | |
| 227 | pub const SHUT_RD: i32 = 0; |
| 228 | pub const SHUT_WR: i32 = 1; |
| 229 | pub const SHUT_RDWR: i32 = 2; |
| 230 | |
| 231 | pub const SO_REUSEADDR: i32 = 0x0004; |
| 232 | pub const SO_KEEPALIVE: i32 = 0x0008; |
| 233 | pub const SO_BROADCAST: i32 = 0x0020; |
| 234 | pub const SO_LINGER: i32 = 0x0080; |
| 235 | pub const SO_SNDBUF: i32 = 0x1001; |
| 236 | pub const SO_RCVBUF: i32 = 0x1002; |
| 237 | pub const SO_SNDTIMEO: i32 = 0x1005; |
| 238 | pub const SO_RCVTIMEO: i32 = 0x1006; |
| 239 | pub const SO_ERROR: i32 = 0x1007; |
| 240 | |
| 241 | pub const SOCK_STREAM: i32 = 1; |
| 242 | pub const SOCK_DGRAM: i32 = 2; |
| 243 | pub const SOCK_NONBLOCK: i32 = 0o4000; |
| 244 | pub const SOCK_CLOEXEC: i32 = 0o40000; |
| 245 | |
| 246 | pub const SOL_SOCKET: i32 = 4095; |
| 247 | |
| 248 | pub const STDIN_FILENO: c_int = 0; |
| 249 | pub const STDOUT_FILENO: c_int = 1; |
| 250 | pub const STDERR_FILENO: c_int = 2; |
| 251 | |
| 252 | pub const TCP_NODELAY: i32 = 1; |
| 253 | |
| 254 | pub const EPERM: i32 = 1; |
| 255 | pub const ENOENT: i32 = 2; |
| 256 | pub const ESRCH: i32 = 3; |
| 257 | pub const EINTR: i32 = 4; |
| 258 | pub const EIO: i32 = 5; |
| 259 | pub const ENXIO: i32 = 6; |
| 260 | pub const E2BIG: i32 = 7; |
| 261 | pub const ENOEXEC: i32 = 8; |
| 262 | pub const EBADF: i32 = 9; |
| 263 | pub const ECHILD: i32 = 10; |
| 264 | pub const EAGAIN: i32 = 11; |
| 265 | pub const ENOMEM: i32 = 12; |
| 266 | pub const EACCES: i32 = 13; |
| 267 | pub const EFAULT: i32 = 14; |
| 268 | pub const ENOTBLK: i32 = 15; |
| 269 | pub const EBUSY: i32 = 16; |
| 270 | pub const EEXIST: i32 = 17; |
| 271 | pub const EXDEV: i32 = 18; |
| 272 | pub const ENODEV: i32 = 19; |
| 273 | pub const ENOTDIR: i32 = 20; |
| 274 | pub const EISDIR: i32 = 21; |
| 275 | pub const EINVAL: i32 = 22; |
| 276 | pub const ENFILE: i32 = 23; |
| 277 | pub const EMFILE: i32 = 24; |
| 278 | pub const ENOTTY: i32 = 25; |
| 279 | pub const ETXTBSY: i32 = 26; |
| 280 | pub const EFBIG: i32 = 27; |
| 281 | pub const ENOSPC: i32 = 28; |
| 282 | pub const ESPIPE: i32 = 29; |
| 283 | pub const EROFS: i32 = 30; |
| 284 | pub const EMLINK: i32 = 31; |
| 285 | pub const EPIPE: i32 = 32; |
| 286 | pub const EDOM: i32 = 33; |
| 287 | pub const ERANGE: i32 = 34; |
| 288 | pub const EDEADLK: i32 = 35; |
| 289 | pub const ENAMETOOLONG: i32 = 36; |
| 290 | pub const ENOLCK: i32 = 37; |
| 291 | pub const ENOSYS: i32 = 38; |
| 292 | pub const ENOTEMPTY: i32 = 39; |
| 293 | pub const ELOOP: i32 = 40; |
| 294 | pub const EWOULDBLOCK: i32 = EAGAIN; |
| 295 | pub const ENOMSG: i32 = 42; |
| 296 | pub const EIDRM: i32 = 43; |
| 297 | pub const ECHRNG: i32 = 44; |
| 298 | pub const EL2NSYNC: i32 = 45; |
| 299 | pub const EL3HLT: i32 = 46; |
| 300 | pub const EL3RST: i32 = 47; |
| 301 | pub const ELNRNG: i32 = 48; |
| 302 | pub const EUNATCH: i32 = 49; |
| 303 | pub const ENOCSI: i32 = 50; |
| 304 | pub const EL2HLT: i32 = 51; |
| 305 | pub const EBADE: i32 = 52; |
| 306 | pub const EBADR: i32 = 53; |
| 307 | pub const EXFULL: i32 = 54; |
| 308 | pub const ENOANO: i32 = 55; |
| 309 | pub const EBADRQC: i32 = 56; |
| 310 | pub const EBADSLT: i32 = 57; |
| 311 | pub const EDEADLOCK: i32 = EDEADLK; |
| 312 | pub const EBFONT: i32 = 59; |
| 313 | pub const ENOSTR: i32 = 60; |
| 314 | pub const ENODATA: i32 = 61; |
| 315 | pub const ETIME: i32 = 62; |
| 316 | pub const ENOSR: i32 = 63; |
| 317 | pub const ENONET: i32 = 64; |
| 318 | pub const ENOPKG: i32 = 65; |
| 319 | pub const EREMOTE: i32 = 66; |
| 320 | pub const ENOLINK: i32 = 67; |
| 321 | pub const EADV: i32 = 68; |
| 322 | pub const ESRMNT: i32 = 69; |
| 323 | pub const ECOMM: i32 = 70; |
| 324 | pub const EPROTO: i32 = 71; |
| 325 | pub const EMULTIHOP: i32 = 72; |
| 326 | pub const EDOTDOT: i32 = 73; |
| 327 | pub const EBADMSG: i32 = 74; |
| 328 | pub const EOVERFLOW: i32 = 75; |
| 329 | pub const ENOTUNIQ: i32 = 76; |
| 330 | pub const EBADFD: i32 = 77; |
| 331 | pub const EREMCHG: i32 = 78; |
| 332 | pub const ELIBACC: i32 = 79; |
| 333 | pub const ELIBBAD: i32 = 80; |
| 334 | pub const ELIBSCN: i32 = 81; |
| 335 | pub const ELIBMAX: i32 = 82; |
| 336 | pub const ELIBEXEC: i32 = 83; |
| 337 | pub const EILSEQ: i32 = 84; |
| 338 | pub const ERESTART: i32 = 85; |
| 339 | pub const ESTRPIPE: i32 = 86; |
| 340 | pub const EUSERS: i32 = 87; |
| 341 | pub const ENOTSOCK: i32 = 88; |
| 342 | pub const EDESTADDRREQ: i32 = 89; |
| 343 | pub const EMSGSIZE: i32 = 90; |
| 344 | pub const EPROTOTYPE: i32 = 91; |
| 345 | pub const ENOPROTOOPT: i32 = 92; |
| 346 | pub const EPROTONOSUPPORT: i32 = 93; |
| 347 | pub const ESOCKTNOSUPPORT: i32 = 94; |
| 348 | pub const EOPNOTSUPP: i32 = 95; |
| 349 | pub const EPFNOSUPPORT: i32 = 96; |
| 350 | pub const EAFNOSUPPORT: i32 = 97; |
| 351 | pub const EADDRINUSE: i32 = 98; |
| 352 | pub const EADDRNOTAVAIL: i32 = 99; |
| 353 | pub const ENETDOWN: i32 = 100; |
| 354 | pub const ENETUNREACH: i32 = 101; |
| 355 | pub const ENETRESET: i32 = 102; |
| 356 | pub const ECONNABORTED: i32 = 103; |
| 357 | pub const ECONNRESET: i32 = 104; |
| 358 | pub const ENOBUFS: i32 = 105; |
| 359 | pub const EISCONN: i32 = 106; |
| 360 | pub const ENOTCONN: i32 = 107; |
| 361 | pub const ESHUTDOWN: i32 = 108; |
| 362 | pub const ETOOMANYREFS: i32 = 109; |
| 363 | pub const ETIMEDOUT: i32 = 110; |
| 364 | pub const ECONNREFUSED: i32 = 111; |
| 365 | pub const EHOSTDOWN: i32 = 112; |
| 366 | pub const EHOSTUNREACH: i32 = 113; |
| 367 | pub const EALREADY: i32 = 114; |
| 368 | pub const EINPROGRESS: i32 = 115; |
| 369 | pub const ESTALE: i32 = 116; |
| 370 | pub const EUCLEAN: i32 = 117; |
| 371 | pub const ENOTNAM: i32 = 118; |
| 372 | pub const ENAVAIL: i32 = 119; |
| 373 | pub const EISNAM: i32 = 120; |
| 374 | pub const EREMOTEIO: i32 = 121; |
| 375 | pub const EDQUOT: i32 = 122; |
| 376 | pub const ENOMEDIUM: i32 = 123; |
| 377 | pub const EMEDIUMTYPE: i32 = 124; |
| 378 | pub const ECANCELED: i32 = 125; |
| 379 | pub const ENOKEY: i32 = 126; |
| 380 | pub const EKEYEXPIRED: i32 = 127; |
| 381 | pub const EKEYREVOKED: i32 = 128; |
| 382 | pub const EKEYREJECTED: i32 = 129; |
| 383 | pub const EOWNERDEAD: i32 = 130; |
| 384 | pub const ENOTRECOVERABLE: i32 = 131; |
| 385 | pub const ERFKILL: i32 = 132; |
| 386 | pub const EHWPOISON: i32 = 133; |
| 387 | |
| 388 | extern "C" { |
| 389 | #[link_name = "sys_alloc"] |
| 390 | pub fn alloc(size: usize, align: usize) -> *mut u8; |
| 391 | |
| 392 | #[link_name = "sys_alloc_zeroed"] |
| 393 | pub fn alloc_zeroed(size: usize, align: usize) -> *mut u8; |
| 394 | |
| 395 | #[link_name = "sys_realloc"] |
| 396 | pub fn realloc(ptr: *mut u8, size: usize, align: usize, new_size: usize) -> *mut u8; |
| 397 | |
| 398 | #[link_name = "sys_dealloc"] |
| 399 | pub fn dealloc(ptr: *mut u8, size: usize, align: usize); |
| 400 | |
| 401 | #[link_name = "sys_exit"] |
| 402 | pub fn exit(status: i32) -> !; |
| 403 | |
| 404 | #[link_name = "sys_abort"] |
| 405 | pub fn abort() -> !; |
| 406 | |
| 407 | #[link_name = "sys_errno"] |
| 408 | pub fn errno() -> i32; |
| 409 | |
| 410 | #[link_name = "sys_clock_gettime"] |
| 411 | pub fn clock_gettime(clockid: clockid_t, tp: *mut timespec) -> i32; |
| 412 | |
| 413 | #[link_name = "sys_nanosleep"] |
| 414 | pub fn nanosleep(req: *const timespec) -> i32; |
| 415 | |
| 416 | #[link_name = "sys_available_parallelism"] |
| 417 | pub fn available_parallelism() -> usize; |
| 418 | |
| 419 | #[link_name = "sys_futex_wait"] |
| 420 | pub fn futex_wait( |
| 421 | address: *mut u32, |
| 422 | expected: u32, |
| 423 | timeout: *const timespec, |
| 424 | flags: u32, |
| 425 | ) -> i32; |
| 426 | |
| 427 | #[link_name = "sys_futex_wake"] |
| 428 | pub fn futex_wake(address: *mut u32, count: i32) -> i32; |
| 429 | |
| 430 | #[link_name = "sys_stat"] |
| 431 | pub fn stat(path: *const c_char, stat: *mut stat) -> i32; |
| 432 | |
| 433 | #[link_name = "sys_fstat"] |
| 434 | pub fn fstat(fd: i32, stat: *mut stat) -> i32; |
| 435 | |
| 436 | #[link_name = "sys_lstat"] |
| 437 | pub fn lstat(path: *const c_char, stat: *mut stat) -> i32; |
| 438 | |
| 439 | #[link_name = "sys_open"] |
| 440 | pub fn open(path: *const c_char, flags: i32, mode: mode_t) -> i32; |
| 441 | |
| 442 | #[link_name = "sys_unlink"] |
| 443 | pub fn unlink(path: *const c_char) -> i32; |
| 444 | |
| 445 | #[link_name = "sys_mkdir"] |
| 446 | pub fn mkdir(path: *const c_char, mode: mode_t) -> i32; |
| 447 | |
| 448 | #[link_name = "sys_rmdir"] |
| 449 | pub fn rmdir(path: *const c_char) -> i32; |
| 450 | |
| 451 | #[link_name = "sys_read"] |
| 452 | pub fn read(fd: i32, buf: *mut u8, len: usize) -> isize; |
| 453 | |
| 454 | #[link_name = "sys_write"] |
| 455 | pub fn write(fd: i32, buf: *const u8, len: usize) -> isize; |
| 456 | |
| 457 | #[link_name = "sys_readv"] |
| 458 | pub fn readv(fd: i32, iov: *const iovec, iovcnt: usize) -> isize; |
| 459 | |
| 460 | #[link_name = "sys_writev"] |
| 461 | pub fn writev(fd: i32, iov: *const iovec, iovcnt: usize) -> isize; |
| 462 | |
| 463 | #[link_name = "sys_close"] |
| 464 | pub fn close(fd: i32) -> i32; |
| 465 | |
| 466 | #[link_name = "sys_dup"] |
| 467 | pub fn dup(fd: i32) -> i32; |
| 468 | |
| 469 | #[link_name = "sys_fcntl"] |
| 470 | pub fn fcntl(fd: i32, cmd: i32, arg: i32) -> i32; |
| 471 | |
| 472 | #[link_name = "sys_getdents64"] |
| 473 | pub fn getdents64(fd: i32, dirp: *mut dirent64, count: usize) -> isize; |
| 474 | |
| 475 | #[link_name = "sys_getaddrinfo"] |
| 476 | pub fn getaddrinfo( |
| 477 | nodename: *const c_char, |
| 478 | servname: *const c_char, |
| 479 | hints: *const addrinfo, |
| 480 | res: *mut *mut addrinfo, |
| 481 | ) -> i32; |
| 482 | |
| 483 | #[link_name = "sys_freeaddrinfo"] |
| 484 | pub fn freeaddrinfo(ai: *mut addrinfo); |
| 485 | |
| 486 | #[link_name = "sys_socket"] |
| 487 | pub fn socket(domain: i32, ty: i32, protocol: i32) -> i32; |
| 488 | |
| 489 | #[link_name = "sys_bind"] |
| 490 | pub fn bind(sockfd: i32, addr: *const sockaddr, addrlen: socklen_t) -> i32; |
| 491 | |
| 492 | #[link_name = "sys_listen"] |
| 493 | pub fn listen(sockfd: i32, backlog: i32) -> i32; |
| 494 | |
| 495 | #[link_name = "sys_accept"] |
| 496 | pub fn accept(sockfd: i32, addr: *mut sockaddr, addrlen: *mut socklen_t) -> i32; |
| 497 | |
| 498 | #[link_name = "sys_connect"] |
| 499 | pub fn connect(sockfd: i32, addr: *const sockaddr, addrlen: socklen_t) -> i32; |
| 500 | |
| 501 | #[link_name = "sys_recv"] |
| 502 | pub fn recv(sockfd: i32, buf: *mut u8, len: usize, flags: i32) -> isize; |
| 503 | |
| 504 | #[link_name = "sys_recvfrom"] |
| 505 | pub fn recvfrom( |
| 506 | sockfd: i32, |
| 507 | buf: *mut c_void, |
| 508 | len: usize, |
| 509 | flags: i32, |
| 510 | addr: *mut sockaddr, |
| 511 | addrlen: *mut socklen_t, |
| 512 | ) -> isize; |
| 513 | |
| 514 | #[link_name = "sys_send"] |
| 515 | pub fn send(sockfd: i32, buf: *const c_void, len: usize, flags: i32) -> isize; |
| 516 | |
| 517 | #[link_name = "sys_sendto"] |
| 518 | pub fn sendto( |
| 519 | sockfd: i32, |
| 520 | buf: *const c_void, |
| 521 | len: usize, |
| 522 | flags: i32, |
| 523 | to: *const sockaddr, |
| 524 | tolen: socklen_t, |
| 525 | ) -> isize; |
| 526 | |
| 527 | #[link_name = "sys_getpeername"] |
| 528 | pub fn getpeername(sockfd: i32, addr: *mut sockaddr, addrlen: *mut socklen_t) -> i32; |
| 529 | |
| 530 | #[link_name = "sys_getsockname"] |
| 531 | pub fn getsockname(sockfd: i32, addr: *mut sockaddr, addrlen: *mut socklen_t) -> i32; |
| 532 | |
| 533 | #[link_name = "sys_getsockopt"] |
| 534 | pub fn getsockopt( |
| 535 | sockfd: i32, |
| 536 | level: i32, |
| 537 | optname: i32, |
| 538 | optval: *mut c_void, |
| 539 | optlen: *mut socklen_t, |
| 540 | ) -> i32; |
| 541 | |
| 542 | #[link_name = "sys_setsockopt"] |
| 543 | pub fn setsockopt( |
| 544 | sockfd: i32, |
| 545 | level: i32, |
| 546 | optname: i32, |
| 547 | optval: *const c_void, |
| 548 | optlen: socklen_t, |
| 549 | ) -> i32; |
| 550 | |
| 551 | #[link_name = "sys_ioctl"] |
| 552 | pub fn ioctl(sockfd: i32, cmd: i32, argp: *mut c_void) -> i32; |
| 553 | |
| 554 | #[link_name = "sys_shutdown"] |
| 555 | pub fn shutdown(sockfd: i32, how: i32) -> i32; |
| 556 | |
| 557 | #[link_name = "sys_eventfd"] |
| 558 | pub fn eventfd(initval: u64, flags: i16) -> i32; |
| 559 | |
| 560 | #[link_name = "sys_poll"] |
| 561 | pub fn poll(fds: *mut pollfd, nfds: nfds_t, timeout: i32) -> i32; |
| 562 | } |