etc/services - sync with NetBSD-8
[minix.git] / minix / lib / libc / sys / getppid.c
blobb3c58bdb02260115f8628f850a304037bd02ff3d
1 #include <sys/cdefs.h>
2 #include "namespace.h"
3 #include <lib.h>
5 #include <string.h>
6 #include <unistd.h>
8 pid_t getppid(void)
10 message m;
12 memset(&m, 0, sizeof(m));
13 /* POSIX says that this function is always successful and that no
14 * return value is reserved to indicate an error. Minix syscalls
15 * are not always successful and Minix returns the reserved value
16 * (pid_t) -1 when there is an error.
18 if (_syscall(PM_PROC_NR, PM_GETPID, &m) < 0) return(-1);
19 return(m.m_pm_lc_getpid.parent_pid);