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

1998/0306/ip/netlog.c (diff list | history)

1997/1104/sys/src/9/ip/netlog.c:7,131998/0306/sys/src/9/ip/netlog.c:7,14 (short | long | prev | next)
1997/0327    
#include	"../ip/ip.h" 
 
int logmask;				/* mask of things to debug */ 
Ipaddr iponly;				/* ip address to print debugging for */ 
1998/0306    
uchar iponly[IPaddrlen];		/* ip address to print debugging for */ 
int iponlyset; 
1997/0327    
 
enum { 
	Nlog		= 4*1024, 
1997/1104/sys/src/9/ip/netlog.c:62,721998/0306/sys/src/9/ip/netlog.c:63,70
1997/0327    
		nexterror(); 
	} 
	if(alog.opens == 0){ 
1997/1104    
		if(alog.buf == nil){ 
1998/0306    
		if(alog.buf == nil) 
1997/0327    
			alog.buf = malloc(Nlog); 
1997/1104    
			if(alog.buf == nil) 
				error(Enomem); 
		} 
1997/0327    
		alog.rptr = alog.buf; 
		alog.end = alog.buf + Nlog; 
	} 
1997/1104/sys/src/9/ip/netlog.c:175,1811998/0306/sys/src/9/ip/netlog.c:173,183
1997/0327    
	else if(strcmp("clear", fields[0]) == 0) 
		set = 0; 
	else if(strcmp("only", fields[0]) == 0){ 
		iponly = parseip(addr, fields[1]); 
1998/0306    
		parseip(iponly, fields[1]); 
		if(ipcmp(iponly, IPnoaddr) == 0) 
			iponlyset = 0; 
		else 
			iponlyset = 1; 
1997/0327    
		return nil; 
	} else 
		return Ebadnetctl; 
1997/1104/sys/src/9/ip/netlog.c:206,2171998/0306/sys/src/9/ip/netlog.c:208,221
1997/0327    
	int i, n; 
	va_list arg; 
 
	if(alog.opens == 0 || !(logmask & mask)) 
1998/0306    
	if(!(logmask & mask)) 
1997/0327    
		return; 
 
	va_start(arg, fmt); 
	n = doprint(buf, buf+sizeof(buf), fmt, arg) - buf; 
	va_end(arg); 
1998/0306    
 
print("%s", buf); 
1997/0327    
 
	if(alog.opens == 0) 
		return; 


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