Termination Signals and default action

Termination Signals and default action

Post by agro.. » Fri, 22 Dec 2000 03:19:30



Hi all!

There are several termination signals like SIGTERM, SIGINT and
SIGQUIT etc.

These signals are used to tell the process to terminate and we
might want to handle these signals by using a certain handler.
The default action of all these signals is to cause the process to
terminate.
And here's the question: how is "termination" exactly performed by
the default handler?
Does it call abort(), exit() or _exit() or something else?
Namely, does it call any cleanup handler installed with atexit() or
on_exit() and does it close open streams removing temp files,
destroys C++ objects?

Thanks in advance.

Andreas Grosam

Sent via Deja.com
http://www.deja.com/

 
 
 

Termination Signals and default action

Post by Barry Margoli » Fri, 22 Dec 2000 03:42:53



>Hi all!

>There are several termination signals like SIGTERM, SIGINT and
>SIGQUIT etc.

>These signals are used to tell the process to terminate and we
>might want to handle these signals by using a certain handler.
>The default action of all these signals is to cause the process to
>terminate.
>And here's the question: how is "termination" exactly performed by
>the default handler?
>Does it call abort(), exit() or _exit() or something else?
>Namely, does it call any cleanup handler installed with atexit() or
>on_exit() and does it close open streams removing temp files,
>destroys C++ objects?

There is no default handler; the default action is for the process to be
terminated instead of calling a handler.

--

Genuity, Burlington, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.

 
 
 

Termination Signals and default action

Post by Andrew Giert » Fri, 22 Dec 2000 04:23:41


 agrosam> Hi all!
 agrosam> There are several termination signals like SIGTERM, SIGINT
 agrosam> and SIGQUIT etc.

 agrosam> These signals are used to tell the process to terminate and
 agrosam> we might want to handle these signals by using a certain
 agrosam> handler.  The default action of all these signals is to
 agrosam> cause the process to terminate.  And here's the question:
 agrosam> how is "termination" exactly performed by the default
 agrosam> handler?

there is no "default handler" as such; if the signal action has been
set to SIG_DFL, then all the handling is done in the kernel.

 agrosam> Does it call abort(), exit() or _exit() or something else?

It's equivalent to calling _exit() except that the status returned to
the parent process is different, and in the case of some signals a
core file may be generated.

 agrosam> Namely, does it call any cleanup handler installed with
 agrosam> atexit() or on_exit()

no

 agrosam> and does it close open streams

open files are closed, but any user-space buffers (such as are usually
used with FILE*s or C++ streambufs) are _not_ flushed

 agrosam> removing temp files,

Temp files created by tmpfile() are removed before the function
returns; they exist only as long as they remain open, and as mentioned
above, open files are closed during process termination. No files are
actually unlinked as part of process termination

 agrosam> destroys C++ objects?

no

--
Andrew.

comp.unix.programmer FAQ: see <URL: http://www.erlenstar.demon.co.uk/unix/>
                           or <URL: http://www.whitefang.com/unix/>

 
 
 

Termination Signals and default action

Post by agro.. » Sat, 23 Dec 2000 02:08:25


Thank you for answering, that was exactly what I wanted to know.
I noticed also that there is no default "handler" but a default action
:)

Thanks

Andreas

Sent via Deja.com
http://www.deja.com/