From 1566923c37118df370ed4620a157cb803b0d4415 Mon Sep 17 00:00:00 2001 From: ChanTsune <41658782+ChanTsune@users.noreply.github.com> Date: Mon, 30 Sep 2024 21:25:40 -0700 Subject: [PATCH] Add `getgrgid`, `getgrnam`, `getgrnam_r` and `getgrgid_r` for emscripten (#3912) --- libc-test/semver/emscripten.txt | 4 ++++ src/unix/linux_like/emscripten/mod.rs | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/libc-test/semver/emscripten.txt b/libc-test/semver/emscripten.txt index d61541c4f2baf..150a7fb8a6c6f 100644 --- a/libc-test/semver/emscripten.txt +++ b/libc-test/semver/emscripten.txt @@ -1,5 +1,9 @@ AT_EACCESS getentropy +getgrgid +getgrnam +getgrnam_r +getgrgid_r posix_fallocate64 getpwnam_r getpwuid_r diff --git a/src/unix/linux_like/emscripten/mod.rs b/src/unix/linux_like/emscripten/mod.rs index 4a8bf8dbb6b2d..c492f49f2995d 100644 --- a/src/unix/linux_like/emscripten/mod.rs +++ b/src/unix/linux_like/emscripten/mod.rs @@ -1791,6 +1791,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 to 64 to mimic glibc's LFS64 support