summaryrefslogtreecommitdiff
path: root/sys/src/libc/9sys/getppid.c
blob: b90b57ee5ffdff5a604f22c09e0dcc8b2c498765 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include	<u.h>
#include	<libc.h>

int
getppid(void)
{
	char b[20];
	int f;

	memset(b, 0, sizeof(b));
	f = open("/dev/ppid", 0);
	if(f >= 0) {
		read(f, b, sizeof(b));
		close(f);
	}
	return atol(b);
}