feat(about): show kernel version
This commit is contained in:
parent
e700589e17
commit
b49f1d4bfe
4 changed files with 20 additions and 0 deletions
|
|
@ -25,6 +25,7 @@ pub struct Info {
|
|||
pub memory: String,
|
||||
pub operating_system: String,
|
||||
pub os_architecture: String,
|
||||
pub kernel_version: String,
|
||||
pub processor: String,
|
||||
pub windowing_system: String,
|
||||
}
|
||||
|
|
@ -37,6 +38,9 @@ impl Info {
|
|||
architecture(&bump, &mut info.os_architecture);
|
||||
bump.reset();
|
||||
|
||||
kernel_version(&bump, &mut info.kernel_version);
|
||||
bump.reset();
|
||||
|
||||
hardware_model(&bump, &mut info.hardware_model);
|
||||
bump.reset();
|
||||
|
||||
|
|
@ -116,6 +120,15 @@ pub fn architecture(bump: &Bump, arch: &mut String) {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn kernel_version(bump: &Bump, kernel: &mut String) {
|
||||
let buffer = &mut bumpalo::collections::Vec::new_in(bump);
|
||||
if let Some(value) = read_to_string("/proc/version", buffer) {
|
||||
if let Some(version) = value.split_whitespace().nth(2) {
|
||||
kernel.push_str(version.trim());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn hardware_model(bump: &Bump, hardware_model: &mut String) {
|
||||
let buffer = &mut bumpalo::collections::Vec::new_in(bump);
|
||||
if let Some(mut sys_vendor) = read_to_string(SYS_VENDOR, buffer) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue