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
  • Loading branch information
devnexen committed Jul 22, 2023
1 parent af676d1 commit e0bd2df
Show file tree
Hide file tree
Showing 5 changed files with 28 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 @@ -582,12 +582,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
7 changes: 6 additions & 1 deletion src/unix/linux_like/linux/arch/generic/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,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 @@ -287,6 +286,12 @@ cfg_if! {
else if #[cfg(target_env = "uclibc")] {
pub const RLIM_NLIMITS: ::__rlimit_resource_t = 15;
}
else if #[cfg(target_env = "musl")] {
pub const RLIM_NLIMITS: ::c_int = 16;
}
else if #[cfg(target_env = "ohos")] {
pub const RLIM_NLIMITS: ::c_int = 15;
}
}

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 @@ -309,7 +309,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 @@ -779,6 +779,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 <foo> to <foo>64 to mimic glibc's LFS64 support
Expand Down

0 comments on commit e0bd2df

Please sign in to comment.