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

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

unix.superglobalmegacorp.com

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