~kris/9p

9hist

ref: fe5ddfbcfef70e14ffefd8f1ac37d04c63abddf2 9hist/port/streboot.c -rw-r--r-- 714 bytes
fe5ddfbc — David du Colombier Plan 9 from Bell Labs 1992-05-22 34 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include	"u.h"
#include	"../port/lib.h"
#include	"mem.h"
#include	"dat.h"
#include	"fns.h"
#include	"../port/error.h"

/*
 *  reboot stream module definition
 */
static void rebootopen(Queue*, Stream*);
static void rebootiput(Queue*, Block*);
static void rebootoput(Queue*, Block*);
static void rebootreset(void);
Qinfo rebootinfo =
{
	rebootiput,
	rebootoput,
	rebootopen,
	0,
	"reboot",
	0
};

static void
rebootopen(Queue *q, Stream *s)
{
	USED(q);
	if(strcmp(u->p->user, eve) != 0)
		error(Eperm);
}

void
rebootoput(Queue *q, Block *bp)
{
	PUTNEXT(q, bp);
}

static void
rebootiput(Queue *q, Block *bp)
{
	if(bp->type == M_HANGUP){
		print("lost connection to fs, rebooting");
		exit();
	}
	PUTNEXT(q, bp);
}