提交 eaa3454b 编写于 作者: mysterywolf's avatar mysterywolf

优化abort函数

上级 8ea33c21
......@@ -256,6 +256,7 @@ void _ttywrch(int ch)
#endif
}
/* for exit() and abort() */
RT_WEAK void _sys_exit(int return_code)
{
extern void __rt_libc_exit(int status);
......
......@@ -9,7 +9,6 @@
*/
#include <rtthread.h>
#include <stdlib.h>
void __rt_libc_exit(int status)
{
......@@ -24,24 +23,12 @@ void __rt_libc_exit(int status)
if (self != RT_NULL)
{
if(status == EXIT_FAILURE) /* abort() */
{
rt_kprintf("thread:%s abort!\n", self->name);
}
else /* exit() */
{
rt_kprintf("thread:%s exit:%d!\n", self->name, status);
}
rt_kprintf("thread:%s exit:%d!\n", self->name, status);
rt_thread_suspend(self);
rt_schedule();
}
}
void __rt_libc_abort(void)
{
__rt_libc_exit(EXIT_FAILURE);
}
int __rt_libc_system(const char *string)
{
/* TODO */
......
......@@ -9,16 +9,10 @@
*/
#include <rtthread.h>
void exit (int status)
/* for exit() and abort() */
void __exit (int status)
{
extern void __rt_libc_exit(int status);
__rt_libc_exit(status);
while(1);
}
void abort(void)
{
extern void __rt_libc_abort(void);
__rt_libc_abort();
while(1);
}
......@@ -283,8 +283,8 @@ _free_r (struct _reent *ptr, void *addr)
rt_free (addr);
}
void
exit (int status)
__attribute__ ((noreturn)) void
_exit (int status)
{
extern void __rt_libc_exit(int status);
__rt_libc_exit(status);
......@@ -303,13 +303,6 @@ void __libc_init_array(void)
/* we not use __libc init_aray to initialize C++ objects */
}
void abort(void)
{
extern void __rt_libc_abort(void);
__rt_libc_abort();
while(1);
}
uid_t getuid(void)
{
return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册