Zephyr Project API 3.7.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
posix_features.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2024 BayLibre SAS
3 * Copyright (c) 2024 Tenstorrent AI ULC
4 *
5 * SPDX-License-Identifier: Apache-2.0
6 */
7
8#ifndef INCLUDE_ZEPHYR_POSIX_POSIX_FEATURES_H_
9#define INCLUDE_ZEPHYR_POSIX_POSIX_FEATURES_H_
10
11#include <zephyr/autoconf.h> /* CONFIG_* */
12#include <zephyr/sys/util_macro.h> /* COND_CODE_1() */
13
14/*
15 * POSIX Application Environment Profiles (AEP - IEEE Std 1003.13-2003)
16 */
17
18#ifdef CONFIG_POSIX_AEP_REALTIME_MINIMAL
19#define _POSIX_AEP_REALTIME_MINIMAL 200312L
20#endif
21
22#ifdef CONFIG_POSIX_AEP_REALTIME_CONTROLLER
23#define _POSIX_AEP_REALTIME_CONTROLLER 200312L
24#endif
25
26#ifdef CONFIG_POSIX_AEP_REALTIME_DEDICATED
27#define _POSIX_AEP_REALTIME_DEDICATED 200312L
28#endif
29
30/*
31 * POSIX System Interfaces
32 */
33
34#define _POSIX_VERSION 200809L
35
36#define _POSIX_CHOWN_RESTRICTED (0)
37#define _POSIX_NO_TRUNC (0)
38#define _POSIX_VDISABLE ('\0')
39
40/* #define _POSIX_ADVISORY_INFO (-1L) */
41
42#ifdef CONFIG_POSIX_ASYNCHRONOUS_IO
43#define _POSIX_ASYNCHRONOUS_IO _POSIX_VERSION
44#endif
45
46#ifdef CONFIG_POSIX_BARRIERS
47#define _POSIX_BARRIERS _POSIX_VERSION
48#endif
49
50#ifdef CONFIG_POSIX_CLOCK_SELECTION
51#define _POSIX_CLOCK_SELECTION _POSIX_VERSION
52#endif
53
54#ifdef CONFIG_POSIX_CPUTIME
55#define _POSIX_CPUTIME _POSIX_VERSION
56#endif
57
58#ifdef CONFIG_POSIX_FSYNC
59#define _POSIX_FSYNC _POSIX_VERSION
60#endif
61
62#ifdef CONFIG_NET_IPV6
63#define _POSIX_IPV6 _POSIX_VERSION
64#endif
65
66/* #define _POSIX_JOB_CONTROL (-1L) */
67
68#ifdef CONFIG_POSIX_MAPPED_FILES
69#define _POSIX_MAPPED_FILES _POSIX_VERSION
70#endif
71
72#ifdef CONFIG_POSIX_MEMLOCK
73#define _POSIX_MEMLOCK _POSIX_VERSION
74#endif
75
76#ifdef CONFIG_POSIX_MEMLOCK_RANGE
77#define _POSIX_MEMLOCK_RANGE _POSIX_VERSION
78#endif
79
80#ifdef CONFIG_POSIX_MEMORY_PROTECTION
81#define _POSIX_MEMORY_PROTECTION _POSIX_VERSION
82#endif
83
84#ifdef CONFIG_POSIX_MESSAGE_PASSING
85#define _POSIX_MESSAGE_PASSING _POSIX_VERSION
86#endif
87
88#ifdef CONFIG_POSIX_MONOTONIC_CLOCK
89#define _POSIX_MONOTONIC_CLOCK _POSIX_VERSION
90#endif
91
92/* #define _POSIX_PRIORITIZED_IO (-1L) */
93
94#ifdef CONFIG_POSIX_PRIORITY_SCHEDULING
95#define _POSIX_PRIORITY_SCHEDULING _POSIX_VERSION
96#endif
97
98#ifdef CONFIG_NET_SOCKETS_PACKET
99#define _POSIX_RAW_SOCKETS _POSIX_VERSION
100#endif
101
102#ifdef CONFIG_POSIX_READER_WRITER_LOCKS
103#define _POSIX_READER_WRITER_LOCKS _POSIX_VERSION
104#endif
105
106/* #define _POSIX_REALTIME_SIGNALS (-1L) */
107/* #define _POSIX_REGEXP (-1L) */
108/* #define _POSIX_SAVED_IDS (-1L) */
109
110#ifdef CONFIG_POSIX_SEMAPHORES
111#define _POSIX_SEMAPHORES _POSIX_VERSION
112#endif
113
114#ifdef CONFIG_POSIX_SHARED_MEMORY_OBJECTS
115#define _POSIX_SHARED_MEMORY_OBJECTS _POSIX_VERSION
116#endif
117
118/* #define _POSIX_SHELL (-1L) */
119/* #define _POSIX_SPAWN (-1L) */
120
121#ifdef CONFIG_POSIX_SPIN_LOCKS
122#define _POSIX_SPIN_LOCKS _POSIX_VERSION
123#endif
124
125/* #define _POSIX_SPORADIC_SERVER (-1L) */
126/* #define _POSIX_SYNCHRONIZED_IO (-1L) */
127
128#ifdef CONFIG_POSIX_THREAD_ATTR_STACKADDR
129#define _POSIX_THREAD_ATTR_STACKADDR _POSIX_VERSION
130#endif
131
132#ifdef CONFIG_POSIX_THREAD_ATTR_STACKSIZE
133#define _POSIX_THREAD_ATTR_STACKSIZE _POSIX_VERSION
134#endif
135
136#ifdef CONFIG_POSIX_THREAD_CPUTIME
137#define _POSIX_THREAD_CPUTIME _POSIX_VERSION
138#endif
139
140#ifdef CONFIG_POSIX_THREAD_PRIO_INHERIT
141#define _POSIX_THREAD_PRIO_INHERIT _POSIX_VERSION
142#endif
143
144#ifdef CONFIG_POSIX_THREAD_PRIO_PROTECT
145#define _POSIX_THREAD_PRIO_PROTECT _POSIX_VERSION
146#endif
147
148#ifdef CONFIG_POSIX_THREAD_PRIORITY_SCHEDULING
149#define _POSIX_THREAD_PRIORITY_SCHEDULING _POSIX_VERSION
150#endif
151
152/* #define _POSIX_THREAD_PROCESS_SHARED (-1L) */
153/* #define _POSIX_THREAD_ROBUST_PRIO_INHERIT (-1L) */
154/* #define _POSIX_THREAD_ROBUST_PRIO_PROTECT (-1L) */
155
156#ifdef CONFIG_POSIX_THREAD_SAFE_FUNCTIONS
157#define _POSIX_THREAD_SAFE_FUNCTIONS _POSIX_VERSION
158#endif
159
160/* #define _POSIX_THREAD_SPORADIC_SERVER (-1L) */
161
162#ifdef CONFIG_POSIX_THREADS
163#ifndef _POSIX_THREADS
164#define _POSIX_THREADS _POSIX_VERSION
165#endif
166#endif
167
168#ifdef CONFIG_POSIX_TIMEOUTS
169#define _POSIX_TIMEOUTS _POSIX_VERSION
170#endif
171
172#ifdef CONFIG_POSIX_TIMERS
173#define _POSIX_TIMERS _POSIX_VERSION
174#endif
175
176/* #define _POSIX_TRACE (-1L) */
177/* #define _POSIX_TRACE_EVENT_FILTER (-1L) */
178/* #define _POSIX_TRACE_INHERIT (-1L) */
179/* #define _POSIX_TRACE_LOG (-1L) */
180/* #define _POSIX_TYPED_MEMORY_OBJECTS (-1L) */
181
182/*
183 * POSIX v6 Options
184 */
185/* #define _POSIX_V6_ILP32_OFF32 (-1L) */
186/* #define _POSIX_V6_ILP32_OFFBIG (-1L) */
187/* #define _POSIX_V6_LP64_OFF64 (-1L) */
188/* #define _POSIX_V6_LPBIG_OFFBIG (-1L) */
189
190/*
191 * POSIX v7 Options
192 */
193/* #define _POSIX_V7_ILP32_OFF32 (-1L) */
194/* #define _POSIX_V7_ILP32_OFFBIG (-1L) */
195/* #define _POSIX_V7_LP64_OFF64 (-1L) */
196/* #define _POSIX_V7_LPBIG_OFFBIG (-1L) */
197
198/*
199 * POSIX2 Options
200 */
201#define _POSIX2_VERSION _POSIX_VERSION
202#define _POSIX2_C_BIND _POSIX2_VERSION
203#define _POSIX2_C_DEV _POSIX2_VERSION
204/* #define _POSIX2_CHAR_TERM (-1L) */
205/* #define _POSIX2_FORT_DEV (-1L) */
206/* #define _POSIX2_FORT_RUN (-1L) */
207/* #define _POSIX2_LOCALEDEF (-1L) */
208/* #define _POSIX2_PBS (-1L) */
209/* #define _POSIX2_PBS_ACCOUNTING (-1L) */
210/* #define _POSIX2_PBS_CHECKPOINT (-1L) */
211/* #define _POSIX2_PBS_LOCATE (-1L) */
212/* #define _POSIX2_PBS_MESSAGE (-1L) */
213/* #define _POSIX2_PBS_TRACK (-1L) */
214/* #define _POSIX2_SW_DEV (-1L) */
215/* #define _POSIX2_UPE (-1L) */
216
217/*
218 * X/Open System Interfaces
219 */
220#define _XOPEN_VERSION 700
221/* #define _XOPEN_CRYPT (-1L) */
222/* #define _XOPEN_ENH_I18N (-1L) */
223/* #define _XOPEN_REALTIME (-1L) */
224/* #define _XOPEN_REALTIME_THREADS (-1L) */
225/* #define _XOPEN_SHM (-1L) */
226
227#ifdef CONFIG_XOPEN_STREAMS
228#define _XOPEN_STREAMS _XOPEN_VERSION
229#endif
230
231/* #define _XOPEN_UNIX (-1L) */
232/* #define _XOPEN_UUCP (-1L) */
233
234/* Maximum values */
235#define _POSIX_CLOCKRES_MIN (20000000L)
236
237/* Minimum values */
238#define _POSIX_AIO_LISTIO_MAX (2)
239#define _POSIX_AIO_MAX (1)
240#define _POSIX_ARG_MAX (4096)
241#define _POSIX_CHILD_MAX (25)
242#define _POSIX_DELAYTIMER_MAX \
243 COND_CODE_1(CONFIG_POSIX_TIMERS, (CONFIG_POSIX_DELAYTIMER_MAX), (0))
244#define _POSIX_HOST_NAME_MAX \
245 COND_CODE_1(CONFIG_POSIX_NETWORKING, (CONFIG_POSIX_HOST_NAME_MAX), (0))
246#define _POSIX_LINK_MAX (8)
247#define _POSIX_LOGIN_NAME_MAX (9)
248#define _POSIX_MAX_CANON (255)
249#define _POSIX_MAX_INPUT (255)
250#define _POSIX_MQ_OPEN_MAX \
251 COND_CODE_1(CONFIG_POSIX_MESSAGE_PASSING, (CONFIG_POSIX_MQ_OPEN_MAX), (0))
252#define _POSIX_MQ_PRIO_MAX (32)
253#define _POSIX_NAME_MAX (14)
254#define _POSIX_NGROUPS_MAX (8)
255#define _POSIX_OPEN_MAX CONFIG_POSIX_OPEN_MAX
256#define _POSIX_PATH_MAX (256)
257#define _POSIX_PIPE_BUF (512)
258#define _POSIX_RE_DUP_MAX (255)
259#define _POSIX_RTSIG_MAX \
260 COND_CODE_1(CONFIG_POSIX_REALTIME_SIGNALS, (CONFIG_POSIX_RTSIG_MAX), (0))
261#define _POSIX_SEM_NSEMS_MAX \
262 COND_CODE_1(CONFIG_POSIX_SEMAPHORES, (CONFIG_POSIX_SEM_NSEMS_MAX), (0))
263#define _POSIX_SEM_VALUE_MAX \
264 COND_CODE_1(CONFIG_POSIX_SEMAPHORES, (CONFIG_POSIX_SEM_VALUE_MAX), (0))
265#define _POSIX_SIGQUEUE_MAX (32)
266#define _POSIX_SSIZE_MAX (32767)
267#define _POSIX_SS_REPL_MAX (4)
268#define _POSIX_STREAM_MAX (8)
269#define _POSIX_SYMLINK_MAX (255)
270#define _POSIX_SYMLOOP_MAX (8)
271#define _POSIX_THREAD_DESTRUCTOR_ITERATIONS (4)
272#define _POSIX_THREAD_KEYS_MAX \
273 COND_CODE_1(CONFIG_POSIX_THREADS, (CONFIG_POSIX_THREAD_KEYS_MAX), (0))
274#define _POSIX_THREAD_THREADS_MAX \
275 COND_CODE_1(CONFIG_POSIX_THREADS, (CONFIG_POSIX_THREAD_THREADS_MAX), (0))
276#define _POSIX_TIMER_MAX \
277 COND_CODE_1(CONFIG_POSIX_TIMERS, (CONFIG_POSIX_TIMER_MAX), (0))
278#define _POSIX_TRACE_EVENT_NAME_MAX (30)
279#define _POSIX_TRACE_NAME_MAX (8)
280#define _POSIX_TRACE_SYS_MAX (8)
281#define _POSIX_TRACE_USER_EVENT_MAX (32)
282#define _POSIX_TTY_NAME_MAX (9)
283#define _POSIX_TZNAME_MAX (6)
284#define _POSIX2_BC_BASE_MAX (99)
285#define _POSIX2_BC_DIM_MAX (2048)
286#define _POSIX2_BC_SCALE_MAX (99)
287#define _POSIX2_BC_STRING_MAX (1000)
288#define _POSIX2_CHARCLASS_NAME_MAX (14)
289#define _POSIX2_COLL_WEIGHTS_MAX (2)
290#define _POSIX2_EXPR_NEST_MAX (32)
291#define _POSIX2_LINE_MAX (2048)
292#define _XOPEN_IOV_MAX (16)
293#define _XOPEN_NAME_MAX (255)
294#define _XOPEN_PATH_MAX (1024)
295
296/* Other invariant values */
297#define NL_LANGMAX (14)
298#define NL_MSGMAX (32767)
299#define NL_SETMAX (255)
300#define NL_TEXTMAX (_POSIX2_LINE_MAX)
301#define NZERO (20)
302
303/* Runtime invariant values */
304#define AIO_LISTIO_MAX _POSIX_AIO_LISTIO_MAX
305#define AIO_MAX _POSIX_AIO_MAX
306#define AIO_PRIO_DELTA_MAX (0)
307#define DELAYTIMER_MAX _POSIX_DELAYTIMER_MAX
308#define HOST_NAME_MAX _POSIX_HOST_NAME_MAX
309#define LOGIN_NAME_MAX _POSIX_LOGIN_NAME_MAX
310#define MQ_OPEN_MAX _POSIX_MQ_OPEN_MAX
311#define MQ_PRIO_MAX _POSIX_MQ_PRIO_MAX
312
313#ifndef ATEXIT_MAX
314#define ATEXIT_MAX 8
315#endif
316
317#define PAGE_SIZE CONFIG_POSIX_PAGE_SIZE
318#define PAGESIZE PAGE_SIZE
319
320#define PTHREAD_DESTRUCTOR_ITERATIONS _POSIX_THREAD_DESTRUCTOR_ITERATIONS
321#define PTHREAD_KEYS_MAX _POSIX_THREAD_KEYS_MAX
322#define PTHREAD_THREADS_MAX _POSIX_THREAD_THREADS_MAX
323#define RTSIG_MAX _POSIX_RTSIG_MAX
324#define SEM_NSEMS_MAX _POSIX_SEM_NSEMS_MAX
325#define SEM_VALUE_MAX _POSIX_SEM_VALUE_MAX
326#define SIGQUEUE_MAX _POSIX_SIGQUEUE_MAX
327#define STREAM_MAX _POSIX_STREAM_MAX
328#define SYMLOOP_MAX _POSIX_SYMLOOP_MAX
329#define TIMER_MAX _POSIX_TIMER_MAX
330#define TTY_NAME_MAX _POSIX_TTY_NAME_MAX
331#define TZNAME_MAX _POSIX_TZNAME_MAX
332
333/* Pathname variable values */
334#define FILESIZEBITS (32)
335#define POSIX_ALLOC_SIZE_MIN (256)
336#define POSIX_REC_INCR_XFER_SIZE (1024)
337#define POSIX_REC_MAX_XFER_SIZE (32767)
338#define POSIX_REC_MIN_XFER_SIZE (1)
339#define POSIX_REC_XFER_ALIGN (4)
340#define SYMLINK_MAX _POSIX_SYMLINK_MAX
341
342#endif /* INCLUDE_ZEPHYR_POSIX_POSIX_FEATURES_H_ */
Macro utilities.