Yes. The only hard part I see is getting the executable filename.
core.c:
--- #include <stdlib.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <signal.h> #include <unistd.h>void init_libcore(void) __attribute__((constructor));
void sighandler(int signo) { struct { int signo; pid_t pid; } s; int fd;
s.signo = signo; s.pid = getpid(); fd = open(getenv("SIG_FIFO"), O_WRONLY); write(fd, &s, sizeof s); close(fd); pause(); }
void init_libcore(void) { struct sigaction act;
act.sa_handler = sighandler; sigfillset(&act.sa_mask); act.sa_flags = SA_RESETHAND; sigaction(SIGSEGV, &act, NULL); } ----- % gcc -fPIC -o core.o -c core.c % gcc -shared -o core.so core.o % LD_PRELOAD=./core SIG_FIFO=$HOME/.crash_handler_fifo bash
A program to listen to the fifo should be straightforward.
-- ICQ UIN: 56155810- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/