home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!gatech!rpi!scott.skidmore.edu!psinntp!psinntp!rsi!prcrs!paul
- From: paul@prcrs.prc.com (Paul Hite)
- Newsgroups: comp.unix.questions
- Subject: Re: changing name of core file
- Message-ID: <4750@prcrs.prc.com>
- Date: 8 Sep 92 21:43:18 GMT
- References: <1992Sep3.210650.65595@evolving.com>
- Organization: PRC Realty Systems, McLean, VA
- Lines: 36
-
- In article <1992Sep3.210650.65595@evolving.com>, dxs@evolving.com (Dan Stanger) writes:
- > does anyone know how to change the name of the core file that will be
- > created if a program fails. we have several programs running in the
- > same directory so if more than one of them fails the core file from
- > one overwrites the other. we would like to change the name to
- > program.core or somthing like that.
-
- Core is dropped when a signal is received. You can install a signal
- handler to catch the signal(s) and do some special processing.
-
- One way the signal handler could work is to:
- create a new directory
- cd to it
- remove the signal handler (not needed with SysV)
- send the signal to yourself again
- You will drop core in the new directory. Thus you'd have
- ./core1/core
- ./core2/core
- ./core3/core
- ...
-
- There's still a chance that two processes would both try to make,
- say, ./core2 at the same time. If that's really an issue you
- could use file locking, semaphores, links to directories, or
- some other way of handling the race condition. It's hard to be
- specific since you failed to mention what system you're using.
-
- If the core file *must* be renamed, you could get fancier. The signal
- handler could fork. The child would dump core. The parent would wait
- for the child to exit and then rename the core file.
-
- But personally, I'd just run the programs in different directories :-)
-
- Paul Hite PRC Realty Systems McLean,Va paul@prcrs.prc.com (703) 556-2243
- "We are trying to bring up an Air Traffic Control display on an X window
- terminal and there seems to be some problems." -- from comp.windows.x
-