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/getpgrp.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 <stdio.h>
8
#include "sys9.h"
9
#include "lib.h"
10
 
11
pid_t
12
getpgrp(void)
13
{
14
	int n, f, pid;
15
	char pgrpbuf[15], fname[30];
16
 
17
	pid = getpid();
18
	sprintf(fname, "/proc/%d/noteid", pid);
19
	f = open(fname, 0);
20
	n = read(f, pgrpbuf, sizeof pgrpbuf);
21
	if(n < 0)
22
		_syserrno();
23
	else
24
		n = atoi(pgrpbuf);
25
	close(f);
26
	return n;
27
}