Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!gatech!udel!rochester!pt!ius2.cs.cmu.edu!edw From: edw@ius2.cs.cmu.edu (Eddie Wyatt) Newsgroups: comp.unix.wizards Subject: Re: trapping cputime limit exceeded Message-ID: <1187@ius2.cs.cmu.edu> Date: Mon, 8-Jun-87 12:31:58 EDT Article-I.D.: ius2.1187 Posted: Mon Jun 8 12:31:58 1987 Date-Received: Sat, 20-Jun-87 08:42:50 EDT References: <43200004@uicsrd> Organization: Carnegie-Mellon University, CS/RI Lines: 35 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 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