| 1 | /* Copyright (C) 2009-2021 Free Software Foundation, Inc. |
| 2 | This file is part of the GNU C Library. |
| 3 | |
| 4 | The GNU C Library is free software; you can redistribute it and/or |
| 5 | modify it under the terms of the GNU Lesser General Public |
| 6 | License as published by the Free Software Foundation; either |
| 7 | version 2.1 of the License, or (at your option) any later version. |
| 8 | |
| 9 | The GNU C Library is distributed in the hope that it will be useful, |
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 | Lesser General Public License for more details. |
| 13 | |
| 14 | You should have received a copy of the GNU Lesser General Public |
| 15 | License along with the GNU C Library; if not, see |
| 16 | <https://www.gnu.org/licenses/>. */ |
| 17 | |
| 18 | #include <stdio.h> |
| 19 | #include <stdlib.h> |
| 20 | #include <unistd.h> |
| 21 | #include <sysdep.h> |
| 22 | #include <signal.h> |
| 23 | #include <errno.h> |
| 24 | #include <shlib-compat.h> |
| 25 | #include "exit.h" |
| 26 | |
| 27 | void |
| 28 | __new_quick_exit (int status) |
| 29 | { |
| 30 | /* The new quick_exit, following C++11 18.5.12, does not run object |
| 31 | destructors. While C11 says nothing about object destructors, |
| 32 | since it has none, the intent is to run the registered |
| 33 | at_quick_exit handlers and then run _Exit immediately without |
| 34 | disturbing the state of the process and threads. */ |
| 35 | __run_exit_handlers (status, &__quick_exit_funcs, false, false); |
| 36 | } |
| 37 | versioned_symbol (libc, __new_quick_exit, quick_exit, GLIBC_2_24); |
| 38 | |
| 39 | #if SHLIB_COMPAT(libc, GLIBC_2_10, GLIBC_2_24) |
| 40 | void |
| 41 | attribute_compat_text_section |
| 42 | __old_quick_exit (int status) |
| 43 | { |
| 44 | /* The old quick_exit runs thread_local destructors. */ |
| 45 | __run_exit_handlers (status, &__quick_exit_funcs, false, true); |
| 46 | } |
| 47 | compat_symbol (libc, __old_quick_exit, quick_exit, GLIBC_2_10); |
| 48 | #endif |
| 49 | |