Expand description
Represents a kernel build information
Fields§
§version: String
§flags: HashSet<String>
§extra: String
This field contains any extra data from the /proc/sys/kernel/version file. It generally contains the build date of the kernel, but the format of the date can vary.
A method named extra_date
is provided which would try to parse some date formats. When the date format is not supported, an error will be returned. It depends on chrono feature.
Implementations§
source§impl BuildInfo
impl BuildInfo
pub fn new(version: &str, flags: HashSet<String>, extra: String) -> BuildInfo
sourcepub fn current() -> ProcResult<Self>
pub fn current() -> ProcResult<Self>
Read the kernel build information from current running kernel
Generated by scripts/mkcompile_h
when building the kernel.
The file is located at /proc/sys/kernel/version
.
sourcepub fn version_number(&self) -> ProcResult<u32>
pub fn version_number(&self) -> ProcResult<u32>
Return version number
This would parse number from first digits of version string. For example, #21~1 to 21.
sourcepub fn extra_date(&self) -> ProcResult<DateTime<Local>>
pub fn extra_date(&self) -> ProcResult<DateTime<Local>>
Parse extra field to DateTime
object
This function may fail as TIMESTAMP can be various formats.