summaryrefslogtreecommitdiff
path: root/lib/libc/stdlib/atexit.c
AgeCommit message (Collapse)Author
2017-11-06Assert that __cxa_atexit is not used with NULL as DSO. Don't usejoerg
__cxa_atexit directly from atexit, they have different behavior.
2017-11-02Revert previous on demand.kamil
Rationale: The DSO handle is a required part of the (external) __cxa_atexit interface. The atexit mapping is an implementation detail and not part of the public interface. Doing it directly creates UB as it involves casting function pointers between incompatible types. -- Joerg
2017-11-02Correct handling of __cxa_atexit(a,b,NULL) in libckamil
In the NetBSD implementation and suggested by Itanium C++ ABI, we wrap the atexit(x) call as __cxa_atexit(x,NULL,NULL). __cxa_atexit() is an internal function for the usage of C++. Correct a bug that __cxa_atexit(x,y,NULL) is handled in the same way as atexit(x) (which is simplified to __cxa_atexit(x,NULL,NULL). This misbehavior has been detected in the Thread Sanitizer port to NetBSD. Patch reviewed by <christos> Sponsored by <The NetBSD Foundation>
2015-04-19Redo __aeabi_atexit by shuffling the arguments and dropping the code injoerg
libstdc++.
2015-04-18Add __aeabi_atexit alias for another case of NIH on ARM.joerg
2015-01-20Fix non _REENTRANT build.christos
2013-08-19Put the startup code in .text.startupmatt
2013-04-26add {at_,}quick_exit(3) from FreeBSDchristos
2009-10-08When converting the locking path of mutex+counter to a real recursivepooka
mutex, it's a good idea to convert the unlock path too so that the recursive mutex gets released as many times as it was locked. Fixes pthread + cxa deadlock.
2008-04-28Remove clause 3 and 4 from TNF licensesmartin
2008-02-25There's no need to do the mutex_trylock dance anymore in __cxa_finalize(),xtraeme
just using mutex_lock() is enough.
2008-02-25Add a comment for __libc_atexit_init() missed in previous that wasxtraeme
available in the original patch.
2008-02-25Make the atexit mutex recursive and initialize it in __libc_init()xtraeme
as suggested by ad@, based on the patch provided by Sverre Froyen in lib/37654. Reviewed by ad@ and jmcneill@.
2007-08-08Keep track of atexit functions that are added while processingkristerw
atexit functions, to ensure that the new functions will be called.
2007-08-08Ensure that the struct atexit_handler has been removed from the listkristerw
of pending atexit handlers before the structure is reused. This prevents __cxa_finalize from going into an infinite loop when an atexit handler register a new atexit handler as in: #include <stdlib.h> void two(void) { } void one(void) { atexit(two); } int main(void) { atexit(one); return 0; }
2005-06-12Add missing __RCSID()lukem
2003-03-19When implementing a recursive mutex, it helps if you remember tonathanw
decrement the recursion count. Fixes the problem of uic dying with a no-next-thread assertion while building kdeadmin3; reported by Perry Metzger and others on tech-pkg.
2003-03-04Fix lib/20558:thorpej
A dynamically linked program invokes the rtld cleanup routine via an atexit handler. This rtld cleanup routine invokes _fini() for shared libraries, which in-turn invoke __cxa_finalize() with their DSO handle. By luck, this happens to work okay for non-threaded programs, but for a threaded program, this leads to deadlock (sometimes manifested as an assertion failure, if the program didn't actually create any threads). Fixed by teaching __cxa_finalize() that it can be recursively invoked, adjusting the handler list manipulation accordingly.
2003-03-01Rewrite atexit(3), and add support for __cxa_atexit()/__cxa_finalize(),thorpej
as specified by the C++ ABI for Itanium. Despite the ABI document's name, many of the items in it are implemented for other architectures. See the following URL for a reference: http://www.codesourcery.com/cxx-abi/abi.html#dso-dtor Fixes lib/18379 (from Joel Baker).
2003-01-18Merge the nathanw_sa branch.thorpej
1999-09-20back out the #ifdef _DIAGNOSTIC argument checks; too many people complained.lukem
_DIAGASSERT() is still retained.
1999-09-16* use _DIAGASSERT() to check pointer arguments against NULL and filelukem
descriptors against -1 (as appropriate). * add actual checks which to detect stuff that would trigger_DIAGASSERT(), and attempt to return a sane error condition. * knf some code * remove some `register' decls. the first two items result in the addition of code similar to the following in various functions: _DIAGASSERT(path != NULL) #ifdef _DIAGNOSTIC if (path == NULL) { errno = EFAULT; return (-1); } #endif
1998-10-18Protect __atexit manipulation and traversal with a mutex.kleink
1998-02-03remove obsolete register declarationsperry
1998-01-30update to lite-2perry
1997-07-13Add local.h for local prototypes.christos
Fix namespace issues for strtoq and strtouq Fix gcc warnings. Fix RCSID's
1995-12-28New-style RCS ids.thorpej
1995-06-14define __atexit pointerjtc
1995-02-28remove unneeded "#include <stddef.h>"jtc
1993-08-26Declare rcsid strings so they are stored in text segment.jtc
1993-08-01Add RCS identifiers.mycroft
1993-03-21initial import of 386bsd-0.1 sourcescgd