VM: simplify slab allocator
[minix.git] / lib / libminlib / vm_query_exit.c
blobdf109dde2a6eb69b7a282c56b81540a9f98e46ba
1 #define _SYSTEM 1
2 #include <lib.h>
3 #include <unistd.h>
4 #include <string.h>
6 /* return -1, when the query itself or the processing of query has errors.
7 * return 1, when there are more processes waiting to be queried.
8 * return 0, when there are no more processes.
9 * note that for the return value of 0 and 1, the 'endpt' is set accordingly.
11 int vm_query_exit(int *endpt)
13 message m;
14 int r;
16 r = _syscall(VM_PROC_NR, VM_QUERY_EXIT, &m);
17 if (r != OK)
18 return -1;
19 if (endpt == NULL)
20 return -1;
22 *endpt = m.VM_QUERY_RET_PT;
23 return (m.VM_QUERY_IS_MORE ? 1 : 0);
26 int vm_watch_exit(endpoint_t ep)
28 message m;
30 memset(&m, 0, sizeof(m));
31 m.VM_WE_EP = ep;
32 return _syscall(VM_PROC_NR, VM_WATCH_EXIT, &m);