minix/lib/libsys/vm_info.c

59 lines
1.6 KiB
C
Raw Normal View History

2010-01-19 22:00:20 +01:00
#include "syslib.h"
#include <string.h>
2010-01-19 22:00:20 +01:00
#include <minix/vm.h>
/*===========================================================================*
* vm_info_stats *
*===========================================================================*/
2012-03-25 20:25:53 +02:00
int vm_info_stats(struct vm_stats_info *vsi)
2010-01-19 22:00:20 +01:00
{
message m;
memset(&m, 0, sizeof(m));
2014-07-26 13:53:48 +02:00
m.m_lsys_vm_info.what = VMIW_STATS;
m.m_lsys_vm_info.ptr = vsi;
2010-01-19 22:00:20 +01:00
return _taskcall(VM_PROC_NR, VM_INFO, &m);
}
/*===========================================================================*
* vm_info_usage *
*===========================================================================*/
2012-03-25 20:25:53 +02:00
int vm_info_usage(endpoint_t who, struct vm_usage_info *vui)
2010-01-19 22:00:20 +01:00
{
message m;
memset(&m, 0, sizeof(m));
2014-07-26 13:53:48 +02:00
m.m_lsys_vm_info.what = VMIW_USAGE;
m.m_lsys_vm_info.ep = who;
m.m_lsys_vm_info.ptr = vui;
2010-01-19 22:00:20 +01:00
return _taskcall(VM_PROC_NR, VM_INFO, &m);
}
/*===========================================================================*
* vm_info_region *
*===========================================================================*/
2012-03-25 20:25:53 +02:00
int vm_info_region(endpoint_t who, struct vm_region_info *vri,
2010-01-19 22:00:20 +01:00
int count, vir_bytes *next)
{
message m;
int result;
memset(&m, 0, sizeof(m));
2014-07-26 13:53:48 +02:00
m.m_lsys_vm_info.what = VMIW_REGION;
m.m_lsys_vm_info.ep = who;
m.m_lsys_vm_info.count = count;
m.m_lsys_vm_info.ptr = vri;
m.m_lsys_vm_info.next = *next;
2010-01-19 22:00:20 +01:00
if ((result = _taskcall(VM_PROC_NR, VM_INFO, &m)) != OK)
return result;
2014-07-26 13:53:48 +02:00
*next = m.m_lsys_vm_info.next;
return m.m_lsys_vm_info.count;
2010-01-19 22:00:20 +01:00
}