This commit is contained in:
Meco Man 2021-02-17 00:18:49 +08:00
parent e927a53b41
commit 9f5878b2fb
4 changed files with 18 additions and 15 deletions

View File

@ -258,8 +258,9 @@ void _ttywrch(int ch)
RT_WEAK void _sys_exit(int return_code)
{
extern rt_inline void __exit__(int status);
extern void __exit__(int status);
__exit__(return_code);
while(1);
}
/**
@ -305,7 +306,7 @@ int remove(const char *filename)
#else
int system(const char *string)
{
extern rt_inline int __system__(const char *string);
extern int __system__(const char *string);
return __system__(string);
}
#endif

View File

@ -12,7 +12,7 @@
#define ABORT_STATUS 2
rt_inline void __exit__(int status)
void __exit__(int status)
{
rt_thread_t self = rt_thread_self();
@ -27,7 +27,7 @@ rt_inline void __exit__(int status)
{
if(status == ABORT_STATUS) /* abort() */
{
rt_kprintf("thread:%s abort!\n", RT_NAME_MAX, self->name, status);
rt_kprintf("thread:%s abort!\n", RT_NAME_MAX, self->name);
}
else /* exit() */
{
@ -36,16 +36,14 @@ rt_inline void __exit__(int status)
rt_thread_suspend(self);
rt_schedule();
}
while(1); /* noreturn */
}
rt_inline void __abort__(void)
void __abort__(void)
{
__exit__(ABORT_STATUS);
}
rt_inline int __system__(const char *string)
int __system__(const char *string)
{
/* TODO */
return 0;

View File

@ -11,12 +11,14 @@
void exit (int status)
{
extern rt_inline void __exit__(int status);
__exit__(return_code);
extern void __exit__(int status);
__exit__(status);
while(1);
}
void abort(void)
{
extern rt_inline void __abort__(void);
extern void __abort__(void);
__abort__();
while(1);
}

View File

@ -286,15 +286,16 @@ _free_r (struct _reent *ptr, void *addr)
void
exit (int status)
{
extern rt_inline void __exit__(int status);
extern void __exit__(int status);
__exit__(status);
while(1);
}
void
_system(const char *s)
{
extern rt_inline int __system__(const char *string);
__system__(string);
extern int __system__(const char *string);
__system__(s);
}
void __libc_init_array(void)
@ -304,8 +305,9 @@ void __libc_init_array(void)
void abort(void)
{
extern rt_inline void __abort__(void);
extern void __abort__(void);
__abort__();
while(1);
}
uid_t getuid(void)