Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

redox: add grp.h and pwd.h functions for the users crate #3228

Merged
merged 1 commit into from May 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 9 additions & 2 deletions libc-test/semver/redox.txt
Expand Up @@ -137,8 +137,8 @@ SO_PEERCRED
SO_PEERSEC
SO_PRIORITY
SO_PROTOCOL
SO_REUSEPORT
SO_RCVBUFFORCE
SO_REUSEPORT
SO_SNDBUFFORCE
TCFLSH
TCGETS
Expand Down Expand Up @@ -180,6 +180,7 @@ bsearch
chroot
clearerr
difftime
endpwent
endservent
epoll_create
epoll_create1
Expand All @@ -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
Expand All @@ -206,6 +212,7 @@ pipe2
pthread_condattr_setclock
qsort
reallocarray
setpwent
setrlimit
setservent
strcasecmp
Expand Down
32 changes: 32 additions & 0 deletions src/unix/redox/mod.rs
Expand Up @@ -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;

Expand Down Expand Up @@ -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,
Expand Down