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
//! This module roughly corresponds to `mach/vm_statistics.h`

use vm_types::{integer_t, natural_t};

pub type vm_statistics_t = *mut vm_statistics;
pub type vm_statistics_data_t = vm_statistics;
// `pmap_statistics_t` was removed after MacOSX 10.3.9.
#[cfg(feature = "deprecated")]
pub type pmap_statistics_t = *mut pmap_statistics;

pub const VM_PAGE_QUERY_PAGE_PRESENT: integer_t    = (1 << 0);
pub const VM_PAGE_QUERY_PAGE_FICTITIOUS: integer_t = (1 << 1);
pub const VM_PAGE_QUERY_PAGE_REF: integer_t        = (1 << 2);
pub const VM_PAGE_QUERY_PAGE_DIRTY: integer_t      = (1 << 3);

pub const VM_MEMORY_MALLOC: ::libc::c_uint                  = 1;
pub const VM_MEMORY_MALLOC_SMALL: ::libc::c_uint            = 2;
pub const VM_MEMORY_MALLOC_LARGE: ::libc::c_uint            = 3;
pub const VM_MEMORY_MALLOC_HUGE: ::libc::c_uint             = 4;
pub const VM_MEMORY_SBRK: ::libc::c_uint                    = 5;
pub const VM_MEMORY_ANALYSIS_TOOL: ::libc::c_uint           = 10;
pub const VM_MEMORY_MACH_MSG: ::libc::c_uint                = 20;
pub const VM_MEMORY_IOKIT: ::libc::c_uint                   = 21;
pub const VM_MEMORY_STACK: ::libc::c_uint                   = 30;
pub const VM_MEMORY_GUARD: ::libc::c_uint                   = 31;
pub const VM_MEMORY_SHARED_PMAP: ::libc::c_uint             = 32;
pub const VM_MEMORY_DYLIB: ::libc::c_uint                   = 33;
pub const VM_MEMORY_APPKIT: ::libc::c_uint                  = 40;
pub const VM_MEMORY_FOUNDATION: ::libc::c_uint              = 41;
pub const VM_MEMORY_COREGRAPHICS: ::libc::c_uint            = 42;
pub const VM_MEMORY_CARBON: ::libc::c_uint                  = 43;
pub const VM_MEMORY_JAVA: ::libc::c_uint                    = 44;
pub const VM_MEMORY_ATS: ::libc::c_uint                     = 50;
pub const VM_MEMORY_DYLD: ::libc::c_uint                    = 60;
pub const VM_MEMORY_DYLD_MALLOC: ::libc::c_uint             = 61;
pub const VM_MEMORY_APPLICATION_SPECIFIC_1: ::libc::c_uint  = 240;
pub const VM_MEMORY_APPLICATION_SPECIFIC_16: ::libc::c_uint = 255;

pub const VM_FLAGS_FIXED: ::libc::c_int    = 0x0;
pub const VM_FLAGS_ANYWHERE: ::libc::c_int = 0x1;
pub const VM_FLAGS_OVERWRITE: ::libc::c_int = 0x4000;

#[repr(C)]
pub struct vm_statistics {
    pub free_count: natural_t,
    pub active_count: natural_t,
    pub inactive_count: natural_t,
    pub wire_count: natural_t,
    pub zero_fill_count: natural_t,
    pub reactivations: natural_t,
    pub pageins: natural_t,
    pub pageouts: natural_t,
    pub faults: natural_t,
    pub cow_faults: natural_t,
    pub lookups: natural_t,
    pub hits: natural_t,
    pub purgeable_count: natural_t,
    pub purges: natural_t,
    pub speculative_count: natural_t,
}

// `pmap_statistics` was removed after MacOSX 10.3.9.
#[cfg(feature = "deprecated")]
#[repr(C)]
pub struct pmap_statistics {
    pub resident_count: integer_t,
    pub wired_count: integer_t,
}