minix/lib/nbsd_libminlib/vm_query_exit.c
Gianluca Guida 878ba523ac Add libminlib for NBSD libc compilation.
This library includes various random and minix-specific functions
included in the Minix libc. Most of them should be part of libsys,
and in general it would be nice to extinguish this library over
time.
2011-03-22 13:47:35 +00:00

23 lines
562 B
C

#define _SYSTEM 1
#include <lib.h>
#include <unistd.h>
/* return -1, when the query itself or the processing of query has errors.
* return 1, when there are more processes waiting to be queried.
* return 0, when there are no more processes.
* note that for the return value of 0 and 1, the 'endpt' is set accordingly.
*/
PUBLIC int vm_query_exit(int *endpt)
{
message m;
int r;
r = _syscall(VM_PROC_NR, VM_QUERY_EXIT, &m);
if (r != OK)
return -1;
if (endpt == NULL)
return -1;
*endpt = m.VM_QUERY_RET_PT;
return (m.VM_QUERY_IS_MORE ? 1 : 0);
}