Debian Codegraph @

upstream/debian-unstable/man3/abort.3

raw
1 '\" t
2 .\" Copyright 2007, Michael Kerrisk <[email protected]>
3 .\" Copyright 1993, David Metcalfe <[email protected]>
4 .\" Copyright, the authors of the Linux man-pages project
5 .\"
6 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
7 .\"
8 .TH abort 3 2026-02-08 "Linux man-pages 6.18"
9 .SH NAME
10 abort \- cause abnormal process termination
11 .SH LIBRARY
12 Standard C library
13 .RI ( libc ,\~ \-lc )
14 .SH SYNOPSIS
15 .nf
16 .B #include <stdlib.h>
17 .P
18 .B [[noreturn]] void abort(void);
19 .fi
20 .SH DESCRIPTION
21 The
22 .BR abort ()
23 function first unblocks the
24 .B SIGABRT
25 signal, and then raises that signal for the calling process
26 (as though
27 .BR raise (3)
28 was called).
29 This results in the abnormal termination of the process unless the
30 .B SIGABRT
31 signal is caught and the signal handler does not return
32 (see
33 .BR longjmp (3)).
34 .P
35 If the
36 .B SIGABRT
37 signal is ignored, or caught by a handler that returns, the
38 .BR abort ()
39 function will still terminate the process.
40 It does this by restoring the default disposition for
41 .B SIGABRT
42 and then raising the signal for a second time.
43 .P
44 As with other cases of abnormal termination the functions registered with
45 .BR atexit (3)
46 and
47 .BR on_exit (3)
48 are not called.
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 .TS
57 allbox;
58 lbx lb lb
59 l l l.
60 Interface Attribute Value
61 T{
62 .na
63 .nh
64 .BR abort ()
65 T} Thread safety MT-Safe
66 .TE
67 .SH STANDARDS
68 C11, POSIX.1-2008.
69 .SH HISTORY
70 SVr4, POSIX.1-2001, 4.3BSD, C89.
71 .P
72 Up until glibc 2.26,
73 if the
74 .BR abort ()
75 function caused process termination,
76 all open streams were closed and flushed (as with
77 .BR fclose (3)).
78 However, in some cases this could result in deadlocks and data corruption.
79 Therefore, starting with glibc 2.27,
80 .\" glibc commit 91e7cf982d0104f0e71770f5ae8e3faf352dea9f
81 .BR abort ()
82 terminates the process without flushing streams.
83 POSIX.1 permits either possible behavior, saying that
84 .BR abort ()
85 "may include an attempt to effect fclose() on all open streams".
86 .SH SEE ALSO
87 .BR gdb (1),
88 .BR sigaction (2),
89 .BR assert (3),
90 .BR exit (3),
91 .BR longjmp (3),
92 .BR raise (3)