Annotation of researchv9/cmd/sh/profile.c, revision 1.1

1.1     ! root        1: char *mktemp();
        !             2: 
        !             3: monitor(lowpc, highpc, buf, bufsiz, cntsiz)
        !             4: char *lowpc, *highpc;
        !             5: int *buf, bufsiz;
        !             6: {
        !             7:        register o;
        !             8:        static *sbuf, ssiz;
        !             9: 
        !            10:        if (lowpc == 0) {
        !            11:                profil(0, 0, 0, 0);
        !            12:                o = creat(mktemp("profXXXXXX"), 0666);
        !            13:                write(o, sbuf, ssiz<<1);
        !            14:                close(o);
        !            15:                return;
        !            16:        }
        !            17:        ssiz = bufsiz;
        !            18:        buf[0] = lowpc;
        !            19:        buf[1] = highpc;
        !            20:        buf[2] = cntsiz;
        !            21:        sbuf = buf;
        !            22:        buf += 3*(cntsiz+1);
        !            23:        bufsiz -= 3*(cntsiz+1);
        !            24:        if (bufsiz<=0)
        !            25:                return;
        !            26:        o = ((highpc - lowpc)>>1) & 077777;
        !            27:        if(bufsiz < o)
        !            28:                o = ((long)bufsiz<<15) / o;
        !            29:        else
        !            30:                o = 077777;
        !            31:        profil(buf, bufsiz<<1, lowpc, o<<1);
        !            32: }

unix.superglobalmegacorp.com

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