]>
Commit | Line | Data |
---|---|---|
7adcbafe | 1 | /* Copyright (C) 1991-2022 Free Software Foundation, Inc. |
99113dff DE |
2 | |
3 | Derived from exit.h in GNU C Library. | |
4 | ||
5 | This file is part of GCC. | |
6 | ||
7 | GCC is free software; you can redistribute it and/or modify it under | |
8 | the terms of the GNU General Public License as published by the Free | |
9 | Software Foundation; either version 3, or (at your option) any later | |
10 | version. | |
11 | ||
12 | GCC is distributed in the hope that it will be useful, but WITHOUT ANY | |
13 | WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
14 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
15 | for more details. | |
16 | ||
17 | Under Section 7 of GPL version 3, you are granted additional | |
18 | permissions described in the GCC Runtime Library Exception, version | |
19 | 3.1, as published by the Free Software Foundation. | |
20 | ||
21 | You should have received a copy of the GNU General Public License and | |
22 | a copy of the GCC Runtime Library Exception along with this program; | |
23 | see the files COPYING3 and COPYING.RUNTIME respectively. If not, see | |
24 | <http://www.gnu.org/licenses/>. */ | |
25 | ||
26 | #ifndef _EXIT_H | |
27 | #define _EXIT_H 1 | |
28 | ||
29 | #define attribute_hidden | |
30 | #define INTDEF(name) | |
31 | ||
32 | #include <stdbool.h> | |
33 | #include <stdint.h> | |
34 | ||
35 | enum | |
36 | { | |
37 | ef_free, /* `ef_free' MUST be zero! */ | |
38 | ef_us, | |
39 | ef_on, | |
40 | ef_at, | |
41 | ef_cxa | |
42 | }; | |
43 | ||
44 | struct exit_function | |
45 | { | |
46 | /* `flavour' should be of type of the `enum' above but since we need | |
47 | this element in an atomic operation we have to use `long int'. */ | |
48 | long int flavor; | |
49 | union | |
50 | { | |
51 | void (*at) (void); | |
52 | struct | |
53 | { | |
54 | void (*fn) (int status, void *arg); | |
55 | void *arg; | |
56 | } on; | |
57 | struct | |
58 | { | |
59 | void (*fn) (void *arg, int status); | |
60 | void *arg; | |
61 | void *dso_handle; | |
62 | } cxa; | |
63 | } func; | |
64 | }; | |
65 | struct exit_function_list | |
66 | { | |
67 | struct exit_function_list *next; | |
68 | size_t idx; | |
69 | struct exit_function fns[32]; | |
70 | }; | |
71 | extern struct exit_function_list *__exit_funcs attribute_hidden; | |
72 | extern struct exit_function_list *__quick_exit_funcs attribute_hidden; | |
73 | ||
74 | extern struct exit_function *__new_exitfn (struct exit_function_list **listp); | |
75 | extern uint64_t __new_exitfn_called attribute_hidden; | |
76 | ||
77 | extern void __run_exit_handlers (int status, struct exit_function_list **listp, | |
78 | bool run_list_atexit) | |
79 | attribute_hidden __attribute__ ((__noreturn__)); | |
80 | ||
81 | extern int __internal_atexit (void (*func) (void *), void *arg, void *d, | |
82 | struct exit_function_list **listp) | |
83 | attribute_hidden; | |
84 | extern int __cxa_at_quick_exit (void (*func) (void *), void *d); | |
85 | ||
86 | extern int __cxa_atexit (void (*func) (void *), void *arg, void *d); | |
87 | extern int __cxa_atexit_internal (void (*func) (void *), void *arg, void *d) | |
88 | attribute_hidden; | |
89 | ||
90 | extern void __cxa_finalize (void *d); | |
91 | ||
92 | #endif /* exit.h */ |