Skip to content

Commit

Permalink
Add getgrgid, getgrnam, getgrnam_r and getgrgid_r for emscrip…
Browse files Browse the repository at this point in the history
…ten (rust-lang#3912)

(backport <rust-lang#3912>)
(cherry picked from commit 1566923)
  • Loading branch information
ChanTsune authored and tgross35 committed Oct 15, 2024
1 parent 68d73f4 commit ccbcfbb
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
4 changes: 4 additions & 0 deletions libc-test/semver/emscripten.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
AT_EACCESS
getentropy
getgrgid
getgrnam
getgrnam_r
getgrgid_r
posix_fallocate64
getpwnam_r
getpwuid_r
18 changes: 18 additions & 0 deletions src/unix/linux_like/emscripten/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1793,6 +1793,24 @@ extern "C" {
buflen: ::size_t,
result: *mut *mut passwd,
) -> ::c_int;

// grp.h
pub fn getgrgid(gid: ::gid_t) -> *mut ::group;
pub fn getgrnam(name: *const ::c_char) -> *mut ::group;
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 getgrgid_r(
gid: ::gid_t,
grp: *mut ::group,
buf: *mut ::c_char,
buflen: ::size_t,
result: *mut *mut ::group,
) -> ::c_int;
}

// Alias <foo> to <foo>64 to mimic glibc's LFS64 support
Expand Down

0 comments on commit ccbcfbb

Please sign in to comment.