summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrayJack <gr41.j4ck@gmail.com>2019-11-28 20:47:50 -0300
committerGrayJack <gr41.j4ck@gmail.com>2019-11-28 20:47:50 -0300
commit42289eb64f63fff85a08dffcfb30b1e6b167d20a (patch)
tree44d1221a95738f2d096367f61bd13a13bd6f5a18
parentcfd561c28987bed1f925e358d8ab03ad8cd9b085 (diff)
downloadrust-libc-42289eb64f63fff85a08dffcfb30b1e6b167d20a.tar.gz
Implement utmp for NetBSD
-rw-r--r--src/unix/bsd/netbsdlike/netbsd/mod.rs27
1 files changed, 24 insertions, 3 deletions
diff --git a/src/unix/bsd/netbsdlike/netbsd/mod.rs b/src/unix/bsd/netbsdlike/netbsd/mod.rs
index 1cdc1c6752..ef9fe04809 100644
--- a/src/unix/bsd/netbsdlike/netbsd/mod.rs
+++ b/src/unix/bsd/netbsdlike/netbsd/mod.rs
@@ -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! {
@@ -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;
@@ -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! {