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

1.1     ! root        1: /* mark.c - _mkinit, mark */
        !             2: 
        !             3: #include <conf.h>
        !             4: #include <kernel.h>
        !             5: #include <mark.h>
        !             6: 
        !             7: #ifdef MEMMARK
        !             8: int    *marks[MAXMARK];
        !             9: int    nmarks;
        !            10: int    mkmutex;
        !            11: 
        !            12: /*------------------------------------------------------------------------
        !            13:  *  _mkinit  --  called once at system startup
        !            14:  *------------------------------------------------------------------------
        !            15:  */
        !            16: _mkinit()
        !            17: {
        !            18:        mkmutex = screate(1);
        !            19:        nmarks = 0;
        !            20: }
        !            21: 
        !            22: 
        !            23: 
        !            24: /*------------------------------------------------------------------------
        !            25:  *  mark  --  mark a location if it hasn't been marked
        !            26:  *------------------------------------------------------------------------
        !            27:  */
        !            28: SYSCALL        mark(loc)
        !            29: int    *loc;
        !            30: {
        !            31:        if ( *loc>=0 && *loc<nmarks && marks[*loc]==loc )
        !            32:                return(0);
        !            33:        if (nmarks>=MAXMARK)
        !            34:                return(SYSERR);
        !            35:        wait(mkmutex);
        !            36:        marks[ (*loc) = nmarks++] = loc;
        !            37:        signal(mkmutex);
        !            38:        return(OK);
        !            39: }
        !            40: #endif

unix.superglobalmegacorp.com

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