Skip to content

Commit

Permalink
utmpx api for linux musl + musl few build fixes.
Browse files Browse the repository at this point in the history
close #3190
  • Loading branch information
devnexen committed Apr 21, 2023
1 parent e4cccf9 commit 463286a
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 10 deletions.
2 changes: 1 addition & 1 deletion libc-test/semver/linux-gnu.txt
Original file line number Diff line number Diff line change
Expand Up @@ -575,12 +575,12 @@ dlinfo
dlmopen
endutxent
explicit_bzero
fgetgrent_r
fgetspent_r
futimes
getauxval
getentropy
getgrent_r
fgetgrent_r
getloadavg
getpt
getpwent_r
Expand Down
18 changes: 12 additions & 6 deletions libc-test/semver/linux-musl.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,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
Expand All @@ -47,13 +56,10 @@ prlimit
prlimit64
process_vm_readv
process_vm_writev
pututxline
pwritev64
reallocarray
timex
euidaccess
eaccess
asctime_r
setutxent
strftime
strptime
dirname
basename
timex
8 changes: 7 additions & 1 deletion src/unix/linux_like/linux/arch/generic/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,6 @@ cfg_if! {
pub const RLIMIT_NICE: ::c_int = 13;
pub const RLIMIT_RTPRIO: ::c_int = 14;
pub const RLIMIT_RTTIME: ::c_int = 15;
pub const RLIM_NLIMITS: ::c_int = 15;
pub const RLIMIT_NLIMITS: ::c_int = RLIM_NLIMITS;
}
}
Expand All @@ -291,6 +290,13 @@ cfg_if! {
else if #[cfg(target_env = "uclibc")] {
pub const RLIM_NLIMITS: ::__rlimit_resource_t = 15;
}
else if #[cfg(target_env = "ohos")] {
// FIXME: is it ?
pub const RLIM_NLIMITS: ::c_int = 15;
}
else if #[cfg(target_env = "musl")] {
pub const RLIM_NLIMITS: ::c_int = 16;
}
}

pub const RLIM_INFINITY: ::rlim_t = !0;
2 changes: 1 addition & 1 deletion src/unix/linux_like/linux/musl/b64/x86_64/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ pub const MAP_32BIT: ::c_int = 0x0040;
pub const O_APPEND: ::c_int = 1024;
pub const O_DIRECT: ::c_int = 0x4000;
pub const O_DIRECTORY: ::c_int = 0x10000;
pub const O_LARGEFILE: ::c_int = 0;
pub const O_LARGEFILE: ::c_int = 0x8000;
pub const O_NOFOLLOW: ::c_int = 0x20000;
pub const O_CREAT: ::c_int = 64;
pub const O_EXCL: ::c_int = 128;
Expand Down
9 changes: 8 additions & 1 deletion src/unix/linux_like/linux/musl/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ s_no_extra_traits! {
pub ut_exit: __exit_status,

#[cfg(target_env = "musl")]
pub ut_session: ::c_long,
pub ut_session: ::c_int,

#[cfg(target_env = "ohos")]
#[cfg(target_endian = "little")]
Expand Down Expand Up @@ -782,6 +782,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();
}

cfg_if! {
Expand Down

0 comments on commit 463286a

Please sign in to comment.