some coverity fixes.
[minix.git] / lib / libc / sys-minix / getppid.c
blob61bd275f4d0ab79cc5050c4be70786da4a6adfbe
1 #include <sys/cdefs.h>
2 #include "namespace.h"
3 #include <lib.h>
5 #include <unistd.h>
7 #ifdef __weak_alias
8 __weak_alias(getppid, _getppid)
9 #endif
11 pid_t getppid()
13 message m;
15 /* POSIX says that this function is always successful and that no
16 * return value is reserved to indicate an error. Minix syscalls
17 * are not always successful and Minix returns the reserved value
18 * (pid_t) -1 when there is an error.
20 if (_syscall(PM_PROC_NR, MINIX_GETPID, &m) < 0) return ( (pid_t) -1);
21 return( (pid_t) m.m2_i1);