|
|
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);
}
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.