exit signal

Ethan Merritt merritt at milton.u.washington.edu
Wed Dec 19 10:30:13 AEST 1990


In article <1990Dec18.153942.15916 at odin.corp.sgi.com> jmb at patton.wpd.sgi.com (Jim Barton) writes:
>In article <9012160645.AA10200 at karron.med.nyu.edu>, Dan
>Karron at UCBVAX.BERKELEY.EDU writes:
> 
>> How can I set a signal handler for a software exit() call ? I am
>> looking to catch programs that exit via an exit(value) call, or fall
>> off the end of the main procedure. I do not have control of the user code.
>
>Your description is a little unclear of what you want - I don't know
>what you mean by not having control of the user code. Guessing, the
>easiest way to do this is to use dbx. Ask dbx to stop on a call to exit,
>or even trap the exit system call. dbx will also catch any signals
>posted to the program, so you can always catch the program when it is
>going south.

	I'm not entirely sure what Karron wants in his original posting, but
this reminds me of something which caused me much grief when I started porting
code to IRIX.  Nowhere that I can find in the various libraries is an
equivalent to the ANSI C atexit() routine, which allows you to establish
a line of exit handlers which get to clean up before the program exits, no
matter where that exit is triggered from.  As Karron mentions, SIGTERM looks
like it might be of some help, but in fact it isn't (too many exit condidions
do not set SIGTERM).

	Any chance of getting atexit() in the next release?

					    Ethan A Merritt
-------------------------------------------------------------------------------
Dept of Biological Structure                H510 Health Sciences
University of Washington SM-20              (206)543-8865
Seattle, WA 98195                           merritt at u.washington.edu
-------------------------------------------------------------------------------



More information about the Comp.sys.sgi mailing list