aboutsummaryrefslogtreecommitdiff
path: root/lib/libc/stdlib/quick_exit.c
Commit message (Collapse)AuthorAgeFilesLines
* libc: Rewrite quick_exit() and at_quick_exit() using C11 atomics.Dag-Erling Smørgrav2023-10-051-24/+16
| | | | | | | | | | | | | | | | | | | | | | | Compiler memory barriers do not prevent the CPU from executing the code out of order. Switch to C11 atomics. This also lets us get rid of the mutex; instead, loop until the compare_exchange succeeds. While here, change the return value of at_quick_exit() on failure to the more traditional -1, matching atexit(). Sponsored by: Klara, Inc. Reviewed by: Olivier Certner, kevans, kib Differential Revision: https://reviews.freebsd.org/D41936 (cherry picked from commit 1dc3abb052430279e47c8922d22b30922adcf0f6) libc: Add a rudimentary test for quick_exit(3). Sponsored by: Klara, Inc. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D41937 (cherry picked from commit c7dd4601aeebbc1bbe131cbe6747476c124b47fe)
* Remove $FreeBSD$: two-line .h patternWarner Losh2023-08-231-2/+0
| | | | | | | Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/ Similar commit in main: (cherry picked from commit b3e7694832e8)
* spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh2023-07-251-1/+1
| | | | | | | | | | | The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix (cherry picked from commit 4d846d260e2b9a3d4d0a701462568268cbfe7a5b)
* libc: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-251-0/+2
| | | | | | | | | | | | | | | Mainly focus on files that use BSD 2-Clause license, however the tool I was using mis-identified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Notes: svn path=/head/; revision=326193
* C++17 requires quick_exit(3) to be async-signal safe.Konstantin Belousov2017-11-041-1/+6
| | | | | | | | | | Make it safe, and update man page with the useful information. Sponsored by: The FreeBSD Foundation MFC after: 1 week Notes: svn path=/head/; revision=325389
* Small style(9) improvements.David Chisnall2011-12-151-2/+4
| | | | | | | Approved by: dim (mentor) Notes: svn path=/head/; revision=228528
* style(9) cleanups.David Chisnall2011-12-071-10/+7
| | | | | | | Approved by: brooks (mentor) Notes: svn path=/head/; revision=228323
* Implement quick_exit() / at_quick_exit() from C++11 / C1x. Also add aDavid Chisnall2011-12-071-0/+81
__noreturn macro and modify the other exiting functions to use it. The __noreturn macro, unlike __dead2, must be used BEFORE the function. This is in line with the C and C++ specifications that place _Noreturn (c1x) and [[noreturn]] (C++11) in front of the functions. As with __dead2, this macro falls back to using the GCC attribute. Unfortunately, clang currently sets the same value for the C version macro in C99 and C1x modes, so these functions are hidden by default. At some point before 10.0, I need to go through the headers and clean up the C1x / C++11 visibility. Reviewed by: brooks (mentor) Notes: svn path=/head/; revision=228322