Get CPU features
This commit is contained in:
parent
6927a4c5cf
commit
7fa413019f
1 changed files with 138 additions and 0 deletions
13
kernel/scheme/sys/cpu.rs
Normal file
13
kernel/scheme/sys/cpu.rs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
use collections::Vec;
|
||||
|
||||
use arch::device::cpu::cpu_info;
|
||||
use syscall::error::{Error, EIO, Result};
|
||||
|
||||
pub fn resource() -> Result<Vec<u8>> {
|
||||
let mut string = format!("CPUs: {}\n", ::cpu_count());
|
||||
|
||||
match cpu_info(&mut string) {
|
||||
Ok(()) => Ok(string.into_bytes()),
|
||||
Err(_) => Err(Error::new(EIO))
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue