Annotation of 42BSD/undoc/brktest.c, revision 1.1.1.1

1.1       root        1:        int     a[1000];
                      2: 
                      3: main()
                      4: {
                      5:        int     asize = 1000,i,inc = 0,new;
                      6: 
                      7:        srand(1);
                      8:        for (i = 0 ; i < asize ; i++)
                      9:                a[i] = i;
                     10:        while (1)  {
                     11:                new = rand() % 4000;
                     12:                if (((rand() % 1000) > 750) && ((asize - new) > 1000))
                     13:                        new = -new;
                     14:                for (i = 0 ;  i < asize ; i++ )
                     15:                        if (a[i] != i)
                     16:                                printf("bad a %x\n",i);
                     17:                        if (sbrk(4 * new) != -1)  {
                     18:                                if (new > 0)  {
                     19:                                        for (i = 0 ; i < new ; i++)
                     20:                                                a[asize + i] = asize + i;  }
                     21:                                asize += new;  }
                     22:                        else  {
                     23:                                new = 1000 - asize;
                     24:                                sbrk(4 * new);
                     25:                                asize += new;  }
                     26:                sleep((rand() % 4) + 1);  }
                     27: }

unix.superglobalmegacorp.com

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