|
7 | 7 | #ifndef RTTHREAD_PLATFORM_INTERNAL_H |
8 | 8 | #define RTTHREAD_PLATFORM_INTERNAL_H |
9 | 9 |
|
| 10 | +#include <sys/ioctl.h> |
| 11 | +#include <fcntl.h> |
| 12 | +#include <limits.h> |
| 13 | +#include <errno.h> |
| 14 | +#include <poll.h> |
| 15 | +#if defined(RT_USING_PTHREADS) |
| 16 | +#include <pthread.h> |
| 17 | +#else |
10 | 18 | #include <rtthread.h> |
| 19 | +#endif |
11 | 20 | #include <stdbool.h> |
12 | 21 | #include <string.h> |
13 | 22 | #include <stdio.h> |
14 | 23 | #include <stdlib.h> |
15 | 24 | #include <math.h> |
16 | 25 | #include <stdint.h> |
17 | 26 | #include <ctype.h> |
| 27 | +#include <dirent.h> |
| 28 | +#include <assert.h> |
18 | 29 |
|
19 | 30 | #if defined(WASM_ENABLE_AOT) |
20 | 31 | #if defined(RTT_WAMR_BUILD_TARGET_THUMB) |
|
32 | 43 | #endif |
33 | 44 | #endif /* WASM_ENABLE_AOT */ |
34 | 45 |
|
| 46 | +/* Use rt-thread's definition as default */ |
| 47 | +#if 0 // defined(RT_USING_PTHREADS) |
| 48 | +typedef pthread_t korp_tid; |
| 49 | +typedef pthread_mutex_t korp_mutex; |
| 50 | +typedef pthread_cond_t korp_cond; |
| 51 | +typedef pthread_t korp_thread; |
| 52 | +#else |
35 | 53 | typedef rt_thread_t korp_tid; |
36 | 54 | typedef struct rt_mutex korp_mutex; |
37 | 55 | typedef struct rt_thread korp_cond; |
38 | 56 | typedef struct rt_thread korp_thread; |
| 57 | +#endif |
39 | 58 | typedef unsigned int korp_sem; |
40 | 59 |
|
| 60 | +#if !defined(socklen_t) && !defined(SOCKLEN_T_DEFINED) |
| 61 | +typedef uint32_t socklen_t; |
| 62 | +#endif |
| 63 | + |
| 64 | +#if !defined(SOL_SOCKET) |
| 65 | +#define SOL_SOCKET 1 |
| 66 | +#endif |
| 67 | + |
| 68 | +#if !defined(SO_TYPE) |
| 69 | +#define SO_TYPE 3 |
| 70 | +#endif |
| 71 | + |
| 72 | +#if !defined(SOCK_DGRAM) |
| 73 | +#define SOCK_DGRAM 2 |
| 74 | +#endif |
| 75 | + |
| 76 | +#if !defined(SOCK_STREAM) |
| 77 | +#define SOCK_STREAM 1 |
| 78 | +#endif |
| 79 | + |
| 80 | +#if !defined(UTIME_NOW) |
| 81 | +#define UTIME_NOW -2L |
| 82 | +#endif |
| 83 | + |
| 84 | +#if !defined(UTIME_OMIT) |
| 85 | +#define UTIME_OMIT -1L |
| 86 | +#endif |
| 87 | + |
| 88 | +#if !defined(AT_SYMLINK_NOFOLLOW) |
| 89 | +#define AT_SYMLINK_NOFOLLOW 2 |
| 90 | +#endif |
| 91 | + |
| 92 | +#if !defined(AT_SYMLINK_FOLLOW) |
| 93 | +#define AT_SYMLINK_FOLLOW 4 |
| 94 | +#endif |
| 95 | + |
| 96 | +#if !defined(AT_REMOVEDIR) |
| 97 | +#define AT_REMOVEDIR 8 |
| 98 | +#endif |
| 99 | + |
| 100 | +#define DT_BLK 0x06 |
| 101 | +#define DT_CHR 0x02 |
| 102 | +#define DT_LNK 0x0A |
| 103 | + |
| 104 | +#define PTHREAD_STACK_MIN 1024 |
| 105 | +#define BH_THREAD_DEFAULT_PRIORITY 30 |
| 106 | + |
41 | 107 | /* korp_rwlock is used in platform_api_extension.h, |
42 | 108 | we just define the type to make the compiler happy */ |
43 | 109 | typedef struct { |
|
0 commit comments