summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernard Xiong <[email protected]>2015-05-04 20:36:50 +0800
committerBernard Xiong <[email protected]>2015-05-04 20:36:50 +0800
commit1f52f79d0be3174698c4fe2ad4fcf70284733be7 (patch)
tree2e95a10c2c9c26c22cb6e4bb9da51b62c6bf157e
parent0af011101d896ec77ae1e4c6b4b986ac53a29a87 (diff)
[pthreads] The pthread component is depended to libc component.
-rw-r--r--components/pthreads/SConscript2
-rw-r--r--components/pthreads/posix_types.h84
2 files changed, 9 insertions, 77 deletions
diff --git a/components/pthreads/SConscript b/components/pthreads/SConscript
index c1211343ec..f220fb1992 100644
--- a/components/pthreads/SConscript
+++ b/components/pthreads/SConscript
@@ -3,6 +3,6 @@ from building import *
src = Glob('*.c')
CPPPATH = [RTT_ROOT + '/components/pthreads']
-group = DefineGroup('pthreads', src, depend = ['RT_USING_PTHREADS'], CPPPATH = CPPPATH)
+group = DefineGroup('pthreads', src, depend = ['RT_USING_PTHREADS', 'RT_USING_LIBC'], CPPPATH = CPPPATH)
Return('group')
diff --git a/components/pthreads/posix_types.h b/components/pthreads/posix_types.h
index 6f02417512..1e401e2de3 100644
--- a/components/pthreads/posix_types.h
+++ b/components/pthreads/posix_types.h
@@ -27,90 +27,22 @@
#include <rtthread.h>
-/* compatible in different compiler and C runtime library */
-#ifdef RT_USING_NEWLIB
-/* normarlly, GNU GCC will use newlib as C runtime library */
-#include <sys/types.h>
-#include <sys/time.h>
-#include <sys/signal.h>
-#include <sys/fcntl.h>
-
-#include <errno.h>
-#include <stdarg.h>
-
-#ifndef ESHUTDOWN
-#define ESHUTDOWN 180
-#endif
-
-#else
-
-/* ARM compiler and IAR compiler */
-#if defined(__CC_ARM) || defined(__IAR_SYSTEMS_ICC__)
#include <stddef.h>
#include <stdarg.h>
#include <string.h>
-typedef rt_int32_t clockid_t;
-typedef rt_int32_t key_t; /* Used for interprocess communication. */
-typedef rt_int32_t pid_t; /* Used for process IDs and process group IDs. */
-typedef signed long ssize_t; /* Used for a count of bytes or an error indication. */
-typedef signed long time_t; /* Used for time in seconds. */
-
-struct timespec
-{
- time_t tv_sec; /* seconds */
- long tv_nsec; /* nanoseconds */
-};
-
-struct timeval
-{
- long tv_sec; /* seconds */
- long tv_usec; /* microseconds */
-};
-
-#ifdef RT_USING_LWIP
-#include <lwip/arch.h>
-#else
-#define EPERM 1 /* Operation not permitted */
-#define ENOENT 2 /* No such file or directory */
-#define ESRCH 3 /* No such process */
-#define EINTR 4 /* Interrupted system call */
-#define EBADF 9 /* Bad file number */
-#define EAGAIN 11 /* Try again */
-#define ENOMEM 12 /* Out of memory */
-#define EBUSY 16 /* Device or resource busy */
-#define EEXIST 17 /* File exists */
-#define EINVAL 22 /* Invalid argument */
-#define ENFILE 23 /* File table overflow */
-#define EDEADLK 45 /* Resource deadlock would occur */
-#define EBADMSG 77 /* Not a data message */
-#define ENOSYS 89 /* Function not implemented */
-#define EOPNOTSUPP 122 /* Operation not supported on transport endpoint */
-#define ETIMEDOUT 145 /* Connection timed out */
-#endif
+#include <sys/types.h>
+#include <sys/time.h>
-#ifdef RT_USING_DFS
-#include <dfs_posix.h>
+/* errno for Keil MDK */
+#if defined(__CC_ARM) || defined(__IAR_SYSTEMS_ICC__)
+#include <sys/errno.h>
+#include <sys/unistd.h>
#else
-typedef rt_uint16_t mode_t;
-#define O_RDONLY 0x0000000
-#define O_WRONLY 0x0000001
-#define O_RDWR 0x0000002
-#define O_ACCMODE 0x0000003
-#define O_CREAT 0x0000100
-#define O_EXCL 0x0000200
-#define O_TRUNC 0x0001000
-#define O_APPEND 0x0002000
-#define O_DIRECTORY 0x0200000
-#endif
-
-#elif defined (__GNUC__) /* GNU GCC Compiler, with minilibc */
-#include <sys/time.h>
-#include <sys/types.h>
-#include <sys/stat.h>
+#include <unistd.h>
#include <errno.h>
+#include <fcntl.h>
#endif
#endif
-#endif