File:  [XINU] / xinu / sys / dlcread.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 17:39:47 2018 UTC (8 years, 2 months ago) by root
Branches: xinu, MAIN
CVS tags: xinu-19910600, HEAD
Xinu for 68000/68010

/* dlcread.c - dlcread */

#include <conf.h>
#include <kernel.h>
#include <slu11.h>
#include <proc.h>
#include <sleep.h>
#include <dlc.h>

/*------------------------------------------------------------------------
 *  dlcread  --  read a block (frame) to user's buffer, unstuffing chars
 *------------------------------------------------------------------------
 */
dlcread(devptr, buf, maxchars)
struct	devsw	*devptr;
char	*buf;
int	maxchars;
{
	char	ps;
	int	nread;
	struct	dlblk	*dptr;

	disable(ps);
	if (maxchars<=0 || (dptr=devptr->dvioblk)->distate != DLIINIT) {
		restore(ps);
		return(SYSERR);
	}
	dptr->distate = DLIREADY;
	dptr->dinext = dptr->distart = buf;
	dptr->dimax = maxchars;
	dptr->dicount = 0;
	dptr->diesc = FALSE;
	dptr->diproc = currpid;
	suspend(currpid);
	nread = dptr->dicount;
	dptr->distate = DLIINIT;
	restore(ps);
	return(nread);
}

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.