timing child processes

MFHorn arosen at hawk.ulowell.edu
Sun Apr 9 06:52:12 AEST 1989


>From article <6250 at homxc.ATT.COM>, by vas1 at homxc.ATT.COM (S.PUTCHA):
> Is there an easy way to kill a process after it uses up a certain
> amount of CPU time (Note: NOT REAL time)?

You could use the setrlimit system call.  Setrlimit is passed a pointer
to an 'rlimit' struct as defined in /usr/include/sys/resource.h .  When
the process uses whatever CPU time you specify, it gets sent a SIGXCPU.

This applies to BSD.  I'm not sure about SysV.

--
Andy Rosen           | arosen at hawk.ulowell.edu | "I got this guitar and I
ULowell, Box #3031   | ulowell!arosen          |  learned how to make it
Lowell, Ma 01854     |                         |  talk" -Thunder Road
		RD in '88 - The way it should've been



More information about the Comp.unix.wizards mailing list