I've been wondering, if it's possible to somehow process kill signal? What I mean is, if I call signal(SIGKILL, funptr), will it ever execute? I tried that with printing some output, but it didn't work... then I found out that printf might not work properly in handler function.
I'm asking since a friend told me it's possible to do that, identyfiy kill signal and do some stuff before it terminates process. So basicly process will get terminated in the end, but with something being done before. And myself, I found that SIGKILL/SIGSTOP may not be ignored/processed.
Background story is, I'm writing some simple wannabe IRC server/client (based on message queues, so not that much I :P), and when client's user decides to kill client instead of typing /logout to quit properly, I'd like to notify server about that, by somehow sending /logout command to server before client gets terminated.
Thanks in advance,