]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/abort.3
dist.mk, All pages: .TH: Generate date at 'make dist'
[thirdparty/man-pages.git] / man3 / abort.3
1 .\" Copyright 2007 (C) Michael Kerrisk <mtk.manpages@gmail.com>
2 .\" some parts Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
3 .\"
4 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
5 .\"
6 .\" References consulted:
7 .\" Linux libc source code
8 .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
9 .\" 386BSD man pages
10 .\" Modified Sat Jul 24 21:46:21 1993 by Rik Faith (faith@cs.unc.edu)
11 .\" Modified Fri Aug 4 10:51:53 2000 - patch from Joseph S. Myers
12 .\" 2007-12-15, mtk, Mostly rewritten
13 .\"
14 .TH ABORT 3 (date) "Linux man-pages (unreleased)"
15 .SH NAME
16 abort \- cause abnormal process termination
17 .SH LIBRARY
18 Standard C library
19 .RI ( libc ", " \-lc )
20 .SH SYNOPSIS
21 .nf
22 .B #include <stdlib.h>
23 .PP
24 .B noreturn void abort(void);
25 .fi
26 .SH DESCRIPTION
27 The
28 .BR abort ()
29 function first unblocks the
30 .B SIGABRT
31 signal, and then raises that signal for the calling process
32 (as though
33 .BR raise (3)
34 was called).
35 This results in the abnormal termination of the process unless the
36 .B SIGABRT
37 signal is caught and the signal handler does not return
38 (see
39 .BR longjmp (3)).
40 .PP
41 If the
42 .B SIGABRT
43 signal is ignored, or caught by a handler that returns, the
44 .BR abort ()
45 function will still terminate the process.
46 It does this by restoring the default disposition for
47 .B SIGABRT
48 and then raising the signal for a second time.
49 .SH RETURN VALUE
50 The
51 .BR abort ()
52 function never returns.
53 .SH ATTRIBUTES
54 For an explanation of the terms used in this section, see
55 .BR attributes (7).
56 .ad l
57 .nh
58 .TS
59 allbox;
60 lbx lb lb
61 l l l.
62 Interface Attribute Value
63 T{
64 .BR abort ()
65 T} Thread safety MT-Safe
66 .TE
67 .hy
68 .ad
69 .sp 1
70 .SH STANDARDS
71 SVr4, POSIX.1-2001, POSIX.1-2008, 4.3BSD, C89, C99.
72 .SH NOTES
73 Up until glibc 2.26,
74 if the
75 .BR abort ()
76 function caused process termination,
77 all open streams were closed and flushed (as with
78 .BR fclose (3)).
79 However, in some cases this could result in deadlocks and data corruption.
80 Therefore, starting with glibc 2.27,
81 .\" glibc commit 91e7cf982d0104f0e71770f5ae8e3faf352dea9f
82 .BR abort ()
83 terminates the process without flushing streams.
84 POSIX.1 permits either possible behavior, saying that
85 .BR abort ()
86 "may include an attempt to effect fclose() on all open streams".
87 .SH SEE ALSO
88 .BR gdb (1),
89 .BR sigaction (2),
90 .BR assert (3),
91 .BR exit (3),
92 .BR longjmp (3),
93 .BR raise (3)