1abort(3) Library Functions Manual abort(3)
2
3
4
6 abort - cause abnormal process termination
7
9 Standard C library (libc, -lc)
10
12 #include <stdlib.h>
13
14 [[noreturn]] void abort(void);
15
17 The abort() function first unblocks the SIGABRT signal, and then raises
18 that signal for the calling process (as though raise(3) was called).
19 This results in the abnormal termination of the process unless the
20 SIGABRT signal is caught and the signal handler does not return (see
21 longjmp(3)).
22
23 If the SIGABRT signal is ignored, or caught by a handler that returns,
24 the abort() function will still terminate the process. It does this by
25 restoring the default disposition for SIGABRT and then raising the sig‐
26 nal for a second time.
27
29 The abort() function never returns.
30
32 For an explanation of the terms used in this section, see at‐
33 tributes(7).
34
35 ┌────────────────────────────────────────────┬───────────────┬─────────┐
36 │Interface │ Attribute │ Value │
37 ├────────────────────────────────────────────┼───────────────┼─────────┤
38 │abort() │ Thread safety │ MT-Safe │
39 └────────────────────────────────────────────┴───────────────┴─────────┘
40
42 C11, POSIX.1-2008.
43
45 SVr4, POSIX.1-2001, 4.3BSD, C89.
46
47 Up until glibc 2.26, if the abort() function caused process termina‐
48 tion, all open streams were closed and flushed (as with fclose(3)).
49 However, in some cases this could result in deadlocks and data corrup‐
50 tion. Therefore, starting with glibc 2.27, abort() terminates the
51 process without flushing streams. POSIX.1 permits either possible be‐
52 havior, saying that abort() "may include an attempt to effect fclose()
53 on all open streams".
54
56 gdb(1), sigaction(2), assert(3), exit(3), longjmp(3), raise(3)
57
58
59
60Linux man-pages 6.04 2023-03-30 abort(3)