Example #1
0
_Noreturn void exit(int code) {
    __tls_run_dtors();
    __funcs_on_exit();
    __libc_exit_fini();
    __stdio_exit();
    if (&__libc_extensions_fini != NULL)
        __libc_extensions_fini();
    _Exit(code);
}
Example #2
0
_Noreturn void exit(int code)
{
	__funcs_on_exit();

#ifndef SHARED
	uintptr_t a = (uintptr_t)&__fini_array_end;
	for (; a>(uintptr_t)&__fini_array_start; a-=sizeof(void(*)()))
		(*(void (**)())(a-sizeof(void(*)())))();
	_fini();
#endif

	__stdio_exit();

	_Exit(code);
}
Example #3
0
void exit(int code)
{
	static int lock;

	/* If more than one thread calls exit, hang until _Exit ends it all */
	LOCK(&lock);

	/* Only do atexit & stdio flush if they were actually used */
	__funcs_on_exit();
	__fflush_on_exit();

	/* Destructor s**t is kept separate from atexit to avoid bloat */
	if (libc.fini) libc.fini();
	if (libc.ldso_fini) libc.ldso_fini();

	_Exit(code);
	for(;;);
}
Example #4
0
_Noreturn void exit(int code)
{
	static int lock;

	/* If more than one thread calls exit, hang until _Exit ends it all */
	while (a_swap(&lock, 1)) __syscall(SYS_pause);

	__funcs_on_exit();

#ifndef SHARED
	uintptr_t a = (uintptr_t)&__fini_array_end;
	for (; a>(uintptr_t)&__fini_array_start; a-=sizeof(void(*)()))
		(*(void (**)())(a-sizeof(void(*)())))();
	_fini();
#endif

	__flush_on_exit();
	__seek_on_exit();

	_Exit(code);
	for(;;);
}