Skip to content
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

Implement utmp for NetBSD #1610

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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
27 changes: 24 additions & 3 deletions src/unix/bsd/netbsdlike/netbsd/mod.rs
Expand Up @@ -299,6 +299,19 @@ s! {
pub shm_ctime: ::time_t,
_shm_internal: *mut ::c_void,
}

pub struct utmp {
pub ut_line: [::c_char; UT_LINESIZE],
pub ut_name: [::c_char; UT_NAMESIZE],
pub ut_host: [::c_char; UT_HOSTSIZE],
pub ut_time: ::time_t
}

pub struct lastlog {
pub ll_line: [::c_char; UT_LINESIZE],
pub ll_host: [::c_char; UT_HOSTSIZE],
pub ll_time: ::time_t
}
}

s_no_extra_traits! {
Expand Down Expand Up @@ -1517,6 +1530,9 @@ pub const CHWFLOW: ::tcflag_t = ::MDMBUF | ::CRTSCTS | ::CDTRCTS;
// pub const _PATH_WTMPX: &[::c_char; 14] = b"/var/log/wtmpx";
// pub const _PATH_LASTLOGX: &[::c_char; 17] = b"/var/log/lastlogx";
// pub const _PATH_UTMP_UPDATE: &[::c_char; 24] = b"/usr/libexec/utmp_update";
pub const UT_NAMESIZE: usize = 8;
pub const UT_LINESIZE: usize = 8;
pub const UT_HOSTSIZE: usize = 16;
pub const _UTX_USERSIZE: usize = 32;
pub const _UTX_LINESIZE: usize = 32;
pub const _UTX_PADSIZE: usize = 40;
Expand Down Expand Up @@ -1914,9 +1930,14 @@ 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 getutmp(ux: *const utmpx, u: *mut utmp);
pub fn getutmpx(u: *const utmp, ux: *mut utmpx);

pub fn utpname(file: *const ::c_char) -> ::c_int;
pub fn setutent();
pub fn endutent();
pub fn getutent() -> *mut utmp;
}

cfg_if! {
Expand Down