Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!spool.mu.edu!news.nd.edu!mentor.cc.purdue.edu!mace.cc.purdue.edu!abe From: abe@mace.cc.purdue.edu (Vic Abell) Newsgroups: comp.unix.aix Subject: Does SIGXCPU work under AIX 3.1? Message-ID: <6893@mace.cc.purdue.edu> Date: 26 Feb 91 14:26:54 GMT Organization: Purdue University Lines: 51 The attached test program works under BSD 4.3-Tahoe, Ultrix 2.2, SunOS 4.0.3, NeXTOS 1.0 and DYNIX 3.0.12. It doesn't work under AIX 3.1 (3003). What else do I need do to limit CPU time? Csh's "limit cputime nnn" command doesn't seem to work, either. Vic Abell #include #include #include #define TIMEOUT 20 #define NEWLIM 1 void cpulim() { (void) fprintf(stderr, "CPU time limit signal received\n"); exit(0); } void timeout() { (void) fprintf(stderr, "%d second alarm rang\n", TIMEOUT); exit(1); } main() { struct rlimit r; if (getrlimit(RLIMIT_CPU, &r) != 0) { perror("getrlimit(RLIMIT_CPU)"); exit(1); } (void) fprintf(stderr, "current (soft) RLIMIT_CPU = %d\n", r.rlim_cur); r.rlim_cur = NEWLIM; if (setrlimit(RLIMIT_CPU, &r) != 0) { perror("setrlimit(RLIMIT_CPU)"); exit(1); } (void) fprintf(stderr, "new (soft) RLIMIT_CPU = %d\n", NEWLIM); (void) signal (SIGALRM, timeout); (void) signal(SIGXCPU, cpulim); alarm(TIMEOUT); for(;;) ; /* NOTREACHED */ } Brought to you by Super Global Mega Corp .com