Whoami
Whoami

Reputation: 14418

How to capture List of Processes that have received SIGSEGV

Part of my application (preferably a daemon) required to log the list of process names that have got core dumped. It would be great, if someone points which mechanism that I can use?

Upvotes: 1

Views: 84

Answers (1)

Hasturkun
Hasturkun

Reputation: 36412

If the processes are truly dumping core, you could use the following trick:

Set /proc/sys/kernel/core_pattern to |/absolute/path/to/some/program %p %e

This will cause the system to execute your program (with the faulting process' pid and executable name), and pipe the core dump into its standard input. You may then log and store the core dump file.

Note that the program will run as the user and group root

See man 5 core for more information, and an example core dump handling program

Upvotes: 1

Related Questions