views:

191

answers:

2

For example calling exit(100) would exit the application with status 100, and calling raise(SIGABRT) aborts the application with status 134 while creating a core dump. But what if I want the core dump with status 100 or any other arbitrary value. How can I do that ? I know there are several signals that triggers a core dump, but they seem to have fixed exit statuses.

+1  A: 

Looks like 134 equals to (128+6) and euqals to ((1<<7) | 6) (where #define SIGABRT 6)
Co-incidence?

ony
Not coincidence, see http://stackoverflow.com/questions/1101957/1104641#1104641 and others.
ephemient
+2  A: 

Well, I suppose you could fork() and have the parent call _exit(100), and the child call abort()...

I concur with the comments saying that it's a bad idea, though.

caf