#![crate_name = "sysinfo"]
#![crate_type = "lib"]
#![crate_type = "rlib"]
#![deny(missing_docs)]
#![allow(unknown_lints)]
#[macro_use]
extern crate cfg_if;
#[cfg(not(any(target_os = "unknown", target_arch = "wasm32")))]
extern crate libc;
extern crate rayon;
#[macro_use]
extern crate doc_comment;
#[cfg(test)]
doctest!("../README.md");
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;
extern crate ntapi;
} else if #[cfg(unix)] {
mod linux;
use linux as sys;
} else {
mod unknown;
use unknown as sys;
}
}
pub use common::{AsU32, Pid, RefreshKind};
pub use sys::{Component, Disk, DiskType, NetworkData, Process, ProcessStatus, Processor, System};
pub use traits::{ComponentExt, DiskExt, NetworkExt, ProcessExt, ProcessorExt, SystemExt};
#[cfg(feature = "c-interface")]
pub use c_interface::*;
pub use utils::get_current_pid;
#[cfg(feature = "c-interface")]
mod c_interface;
mod common;
mod component;
mod process;
mod processor;
mod system;
mod traits;
mod utils;
#[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
);
}
}