From f4ed4a786550fd075ce65bc79164fe78bb01d1ec Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Wed, 26 Apr 2023 11:31:34 -0600 Subject: [PATCH] redox: add grp.h and pwd.h functions for the users crate --- libc-test/semver/redox.txt | 11 +++++++++-- src/unix/redox/mod.rs | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/libc-test/semver/redox.txt b/libc-test/semver/redox.txt index 4b6e126ea6d94..cd07660cc4757 100644 --- a/libc-test/semver/redox.txt +++ b/libc-test/semver/redox.txt @@ -137,8 +137,8 @@ SO_PEERCRED SO_PEERSEC SO_PRIORITY SO_PROTOCOL -SO_REUSEPORT SO_RCVBUFFORCE +SO_REUSEPORT SO_SNDBUFFORCE TCFLSH TCGETS @@ -180,6 +180,7 @@ bsearch chroot clearerr difftime +endpwent endservent epoll_create epoll_create1 @@ -189,12 +190,17 @@ epoll_wait explicit_bzero fchdir fmemopen +getdtablesize +getgrgid_r +getgrnam_r +getgrouplist getline +getpwent +getpwnam_r getrlimit getrusage getservbyport getservent -getdtablesize killpg lockf madvise @@ -206,6 +212,7 @@ pipe2 pthread_condattr_setclock qsort reallocarray +setpwent setrlimit setservent strcasecmp diff --git a/src/unix/redox/mod.rs b/src/unix/redox/mod.rs index ccd3d779fa6bb..09abf54ed50eb 100644 --- a/src/unix/redox/mod.rs +++ b/src/unix/redox/mod.rs @@ -996,6 +996,28 @@ extern "C" { pub fn pipe2(fds: *mut ::c_int, flags: ::c_int) -> ::c_int; pub fn getdtablesize() -> ::c_int; + // grp.h + pub fn getgrgid_r( + gid: ::gid_t, + grp: *mut ::group, + buf: *mut ::c_char, + buflen: ::size_t, + result: *mut *mut ::group, + ) -> ::c_int; + pub fn getgrnam_r( + name: *const ::c_char, + grp: *mut ::group, + buf: *mut ::c_char, + buflen: ::size_t, + result: *mut *mut ::group, + ) -> ::c_int; + pub fn getgrouplist( + user: *const ::c_char, + group: ::gid_t, + groups: *mut ::gid_t, + ngroups: *mut ::c_int, + ) -> ::c_int; + // malloc.h pub fn memalign(align: ::size_t, size: ::size_t) -> *mut ::c_void; @@ -1028,6 +1050,16 @@ extern "C" { ) -> ::c_int; // pwd.h + pub fn getpwent() -> *mut passwd; + pub fn setpwent(); + pub fn endpwent(); + pub fn getpwnam_r( + name: *const ::c_char, + pwd: *mut passwd, + buf: *mut ::c_char, + buflen: ::size_t, + result: *mut *mut passwd, + ) -> ::c_int; pub fn getpwuid_r( uid: ::uid_t, pwd: *mut passwd,