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

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

unix.superglobalmegacorp.com

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