From 1f52f79d0be3174698c4fe2ad4fcf70284733be7 Mon Sep 17 00:00:00 2001 From: Bernard Xiong Date: Mon, 4 May 2015 20:36:50 +0800 Subject: [PATCH] [pthreads] The pthread component is depended to libc component. --- components/pthreads/SConscript | 2 +- components/pthreads/posix_types.h | 84 +++---------------------------- 2 files changed, 9 insertions(+), 77 deletions(-) diff --git a/components/pthreads/SConscript b/components/pthreads/SConscript index c1211343e..f220fb199 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 6f0241751..1e401e2de 100644 --- a/components/pthreads/posix_types.h +++ b/components/pthreads/posix_types.h @@ -27,90 +27,22 @@ #include -/* compatible in different compiler and C runtime library */ -#ifdef RT_USING_NEWLIB -/* normarlly, GNU GCC will use newlib as C runtime library */ -#include -#include -#include -#include - -#include -#include - -#ifndef ESHUTDOWN -#define ESHUTDOWN 180 -#endif - -#else - -/* ARM compiler and IAR compiler */ -#if defined(__CC_ARM) || defined(__IAR_SYSTEMS_ICC__) #include #include #include -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 -#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 +#include -#ifdef RT_USING_DFS -#include +/* errno for Keil MDK */ +#if defined(__CC_ARM) || defined(__IAR_SYSTEMS_ICC__) +#include +#include #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 -#include -#include +#include #include +#include #endif #endif -#endif -- GitLab