Annotation of Net2/tests/benchmarks/signocsw.c, revision 1.1

1.1     ! root        1: /*
        !             2:  * Signal without context switch benchmark.
        !             3:  */
        !             4: #include <signal.h>
        !             5: 
        !             6: int    pid;
        !             7: int    nsigs;
        !             8: int    sigsub();
        !             9: 
        !            10: main(argc, argv)
        !            11:        char *argv[];
        !            12: {
        !            13:        register int i;
        !            14: 
        !            15:        if (argc < 2) {
        !            16:                printf("usage: %s nsignals\n", argv[0]);
        !            17:                exit(1);
        !            18:        }
        !            19:        nsigs = atoi(argv[1]);
        !            20:        signal(SIGALRM, sigsub);
        !            21:        pid = getpid();
        !            22:        for (i = 0; i < nsigs; i++)
        !            23:                kill(pid, SIGALRM);
        !            24: }
        !            25: 
        !            26: sigsub()
        !            27: {
        !            28:        static mustreset = 1;
        !            29:        int (*osig)();
        !            30: 
        !            31:        if (mustreset) {
        !            32:                osig = signal(SIGALRM, sigsub);
        !            33:                if (osig == sigsub)
        !            34:                        mustreset = 0;
        !            35:        }
        !            36: }

unix.superglobalmegacorp.com

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