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.
views:
191answers:
2
+1
A:
Looks like 134
equals to (128+6)
and euqals to ((1<<7) | 6)
(where #define SIGABRT 6
)
Co-incidence?
ony
2010-04-09 13:50:41
Not coincidence, see http://stackoverflow.com/questions/1101957/1104641#1104641 and others.
ephemient
2010-04-10 02:43:56
+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
2010-04-10 13:00:32