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

/* freebuf.c - freebuf */

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

/*------------------------------------------------------------------------
 *  freebuf  --  free a buffer that was allocated from a pool by getbuf
 *------------------------------------------------------------------------
 */
freebuf(buf)
int *buf;
{
	int	poolid;

#ifdef	DEBUG
	dotrace("freebuf", &buf, 1);
#endif
#ifdef	MEMMARK
	if ( unmarked(bpmark) )
		return(SYSERR);
#endif
	poolid = *(--buf);
	if (poolid<0 || poolid>=nbpools) {
		kprintf("Bad poolid\n");
		regdump();
		return(SYSERR);
	}
	disable();
	*buf = bptab[poolid].bpnext;
	bptab[poolid].bpnext = buf;
	restore();
	signal(bptab[poolid].bpsem);
	return(OK);
}

unix.superglobalmegacorp.com

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