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/libc/9sys/postnote.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 <u.h>
2
#include <libc.h>
3
 
4
int
5
postnote(int group, int pid, char *note)
6
{
7
	char file[128];
8
	int f, r;
9
 
10
	switch(group) {
11
	case PNPROC:
12
		sprint(file, "/proc/%d/note", pid);
13
		break;
14
	case PNGROUP:
15
		sprint(file, "/proc/%d/notepg", pid);
16
		break;
17
	default:
18
		return -1;
19
	}
20
 
21
	f = open(file, OWRITE);
22
	if(f < 0)
23
		return -1;
24
 
25
	r = strlen(note);
26
	if(write(f, note, r) != r) {
27
		close(f);
28
		return -1;
29
	}
30
	close(f);
31
	return 0;
32
}