plan 9 kernel history: overview | file list | diff list

1993/0525/boot/boot.c (diff list | history)

1993/0501/sys/src/9/boot/boot.c:25,301993/0525/sys/src/9/boot/boot.c:25,75 (short | long | prev | next)
1992/0530    
static Method	*rootserver(char*); 
1992/0317    
 
void 
1993/0525    
ethertest(void) 
{ 
	int cf, df, n, t; 
	char buf[64]; 
	struct Etherpkt 
	{ 
		uchar	d[6]; 
		uchar	s[6]; 
		uchar	type[2]; 
	} p; 
 
	cf = open("#l/ether/clone", ORDWR); 
	if(cf < 0){ 
		print("can't open #l/ether/clone: %r\n"); 
		exits(0); 
	} 
	n = read(cf, buf, 12); 
	if(n < 0){ 
		print("can't read #l/ether/clone: %r\n"); 
		exits(0); 
	} 
	buf[n] = 0; 
	sprint(buf, "#l/ether/%d/data", atoi(buf)); 
	df = open(buf, ORDWR); 
	if(df < 0){ 
		print("can't open %s: %r\n", buf); 
		exits(0); 
	} 
	if(write(cf, "connect -1", sizeof("connect -1")-1) < 0){ 
		print("can't connect -1: %r\n"); 
		exits(0); 
	} 
	close(cf); 
	for(;;){ 
		n = read(df, &p, sizeof(p)); 
		if(n <= 0){ 
			print("read returns %d: %r\n", n); 
			continue; 
		} 
		t = (p.type[0]<<8) | p.type[1]; 
		print("%d %2.2ux%2.2ux%2.2ux%2.2ux%2.2ux%2.2ux -> %2.2ux%2.2ux%2.2ux%2.2ux%2.2ux%2.2ux %ux\n", n, p.s[0], p.s[1], p.s[2], p.s[3], p.s[4], p.s[5], p.d[0], p.d[1], p.d[2], p.d[3], p.d[4], p.d[5], t); 
	} 
} 
 
void 
1992/0522    
boot(int argc, char *argv[]) 
1992/0317    
{ 
	int fd; 
1993/0501/sys/src/9/boot/boot.c:38,471993/0525/sys/src/9/boot/boot.c:83,94
1992/0317    
	open("#c/cons", OREAD); 
	open("#c/cons", OWRITE); 
	open("#c/cons", OWRITE); 
1992/0814    
/*	print("argc=%d\n", argc); 
1993/0525    
	print("argc=%d\n", argc); 
1992/0813    
	for(fd = 0; fd < argc; fd++) 
1992/0610    
		print("%s ", argv[fd]); 
	print("\n");/**/ 
1993/0525    
 
	ethertest(); 
1992/0610    
 
1992/1021    
	if(argc <= 1) 
		pflag = 1; 


source code copyright © 1990-2005 Lucent Technologies; see license
Plan 9 distribution
comments to russ cox (rsc@swtch.com)