From 7e8bdd7524e4c73721d965718a3a1b454293750b Mon Sep 17 00:00:00 2001 From: ChanTsune <41658782+ChanTsune@users.noreply.github.com> Date: Tue, 10 Sep 2024 23:35:05 +0900 Subject: [PATCH] Add `getgrgid`, `getgrnam`, `getgrnam_r` and `getgrgid_r` for emscripten --- 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 d14abae402367..4c518d8d08952 100644 --- a/libc-test/semver/emscripten.txt +++ b/libc-test/semver/emscripten.txt @@ -1,4 +1,8 @@ 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 33d45bce91911..a1c879efaf02d 100644 --- a/src/unix/linux_like/emscripten/mod.rs +++ b/src/unix/linux_like/emscripten/mod.rs @@ -1789,6 +1789,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