From db49e93776eb86e050519e09c7a0a8cfdcdb934c Mon Sep 17 00:00:00 2001 From: Michael Kerrisk Date: Thu, 6 Dec 2007 08:56:29 +0000 Subject: [PATCH] A fairly significant rewrite to clarify operation of abort(). --- Changes | 5 +++++ man3/abort.3 | 32 ++++++++++++++++++++++---------- 2 files changed, 27 insertions(+), 10 deletions(-) diff --git a/Changes b/Changes index 8b093c50c..29f784d38 100644 --- a/Changes +++ b/Changes @@ -9,6 +9,7 @@ Contributors The following people contributed notes, ideas, or patches that have been incorporated in changes in this release: +Alex Tuninga Bert Wesarg Maxime Vaudequin @@ -25,6 +26,10 @@ Typographical or grammatical errors have been corrected in several places. Changes to individual pages --------------------------- +abort.3 + mtk, after a note by Alex Tuninga + A fairly significant rewrite to clarify operation of abort(). + argz_add.3 Bert Wesarg / mtk s/envz/envz_add/ in SEE ALSO. diff --git a/man3/abort.3 b/man3/abort.3 index 5cd3eca3b..9928107d1 100644 --- a/man3/abort.3 +++ b/man3/abort.3 @@ -1,4 +1,5 @@ -.\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk) +.\" Copyright 2007 (C) Michael Kerrisk +.\" some parts Copyright 1993 David Metcalfe (david@prism.demon.co.uk) .\" .\" Permission is granted to make and distribute verbatim copies of this .\" manual provided the copyright notice and this permission notice are @@ -26,10 +27,11 @@ .\" 386BSD man pages .\" Modified Sat Jul 24 21:46:21 1993 by Rik Faith (faith@cs.unc.edu) .\" Modified Fri Aug 4 10:51:53 2000 - patch from Joseph S. Myers +.\" 2007-12-15, mtk, Mostly rewritten .\" -.TH ABORT 3 1993-04-12 "GNU" "Linux Programmer's Manual" +.TH ABORT 3 2007-12-15 "GNU" "Linux Programmer's Manual" .SH NAME -abort \- cause abnormal program termination +abort \- cause abnormal process termination .SH SYNOPSIS .nf .B #include @@ -39,20 +41,28 @@ abort \- cause abnormal program termination .SH DESCRIPTION The .BR abort () -function causes abnormal program termination unless -the signal +first unblocks the .B SIGABRT -is caught and the signal handler does not return. +signal, and then raises that signal for the calling process. +This results in the abnormal termination of the process unless the +.B SIGABRT +signal is caught and the signal handler does not return +(see +.BR longjmp (3)). +.PP If the .BR abort () -function causes program termination, all open -streams are closed and flushed. +function causes process termination, +all open streams are closed and flushed. .PP If the .B SIGABRT -signal is blocked or ignored, the +signal is ignored, or caught by a handler that returns, the .BR abort () -function will still override it. +function will still terminate the process. +It does this by restoring the default disposition for +.B SIGABRT +and then raising the signal for a second time. .SH "RETURN VALUE" The .BR abort () @@ -60,6 +70,8 @@ function never returns. .SH "CONFORMING TO" SVr4, POSIX.1-2001, 4.3BSD, C89, C99 .SH "SEE ALSO" +.BR gdb (1), .BR sigaction (2), .BR exit (3), +.BR longjmp (3), .BR raise (3)