projects
/
project
/
bcm63xx
/
atf.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
Add atexit function to libc
[project/bcm63xx/atf.git]
/
lib
/
libc
/
exit.c
1
/*
2
* Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
3
*
4
* SPDX-License-Identifier: BSD-3-Clause
5
*/
6
7
#include <stdlib.h>
8
9
static void
(*
exitfun
)(
void
);
10
11
void
exit
(
int
status
)
12
{
13
if
(
exitfun
)
14
(*
exitfun
)();
15
for
(;;)
16
;
17
}
18
19
int
atexit
(
void
(*
fun
)(
void
))
20
{
21
if
(
exitfun
)
22
return
-
1
;
23
exitfun
=
fun
;
24
25
return
0
;
26
}