Skip to content

Commit

Permalink
chore: bump deps
Browse files Browse the repository at this point in the history
  • Loading branch information
cijiugechu committed Aug 2, 2024
1 parent 6ca8333 commit 20f086d
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 21 deletions.
12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ edition = "2021"
license = "MIT"

[dependencies]
libc = "0.2.147"
utmp-raw = "0.3.0"
thiserror = "1.0.48"
zerocopy = "0.6"
libc = "0.2.155"
utwt-raw = "0.4.0"
thiserror = "1.0.63"
zerocopy = "0.7.35"

[dev-dependencies]
anyhow = "1.0.75"
once_cell = "1.18"
anyhow = "1.0.86"
once_cell = "1.19"

[package.metadata.docs.rs]
default-target = "x86_64-unknown-linux-gnu"
Expand Down
24 changes: 12 additions & 12 deletions src/entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ use std::convert::TryFrom;
use std::ffi::CStr;
use std::os::raw::c_short;
use thiserror::Error;
use utmp_raw::x32::utmp as utmp32;
use utmp_raw::x64::{timeval as timeval64, utmp as utmp64};
use utwt_raw::x32::utmp as utmp32;
use utwt_raw::x64::{timeval as timeval64, utmp as utmp64};

/// Parsed utmp entry.
#[derive(Clone, Debug, Eq, PartialEq)]
Expand Down Expand Up @@ -110,8 +110,8 @@ impl<'a> TryFrom<&'a utmp64> for UtmpEntry {

fn try_from(from: &utmp64) -> Result<Self, UtmpError> {
Ok(match from.ut_type {
utmp_raw::EMPTY => UtmpEntry::Empty,
utmp_raw::RUN_LVL => {
utwt_raw::EMPTY => UtmpEntry::Empty,
utwt_raw::RUN_LVL => {
let kernel_version =
string_from_bytes(&from.ut_host).map_err(UtmpError::InvalidHost)?;
let time_in_micros = time_from_tv(from.ut_tv)?;
Expand All @@ -127,34 +127,34 @@ impl<'a> TryFrom<&'a utmp64> for UtmpEntry {
}
}
}
utmp_raw::BOOT_TIME => UtmpEntry::BootTime {
utwt_raw::BOOT_TIME => UtmpEntry::BootTime {
kernel_version: string_from_bytes(&from.ut_host).map_err(UtmpError::InvalidHost)?,
time_in_micros: time_from_tv(from.ut_tv)?,
},
utmp_raw::NEW_TIME => UtmpEntry::NewTime(time_from_tv(from.ut_tv)?),
utmp_raw::OLD_TIME => UtmpEntry::OldTime(time_from_tv(from.ut_tv)?),
utmp_raw::INIT_PROCESS => UtmpEntry::InitProcess {
utwt_raw::NEW_TIME => UtmpEntry::NewTime(time_from_tv(from.ut_tv)?),
utwt_raw::OLD_TIME => UtmpEntry::OldTime(time_from_tv(from.ut_tv)?),
utwt_raw::INIT_PROCESS => UtmpEntry::InitProcess {
pid: from.ut_pid,
time_in_micros: time_from_tv(from.ut_tv)?,
},
utmp_raw::LOGIN_PROCESS => UtmpEntry::LoginProcess {
utwt_raw::LOGIN_PROCESS => UtmpEntry::LoginProcess {
pid: from.ut_pid,
time_in_micros: time_from_tv(from.ut_tv)?,
},
utmp_raw::USER_PROCESS => UtmpEntry::UserProcess {
utwt_raw::USER_PROCESS => UtmpEntry::UserProcess {
pid: from.ut_pid,
line: string_from_bytes(&from.ut_line).map_err(UtmpError::InvalidLine)?,
user: string_from_bytes(&from.ut_user).map_err(UtmpError::InvalidUser)?,
host: string_from_bytes(&from.ut_host).map_err(UtmpError::InvalidHost)?,
session: from.ut_session as pid_t,
time_in_micros: time_from_tv(from.ut_tv)?,
},
utmp_raw::DEAD_PROCESS => UtmpEntry::DeadProcess {
utwt_raw::DEAD_PROCESS => UtmpEntry::DeadProcess {
pid: from.ut_pid,
line: string_from_bytes(&from.ut_line).map_err(UtmpError::InvalidLine)?,
time_in_micros: time_from_tv(from.ut_tv)?,
},
utmp_raw::ACCOUNTING => UtmpEntry::Accounting,
utwt_raw::ACCOUNTING => UtmpEntry::Accounting,
_ => return Err(UtmpError::UnknownType(from.ut_type)),
})
}
Expand Down
6 changes: 3 additions & 3 deletions src/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ use std::marker::PhantomData;
use std::mem;
use std::path::Path;
use thiserror::Error;
use utmp_raw::{utmp, x32::utmp as utmp32, x64::utmp as utmp64};
use zerocopy::{FromBytes, LayoutVerified};
use utwt_raw::{utmp, x32::utmp as utmp32, x64::utmp as utmp64};
use zerocopy::{FromBytes, Ref};

#[doc(hidden)]
pub struct UtmpParserImpl<R, T = utmp>(R, PhantomData<T>);
Expand Down Expand Up @@ -111,7 +111,7 @@ fn read_entry<R: Read, T: FromBytes>(
}
}
Ok(Some(
LayoutVerified::<_, T>::new(buffer).unwrap().into_ref(),
Ref::<_, T>::new(buffer).unwrap().into_ref(),
))
}

Expand Down

0 comments on commit 20f086d

Please sign in to comment.