From a37cddee10a064125ca37206dfef8c043aa0654d Mon Sep 17 00:00:00 2001 From: ChanTsune <41658782+ChanTsune@users.noreply.github.com> Date: Tue, 24 Sep 2024 11:05:47 -0700 Subject: [PATCH] Add `getpwnam_r`, `getpwuid_r` to emscripten (#3906) (backport ) (cherry picked from commit d5b17d5e6974dd5ef2daa2ed08e9f8cb53cde276) --- 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 1dc607496a2ad..11a16aa7afa41 100644 --- a/src/unix/linux_like/emscripten/mod.rs +++ b/src/unix/linux_like/emscripten/mod.rs @@ -1776,6 +1776,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