1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
// 
// Sysinfo
// 
// Copyright (c) 2015 Guillaume Gomez
//

#![crate_name = "sysinfo"]
#![crate_type = "lib"]
#![crate_type = "rlib"]

extern crate libc;

#[cfg(target_os = "macos")]
mod mac;
#[cfg(target_os = "macos")]
use mac as sys;
#[cfg(not(target_os = "macos"))]
mod linux;
#[cfg(not(target_os = "macos"))]
use linux as sys;

pub use sys::{
    Component,
    Process,
    Processor,
    System,
    Disk,
    DiskType,
};

mod component;
mod process;
mod processor;
mod system;
mod utils;

#[repr(C)]
#[derive(Clone, PartialEq, PartialOrd, Debug, Copy)]
pub enum Signal {
    /// Hangup detected on controlling terminal or death of controlling process
    Hangup = 1,
    /// Interrupt from keyboard
    Interrupt = 2,
    /// Quit from keyboard
    Quit = 3,
    /// Illegal instruction
    Illegal = 4,
    /// Trace/breakpoint trap
    Trap = 5,
    /// Abort signal from C abort function
    Abort = 6,
    // IOT trap. A synonym for SIGABRT
    // IOT = 6,
    /// Bus error (bad memory access)
    Bus = 7,
    /// Floating point exception
    FloatingPointException = 8,
    /// Kill signal
    Kill = 9,
    /// User-defined signal 1
    User1 = 10,
    /// Invalid memory reference
    Segv = 11,
    /// User-defined signal 2
    User2 = 12,
    /// Broken pipe: write to pipe with no readers
    Pipe = 13,
    /// Timer signal from C alarm function
    Alarm = 14,
    /// Termination signal
    Term = 15,
    /// Stack fault on coprocessor (unused)
    Stklft = 16,
    /// Child stopped or terminated
    Child = 17,
    /// Continue if stopped
    Continue = 18,
    /// Stop process
    Stop = 19,
    /// Stop typed at terminal
    TSTP = 20,
    /// Terminal input for background process
    TTIN = 21,
    /// Terminal output for background process
    TTOU = 22,
    /// Urgent condition on socket
    Urgent = 23,
    /// CPU time limit exceeded
    XCPU = 24,
    /// File size limit exceeded
    XFSZ = 25,
    /// Virtual alarm clock
    VirtualAlarm = 26,
    /// Profiling time expired
    Profiling = 27,
    /// Windows resize signal
    Winch = 28,
    /// I/O now possible
    IO = 29,
    // Pollable event (Sys V). Synonym for IO
    //Poll = 29,
    /// Power failure (System V)
    Power = 30,
    /// Bad argument to routine (SVr4)
    Sys = 31,
}