Annotation of coherent/d/lib/libc/gen/malloc/memok.c, revision 1.1.1.1

1.1       root        1: /*
                      2:  * memok.c
                      3:  * Test for corruption of malloc arena.
                      4:  */
                      5: 
                      6: #include <stdio.h>
                      7: #include <sys/malloc.h>
                      8: 
                      9: /*
                     10:  * memok() returns 1 if memory is ok,
                     11:  * 0 if it is corrupted.
                     12:  */
                     13: int
                     14: memok()
                     15: {
                     16:        register MBLOCK *mp;
                     17:        unsigned counter, flag, len;
                     18: 
                     19:        if (NULL == (mp = __a_first))
                     20:                return ((NULL == __a_scanp) && !__a_count);
                     21:        flag = 0;
                     22:        for (counter = __a_count; counter--; ) {
                     23:                if (mp == __a_scanp)
                     24:                        flag++;
                     25:                mp = (len = realsize(mp->blksize)) ? bumpp(mp, len) : mp->uval.next;
                     26:        }
                     27:        return ((1 == flag) && (mp == __a_first));
                     28: }

unix.superglobalmegacorp.com

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