Path: utzoo!mnetor!tmsoft!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!samsung!dali.cs.montana.edu!milton!merritt From: merritt@milton.u.washington.edu (Ethan Merritt) Newsgroups: comp.sys.sgi Subject: Re: exit signal Summary: where's an IRIX equivalent for atexit()? Message-ID: <13238@milton.u.washington.edu> Date: 18 Dec 90 23:30:13 GMT References: <9012160645.AA10200@karron.med.nyu.edu> <1990Dec18.153942.15916@odin.corp.sgi.com> Organization: University of Washington, Seattle Lines: 32 In article <1990Dec18.153942.15916@odin.corp.sgi.com> jmb@patton.wpd.sgi.com (Jim Barton) writes: >In article <9012160645.AA10200@karron.med.nyu.edu>, Dan >Karron@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@u.washington.edu -------------------------------------------------------------------------------