Skip to content

Implement utmp for solarish targets #1603

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 25, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 23 additions & 4 deletions src/unix/solarish/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,16 @@ s! {
e_termination: ::c_short,
e_exit: ::c_short,
}

pub struct utmp {
pub ut_user: [::c_char; 8],
pub ut_id: [::c_char; 4],
pub ut_line: [::c_char; 12],
pub ut_pid: ::c_short,
pub ut_type: ::c_short,
pub ut_exit: exit_status,
pub ut_time: ::time_t,
}
}

s_no_extra_traits! {
Expand Down Expand Up @@ -1690,6 +1700,7 @@ pub const PORT_SOURCE_FILE: ::c_int = 7;
pub const PORT_SOURCE_POSTWAIT: ::c_int = 8;
pub const PORT_SOURCE_SIGNAL: ::c_int = 9;

pub const NONROOT_USR: ::c_short = 2;
pub const _UTX_USERSIZE: usize = 32;
pub const _UTX_LINESIZE: usize = 32;
pub const _UTX_PADSIZE: usize = 5;
Expand Down Expand Up @@ -2404,10 +2415,18 @@ extern "C" {
pub fn pututxline(ut: *const utmpx) -> *mut utmpx;
pub fn setutxent();
pub fn endutxent();
// TODO: uncomment after utmp implementation
// pub fn getutmp(ux: *const utmpx, u: *mut utmp);
// pub fn getutmpx(u: *const utmp, ux: *mut utmpx);
// pub fn updwtmp(file: *const ::c_char, u: *mut utmp);

pub fn endutent();
pub fn getutent() -> *mut utmp;
pub fn getutid(u: *const utmp) -> *mut utmp;
pub fn getutline(u: *const utmp) -> *mut utmp;
pub fn pututline(u: *const utmp) -> *mut utmp;
pub fn setutent();
pub fn utmpname(file: *const ::c_char) -> ::c_int;

pub fn getutmp(ux: *const utmpx, u: *mut utmp);
pub fn getutmpx(u: *const utmp, ux: *mut utmpx);
pub fn updwtmp(file: *const ::c_char, u: *mut utmp);
}

mod compat;
Expand Down