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

1991/0411/port/devcons.c (diff list | history)

1991/0403/sys/src/9/port/devcons.c:197,2101991/0411/sys/src/9/port/devcons.c:197,210 (short | long | prev | next)
1990/0321    
		return 0; 
1990/0227    
	n = sprint(buf, "%s %d: ", u->p->text, u->p->pid); 
1990/06111    
	n = doprint(buf+n, buf+sizeof(buf), fmt, (&fmt+1)) - buf; 
1990/0227    
	qlock(c); 
1991/0411    
	qlock(&c->wrl); 
1990/0227    
	if(waserror()){ 
		qunlock(c); 
1991/0411    
		qunlock(&c->wrl); 
1990/0321    
		return 0; 
1990/0227    
	} 
	(*devtab[c->type].write)(c, buf, n); 
1991/0411    
	(*devtab[c->type].write)(c, buf, n, c->offset); 
1990/0227    
	c->offset += n; 
	qunlock(c); 
1991/0411    
	qunlock(&c->wrl); 
1990/0321    
	poperror(); 
1990/0227    
	return n; 
} 
1991/0403/sys/src/9/port/devcons.c:435,4411991/0411/sys/src/9/port/devcons.c:435,441
1990/0227    
} 
 
long 
consread(Chan *c, void *buf, long n) 
1991/0411    
consread(Chan *c, void *buf, long n, ulong offset) 
1990/0227    
{ 
	int ch, i, j, k; 
	ulong l; 
1991/0403/sys/src/9/port/devcons.c:492,4981991/0411/sys/src/9/port/devcons.c:492,498
1990/0227    
		return i; 
 
	case Qcputime: 
1990/0312    
		k = c->offset; 
1991/0411    
		k = offset; 
1990/0312    
		if(k >= sizeof tmp) 
			return 0; 
1990/0227    
		if(k+n > sizeof tmp) 
1991/0403/sys/src/9/port/devcons.c:509,5301991/0411/sys/src/9/port/devcons.c:509,530
1990/0227    
		return n; 
 
	case Qpgrpid: 
		return readnum(c->offset, buf, n, u->p->pgrp->pgrpid, NUMSIZE); 
1991/0411    
		return readnum(offset, buf, n, u->p->pgrp->pgrpid, NUMSIZE); 
1990/0227    
 
	case Qpid: 
		return readnum(c->offset, buf, n, u->p->pid, NUMSIZE); 
1991/0411    
		return readnum(offset, buf, n, u->p->pid, NUMSIZE); 
1990/0227    
 
	case Qppid: 
		return readnum(c->offset, buf, n, u->p->parentpid, NUMSIZE); 
1991/0411    
		return readnum(offset, buf, n, u->p->parentpid, NUMSIZE); 
1990/0227    
 
	case Qtime: 
1990/0617    
		return readnum(c->offset, buf, n, boottime+TK2SEC(MACHP(0)->ticks), 12); 
1991/0411    
		return readnum(offset, buf, n, boottime+TK2SEC(MACHP(0)->ticks), 12); 
1990/0227    
 
	case Quser: 
		return readstr(c->offset, buf, n, u->p->pgrp->user); 
1991/0411    
		return readstr(offset, buf, n, u->p->pgrp->user); 
1990/0227    
 
1990/0720    
	case Qlog: 
		return readlog(c->offset, buf, n); 
1991/0411    
		return readlog(offset, buf, n); 
1990/0720    
 
1990/0227    
	case Qnull: 
		return 0; 
1991/0403/sys/src/9/port/devcons.c:536,5421991/0411/sys/src/9/port/devcons.c:536,542
1990/0227    
} 
 
long 
conswrite(Chan *c, void *va, long n) 
1991/0411    
conswrite(Chan *c, void *va, long n, ulong offset) 
1990/0227    
{ 
	char cbuf[64]; 
	char buf[256]; 
1991/0403/sys/src/9/port/devcons.c:573,5841991/0411/sys/src/9/port/devcons.c:573,584
1990/0227    
	case Quser: 
		if(u->p->pgrp->user[0])		/* trying to overwrite /dev/user */ 
1990/11211    
			error(Eperm); 
1990/0227    
		if(c->offset >= NAMELEN-1) 
1991/0411    
		if(offset >= NAMELEN-1) 
1990/0227    
			return 0; 
		if(c->offset+n >= NAMELEN-1) 
			n = NAMELEN-1 - c->offset; 
1991/0318    
		memmove(u->p->pgrp->user+c->offset, a, n); 
1990/0227    
		u->p->pgrp->user[c->offset+n] = 0; 
1991/0411    
		if(offset+n >= NAMELEN-1) 
			n = NAMELEN-1 - offset; 
		memmove(u->p->pgrp->user+offset, a, n); 
		u->p->pgrp->user[offset+n] = 0; 
1990/0227    
		break; 
 
	case Qcputime: 


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