blob: 6de2e9356cecc6c851b86df9eb12e6736ddf6dcb [file] [log] [blame]
Imre Kisf55f2aa2024-05-28 15:55:19 +02001/*
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}