From c09d65f7fb01e60e4d5d46f073437c4be658e558 Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Mon, 17 Oct 2022 10:36:10 -0600 Subject: [PATCH] redox: Add ENOTSUP, FIONREAD, MSG_DONTWAIT, and madvise --- libc-test/semver/redox.txt | 4 ++++ src/unix/redox/mod.rs | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/libc-test/semver/redox.txt b/libc-test/semver/redox.txt index adff39fa0b928..475e96bdd9a29 100644 --- a/libc-test/semver/redox.txt +++ b/libc-test/semver/redox.txt @@ -58,6 +58,7 @@ ENOSTR ENOTBLK ENOTNAM ENOTRECOVERABLE +ENOTSUP ENOTUNIQ EOWNERDEAD EPOLLERR @@ -93,11 +94,13 @@ EUCLEAN EUNATCH EUSERS EXFULL +FIONREAD IMAXBEL IPV6_ADD_MEMBERSHIP IPV6_DROP_MEMBERSHIP IUCLC IUTF8 +MSG_DONTWAIT NI_DGRAM NI_MAXSERV NI_NAMEREQD @@ -187,6 +190,7 @@ getservbyport getservent killpg lockf +madvise memalign nice open_memstream diff --git a/src/unix/redox/mod.rs b/src/unix/redox/mod.rs index bc46d4942a43d..02beda431277e 100644 --- a/src/unix/redox/mod.rs +++ b/src/unix/redox/mod.rs @@ -375,6 +375,7 @@ pub const EPROTONOSUPPORT: ::c_int = 93; /* Protocol not supported */ pub const ESOCKTNOSUPPORT: ::c_int = 94; /* Socket type not supported */ /* Operation not supported on transport endpoint */ pub const EOPNOTSUPP: ::c_int = 95; +pub const ENOTSUP: ::c_int = EOPNOTSUPP; pub const EPFNOSUPPORT: ::c_int = 96; /* Protocol family not supported */ /* Address family not supported by protocol */ pub const EAFNOSUPPORT: ::c_int = 97; @@ -615,6 +616,7 @@ pub const EXIT_FAILURE: ::c_int = 1; // sys/ioctl.h // FIXME: relibc { +pub const FIONREAD: ::c_ulong = 0x541B; pub const FIONBIO: ::c_ulong = 0x5421; pub const FIOCLEX: ::c_ulong = 0x5451; // } @@ -661,6 +663,7 @@ pub const MSG_EOR: ::c_int = 128; pub const MSG_OOB: ::c_int = 1; pub const MSG_PEEK: ::c_int = 2; pub const MSG_TRUNC: ::c_int = 32; +pub const MSG_DONTWAIT: ::c_int = 64; pub const MSG_WAITALL: ::c_int = 256; pub const SHUT_RD: ::c_int = 0; pub const SHUT_WR: ::c_int = 1; @@ -1028,6 +1031,7 @@ extern "C" { pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int; // sys/mman.h + pub fn madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int) -> ::c_int; pub fn msync(addr: *mut ::c_void, len: ::size_t, flags: ::c_int) -> ::c_int; pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int) -> ::c_int; pub fn shm_open(name: *const c_char, oflag: ::c_int, mode: mode_t) -> ::c_int;