From b25d91f92b22d7a6e2677eea26c1e946fa938c50 Mon Sep 17 00:00:00 2001 From: Josh Megnauth Date: Wed, 13 Aug 2025 02:33:27 -0400 Subject: [PATCH] redox: dirfd, VDISABLE, and resource consts --- libc-test/semver/redox.txt | 13 +++++++++++++ src/unix/redox/mod.rs | 20 ++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/libc-test/semver/redox.txt b/libc-test/semver/redox.txt index 3c0bd87f686d4..790f2ac76b398 100644 --- a/libc-test/semver/redox.txt +++ b/libc-test/semver/redox.txt @@ -16,6 +16,7 @@ B460800 B500000 B576000 B921600 +BUFSIZ DT_UNKNOWN EADV EBADE @@ -130,10 +131,17 @@ OLCUC O_ASYNC O_EXLOCK O_FSYNC +O_NOCTTY O_PATH O_SHLOCK O_SYMLINK PTHREAD_STACK_MIN +RLIM_INFINITY +RLIM_SAVED_CUR +RLIM_SAVED_MAX +RUSAGE_CHILDREN +RUSAGE_SELF +RUSAGE_THREAD SA_RESTORER SCM_RIGHTS SIGIO @@ -172,6 +180,9 @@ VWERASE WEXITED WNOWAIT WSTOPPED +_IOFBF +_IOLBF +_IONBF _PC_2_SYMLINKS _PC_ALLOC_SIZE_MIN _PC_ASYNC_IO @@ -184,6 +195,7 @@ _PC_REC_XFER_ALIGN _PC_SOCK_MAXBUF _PC_SYMLINK_MAX _PC_SYNC_IO +_POSIX_VDISABLE _SC_LOGIN_NAME_MAX _SC_RE_DUP_MAX __WALL @@ -194,6 +206,7 @@ bsearch chroot clearerr difftime +dirfd endgrent endpwent endservent diff --git a/src/unix/redox/mod.rs b/src/unix/redox/mod.rs index 927e43948f565..dfeda2e2b2ed2 100644 --- a/src/unix/redox/mod.rs +++ b/src/unix/redox/mod.rs @@ -532,6 +532,7 @@ pub const O_SYMLINK: c_int = 0x4000_0000; // Negative to allow it to be used as int // FIXME(redox): Fix negative values missing from includes pub const O_NOFOLLOW: c_int = -0x8000_0000; +pub const O_NOCTTY: c_int = 0x00000200; // locale.h pub const LC_ALL: c_int = 0; @@ -626,6 +627,15 @@ pub const PTHREAD_RWLOCK_INITIALIZER: crate::pthread_rwlock_t = crate::pthread_r }; pub const PTHREAD_STACK_MIN: size_t = 4096; +// sys/resource.h +pub const RLIM_INFINITY: u64 = !0; +pub const RLIM_SAVED_CUR: u64 = RLIM_INFINITY; +pub const RLIM_SAVED_MAX: u64 = RLIM_INFINITY; +pub const RUSAGE_SELF: c_int = 0; +pub const RUSAGE_CHILDREN: c_int = -1; +pub const RUSAGE_BOTH: c_int = -2; +pub const RUSAGE_THREAD: c_int = 1; + // signal.h pub const SIG_BLOCK: c_int = 0; pub const SIG_UNBLOCK: c_int = 1; @@ -935,6 +945,8 @@ pub const TCSANOW: c_int = 0; pub const TCSADRAIN: c_int = 1; pub const TCSAFLUSH: c_int = 2; +pub const _POSIX_VDISABLE: crate::cc_t = 0; + // sys/wait.h pub const WNOHANG: c_int = 1; pub const WUNTRACED: c_int = 2; @@ -984,6 +996,11 @@ pub const R_OK: c_int = 4; pub const W_OK: c_int = 2; pub const X_OK: c_int = 1; +// stdio.h +pub const BUFSIZ: c_uint = 1024; +pub const _IOFBF: c_int = 0; +pub const _IOLBF: c_int = 1; +pub const _IONBF: c_int = 2; pub const SEEK_SET: c_int = 0; pub const SEEK_CUR: c_int = 1; pub const SEEK_END: c_int = 2; @@ -1096,6 +1113,9 @@ extern "C" { pub fn __errno_location() -> *mut c_int; pub fn strerror_r(errnum: c_int, buf: *mut c_char, buflen: size_t) -> c_int; + // dirent.h + pub fn dirfd(dirp: *mut crate::DIR) -> c_int; + // unistd.h pub fn pipe2(fds: *mut c_int, flags: c_int) -> c_int; pub fn getdtablesize() -> c_int;