|
8 | 8 | #ifndef INCLUDE_ZEPHYR_POSIX_POSIX_FEATURES_H_ |
9 | 9 | #define INCLUDE_ZEPHYR_POSIX_POSIX_FEATURES_H_ |
10 | 10 |
|
11 | | -#include <zephyr/autoconf.h> /* CONFIG_* */ |
12 | | -#include <zephyr/sys/util_macro.h> /* COND_CODE_1() */ |
| 11 | +/* |
| 12 | + * Note: this header is included (currently) via |
| 13 | + * `-imacros ${ZEPHYR_BASE}/include/zephyr/posix/posix_features.h`. |
| 14 | + * |
| 15 | + * It is not appropriate to place anything other than "symbolic constants" in this file. In this |
| 16 | + * context, "symbolic constants" refers to those listed in the section "Constants for Options and |
| 17 | + * Option Groups", in the POSIX specification. |
| 18 | + * https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/unistd.h.html |
| 19 | + * |
| 20 | + * If there is a better alternative, to ensure that the contents of this file are available to |
| 21 | + * every compilation unit, for arbitrary C compilers, C libraries, toolchains, and so on, it is |
| 22 | + * to be investigated as part of the issue below. |
| 23 | + * |
| 24 | + * https://github.com/zephyrproject-rtos/zephyr/issues/98525 |
| 25 | + */ |
| 26 | +#if defined(_POSIX_C_SOURCE) && defined(CONFIG_POSIX_SYSTEM_INTERFACES) |
13 | 27 |
|
14 | 28 | /* |
15 | 29 | * POSIX Application Environment Profiles (AEP - IEEE Std 1003.13-2003) |
16 | 30 | */ |
17 | 31 |
|
| 32 | +#undef _POSIX_AEP_REALTIME_MINIMAL |
18 | 33 | #ifdef CONFIG_POSIX_AEP_REALTIME_MINIMAL |
19 | 34 | #define _POSIX_AEP_REALTIME_MINIMAL 200312L |
20 | 35 | #endif |
21 | 36 |
|
| 37 | +#undef _POSIX_AEP_REALTIME_CONTROLLER |
22 | 38 | #ifdef CONFIG_POSIX_AEP_REALTIME_CONTROLLER |
23 | 39 | #define _POSIX_AEP_REALTIME_CONTROLLER 200312L |
24 | 40 | #endif |
25 | 41 |
|
| 42 | +#undef _POSIX_AEP_REALTIME_DEDICATED |
26 | 43 | #ifdef CONFIG_POSIX_AEP_REALTIME_DEDICATED |
27 | 44 | #define _POSIX_AEP_REALTIME_DEDICATED 200312L |
28 | 45 | #endif |
|
36 | 53 | * POSIX System Interfaces |
37 | 54 | */ |
38 | 55 |
|
| 56 | +#define _POSIX_VERSION 200809L |
| 57 | + |
| 58 | +#undef _POSIX_CHOWN_RESTRICTED |
39 | 59 | #define _POSIX_CHOWN_RESTRICTED (0) |
40 | | -#define _POSIX_NO_TRUNC (0) |
41 | | -#define _POSIX_VDISABLE ('\0') |
| 60 | +#undef _POSIX_NO_TRUNC |
| 61 | +#define _POSIX_NO_TRUNC (0) |
| 62 | +#undef _POSIX_VDISABLE |
| 63 | +#define _POSIX_VDISABLE ('\0') |
42 | 64 |
|
43 | 65 | /* #define _POSIX_ADVISORY_INFO (-1L) */ |
44 | 66 |
|
| 67 | +#undef _POSIX_ASYNCHRONOUS_IO |
| 68 | +#ifdef CONFIG_POSIX_ASYNCHRONOUS_IO |
| 69 | +#define _POSIX_ASYNCHRONOUS_IO _POSIX_VERSION |
| 70 | +#endif |
| 71 | + |
| 72 | +#undef _POSIX_BARRIERS |
| 73 | +#ifdef CONFIG_POSIX_BARRIERS |
| 74 | +#define _POSIX_BARRIERS _POSIX_VERSION |
| 75 | +#endif |
| 76 | + |
| 77 | +#undef _POSIX_CLOCK_SELECTION |
| 78 | +#ifdef CONFIG_POSIX_CLOCK_SELECTION |
| 79 | +#define _POSIX_CLOCK_SELECTION _POSIX_VERSION |
| 80 | +#endif |
| 81 | + |
| 82 | +#undef _POSIX_CPUTIME |
| 83 | +#ifdef CONFIG_POSIX_CPUTIME |
| 84 | +#define _POSIX_CPUTIME _POSIX_VERSION |
| 85 | +#endif |
| 86 | + |
| 87 | +#undef _POSIX_FSYNC |
| 88 | +#ifdef CONFIG_POSIX_FSYNC |
| 89 | +#define _POSIX_FSYNC _POSIX_VERSION |
| 90 | +#endif |
| 91 | + |
| 92 | +#undef _POSIX_IPV6 |
| 93 | +#ifdef CONFIG_POSIX_IPV6 |
| 94 | +#define _POSIX_IPV6 _POSIX_VERSION |
| 95 | +#endif |
| 96 | + |
45 | 97 | /* #define _POSIX_JOB_CONTROL (-1L) */ |
46 | 98 |
|
| 99 | +#undef _POSIX_MAPPED_FILES |
| 100 | +#ifdef CONFIG_POSIX_MAPPED_FILES |
| 101 | +#define _POSIX_MAPPED_FILES _POSIX_VERSION |
| 102 | +#endif |
| 103 | + |
| 104 | +#ifdef CONFIG_POSIX_MEMLOCK |
| 105 | +#define _POSIX_MEMLOCK _POSIX_VERSION |
| 106 | +#endif |
| 107 | + |
| 108 | +#undef _POSIX_MEMLOCK_RANGE |
| 109 | +#ifdef CONFIG_POSIX_MEMLOCK_RANGE |
| 110 | +#define _POSIX_MEMLOCK_RANGE _POSIX_VERSION |
| 111 | +#endif |
| 112 | + |
| 113 | +#undef _POSIX_MEMORY_PROTECTION |
| 114 | +#ifdef CONFIG_POSIX_MEMORY_PROTECTION |
| 115 | +#define _POSIX_MEMORY_PROTECTION _POSIX_VERSION |
| 116 | +#endif |
| 117 | + |
| 118 | +#undef _POSIX_MESSAGE_PASSING |
| 119 | +#ifdef CONFIG_POSIX_MESSAGE_PASSING |
| 120 | +#define _POSIX_MESSAGE_PASSING _POSIX_VERSION |
| 121 | +#endif |
| 122 | + |
| 123 | +#undef _POSIX_MONOTONIC_CLOCK |
| 124 | +#ifdef CONFIG_POSIX_MONOTONIC_CLOCK |
| 125 | +#define _POSIX_MONOTONIC_CLOCK _POSIX_VERSION |
| 126 | +#endif |
| 127 | + |
47 | 128 | /* #define _POSIX_PRIORITIZED_IO (-1L) */ |
48 | 129 |
|
| 130 | +#undef _POSIX_PRIORITY_SCHEDULING |
| 131 | +#ifdef CONFIG_POSIX_PRIORITY_SCHEDULING |
| 132 | +#define _POSIX_PRIORITY_SCHEDULING _POSIX_VERSION |
| 133 | +#endif |
| 134 | + |
| 135 | +#undef _POSIX_RAW_SOCKETS |
| 136 | +#ifdef CONFIG_POSIX_RAW_SOCKETS |
| 137 | +#define _POSIX_RAW_SOCKETS _POSIX_VERSION |
| 138 | +#endif |
| 139 | + |
| 140 | +#undef _POSIX_READER_WRITER_LOCKS |
| 141 | +#ifdef CONFIG_POSIX_RW_LOCKS |
| 142 | +#define _POSIX_READER_WRITER_LOCKS _POSIX_VERSION |
| 143 | +#endif |
| 144 | + |
| 145 | +#undef _POSIX_REALTIME_SIGNALS |
| 146 | +#ifdef CONFIG_POSIX_REALTIME_SIGNALS |
| 147 | +#define _POSIX_REALTIME_SIGNALS _POSIX_VERSION |
| 148 | +#endif |
| 149 | + |
49 | 150 | /* #define _POSIX_REGEXP (-1L) */ |
50 | 151 | /* #define _POSIX_SAVED_IDS (-1L) */ |
51 | 152 |
|
| 153 | +#undef _POSIX_SEMAPHORES |
| 154 | +#ifdef CONFIG_POSIX_SEMAPHORES |
| 155 | +#define _POSIX_SEMAPHORES _POSIX_VERSION |
| 156 | +#endif |
| 157 | + |
| 158 | +#undef _POSIX_SHARED_MEMORY_OBJECTS |
| 159 | +#ifdef CONFIG_POSIX_SHARED_MEMORY_OBJECTS |
| 160 | +#define _POSIX_SHARED_MEMORY_OBJECTS _POSIX_VERSION |
| 161 | +#endif |
| 162 | + |
52 | 163 | /* #define _POSIX_SHELL (-1L) */ |
53 | 164 | /* #define _POSIX_SPAWN (-1L) */ |
54 | 165 |
|
| 166 | +#undef _POSIX_SPIN_LOCKS |
| 167 | +#ifdef CONFIG_POSIX_SPIN_LOCKS |
| 168 | +#define _POSIX_SPIN_LOCKS _POSIX_VERSION |
| 169 | +#endif |
| 170 | + |
55 | 171 | /* #define _POSIX_SPORADIC_SERVER (-1L) */ |
56 | 172 |
|
| 173 | +#undef _POSIX_SYNCHRONIZED_IO |
| 174 | +#ifdef CONFIG_POSIX_SYNCHRONIZED_IO |
| 175 | +#define _POSIX_SYNCHRONIZED_IO _POSIX_VERSION |
| 176 | +#endif |
| 177 | + |
| 178 | +#undef _POSIX_THREADS |
| 179 | +#undef _POSIX_THREAD_PROCESS_SHARED |
| 180 | +#undef _POSIX_PRIORITY_SCHEDULING |
| 181 | +#undef _POSIX_THREAD_PRIORITY_SCHEDULING |
| 182 | +#ifdef CONFIG_POSIX_THREADS |
| 183 | +#define _POSIX_THREADS _POSIX_VERSION |
| 184 | +#define _POSIX_THREAD_PROCESS_SHARED _POSIX_VERSION |
| 185 | +#define _POSIX_PRIORITY_SCHEDULING _POSIX_VERSION |
| 186 | +#define _POSIX_THREAD_PRIORITY_SCHEDULING _POSIX_VERSION |
| 187 | +#endif |
| 188 | + |
| 189 | +#undef _POSIX_THREAD_ATTR_STACKADDR |
| 190 | +#ifdef CONFIG_POSIX_THREAD_ATTR_STACKADDR |
| 191 | +#define _POSIX_THREAD_ATTR_STACKADDR _POSIX_VERSION |
| 192 | +#endif |
| 193 | + |
| 194 | +#undef _POSIX_THREAD_ATTR_STACKSIZE |
| 195 | +#ifdef CONFIG_POSIX_THREAD_ATTR_STACKSIZE |
| 196 | +#define _POSIX_THREAD_ATTR_STACKSIZE _POSIX_VERSION |
| 197 | +#endif |
| 198 | + |
| 199 | +#undef _POSIX_THREAD_CPUTIME |
| 200 | +#ifdef CONFIG_POSIX_THREAD_CPUTIME |
| 201 | +#define _POSIX_THREAD_CPUTIME _POSIX_VERSION |
| 202 | +#endif |
| 203 | + |
| 204 | +#undef _POSIX_THREAD_PRIO_INHERIT |
| 205 | +#ifdef CONFIG_POSIX_THREAD_PRIO_INHERIT |
| 206 | +#define _POSIX_THREAD_PRIO_INHERIT _POSIX_VERSION |
| 207 | +#endif |
| 208 | + |
| 209 | +#undef _POSIX_THREAD_PRIO_PROTECT |
| 210 | +#ifdef CONFIG_POSIX_THREAD_PRIO_PROTECT |
| 211 | +#define _POSIX_THREAD_PRIO_PROTECT _POSIX_VERSION |
| 212 | +#endif |
| 213 | + |
| 214 | +#undef _POSIX_THREAD_PRIORITY_SCHEDULING |
| 215 | +#ifdef CONFIG_POSIX_THREAD_PRIORITY_SCHEDULING |
| 216 | +#define _POSIX_THREAD_PRIORITY_SCHEDULING _POSIX_VERSION |
| 217 | +#endif |
| 218 | + |
57 | 219 | /* #define _POSIX_THREAD_PROCESS_SHARED (-1L) */ |
58 | 220 | /* #define _POSIX_THREAD_ROBUST_PRIO_INHERIT (-1L) */ |
59 | 221 | /* #define _POSIX_THREAD_ROBUST_PRIO_PROTECT (-1L) */ |
60 | 222 |
|
| 223 | +#undef _POSIX_THREAD_SAFE_FUNCTIONS |
| 224 | +#if defined(CONFIG_POSIX_FILE_SYSTEM_R) && defined(CONFIG_POSIX_C_LANG_SUPPORT_R) |
| 225 | +#define _POSIX_THREAD_SAFE_FUNCTIONS _POSIX_VERSION |
| 226 | +#endif |
| 227 | + |
61 | 228 | /* #define _POSIX_THREAD_SPORADIC_SERVER (-1L) */ |
62 | 229 |
|
| 230 | +#undef _POSIX_THREADS |
| 231 | +#undef _POSIX_THREAD_PROCESS_SHARED |
| 232 | +#undef _POSIX_PRIORITY_SCHEDULING |
| 233 | +#undef _POSIX_THREAD_PRIORITY_SCHEDULING |
| 234 | +#ifdef CONFIG_POSIX_THREADS |
| 235 | +#define _POSIX_THREADS _POSIX_VERSION |
| 236 | +#define _POSIX_THREAD_PROCESS_SHARED _POSIX_VERSION |
| 237 | +#define _POSIX_PRIORITY_SCHEDULING _POSIX_VERSION |
| 238 | +#define _POSIX_THREAD_PRIORITY_SCHEDULING _POSIX_VERSION |
| 239 | +#endif |
| 240 | + |
| 241 | +#undef _POSIX_TIMEOUTS |
| 242 | +#ifdef CONFIG_POSIX_TIMEOUTS |
| 243 | +#define _POSIX_TIMEOUTS _POSIX_VERSION |
| 244 | +#endif |
| 245 | + |
| 246 | +#undef _POSIX_CPUTIME |
| 247 | +#undef _POSIX_MONOTONIC_CLOCK |
| 248 | +#undef _POSIX_TIMEOUTS |
| 249 | +#undef _POSIX_TIMERS |
| 250 | +#ifdef CONFIG_POSIX_TIMERS |
| 251 | +#define _POSIX_TIMERS _POSIX_VERSION |
| 252 | +#define _POSIX_TIMEOUTS _POSIX_VERSION |
| 253 | +/* |
| 254 | + * FIXME: Until we have a Kconfig for XSI_ADVANCED_REALTIME, define _POSIX_CPUTIME and |
| 255 | + * _POSIX_MONOTONIC_CLOCK with _POSIX_TIMERS. |
| 256 | + * For more information on the Advanced Realtime Option Group, please see |
| 257 | + * https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap02.html |
| 258 | + */ |
| 259 | +#define _POSIX_CPUTIME _POSIX_VERSION |
| 260 | +#define _POSIX_MONOTONIC_CLOCK _POSIX_VERSION |
| 261 | +#endif |
| 262 | + |
63 | 263 | /* #define _POSIX_TRACE (-1L) */ |
64 | 264 | /* #define _POSIX_TRACE_EVENT_FILTER (-1L) */ |
65 | 265 | /* #define _POSIX_TRACE_INHERIT (-1L) */ |
|
85 | 285 | /* |
86 | 286 | * POSIX2 Options |
87 | 287 | */ |
| 288 | +#undef _POSIX2_C_BIND |
| 289 | +#define _POSIX2_C_BIND _POSIX_VERSION |
88 | 290 | /* #define _POSIX2_C_DEV (-1) */ |
89 | 291 | /* #define _POSIX2_CHAR_TERM (-1L) */ |
90 | 292 | /* #define _POSIX2_FORT_DEV (-1L) */ |
|
102 | 304 | /* |
103 | 305 | * X/Open System Interfaces |
104 | 306 | */ |
| 307 | + |
| 308 | +#undef _XOPEN_VERSION |
| 309 | +#ifdef CONFIG_XSI |
| 310 | +#define _XOPEN_VERSION 700 |
| 311 | +#endif |
| 312 | + |
105 | 313 | /* #define _XOPEN_CRYPT (-1L) */ |
106 | 314 | /* #define _XOPEN_ENH_I18N (-1L) */ |
107 | 315 | #if defined(CONFIG_XSI_REALTIME) || \ |
|
114 | 322 | /* #define _XOPEN_REALTIME_THREADS (-1L) */ |
115 | 323 | /* #define _XOPEN_SHM (-1L) */ |
116 | 324 |
|
117 | | -/* #define _XOPEN_UNIX (-1L) */ |
| 325 | +#undef _XOPEN_STREAMS |
| 326 | +#ifdef CONFIG_XSI_STREAMS |
| 327 | +#define _XOPEN_STREAMS _XOPEN_VERSION |
| 328 | +#endif |
| 329 | + |
| 330 | +#undef _XOPEN_UNIX |
| 331 | +#ifdef CONFIG_XSI |
| 332 | +#define _XOPEN_UNIX _XOPEN_VERSION |
| 333 | +#endif |
| 334 | + |
118 | 335 | /* #define _XOPEN_UUCP (-1L) */ |
119 | 336 |
|
| 337 | +#endif /* defined(_POSIX_C_SOURCE) || defined(CONFIG_POSIX_SYSTEM_INTERFACES) */ |
| 338 | + |
120 | 339 | #endif /* INCLUDE_ZEPHYR_POSIX_POSIX_FEATURES_H_ */ |
0 commit comments