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

/* getbuf.c - getbuf */

#include <conf.h>
#include <kernel.h>
#include <mark.h>
#include <bufpool.h>

/*------------------------------------------------------------------------
 *  getbuf  --  get a buffer from a preestablished buffer pool
 *------------------------------------------------------------------------
 */
char	*
getbuf(poolid)
int poolid;
{
	int	*buf;

#ifdef	DEBUG
	dotrace("getbuf", &poolid, 1);
#endif
#ifdef	MEMMARK
	if ( unmarked(bpmark) )
		return(SYSERR);
#endif
	if (poolid<0 || poolid>=nbpools)
		return(SYSERR);
	wait(bptab[poolid].bpsem);
	disable();
	buf = (int *)bptab[poolid].bpnext;
	bptab[poolid].bpnext = *buf;
	restore();
	*buf++ = poolid;
	return( (char *)buf );
}

unix.superglobalmegacorp.com

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