summaryrefslogtreecommitdiff
path: root/components/libc/compilers/dlib
diff options
context:
space:
mode:
authorMeco Jianting Man <[email protected]>2021-02-16 06:54:02 -0600
committerGitHub <[email protected]>2021-02-16 06:54:02 -0600
commite19873db6d6947f02e0b093251adf3c73daabdd8 (patch)
treea10b63a5ce4157ad2e232f70382702fe1af24946 /components/libc/compilers/dlib
parentf0805a7973ffe62e459da7748cbada62bccf98b9 (diff)
parent06f47dafd25e396787dffaecc777fe1210b4a82b (diff)
Merge pull request #17 from RT-Thread/master
pr
Diffstat (limited to 'components/libc/compilers/dlib')
-rw-r--r--components/libc/compilers/dlib/syscall_remove.c10
-rw-r--r--components/libc/compilers/dlib/syscalls.c52
-rw-r--r--components/libc/compilers/dlib/syscalls.h10
3 files changed, 57 insertions, 15 deletions
diff --git a/components/libc/compilers/dlib/syscall_remove.c b/components/libc/compilers/dlib/syscall_remove.c
index e7f0268b1b..f7e64d1997 100644
--- a/components/libc/compilers/dlib/syscall_remove.c
+++ b/components/libc/compilers/dlib/syscall_remove.c
@@ -9,16 +9,16 @@
*/
#include <rtthread.h>
#ifdef RT_USING_DFS
-#include <dfs_file.h>
+#include <dfs_posix.h>
#endif
#include <yfuns.h>
#pragma module_name = "?remove"
int remove(const char *val)
{
-#ifdef RT_USING_DFS
- dfs_file_unlink(val);
+#ifndef RT_USING_DFS
+ return -1;
+#else
+ return unlink(val);
#endif
-
- return 0;
}
diff --git a/components/libc/compilers/dlib/syscalls.c b/components/libc/compilers/dlib/syscalls.c
new file mode 100644
index 0000000000..0d5f02f952
--- /dev/null
+++ b/components/libc/compilers/dlib/syscalls.c
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2006-2018, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2021-02-13 Meco Man implement exit() and abort()
+ */
+#include <rtthread.h>
+
+void exit (int status)
+{
+ rt_thread_t self = rt_thread_self();
+
+#ifdef RT_USING_MODULE
+ if (dlmodule_self())
+ {
+ dlmodule_exit(status);
+ }
+#endif
+
+ if (self != RT_NULL)
+ {
+ rt_kprintf("thread:%-8.*s exit:%d!\n", RT_NAME_MAX, self->name, status);
+ rt_thread_suspend(self);
+ rt_schedule();
+ }
+
+ while(1); /* noreturn */
+}
+
+void abort(void)
+{
+ rt_thread_t self = rt_thread_self();
+
+#ifdef RT_USING_MODULE
+ if (dlmodule_self())
+ {
+ dlmodule_exit(-1);
+ }
+#endif
+
+ if (self != RT_NULL)
+ {
+ rt_kprintf("thread:%-8.*s abort!\n", RT_NAME_MAX, self->name);
+ rt_thread_suspend(self);
+ rt_schedule();
+ }
+
+ while(1); /* noreturn */
+}
diff --git a/components/libc/compilers/dlib/syscalls.h b/components/libc/compilers/dlib/syscalls.h
deleted file mode 100644
index 993962e8db..0000000000
--- a/components/libc/compilers/dlib/syscalls.h
+++ /dev/null
@@ -1,10 +0,0 @@
-/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Change Logs:
- * Date Author Notes
- * 2015-01-28 Bernard first version
- */
-