[comp.unix.wizards] trapping cputime limit exceeded

kai@uicsrd.UUCP (06/05/87)

I need a method of trapping cputime limit exceeded. I am doing lots of
testing and have to know if the program ended on it's own, or if
it was killed because of too much cpu time.

C-shell's onintr and Bourne shell's trap command don't seem to work
with cputime limit exceeded (signal 24). Any useful suggestions?

edw@ius2.cs.cmu.edu (Eddie Wyatt) (06/08/87)

In article <43200004@uicsrd>, kai@uicsrd.CSRD.UIUC.EDU writes:
> 
> I need a method of trapping cputime limit exceeded. I am doing lots of
> testing and have to know if the program ended on it's own, or if
> it was killed because of too much cpu time.
> 
> C-shell's onintr and Bourne shell's trap command don't seem to work
> with cputime limit exceeded (signal 24). Any useful suggestions?


 In the program that you are monitoring add the following:

	#include <signal.h>

	int cpu_limit_exceeded();


	Your_init_func()
	    {
	    ....
	    (void) signal(SIGXCPU,cpu_limit_exceed);
	    ....
	    }


	int cpu_limit_exceeded(sig,code,scp)
	    int sig, code;
	    struct sigcontext *scp;
	    {
	    printf("Time's up Bud\n");
	    }
-- 
					Eddie Wyatt

e-mail: edw@ius2.cs.cmu.edu