From c780f22d19a328c7958a8924b17d4305ef481a82 Mon Sep 17 00:00:00 2001 From: ChanTsune <41658782+ChanTsune@users.noreply.github.com> Date: Sat, 7 Sep 2024 13:12:07 +0900 Subject: [PATCH] Add `getpwnam_r`, `getpwuid_r` to emscripten --- libc-test/semver/emscripten.txt | 2 ++ src/unix/linux_like/emscripten/mod.rs | 15 +++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/libc-test/semver/emscripten.txt b/libc-test/semver/emscripten.txt index 6b1df1aab4c7f..d14abae402367 100644 --- a/libc-test/semver/emscripten.txt +++ b/libc-test/semver/emscripten.txt @@ -1,2 +1,4 @@ getentropy 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 8014060890963..33d45bce91911 100644 --- a/src/unix/linux_like/emscripten/mod.rs +++ b/src/unix/linux_like/emscripten/mod.rs @@ -1774,6 +1774,21 @@ extern "C" { ) -> ::c_int; pub fn getentropy(buf: *mut ::c_void, buflen: ::size_t) -> ::c_int; + + 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, + buf: *mut ::c_char, + buflen: ::size_t, + result: *mut *mut passwd, + ) -> ::c_int; } // Alias to 64 to mimic glibc's LFS64 support