blob: f4ffe27cfb6a96447d92a7cf176151bfce2de794 [file] [log] [blame]
Ambroise Vincent4128f9f2019-02-11 13:34:41 +00001/*
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
9static void (*exitfun)(void);
10
11void exit(int status)
12{
13 if (exitfun != NULL)
14 (*exitfun)();
15 for (;;)
16 ;
17}
18
19int atexit(void (*fun)(void))
20{
21 if (exitfun != NULL)
22 return -1;
23 exitfun = fun;
24
25 return 0;
26}