Skip to content

Commit bba019b

Browse files
committed
Auto merge of #1610 - GrayJack:utmp_netbsd, r=gnzlbg
Implement utmp for NetBSD Followed this: https://github.com/NetBSD/src/blob/trunk/include/utmp.h
2 parents ea0a54a + 42289eb commit bba019b

File tree

1 file changed

+24
-3
lines changed
  • src/unix/bsd/netbsdlike/netbsd

1 file changed

+24
-3
lines changed

src/unix/bsd/netbsdlike/netbsd/mod.rs

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,19 @@ s! {
299299
pub shm_ctime: ::time_t,
300300
_shm_internal: *mut ::c_void,
301301
}
302+
303+
pub struct utmp {
304+
pub ut_line: [::c_char; UT_LINESIZE],
305+
pub ut_name: [::c_char; UT_NAMESIZE],
306+
pub ut_host: [::c_char; UT_HOSTSIZE],
307+
pub ut_time: ::time_t
308+
}
309+
310+
pub struct lastlog {
311+
pub ll_line: [::c_char; UT_LINESIZE],
312+
pub ll_host: [::c_char; UT_HOSTSIZE],
313+
pub ll_time: ::time_t
314+
}
302315
}
303316

304317
s_no_extra_traits! {
@@ -1517,6 +1530,9 @@ pub const CHWFLOW: ::tcflag_t = ::MDMBUF | ::CRTSCTS | ::CDTRCTS;
15171530
// pub const _PATH_WTMPX: &[::c_char; 14] = b"/var/log/wtmpx";
15181531
// pub const _PATH_LASTLOGX: &[::c_char; 17] = b"/var/log/lastlogx";
15191532
// pub const _PATH_UTMP_UPDATE: &[::c_char; 24] = b"/usr/libexec/utmp_update";
1533+
pub const UT_NAMESIZE: usize = 8;
1534+
pub const UT_LINESIZE: usize = 8;
1535+
pub const UT_HOSTSIZE: usize = 16;
15201536
pub const _UTX_USERSIZE: usize = 32;
15211537
pub const _UTX_LINESIZE: usize = 32;
15221538
pub const _UTX_PADSIZE: usize = 40;
@@ -1914,9 +1930,14 @@ extern "C" {
19141930
pub fn pututxline(ut: *const utmpx) -> *mut utmpx;
19151931
pub fn setutxent();
19161932
pub fn endutxent();
1917-
// TODO: uncomment after utmp implementation
1918-
// pub fn getutmp(ux: *const utmpx, u: *mut utmp);
1919-
// pub fn getutmpx(u: *const utmp, ux: *mut utmpx);
1933+
1934+
pub fn getutmp(ux: *const utmpx, u: *mut utmp);
1935+
pub fn getutmpx(u: *const utmp, ux: *mut utmpx);
1936+
1937+
pub fn utpname(file: *const ::c_char) -> ::c_int;
1938+
pub fn setutent();
1939+
pub fn endutent();
1940+
pub fn getutent() -> *mut utmp;
19201941
}
19211942

19221943
cfg_if! {

0 commit comments

Comments
 (0)