Annotation of xinu/sys/freebuf.c, revision 1.1.1.2

1.1       root        1: /* freebuf.c - freebuf */
                      2: 
                      3: #include <conf.h>
                      4: #include <kernel.h>
                      5: #include <mark.h>
                      6: #include <bufpool.h>
                      7: 
                      8: /*------------------------------------------------------------------------
                      9:  *  freebuf  --  free a buffer that was allocated from a pool by getbuf
                     10:  *------------------------------------------------------------------------
                     11:  */
1.1.1.2 ! root       12: freebuf(buf)
1.1       root       13: int *buf;
                     14: {
                     15:        int     poolid;
                     16: 
1.1.1.2 ! root       17: #ifdef DEBUG
        !            18:        dotrace("freebuf", &buf, 1);
        !            19: #endif
1.1       root       20: #ifdef MEMMARK
                     21:        if ( unmarked(bpmark) )
                     22:                return(SYSERR);
                     23: #endif
                     24:        poolid = *(--buf);
1.1.1.2 ! root       25:        if (poolid<0 || poolid>=nbpools) {
        !            26:                kprintf("Bad poolid\n");
        !            27:                regdump();
1.1       root       28:                return(SYSERR);
1.1.1.2 ! root       29:        }
        !            30:        disable();
        !            31:        *buf = bptab[poolid].bpnext;
        !            32:        bptab[poolid].bpnext = buf;
        !            33:        restore();
1.1       root       34:        signal(bptab[poolid].bpsem);
                     35:        return(OK);
                     36: }

unix.superglobalmegacorp.com

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