custom message type for VM_QUERY_EXIT
[minix3.git] / lib / libsys / vm_query_exit.c
blob49d1334cf63923c0c91a2e39a494d85aa5a8c3ac
1 #include "syslib.h"
2 #include <unistd.h>
3 #include <string.h>
5 /*
6 * Return a negative error code if the query itself or the processing of the
7 * query resulted in an error.
8 * Return 1 if there are more processes waiting to be queried.
9 * Return 0 if there are no more processes.
10 * Note that for the return value of 0 and 1, the 'endpt' is set accordingly.
12 int
13 vm_query_exit(int *endpt)
15 message m;
16 int r;
18 memset(&m, 0, sizeof(m));
19 r = _taskcall(VM_PROC_NR, VM_QUERY_EXIT, &m);
20 if (r != OK)
21 return r;
22 if (endpt == NULL)
23 return EFAULT;
25 *endpt = m.m_lsys_vm_query_exit.ret_pt;
26 return (m.m_lsys_vm_query_exit.is_more ? 1 : 0);
29 int
30 vm_watch_exit(endpoint_t ep)
32 message m;
34 memset(&m, 0, sizeof(m));
35 m.VM_WE_EP = ep;
36 return _taskcall(VM_PROC_NR, VM_WATCH_EXIT, &m);