2014-11-17 17:27:41 +00:00
|
|
|
/*
|
2018-02-12 12:36:17 +00:00
|
|
|
* Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
|
2014-11-17 17:27:41 +00:00
|
|
|
*
|
2017-05-03 09:38:09 +01:00
|
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
2014-11-17 17:27:41 +00:00
|
|
|
*/
|
|
|
|
|
2018-02-12 12:36:17 +00:00
|
|
|
#include <stdlib.h>
|
2014-11-17 17:27:41 +00:00
|
|
|
|
2018-05-24 13:34:53 +01:00
|
|
|
static void (*exitfun)(void);
|
|
|
|
|
|
|
|
void exit(int status)
|
2014-11-17 17:27:41 +00:00
|
|
|
{
|
2018-08-23 15:11:46 +01:00
|
|
|
if (exitfun != NULL)
|
2018-05-24 13:34:53 +01:00
|
|
|
(*exitfun)();
|
|
|
|
for (;;)
|
|
|
|
;
|
|
|
|
}
|
|
|
|
|
|
|
|
int atexit(void (*fun)(void))
|
|
|
|
{
|
2018-08-23 15:11:46 +01:00
|
|
|
if (exitfun != NULL)
|
2018-05-24 13:34:53 +01:00
|
|
|
return -1;
|
|
|
|
exitfun = fun;
|
|
|
|
|
|
|
|
return 0;
|
2014-11-17 17:27:41 +00:00
|
|
|
}
|