1*8feb0f0bSmrg /* Copyright (C) 1991-2020 Free Software Foundation, Inc. 236ac495dSmrg 336ac495dSmrg Derived from exit.h in GNU C Library. 436ac495dSmrg 536ac495dSmrg This file is part of GCC. 636ac495dSmrg 736ac495dSmrg GCC is free software; you can redistribute it and/or modify it under 836ac495dSmrg the terms of the GNU General Public License as published by the Free 936ac495dSmrg Software Foundation; either version 3, or (at your option) any later 1036ac495dSmrg version. 1136ac495dSmrg 1236ac495dSmrg GCC is distributed in the hope that it will be useful, but WITHOUT ANY 1336ac495dSmrg WARRANTY; without even the implied warranty of MERCHANTABILITY or 1436ac495dSmrg FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1536ac495dSmrg for more details. 1636ac495dSmrg 1736ac495dSmrg Under Section 7 of GPL version 3, you are granted additional 1836ac495dSmrg permissions described in the GCC Runtime Library Exception, version 1936ac495dSmrg 3.1, as published by the Free Software Foundation. 2036ac495dSmrg 2136ac495dSmrg You should have received a copy of the GNU General Public License and 2236ac495dSmrg a copy of the GCC Runtime Library Exception along with this program; 2336ac495dSmrg see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 2436ac495dSmrg <http://www.gnu.org/licenses/>. */ 2536ac495dSmrg 2636ac495dSmrg #ifndef _EXIT_H 2736ac495dSmrg #define _EXIT_H 1 2836ac495dSmrg 2936ac495dSmrg #define attribute_hidden 3036ac495dSmrg #define INTDEF(name) 3136ac495dSmrg 3236ac495dSmrg #include <stdbool.h> 3336ac495dSmrg #include <stdint.h> 3436ac495dSmrg 3536ac495dSmrg enum 3636ac495dSmrg { 3736ac495dSmrg ef_free, /* `ef_free' MUST be zero! */ 3836ac495dSmrg ef_us, 3936ac495dSmrg ef_on, 4036ac495dSmrg ef_at, 4136ac495dSmrg ef_cxa 4236ac495dSmrg }; 4336ac495dSmrg 4436ac495dSmrg struct exit_function 4536ac495dSmrg { 4636ac495dSmrg /* `flavour' should be of type of the `enum' above but since we need 4736ac495dSmrg this element in an atomic operation we have to use `long int'. */ 4836ac495dSmrg long int flavor; 4936ac495dSmrg union 5036ac495dSmrg { 5136ac495dSmrg void (*at) (void); 5236ac495dSmrg struct 5336ac495dSmrg { 5436ac495dSmrg void (*fn) (int status, void *arg); 5536ac495dSmrg void *arg; 5636ac495dSmrg } on; 5736ac495dSmrg struct 5836ac495dSmrg { 5936ac495dSmrg void (*fn) (void *arg, int status); 6036ac495dSmrg void *arg; 6136ac495dSmrg void *dso_handle; 6236ac495dSmrg } cxa; 6336ac495dSmrg } func; 6436ac495dSmrg }; 6536ac495dSmrg struct exit_function_list 6636ac495dSmrg { 6736ac495dSmrg struct exit_function_list *next; 6836ac495dSmrg size_t idx; 6936ac495dSmrg struct exit_function fns[32]; 7036ac495dSmrg }; 7136ac495dSmrg extern struct exit_function_list *__exit_funcs attribute_hidden; 7236ac495dSmrg extern struct exit_function_list *__quick_exit_funcs attribute_hidden; 7336ac495dSmrg 7436ac495dSmrg extern struct exit_function *__new_exitfn (struct exit_function_list **listp); 7536ac495dSmrg extern uint64_t __new_exitfn_called attribute_hidden; 7636ac495dSmrg 7736ac495dSmrg extern void __run_exit_handlers (int status, struct exit_function_list **listp, 7836ac495dSmrg bool run_list_atexit) 7936ac495dSmrg attribute_hidden __attribute__ ((__noreturn__)); 8036ac495dSmrg 8136ac495dSmrg extern int __internal_atexit (void (*func) (void *), void *arg, void *d, 8236ac495dSmrg struct exit_function_list **listp) 8336ac495dSmrg attribute_hidden; 8436ac495dSmrg extern int __cxa_at_quick_exit (void (*func) (void *), void *d); 8536ac495dSmrg 8636ac495dSmrg extern int __cxa_atexit (void (*func) (void *), void *arg, void *d); 8736ac495dSmrg extern int __cxa_atexit_internal (void (*func) (void *), void *arg, void *d) 8836ac495dSmrg attribute_hidden; 8936ac495dSmrg 9036ac495dSmrg extern void __cxa_finalize (void *d); 9136ac495dSmrg 9236ac495dSmrg #endif /* exit.h */ 93