source: azure_iot_hub/trunk/musl-1.1.18/src/exit/exit.c@ 390

Last change on this file since 390 was 390, checked in by coas-nagasima, 5 years ago

コードを整理

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-csrc;charset=UTF-8
File size: 802 bytes
Line 
1#include <stdlib.h>
2#include <stdint.h>
3#include "libc.h"
4
5static void dummy()
6{
7}
8
9/* atexit.c and __stdio_exit.c override these. the latter is linked
10 * as a consequence of linking either __toread.c or __towrite.c. */
11weak_alias(dummy, __funcs_on_exit);
12weak_alias(dummy, __stdio_exit);
13weak_alias(dummy, _fini);
14
15__attribute__((__weak__, __visibility__("hidden")))
16extern void (*const __fini_array_start)(void), (*const __fini_array_end)(void);
17
18static void libc_exit_fini(void)
19{
20 uintptr_t a = (uintptr_t)&__fini_array_end;
21 for (; a>(uintptr_t)&__fini_array_start; a-=sizeof(void(*)()))
22 (*(void (**)())(a-sizeof(void(*)())))();
23 _fini();
24}
25
26weak_alias(libc_exit_fini, __libc_exit_fini);
27
28_Noreturn void exit(int code)
29{
30 __funcs_on_exit();
31 __libc_exit_fini();
32 __stdio_exit();
33 _Exit(code);
34}
Note: See TracBrowser for help on using the repository browser.