Subversion Repositories planix.SVN

Rev

Rev 2 | Details | Compare with Previous | 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
}