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

1990/0707/port/devdk.c (diff list | history)

1990/0617/sys/src/9/port/devdk.c:123,1281990/0707/sys/src/9/port/devdk.c:123,129 (short | long | prev | next)
1990/0312    
	int	ncsc;		/* csc line number */ 
	Chan	*csc;		/* common signalling line */ 
	Line	line[Nline]; 
1990/0707    
	int	restart; 
1990/0312    
}; 
static Dk dk[Ndk]; 
 
1990/0617/sys/src/9/port/devdk.c:427,4361990/0707/sys/src/9/port/devdk.c:428,438
1990/0312    
} 
 
/* 
 *  configure a datakit multiplexor.  this takes 3 arguments separated 
1990/0707    
 *  configure a datakit multiplexor.  this takes 4 arguments separated 
1990/0312    
 *  by spaces: 
 *	the line number of the common signalling channel (must be > 0) 
 *	the number of lines in the device (optional) 
1990/0707    
 *	the word `restart' or `norestart' (optional/default==restart) 
1990/0312    
 *	the name of the dk (optional) 
 * 
 *  we can configure only once 
1990/0617/sys/src/9/port/devdk.c:439,4451990/0707/sys/src/9/port/devdk.c:441,447
1990/0312    
dkmuxconfig(Dk *dp, Block *bp) 
{ 
	Chan *c; 
	char *fields[3]; 
1990/0707    
	char *fields[4]; 
1990/0312    
	int n; 
	char buf[64]; 
	static int dktimeron; 
1990/0617/sys/src/9/port/devdk.c:452,4611990/0707/sys/src/9/port/devdk.c:454,467
1990/0312    
	/* 
	 *  parse 
	 */ 
	n = getfields((char *)bp->rptr, fields, 3, ' '); 
1990/0707    
	dp->restart = 1; 
	n = getfields((char *)bp->rptr, fields, 4, ' '); 
1990/0312    
	switch(n){ 
1990/0707    
	case 4: 
		strncpy(dp->name, fields[3], sizeof(dp->name)); 
1990/0312    
	case 3: 
		strncpy(dp->name, fields[2], sizeof(dp->name)); 
1990/0707    
		if(strcmp(fields[2], "restart")!=0) 
			dp->restart = 0; 
1990/0312    
	case 2: 
		dp->lines = strtoul(fields[1], 0, 0); 
	case 1: 
1990/0617/sys/src/9/port/devdk.c:893,8981990/0707/sys/src/9/port/devdk.c:899,905
1990/0312    
	Dk *dp; 
	Line *lp; 
	Chan *dc; 
1990/0707    
	char *bang, *dot; 
1990/0312    
 
	line = STREAMID(c->qid); 
	dp = &dk[c->dev]; 
1990/0617/sys/src/9/port/devdk.c:907,9131990/0707/sys/src/9/port/devdk.c:914,922
1990/0312    
	DPRINT("dkcall(line=%d, type=%d, dest=%s)\n", line, type, addr); 
 
	/* 
	 *  build dial string (guard against new lines) 
1990/0707    
	 *  build dial string 
	 *	- guard against new lines 
	 *	- change ! into . to delimit service 
1990/0312    
	 */ 
	if(strchr(addr, '\n')) 
		error(0, Ebadarg); 
1990/0617/sys/src/9/port/devdk.c:914,9191990/0707/sys/src/9/port/devdk.c:923,934
1990/0312    
	if(strlen(addr)+strlen(u->p->pgrp->user)+2 >= sizeof(dialstr)) 
		error(0, Ebadarg); 
	strcpy(dialstr, addr); 
1990/0707    
	bang = strchr(dialstr, '!'); 
	if(bang){ 
		dot = strchr(dialstr, '.'); 
		if(dot==0 || dot > bang) 
			*bang = '.'; 
	} 
1990/0312    
	switch(type){ 
	case Dial: 
		t_val = T_SRV; 
1990/0617/sys/src/9/port/devdk.c:1296,13021990/0707/sys/src/9/port/devdk.c:1311,1318
1990/0617    
	/* 
	 *  tell datakit we've rebooted. It should close all channels. 
	 */ 
	dkmesg(dp, T_ALIVE, D_RESTART, 0, 0);	/* do this on mips but not 68020 */ 
1990/0707    
	if(dp->restart) 
		dkmesg(dp, T_ALIVE, D_RESTART, 0, 0); 
1990/0617    
	dkmesg(dp, T_CHG, D_CLOSEALL, 0, 0); 
1990/0312    
 
	/* 


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