Warning: Attempt to read property "date" on null in /usr/local/www/websvn.planix.org/blame.php on line 247

Warning: Attempt to read property "msg" on null in /usr/local/www/websvn.planix.org/blame.php on line 247
WebSVN – planix.SVN – Blame – /os/branches/feature_tlsv12/sys/src/ape/lib/ap/plan9/getppid.c – Rev 2

Subversion Repositories planix.SVN

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
#include <sys/types.h>
2
#include <sys/stat.h>
3
#include <fcntl.h>
4
#include <stdlib.h>
5
#include <unistd.h>
6
#include <errno.h>
7
#include "sys9.h"
8
 
9
pid_t
10
getppid(void)
11
{
12
	int n, f;
13
	char ppidbuf[15];
14
 
15
	f = open("#c/ppid", 0);
16
	n = read(f, ppidbuf, sizeof ppidbuf);
17
	if(n < 0)
18
		errno = EINVAL;
19
	else
20
		n = atoi(ppidbuf);
21
	close(f);
22
	return n;
23
}