Annotation of xinu/sys/mkpool.c, revision 1.1

1.1     ! root        1: /* mkpool.c - mkpool */
        !             2: 
        !             3: #include <conf.h>
        !             4: #include <kernel.h>
        !             5: #include <mark.h>
        !             6: #include <bufpool.h>
        !             7: 
        !             8: /*------------------------------------------------------------------------
        !             9:  *  mkpool  --  allocate memory for a buffer pool and link together
        !            10:  *------------------------------------------------------------------------
        !            11:  */
        !            12: SYSCALL        mkpool(bufsiz, numbufs)
        !            13: int    bufsiz, numbufs;
        !            14: {
        !            15:        PStype  ps;
        !            16:        int     poolid;
        !            17:        char    *where;
        !            18: 
        !            19: #ifdef MEMMARK
        !            20:        if ( unmarked(bpmark) )
        !            21:                poolinit();
        !            22: #endif
        !            23:        disable(ps);
        !            24:        if (bufsiz<BPMINB || bufsiz>BPMAXB
        !            25:            || numbufs<1 || numbufs>BPMAXN
        !            26:            || nbpools >= NBPOOLS
        !            27:            || (where=(char *)getmem((bufsiz+sizeof(int))*numbufs))
        !            28:                    == (char *)SYSERR) {
        !            29:                restore(ps);
        !            30:                return(SYSERR);
        !            31:        }
        !            32:        poolid = nbpools++;
        !            33:        bptab[poolid].bpnext = where;
        !            34:        bptab[poolid].bpsize = bufsiz;
        !            35:        bptab[poolid].bpsem = screate(numbufs);
        !            36:        bufsiz+=sizeof(int);
        !            37:        for (numbufs-- ; numbufs>0 ; numbufs--,where+=bufsiz)
        !            38:                *( (int *) where ) = (int)(where+bufsiz);
        !            39:        *( (int *) where) = (int) NULL;
        !            40:        restore(ps);
        !            41:        return(poolid);
        !            42: }

unix.superglobalmegacorp.com

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