make vfs & filesystems use failable copying
[minix3.git] / lib / libsys / vm_info.c
blob591d3b267d6a7699f84f9d2aacd0bcec258c3092
2 #include "syslib.h"
4 #include <string.h>
5 #include <minix/vm.h>
7 /*===========================================================================*
8 * vm_info_stats *
9 *===========================================================================*/
10 int vm_info_stats(struct vm_stats_info *vsi)
12 message m;
14 memset(&m, 0, sizeof(m));
15 m.VMI_WHAT = VMIW_STATS;
16 m.VMI_PTR = (void *) vsi;
18 return _taskcall(VM_PROC_NR, VM_INFO, &m);
21 /*===========================================================================*
22 * vm_info_usage *
23 *===========================================================================*/
24 int vm_info_usage(endpoint_t who, struct vm_usage_info *vui)
26 message m;
28 memset(&m, 0, sizeof(m));
29 m.VMI_WHAT = VMIW_USAGE;
30 m.VMI_EP = who;
31 m.VMI_PTR = (void *) vui;
33 return _taskcall(VM_PROC_NR, VM_INFO, &m);
36 /*===========================================================================*
37 * vm_info_region *
38 *===========================================================================*/
39 int vm_info_region(endpoint_t who, struct vm_region_info *vri,
40 int count, vir_bytes *next)
42 message m;
43 int result;
45 memset(&m, 0, sizeof(m));
46 m.VMI_WHAT = VMIW_REGION;
47 m.VMI_EP = who;
48 m.VMI_COUNT = count;
49 m.VMI_PTR = (void *) vri;
50 m.VMI_NEXT = *next;
52 if ((result = _taskcall(VM_PROC_NR, VM_INFO, &m)) != OK)
53 return result;
55 *next = m.VMI_NEXT;
56 return m.VMI_COUNT;