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_fixcpp/sys/src/ape/lib/ap/plan9/getpid.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 "lib.h"
2
#include <sys/stat.h>
3
#include <stdlib.h>
4
#include <unistd.h>
5
#include <errno.h>
6
#include "sys9.h"
7
 
8
pid_t
9
getpid(void)
10
{
11
	int n, f;
12
	char pidbuf[15];
13
 
14
	f = _OPEN("#c/pid", 0);
15
	n = _READ(f, pidbuf, sizeof pidbuf);
16
	if(n < 0)
17
		_syserrno();
18
	else
19
		n = atoi(pidbuf);
20
	_CLOSE(f);
21
	return n;
22
}