From e3caaf6b0ea08ae294e25a861022c256a7535ec4 Mon Sep 17 00:00:00 2001 From: David Carlier Date: Fri, 21 Apr 2023 20:25:58 +0100 Subject: [PATCH] utmpx api for linux musl. close #3190 --- libc-test/semver/linux-gnu.txt | 2 +- libc-test/semver/linux-musl.txt | 18 ++++++++++++------ src/unix/linux_like/linux/musl/mod.rs | 7 +++++++ 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/libc-test/semver/linux-gnu.txt b/libc-test/semver/linux-gnu.txt index 9bbdee0771b60..d39726f4260a7 100644 --- a/libc-test/semver/linux-gnu.txt +++ b/libc-test/semver/linux-gnu.txt @@ -617,12 +617,12 @@ dlinfo dlmopen endutxent explicit_bzero +fgetgrent_r fgetspent_r futimes getauxval getentropy getgrent_r -fgetgrent_r getloadavg getpt getpwent_r diff --git a/libc-test/semver/linux-musl.txt b/libc-test/semver/linux-musl.txt index 2db034f813be7..f6e293aa9b7fc 100644 --- a/libc-test/semver/linux-musl.txt +++ b/libc-test/semver/linux-musl.txt @@ -56,13 +56,22 @@ aio_return aio_suspend aio_write aiocb +asctime_r +basename clock_adjtime copy_file_range ctermid +dirname +eaccess +endutxent +euidaccess explicit_bzero futimes getauxval getloadavg +getutxent +getutxid +getutxline lio_listio ntptimeval open_wmemstream @@ -71,14 +80,11 @@ prlimit prlimit64 process_vm_readv process_vm_writev +pututxline pwritev64 reallocarray -timex -euidaccess -eaccess -asctime_r +setutxent strftime strftime_l strptime -dirname -basename +timex diff --git a/src/unix/linux_like/linux/musl/mod.rs b/src/unix/linux_like/linux/musl/mod.rs index a4c1f708afd50..d8b2767669309 100644 --- a/src/unix/linux_like/linux/musl/mod.rs +++ b/src/unix/linux_like/linux/musl/mod.rs @@ -900,6 +900,13 @@ extern "C" { pub fn dirname(path: *mut ::c_char) -> *mut ::c_char; pub fn basename(path: *mut ::c_char) -> *mut ::c_char; + + pub fn getutxent() -> *mut utmpx; + pub fn getutxid(ut: *const utmpx) -> *mut utmpx; + pub fn getutxline(ut: *const utmpx) -> *mut utmpx; + pub fn pututxline(ut: *const utmpx) -> *mut utmpx; + pub fn setutxent(); + pub fn endutxent(); } // Alias to 64 to mimic glibc's LFS64 support