Debian Codegraph @

upstream/debian-trixie/man3/abort.3

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