-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwrap_exit.c
More file actions
43 lines (31 loc) · 786 Bytes
/
wrap_exit.c
File metadata and controls
43 lines (31 loc) · 786 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include "alloc_stats.h"
void exit(int status)
{
static void (*real)(int) = NULL;
if (real == NULL)
resolve_symbol((void **)&real, "exit");
print_stats();
real(status);
/* Ignore clangd noreturn, as we exited above */
__builtin_unreachable();
}
void abort(void)
{
static void (*real)(void) = NULL;
if (real == NULL)
resolve_symbol((void **)&real, "abort");
print_stats();
real();
/* Ignore clangd noreturn, as we exited above */
__builtin_unreachable();
}
void _exit(int status)
{
static void (*real)(int) = NULL;
if (real == NULL)
resolve_symbol((void **)&real, "_exit");
print_stats();
real(status);
/* Ignore clangd noreturn, as we exited above */
__builtin_unreachable();
}