sinf 0.1.0

Library for obtaining in-depth system information at both the hardware and software levels
Documentation
#![allow(dead_code, non_camel_case_types)]

use libc::{c_char, c_int, c_long, c_ulong, kinfo_proc2, size_t};

use super::kvm_t;

unsafe extern "C" {
    pub(crate) fn getifnum() -> c_int;
}

#[link(name = "kvm")]
unsafe extern "C" {
    pub(crate) fn kvm_close(kd: *mut kvm_t);
    pub(crate) fn kvm_openfiles(
        a: *const c_char,
        b: *const c_char,
        c: *const c_char,
        kind: c_int,
        error: *mut c_char,
    ) -> *mut kvm_t;
    pub(crate) fn kvm_getlwps(
        kd: *mut kvm_t,
        pid: c_int,
        procaddr: c_ulong,
        elemsize: size_t,
        count: *mut c_int,
    ) -> *mut libc::kinfo_lwp;
    pub(crate) fn kvm_getargv2(
        kd: *mut kvm_t,
        p: *const kinfo_proc2,
        nchr: c_int,
    ) -> *mut *mut c_char;
    pub(crate) fn kvm_getenvv2(
        kd: *mut kvm_t,
        p: *const kinfo_proc2,
        nchr: c_int,
    ) -> *mut *mut c_char;
    pub(crate) fn kvm_getproc2(
        kd: *mut kvm_t,
        op: c_int,
        arg: c_int,
        elemsize: size_t,
        cnt: *mut c_int,
    ) -> *mut kinfo_proc2;
}

#[link(name = "c")]
unsafe extern "C" {
    pub(crate) fn err(status: c_int, fmt: *const c_char);

    // Reads the user-preferred display block size (the `BLOCKSIZE` environment variable, or the system default `DEV_BSIZE` = 512).
    pub(crate) fn getbsize(headerlenp: *mut c_int, blocksizep: *mut c_long) -> *const c_char;
}