Default behavior on SIGTERM?

G

Guest

I hope you will forgive the slightly OT post, but I haven't had any
luck getting answers in the Unix/Solaris groups. I know the C++
standard doesn't mention signals because they are a platform-specific
topic, but I'm hoping someone here can help me nonetheless.

When a Unix C++ application (Solaris 9 in my case) receives a SIGTERM
signal, do any of the standard C++ handlers get called? Of course I'm
assuming the app hasn't explicitly trapped SIGTERM by installing a
handler for it -- I'm just asking about default behavior.

Do any of the C++ handlers installed by atexit(), set_unexpected(), or
set_terminate() get called? Or is it just as if abort() was called
asynchronously when the SIGTERM arrived? My tests show no C++ handlers
get called, but I thought I'd get a second opinion in case I'm simply
doing something wrong.

Thanks.
 
L

Larry I Smith

I hope you will forgive the slightly OT post, but I haven't had any
luck getting answers in the Unix/Solaris groups. I know the C++
standard doesn't mention signals because they are a platform-specific
topic, but I'm hoping someone here can help me nonetheless.

When a Unix C++ application (Solaris 9 in my case) receives a SIGTERM
signal, do any of the standard C++ handlers get called? Of course I'm
assuming the app hasn't explicitly trapped SIGTERM by installing a
handler for it -- I'm just asking about default behavior.

Do any of the C++ handlers installed by atexit(), set_unexpected(), or
set_terminate() get called? Or is it just as if abort() was called
asynchronously when the SIGTERM arrived? My tests show no C++ handlers
get called, but I thought I'd get a second opinion in case I'm simply
doing something wrong.

Thanks.


man -S 7 signal

The default for SIGTERM is for the kernel to terminate the
process immediately. If you wish to catch SIGTERM, you'll
have to install your own signal handler, or set it to be
ignored. In most implementations the C/C++ libs are unaware
of signals.

Larry
 
G

Guest

Thanks. So it seems if I don't explicitly provide a signal handler,
SIGTERM is no different than SIGKILL without the core dump.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top