summaryrefslogtreecommitdiff
path: root/minix/lib/libsys/getsysinfo.c
blob: 8bdc1ec2694dceb577254fb4cd903566d70a25b3 (plain)
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

#include "syslib.h"

#include <string.h>
#include <minix/sysinfo.h>
#include <minix/com.h>

int getsysinfo(
  endpoint_t who,		/* from whom to request info */
  int what,			/* what information is requested */
  void *where,			/* where to put it */
  size_t size 			/* how big it should be */
)
{
  message m;
  int call_nr;

  switch (who) {
  case PM_PROC_NR: call_nr = PM_GETSYSINFO; break;
  case VFS_PROC_NR: call_nr = VFS_GETSYSINFO; break;
  case RS_PROC_NR: call_nr = RS_GETSYSINFO; break;
  case DS_PROC_NR: call_nr = DS_GETSYSINFO; break;
  default:
	return ENOSYS;
  }

  memset(&m, 0, sizeof(m));
  m.m_lsys_getsysinfo.what = what;
  m.m_lsys_getsysinfo.where = (vir_bytes)where;
  m.m_lsys_getsysinfo.size = size;
  return _taskcall(who, call_nr, &m);
}