xref: /minix3/minix/lib/libsys/vm_info.c (revision 433d6423c39e34ec4b79c950597bb2d236f886be)
1*433d6423SLionel Sambuc 
2*433d6423SLionel Sambuc #include "syslib.h"
3*433d6423SLionel Sambuc 
4*433d6423SLionel Sambuc #include <string.h>
5*433d6423SLionel Sambuc #include <minix/vm.h>
6*433d6423SLionel Sambuc 
7*433d6423SLionel Sambuc /*===========================================================================*
8*433d6423SLionel Sambuc  *                                vm_info_stats				     *
9*433d6423SLionel Sambuc  *===========================================================================*/
vm_info_stats(struct vm_stats_info * vsi)10*433d6423SLionel Sambuc int vm_info_stats(struct vm_stats_info *vsi)
11*433d6423SLionel Sambuc {
12*433d6423SLionel Sambuc     message m;
13*433d6423SLionel Sambuc 
14*433d6423SLionel Sambuc     memset(&m, 0, sizeof(m));
15*433d6423SLionel Sambuc     m.m_lsys_vm_info.what = VMIW_STATS;
16*433d6423SLionel Sambuc     m.m_lsys_vm_info.ptr = vsi;
17*433d6423SLionel Sambuc 
18*433d6423SLionel Sambuc     return _taskcall(VM_PROC_NR, VM_INFO, &m);
19*433d6423SLionel Sambuc }
20*433d6423SLionel Sambuc 
21*433d6423SLionel Sambuc /*===========================================================================*
22*433d6423SLionel Sambuc  *                                vm_info_usage				     *
23*433d6423SLionel Sambuc  *===========================================================================*/
vm_info_usage(endpoint_t who,struct vm_usage_info * vui)24*433d6423SLionel Sambuc int vm_info_usage(endpoint_t who, struct vm_usage_info *vui)
25*433d6423SLionel Sambuc {
26*433d6423SLionel Sambuc     message m;
27*433d6423SLionel Sambuc 
28*433d6423SLionel Sambuc     memset(&m, 0, sizeof(m));
29*433d6423SLionel Sambuc     m.m_lsys_vm_info.what = VMIW_USAGE;
30*433d6423SLionel Sambuc     m.m_lsys_vm_info.ep = who;
31*433d6423SLionel Sambuc     m.m_lsys_vm_info.ptr = vui;
32*433d6423SLionel Sambuc 
33*433d6423SLionel Sambuc     return _taskcall(VM_PROC_NR, VM_INFO, &m);
34*433d6423SLionel Sambuc }
35*433d6423SLionel Sambuc 
36*433d6423SLionel Sambuc /*===========================================================================*
37*433d6423SLionel Sambuc  *                                vm_info_region			     *
38*433d6423SLionel Sambuc  *===========================================================================*/
vm_info_region(endpoint_t who,struct vm_region_info * vri,int count,vir_bytes * next)39*433d6423SLionel Sambuc int vm_info_region(endpoint_t who, struct vm_region_info *vri,
40*433d6423SLionel Sambuc 	int count, vir_bytes *next)
41*433d6423SLionel Sambuc {
42*433d6423SLionel Sambuc     message m;
43*433d6423SLionel Sambuc     int result;
44*433d6423SLionel Sambuc 
45*433d6423SLionel Sambuc     memset(&m, 0, sizeof(m));
46*433d6423SLionel Sambuc     m.m_lsys_vm_info.what = VMIW_REGION;
47*433d6423SLionel Sambuc     m.m_lsys_vm_info.ep = who;
48*433d6423SLionel Sambuc     m.m_lsys_vm_info.count = count;
49*433d6423SLionel Sambuc     m.m_lsys_vm_info.ptr = vri;
50*433d6423SLionel Sambuc     m.m_lsys_vm_info.next = *next;
51*433d6423SLionel Sambuc 
52*433d6423SLionel Sambuc     if ((result = _taskcall(VM_PROC_NR, VM_INFO, &m)) != OK)
53*433d6423SLionel Sambuc         return result;
54*433d6423SLionel Sambuc 
55*433d6423SLionel Sambuc     *next = m.m_lsys_vm_info.next;
56*433d6423SLionel Sambuc     return m.m_lsys_vm_info.count;
57*433d6423SLionel Sambuc }
58*433d6423SLionel Sambuc 
59