summaryrefslogtreecommitdiff
path: root/components/libc/compilers/dlib
diff options
context:
space:
mode:
authorlizhirui <[email protected]>2021-05-18 09:54:11 +0800
committerlizhirui <[email protected]>2021-05-18 09:54:11 +0800
commit9a4e270f9770f778128ffdabe94f101416ce8c61 (patch)
tree9df43fbcc25c3f288ed6fdecd65909d4094d849f /components/libc/compilers/dlib
parente7fc0c89d2367533dcd1b77e46acaeea7bc3f876 (diff)
parent4e9e3f79a565bb4fdc1d96deda18f9c771aeb0c9 (diff)
Merge branch 'RT-Thread:master' into master
Diffstat (limited to 'components/libc/compilers/dlib')
-rw-r--r--components/libc/compilers/dlib/dirent.h62
-rw-r--r--components/libc/compilers/dlib/environ.c2
-rw-r--r--components/libc/compilers/dlib/fcntl.h8
-rw-r--r--components/libc/compilers/dlib/libc.c2
-rw-r--r--components/libc/compilers/dlib/libc.h2
-rw-r--r--components/libc/compilers/dlib/rmtx.c60
-rw-r--r--components/libc/compilers/dlib/stdio.c2
-rw-r--r--components/libc/compilers/dlib/sys/README.md1
-rw-r--r--components/libc/compilers/dlib/sys/errno.h16
-rw-r--r--components/libc/compilers/dlib/sys/mman.h58
-rw-r--r--components/libc/compilers/dlib/sys/signal.h16
-rw-r--r--components/libc/compilers/dlib/sys/stat.h8
-rw-r--r--components/libc/compilers/dlib/sys/types.h25
-rw-r--r--components/libc/compilers/dlib/sys/unistd.h50
-rw-r--r--components/libc/compilers/dlib/syscall_close.c2
-rw-r--r--components/libc/compilers/dlib/syscall_lseek.c2
-rw-r--r--components/libc/compilers/dlib/syscall_mem.c2
-rw-r--r--components/libc/compilers/dlib/syscall_open.c2
-rw-r--r--components/libc/compilers/dlib/syscall_read.c2
-rw-r--r--components/libc/compilers/dlib/syscall_remove.c2
-rw-r--r--components/libc/compilers/dlib/syscall_write.c2
-rw-r--r--components/libc/compilers/dlib/syscalls.c13
-rw-r--r--components/libc/compilers/dlib/unistd.h14
23 files changed, 18 insertions, 335 deletions
diff --git a/components/libc/compilers/dlib/dirent.h b/components/libc/compilers/dlib/dirent.h
deleted file mode 100644
index 4c897cc550..0000000000
--- a/components/libc/compilers/dlib/dirent.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Change Logs:
- * Date Author Notes
- */
-#ifndef __RTT_DIRENT_H__
-#define __RTT_DIRENT_H__
-
-#include <rtthread.h>
-#include <rtlibc.h>
-
-/*
-* dirent.h - format of directory entries
- * Ref: http://www.opengroup.org/onlinepubs/009695399/basedefs/dirent.h.html
- */
-
-/* File types */
-#define FT_REGULAR 0 /* regular file */
-#define FT_SOCKET 1 /* socket file */
-#define FT_DIRECTORY 2 /* directory */
-#define FT_USER 3 /* user defined */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef HAVE_DIR_STRUCTURE
-typedef struct
-{
- int fd; /* directory file */
- char buf[512];
- int num;
- int cur;
-} DIR;
-#endif
-
-#ifndef HAVE_DIRENT_STRUCTURE
-struct dirent
-{
- rt_uint8_t d_type; /* The type of the file */
- rt_uint8_t d_namlen; /* The length of the not including the terminating null file name */
- rt_uint16_t d_reclen; /* length of this record */
- char d_name[256]; /* The null-terminated file name */
-};
-#endif
-
-int closedir(DIR *);
-DIR *opendir(const char *);
-struct dirent *readdir(DIR *);
-int readdir_r(DIR *, struct dirent *, struct dirent **);
-void rewinddir(DIR *);
-void seekdir(DIR *, long int);
-long telldir(DIR *);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/components/libc/compilers/dlib/environ.c b/components/libc/compilers/dlib/environ.c
index ac19758838..84b04fda55 100644
--- a/components/libc/compilers/dlib/environ.c
+++ b/components/libc/compilers/dlib/environ.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/components/libc/compilers/dlib/fcntl.h b/components/libc/compilers/dlib/fcntl.h
deleted file mode 100644
index ce95230e88..0000000000
--- a/components/libc/compilers/dlib/fcntl.h
+++ /dev/null
@@ -1,8 +0,0 @@
-/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Change Logs:
- * Date Author Notes
- */
diff --git a/components/libc/compilers/dlib/libc.c b/components/libc/compilers/dlib/libc.c
index 8b42411a6b..d0dca7c5f6 100644
--- a/components/libc/compilers/dlib/libc.c
+++ b/components/libc/compilers/dlib/libc.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/components/libc/compilers/dlib/libc.h b/components/libc/compilers/dlib/libc.h
index 5b46bee0c8..fc3cafca78 100644
--- a/components/libc/compilers/dlib/libc.h
+++ b/components/libc/compilers/dlib/libc.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/components/libc/compilers/dlib/rmtx.c b/components/libc/compilers/dlib/rmtx.c
deleted file mode 100644
index 69405c8f6a..0000000000
--- a/components/libc/compilers/dlib/rmtx.c
+++ /dev/null
@@ -1,60 +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
- */
-#include <rtthread.h>
-#include <yfuns.h>
-
-/*
- * for IAR compiler, we recommand to define _DLIB_THREAD_SUPPORT
- * as 2 for dlib multi-thread support.
- */
-
-#if _DLIB_THREAD_SUPPORT
-typedef void* _Rmtx;
-void _Mtxinit(_Rmtx *m)
-{
- rt_mutex_t mutex;
-
- RT_ASSERT(m != RT_NULL);
-
- mutex = (rt_mutex_t)m;
- rt_mutex_init(mutex, "iarMtx", RT_IPC_FLAG_FIFO);
-}
-
-void _Mtxdst(_Rmtx *m)
-{
- rt_mutex_t mutex;
-
- RT_ASSERT(m != RT_NULL);
-
- mutex = (rt_mutex_t)m;
- rt_mutex_detach(mutex);
-}
-
-void _Mtxlock(_Rmtx *m)
-{
- rt_mutex_t mutex;
-
- RT_ASSERT(m != RT_NULL);
-
- mutex = (rt_mutex_t)m;
- rt_mutex_take(mutex, RT_WAITING_FOREVER);
-}
-
-void _Mtxunlock(_Rmtx *m)
-{
- rt_mutex_t mutex;
-
- RT_ASSERT(m != RT_NULL);
-
- mutex = (rt_mutex_t)m;
- rt_mutex_release(mutex);
-}
-#endif
-
diff --git a/components/libc/compilers/dlib/stdio.c b/components/libc/compilers/dlib/stdio.c
index b35ade7a38..c11157d759 100644
--- a/components/libc/compilers/dlib/stdio.c
+++ b/components/libc/compilers/dlib/stdio.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/components/libc/compilers/dlib/sys/README.md b/components/libc/compilers/dlib/sys/README.md
deleted file mode 100644
index 4f0d203180..0000000000
--- a/components/libc/compilers/dlib/sys/README.md
+++ /dev/null
@@ -1 +0,0 @@
-Because IAR leaks some system header file, we put them in here. \ No newline at end of file
diff --git a/components/libc/compilers/dlib/sys/errno.h b/components/libc/compilers/dlib/sys/errno.h
deleted file mode 100644
index 1ad4c8acc0..0000000000
--- a/components/libc/compilers/dlib/sys/errno.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Change Logs:
- * Date Author Notes
- * 2019-07-08 Bernard The first version
- */
-
-#ifndef SYS_ERRNO_H__
-#define SYS_ERRNO_H__
-
-#include <errno.h>
-
-#endif
diff --git a/components/libc/compilers/dlib/sys/mman.h b/components/libc/compilers/dlib/sys/mman.h
deleted file mode 100644
index 8c61b32b7c..0000000000
--- a/components/libc/compilers/dlib/sys/mman.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Change Logs:
- * Date Author Notes
- * 2017/11/30 Bernard The first version.
- */
-
-#ifndef _SYS_MMAN_H
-#define _SYS_MMAN_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define MAP_FAILED ((void *) -1)
-
-#define MAP_SHARED 0x01
-#define MAP_PRIVATE 0x02
-#define MAP_TYPE 0x0f
-#define MAP_FIXED 0x10
-#define MAP_ANON 0x20
-#define MAP_ANONYMOUS MAP_ANON
-#define MAP_NORESERVE 0x4000
-#define MAP_GROWSDOWN 0x0100
-#define MAP_DENYWRITE 0x0800
-#define MAP_EXECUTABLE 0x1000
-#define MAP_LOCKED 0x2000
-#define MAP_POPULATE 0x8000
-#define MAP_NONBLOCK 0x10000
-#define MAP_STACK 0x20000
-#define MAP_HUGETLB 0x40000
-#define MAP_FILE 0
-
-#define PROT_NONE 0
-#define PROT_READ 1
-#define PROT_WRITE 2
-#define PROT_EXEC 4
-#define PROT_GROWSDOWN 0x01000000
-#define PROT_GROWSUP 0x02000000
-
-#define MS_ASYNC 1
-#define MS_INVALIDATE 2
-#define MS_SYNC 4
-
-#define MCL_CURRENT 1
-#define MCL_FUTURE 2
-#define MCL_ONFAULT 4
-
-void *mmap (void *start, size_t len, int prot, int flags, int fd, off_t off);
-int munmap (void *start, size_t len);
-
-#ifdef __cplusplus
-}
-#endif
-#endif
diff --git a/components/libc/compilers/dlib/sys/signal.h b/components/libc/compilers/dlib/sys/signal.h
deleted file mode 100644
index 22adb1228b..0000000000
--- a/components/libc/compilers/dlib/sys/signal.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Change Logs:
- * Date Author Notes
- * 2019-07-08 Bernard The first version
- */
-
-#ifndef SYS_SIGNAL_H__
-#define SYS_SIGNAL_H__
-
-#include <libc/libc_signal.h>
-
-#endif
diff --git a/components/libc/compilers/dlib/sys/stat.h b/components/libc/compilers/dlib/sys/stat.h
deleted file mode 100644
index ce95230e88..0000000000
--- a/components/libc/compilers/dlib/sys/stat.h
+++ /dev/null
@@ -1,8 +0,0 @@
-/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Change Logs:
- * Date Author Notes
- */
diff --git a/components/libc/compilers/dlib/sys/types.h b/components/libc/compilers/dlib/sys/types.h
deleted file mode 100644
index 7dbeddcaa9..0000000000
--- a/components/libc/compilers/dlib/sys/types.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Change Logs:
- * Date Author Notes
- * 2020-12-16 Meco Man add useconds_t
- */
-#ifndef __TYPES_H__
-#define __TYPES_H__
-
-#include <stdint.h>
-
-typedef int32_t clockid_t;
-typedef int32_t key_t; /* Used for interprocess communication. */
-typedef int32_t pid_t; /* Used for process IDs and process group IDs. */
-#ifndef ARCH_CPU_64BIT
-typedef signed int ssize_t; /* Used for a count of bytes or an error indication. */
-#else
-typedef long signed int ssize_t; /* Used for a count of bytes or an error indication. */
-#endif
-typedef unsigned long useconds_t; /* microseconds (unsigned) */
-
-#endif
diff --git a/components/libc/compilers/dlib/sys/unistd.h b/components/libc/compilers/dlib/sys/unistd.h
deleted file mode 100644
index 6d99cd6c55..0000000000
--- a/components/libc/compilers/dlib/sys/unistd.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Change Logs:
- * Date Author Notes
- * 2020-12-16 Meco Man add usleep
- */
-#ifndef _SYS_UNISTD_H
-#define _SYS_UNISTD_H
-
-#include <rtconfig.h>
-#include "types.h"
-
-#ifdef RT_USING_DFS
-
-#define STDIN_FILENO 0 /* standard input file descriptor */
-#define STDOUT_FILENO 1 /* standard output file descriptor */
-#define STDERR_FILENO 2 /* standard error file descriptor */
-
-#include <dfs_posix.h>
-#else
-#define _FREAD 0x0001 /* read enabled */
-#define _FWRITE 0x0002 /* write enabled */
-#define _FAPPEND 0x0008 /* append (writes guaranteed at the end) */
-#define _FMARK 0x0010 /* internal; mark during gc() */
-#define _FDEFER 0x0020 /* internal; defer for next gc pass */
-#define _FASYNC 0x0040 /* signal pgrp when data ready */
-#define _FSHLOCK 0x0080 /* BSD flock() shared lock present */
-#define _FEXLOCK 0x0100 /* BSD flock() exclusive lock present */
-#define _FCREAT 0x0200 /* open with file create */
-#define _FTRUNC 0x0400 /* open with truncation */
-#define _FEXCL 0x0800 /* error on open if file exists */
-#define _FNBIO 0x1000 /* non blocking I/O (sys5 style) */
-#define _FSYNC 0x2000 /* do all writes synchronously */
-#define _FNONBLOCK 0x4000 /* non blocking I/O (POSIX style) */
-#define _FNDELAY _FNONBLOCK /* non blocking I/O (4.2 style) */
-#define _FNOCTTY 0x8000 /* don't assign a ctty on this open */
-
-#endif
-
-
-int isatty (int fd);
-char * ttyname (int desc);
-
-unsigned int sleep(unsigned int seconds);
-int usleep(useconds_t usec);
-
-#endif /* _SYS_UNISTD_H */
diff --git a/components/libc/compilers/dlib/syscall_close.c b/components/libc/compilers/dlib/syscall_close.c
index f46162deb7..7ed1cc2f2d 100644
--- a/components/libc/compilers/dlib/syscall_close.c
+++ b/components/libc/compilers/dlib/syscall_close.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/components/libc/compilers/dlib/syscall_lseek.c b/components/libc/compilers/dlib/syscall_lseek.c
index b79cc410b7..47a069bf0a 100644
--- a/components/libc/compilers/dlib/syscall_lseek.c
+++ b/components/libc/compilers/dlib/syscall_lseek.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/components/libc/compilers/dlib/syscall_mem.c b/components/libc/compilers/dlib/syscall_mem.c
index 236ef1c12d..9c6de64455 100644
--- a/components/libc/compilers/dlib/syscall_mem.c
+++ b/components/libc/compilers/dlib/syscall_mem.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/components/libc/compilers/dlib/syscall_open.c b/components/libc/compilers/dlib/syscall_open.c
index 96e02dc32a..37bfcecb47 100644
--- a/components/libc/compilers/dlib/syscall_open.c
+++ b/components/libc/compilers/dlib/syscall_open.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/components/libc/compilers/dlib/syscall_read.c b/components/libc/compilers/dlib/syscall_read.c
index e248211486..afb661bd93 100644
--- a/components/libc/compilers/dlib/syscall_read.c
+++ b/components/libc/compilers/dlib/syscall_read.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/components/libc/compilers/dlib/syscall_remove.c b/components/libc/compilers/dlib/syscall_remove.c
index f7e64d1997..7d74236f4c 100644
--- a/components/libc/compilers/dlib/syscall_remove.c
+++ b/components/libc/compilers/dlib/syscall_remove.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/components/libc/compilers/dlib/syscall_write.c b/components/libc/compilers/dlib/syscall_write.c
index 85c0da22c3..de464530b8 100644
--- a/components/libc/compilers/dlib/syscall_write.c
+++ b/components/libc/compilers/dlib/syscall_write.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/components/libc/compilers/dlib/syscalls.c b/components/libc/compilers/dlib/syscalls.c
index 10155948ba..e1c9562b3a 100644
--- a/components/libc/compilers/dlib/syscalls.c
+++ b/components/libc/compilers/dlib/syscalls.c
@@ -1,24 +1,25 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2021-02-13 Meco Man implement exit() and abort()
+ * 2021-02-20 Meco Man add system()
*/
#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)
+int system(const char * string)
{
- extern void __rt_libc_abort(void);
- __rt_libc_abort();
- while(1);
+ extern int __rt_libc_system(const char *string);
+ return __rt_libc_system(string);
}
diff --git a/components/libc/compilers/dlib/unistd.h b/components/libc/compilers/dlib/unistd.h
deleted file mode 100644
index a07d8409c2..0000000000
--- a/components/libc/compilers/dlib/unistd.h
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Change Logs:
- * Date Author Notes
- */
-#ifndef _UNISTD_H_
-#define _UNISTD_H_
-
-# include "sys/unistd.h"
-
-#endif /* _UNISTD_H_ */