#![crate_name = "sysinfo"]
#![crate_type = "lib"]
#![crate_type = "rlib"]
#![deny(missing_docs)]
#![allow(unknown_lints)]
#![allow(too_many_arguments)]
#[macro_use]
extern crate cfg_if;
extern crate libc;
extern crate rayon;
cfg_if! {
if #[cfg(target_os = "macos")] {
mod mac;
use mac as sys;
} else if #[cfg(windows)] {
mod windows;
use windows as sys;
extern crate winapi;
} else {
mod linux;
use linux as sys;
}
}
pub use common::{
AsU32,
Pid,
};
pub use sys::{
Component,
Disk,
DiskType,
NetworkData,
Process,
ProcessStatus,
Processor,
System,
};
pub use traits::{
ComponentExt,
DiskExt,
ProcessExt,
ProcessorExt,
SystemExt,
NetworkExt,
};
pub use utils::get_current_pid;
#[cfg(feature = "c-interface")]
pub use c_interface::*;
mod common;
mod component;
mod process;
mod processor;
mod system;
mod traits;
mod utils;
#[cfg(feature = "c-interface")]
mod c_interface;
#[repr(C)]
#[derive(Clone, PartialEq, PartialOrd, Debug, Copy)]
pub enum Signal {
Hangup = 1,
Interrupt = 2,
Quit = 3,
Illegal = 4,
Trap = 5,
Abort = 6,
Bus = 7,
FloatingPointException = 8,
Kill = 9,
User1 = 10,
Segv = 11,
User2 = 12,
Pipe = 13,
Alarm = 14,
Term = 15,
Stklft = 16,
Child = 17,
Continue = 18,
Stop = 19,
TSTP = 20,
TTIN = 21,
TTOU = 22,
Urgent = 23,
XCPU = 24,
XFSZ = 25,
VirtualAlarm = 26,
Profiling = 27,
Winch = 28,
IO = 29,
Power = 30,
Sys = 31,
}
#[cfg(test)]
mod test {
use traits::{ProcessExt, SystemExt};
#[test]
fn check_memory_usage() {
let mut s = ::System::new();
s.refresh_all();
assert_eq!(s.get_process_list().iter().all(|(_, proc_)| proc_.memory() == 0), false);
}
}