minix/lib/nbsd_libminlib/getnprocnr.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

14 lines
313 B
C

#include <lib.h>
#include <unistd.h>
PUBLIC int getnprocnr(pid_t pid)
{
message m;
int t = GETPROCNR;
m.m1_i1 = pid; /* pass pid >=0 to search for */
m.m1_i2 = 0; /* don't pass name to search for */
if (_syscall(PM_PROC_NR, t, &m) < 0) return(-1);
return(m.m1_i1); /* return search result */
}