Skip to content

Commit

Permalink
Implement utmp for NetBSD
Browse files Browse the repository at this point in the history
  • Loading branch information
GrayJack committed Nov 28, 2019
1 parent cfd561c commit 42289eb
Showing 1 changed file with 24 additions and 3 deletions.
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

0 comments on commit 42289eb

Please sign in to comment.