On Wed, 6 May 1998, Mark A. Heilpern wrote: > if (fork()) force_warmboot(); > else my_signal(SIGSEGV, SIG_IGN); > > I end up with a more accurate core file -- i.e., I'm right where the crash > was caused. > (I know this because I've got an "admin crash" command that tries to to a > send_to_char > to NULL.) In addition to this, I run a script that analyzes the core after 30 seconds and mails me the results. BTW, if you have more than SIGSEGV handled by the functrion, you might want to ignore the actual signal, not SIGSEGV. void nasty_signal_handler (int no) { signal (no, SIG_DFL); write_last_command(); disable_reaping(); if (!fork()) { // Close all files! // RACE CONDITION: if the exec completes before this part is reached, // we'll get bind errors for (int i = 255; i >= 0; i--) close(i); // Dup /dev/null to STD{IN,OUT,ERR} open("/dev/null", O_RDWR); dup(0); dup(0); if (!fork()) { execl(CORE_EXAMINE_SCRIPT, CORE_EXAMINE_SCRIPT, (char*)NULL); perror("execl"); _exit(EXIT_FAILURE); } else return; // and dump core! } perform_copyover("", false); _exit(0); } And the script: #!/bin/sh CORE=core PEOPLE=erwin@localhost COUNT=`cat .crashcount` COUNT=`expr 1 + ${COUNT}` echo ${COUNT} > .crashcount sleep 30 gdb -batch ../src/envy ${CORE} | head -1000 | mailx -s "[AR] She's dead, Jim! (#${COUNT})" $PEOPLE rm ${CORE}.2 mv ${CORE}.1 ${CORE}.2 mv ${CORE} ${CORE}.1 ============================================================================= Erwin Andreasen Herlev, Denmark <erwin@pip.dknet.dk> UNIX System Programmer <URL:http://www.abandoned.org/drylock/> <*> (not speaking for) DDE ============================================================================= +------------------------------------------------------------+ | Ensure that you have read the CircleMUD Mailing List FAQ: | | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html | +------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/15/00 PST