1abort(3)                   Library Functions Manual                   abort(3)
2
3
4

NAME

6       abort - cause abnormal process termination
7

LIBRARY

9       Standard C library (libc, -lc)
10

SYNOPSIS

12       #include <stdlib.h>
13
14       [[noreturn]] void abort(void);
15

DESCRIPTION

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
28       As with other cases of abnormal termination  the  functions  registered
29       with atexit(3) and on_exit(3) are not called.
30

RETURN VALUE

32       The abort() function never returns.
33

ATTRIBUTES

35       For  an  explanation  of  the  terms  used  in  this  section,  see at‐
36       tributes(7).
37
38       ┌────────────────────────────────────────────┬───────────────┬─────────┐
39Interface                                   Attribute     Value   
40       ├────────────────────────────────────────────┼───────────────┼─────────┤
41abort()                                     │ Thread safety │ MT-Safe │
42       └────────────────────────────────────────────┴───────────────┴─────────┘
43

STANDARDS

45       C11, POSIX.1-2008.
46

HISTORY

48       SVr4, POSIX.1-2001, 4.3BSD, C89.
49
50       Up  until  glibc  2.26,  if  the  abort()   function   caused   process
51       termination,  all  open  streams  were  closed  and  flushed  (as  with
52       fclose(3)).  However, in some cases this could result in deadlocks  and
53       data   corruption.    Therefore,  starting  with  glibc  2.27,  abort()
54       terminates the  process  without  flushing  streams.   POSIX.1  permits
55       either  possible  behavior, saying that abort() "may include an attempt
56       to effect fclose() on all open streams".
57

SEE ALSO

59       gdb(1), sigaction(2), assert(3), exit(3), longjmp(3), raise(3)
60
61
62
63Linux man-pages 6.05              2023-07-28                          abort(3)
Impressum