Plan 9 from Bell Labs’s /usr/web/sources/extra/9hist/boot/nopsession.c

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


## diffname boot/nopsession.c 1992/0318
## diff -e /dev/null /n/bootesdump/1992/0318/sys/src/9/boot/nopsession.c
0a
#include <u.h>
#include <libc.h>
#include <fcall.h>
#include "../boot/boot.h"

static Fcall	hdr;
static char	buf[4*1024];

void
nop(int fd)
{
	long n;

	print("nop...");
	hdr.type = Tnop;
	hdr.tag = NOTAG;
	n = convS2M(&hdr, buf);
	if(write(fd, buf, n) != n)
		fatal("write nop");
	n = read(fd, buf, sizeof buf);
	if(n==2 && buf[0]=='O' && buf[1]=='K')
		n = read(fd, buf, sizeof buf);
	if(n <= 0)
		fatal("read nop");
	if(convM2S(buf, &hdr, n) == 0) {
		print("n = %d; buf = %#.2x %#.2x %#.2x %#.2x\n",
			n, buf[0], buf[1], buf[2], buf[3]);
		fatal("format nop");
	}
	if(hdr.type != Rnop)
		fatal("not Rnop");
}

void
session(int fd)
{
	long n;

	print("session...");
	hdr.type = Tsession;
	hdr.tag = NOTAG;
	n = convS2M(&hdr, buf);
	if(write(fd, buf, n) != n)
		fatal("write session");
	n = read(fd, buf, sizeof buf);
	if(n <= 0)
		fatal("read session");
	if(convM2S(buf, &hdr, n) == 0)
		fatal("format session");
	if(hdr.type == Rerror){
		print("error %s;", hdr.ename);
		fatal(hdr.ename);
	}
	if(hdr.type != Rsession)
		fatal("not Rsession");
}
.
## diffname boot/nopsession.c 1992/0319
## diff -e /n/bootesdump/1992/0318/sys/src/9/boot/nopsession.c /n/bootesdump/1992/0319/sys/src/9/boot/nopsession.c
39,55c
void
session(int fd)
{
	print("session");
	rpc(fd, Tsession);
.
37c
	print("nop");
	rpc(fd, Tnop);
}
.
35c
nop(int fd)
.
30,31c
	if(convM2S(buf, &hdr, n) == 0){
		print("%ux %ux %ux\n", buf[0], buf[1], buf[2]);
		fatal("rpc format");
	}
	if(hdr.tag != NOTAG)
		fatal("rpc tag not NOTAG");
	if(hdr.type == Rerror){
		print("error %s;", hdr.ename);
		fatal("remote error");
	}
	if(hdr.type != type+1)
		fatal("not reply");
.
19,28c
		fatal("write rpc");

	print("...");
	p = buf;
	l = 0;
	while(l < 3) {
		n = read(fd, p, 3);
		if(n <= 0)
			fatal("read rpc");
		if(n == 2 && l == 0 && buf[0] == 'O' && buf[1] == 'K')
			continue;
		p += n;
		l += n;
.
14,15c
	hdr.type = type;
.
12c
	int n, l;
	char buf[128], *p;
.
9,10c
static void
rpc(int fd, int type)
.
7d
## diffname boot/nopsession.c 1993/0330
## diff -e /n/bootesdump/1992/0319/sys/src/9/boot/nopsession.c /n/bootesdump/1993/0330/sys/src/9/boot/nopsession.c
51,57d
2a
#include <auth.h>
.
## diffname boot/nopsession.c 2001/0527
## diff -e /n/bootesdump/1993/0330/sys/src/9/boot/nopsession.c /n/emeliedump/2001/0527/sys/src/9/boot/nopsession.c
6a
/*BUG transition*/
int client9p=2;
int kernel9p=2;
.
## diffname boot/nopsession.c 2002/0115
## diff -e /n/emeliedump/2001/0527/sys/src/9/boot/nopsession.c /n/emeliedump/2002/0115/sys/src/9/boot/nopsession.c
7,9d

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.