summaryrefslogtreecommitdiff
path: root/src/lib/libc/stdlib/atexit.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Move __cxa_thread_atexit* to its own .c file to avoid pulling the codeguenther2017-12-161-36/+3
| | | | | | | (w/ _dlctl reference) into static executables. It's all Mark's code so put his preferred copyright on it. ok kettenis@
* Remove DEF_STRONG(__cxa_thread_atexit_impl). This produces an unwantedkettenis2017-12-051-2/+1
| | | | | _libc___cxa_thread_atexit_impl reference on gcc architectures that breaks the build.
* Implement __cxa_thread_atexit to support C++11 thread_local scope. Thekettenis2017-12-051-1/+53
| | | | | | | interface is also made available as __cxa_thread_atexit_impl to satisfy the needs of GNU libstdc++. ok guenther@, millert@
* libc.so can't be unloaded, so move the hidden atexit() and pthread_atfork()guenther2015-11-101-1/+13
| | | | | | | | | | | stubs for the executable from crtbegin.o into libc, which lets them be excluded from static links that don't use them. For this, drop the normal crt{begin,end}S.o from libc.so: the .init and .fini sections for libc aren't called at the right times anyway, so it's good that they're unused. libc.so just needs __guard_local and the .note.openbsd.ident section, so add them to stack_protector.c for now (this will be improved) "good time" deraadt@
* Move the _atfork_list definition to atexit.c so that the fork syscall stubguenther2015-10-251-1/+5
| | | | | | doesn't get pulled into all static executables ok millert@ jca@
* Hide __atexit and __atexit_register_cleanup()guenther2015-10-251-1/+3
| | | | | | | | Wrap __cxa_{atexit,finalize}() so the call from exit() goes direct Switch regress/lib/libc/atexit/ to be built with -static so that it can still access __atexit* ok millert@ jca@
* Make pthread_atfork() track the DSO that called it like atexit() does,guenther2015-04-071-1/+19
| | | | | | | | | | unregistering callbacks if the DSO is unloaded. Move the callback handling from libpthread to libc, though libpthread still overrides the inner call to handle locking and thread-library reinitialization. Major version bump for both libc and libpthread. verification that this fixes various ports ajacoutot@ asm assistance miod@; ok millert@ deraadt@
* Add locking for __cxa_finalize() as it modifies the page permissions of thekettenis2014-07-111-1/+5
| | | | | | | __atexit tables and touches global variables. From Srinavasa Nagaraju through Android/Elliott Hughes. ok tedu@, guenther@
* as noted by google/android via kettenis, atexit handlers can install newtedu2014-07-101-1/+8
| | | | | handlers. if this happens, restart the loop. ok kettenis matthew millert miod
* Always call atexit handlers as if they were registered with __cxa_atexit.kettenis2014-06-181-9/+6
| | | | | | | | | | | The extra argument doesn't hurt genuine atexit handlers and this fixes a bug where we didn't provide the argument (effectively passing garbage) for functions registered with __cxa_atexit in the main executable. Pointed out by Dmitriy Ivanov <dimitry@google.com> and Elliott Hughes <enh@google.com>. ok matthew@
* Move atexit(3) into crtbegin.c and certbeginS.c such that we can pass thekettenis2013-12-281-10/+1
| | | | | | | | | | right __dso_handle and have dlopen'ed shared objects run their atexit handlers when they get unloaded. This is what Linux does, and several ports depend on this behaviour (and will crash upon exit without this chang). Based on an earlier diff from matthew@ Tested by ajacoutot@ ok deraadt@
* Two small cleanups to atexit: remove unneeded __atexit_invalid, andmatthew2013-06-021-10/+4
| | | | | | | move the call_depth decrement so it happens unconditionally and can still return to 0 when called with dso!=NULL. ok millert
* Fix __cxa_finalize() so that calling __cxa_finalize(NULL) properlymatthew2011-03-021-2/+2
| | | | | | invokes handlers registered with __cxa_atexit(). "seems right" deraadt@
* Add missing header to avoid warningchl2007-09-051-1/+2
| | | | ok millert@ ray@
* Add __cxa_atexit() support for gcc3. This provides support for shared ↵millert2007-09-031-9/+84
| | | | object destructors called at dlclose() time. Inspired by similar changes in FreeBSD and NetBSD.
* Avouid a race in atexit() handling by introducing a lock. Problemotto2006-02-221-9/+20
| | | | | originally reported by Gergely Kovacs; help from dhartmei@; ok tedu@ millert@
* Remove obsolete comment. ok deraadt@otto2005-10-261-5/+1
|
* zap remaining rcsid.espie2005-08-081-4/+1
| | | | | | Kill old files that are no longer compiled. okay theo
* no longer a need for the free(malloc(1)) hack, because the brk stuffderaadt2005-06-171-9/+5
| | | | | no longer needs initializing (we use mmap for malloc entirely now) noticed by kjell, ok dhartmei, tested by me
* ansi + de-registerpat2005-03-301-9/+7
| | | | ok otto deraadt
* Move __cleanup into mprotect'ed page to prevent unintentional modificationsdhartmei2002-09-141-5/+56
| | | | similar to the atexit handlers. Idea and help deraadt@, ok deraadt@
* missing include, ok theohenning2002-09-061-1/+2
|
* re-enable function pointer table protection, this time make sure thatdhartmei2002-08-301-35/+51
| | | | | malloc.c gets the first mmap() call (since it depends on that, for its sbrk(0) use). ok deraadt@
* Back it out, it breaks something in perl (seen with spamassassin), debugdhartmei2002-07-311-46/+35
| | | | first.
* Replace atexit handler. mprotect() the pages so an attempt to modify thedhartmei2002-07-291-35/+46
| | | | | function pointers from the outside will segfault. Idea, hints and feedback from deraadt. ok deraadt.
* Fix RCS idstholo1996-08-191-2/+1
| | | | Make sure everything uses {SYS,}LIBC_SCCS properly
* initial import of NetBSD treederaadt1995-10-181-0/+68