Zephyr API Documentation 4.0.0-rc3
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
127#ifdef CONFIG_POSIX_SYNCHRONIZED_IO
128#define _POSIX_SYNCHRONIZED_IO _POSIX_VERSION
129#endif
130
131#ifdef CONFIG_POSIX_THREAD_ATTR_STACKADDR
132#define _POSIX_THREAD_ATTR_STACKADDR _POSIX_VERSION
133#endif
134
135#ifdef CONFIG_POSIX_THREAD_ATTR_STACKSIZE
136#define _POSIX_THREAD_ATTR_STACKSIZE _POSIX_VERSION
137#endif
138
139#ifdef CONFIG_POSIX_THREAD_CPUTIME
140#define _POSIX_THREAD_CPUTIME _POSIX_VERSION
141#endif
142
143#ifdef CONFIG_POSIX_THREAD_PRIO_INHERIT
144#define _POSIX_THREAD_PRIO_INHERIT _POSIX_VERSION
145#endif
146
147#ifdef CONFIG_POSIX_THREAD_PRIO_PROTECT
148#define _POSIX_THREAD_PRIO_PROTECT _POSIX_VERSION
149#endif
150
151#ifdef CONFIG_POSIX_THREAD_PRIORITY_SCHEDULING
152#define _POSIX_THREAD_PRIORITY_SCHEDULING _POSIX_VERSION
153#endif
154
155/* #define _POSIX_THREAD_PROCESS_SHARED (-1L) */
156/* #define _POSIX_THREAD_ROBUST_PRIO_INHERIT (-1L) */
157/* #define _POSIX_THREAD_ROBUST_PRIO_PROTECT (-1L) */
158
159#ifdef CONFIG_POSIX_THREAD_SAFE_FUNCTIONS
160#define _POSIX_THREAD_SAFE_FUNCTIONS _POSIX_VERSION
161#endif
162
163/* #define _POSIX_THREAD_SPORADIC_SERVER (-1L) */
164
165#ifdef CONFIG_POSIX_THREADS
166#ifndef _POSIX_THREADS
167#define _POSIX_THREADS _POSIX_VERSION
168#endif
169#endif
170
171#ifdef CONFIG_POSIX_TIMEOUTS
172#define _POSIX_TIMEOUTS _POSIX_VERSION
173#endif
174
175#ifdef CONFIG_POSIX_TIMERS
176#define _POSIX_TIMERS _POSIX_VERSION
177#endif
178
179/* #define _POSIX_TRACE (-1L) */
180/* #define _POSIX_TRACE_EVENT_FILTER (-1L) */
181/* #define _POSIX_TRACE_INHERIT (-1L) */
182/* #define _POSIX_TRACE_LOG (-1L) */
183/* #define _POSIX_TYPED_MEMORY_OBJECTS (-1L) */
184
185/*
186 * POSIX v6 Options
187 */
188/* #define _POSIX_V6_ILP32_OFF32 (-1L) */
189/* #define _POSIX_V6_ILP32_OFFBIG (-1L) */
190/* #define _POSIX_V6_LP64_OFF64 (-1L) */
191/* #define _POSIX_V6_LPBIG_OFFBIG (-1L) */
192
193/*
194 * POSIX v7 Options
195 */
196/* #define _POSIX_V7_ILP32_OFF32 (-1L) */
197/* #define _POSIX_V7_ILP32_OFFBIG (-1L) */
198/* #define _POSIX_V7_LP64_OFF64 (-1L) */
199/* #define _POSIX_V7_LPBIG_OFFBIG (-1L) */
200
201/*
202 * POSIX2 Options
203 */
204#define _POSIX2_VERSION _POSIX_VERSION
205#define _POSIX2_C_BIND _POSIX2_VERSION
206#define _POSIX2_C_DEV _POSIX2_VERSION
207/* #define _POSIX2_CHAR_TERM (-1L) */
208/* #define _POSIX2_FORT_DEV (-1L) */
209/* #define _POSIX2_FORT_RUN (-1L) */
210/* #define _POSIX2_LOCALEDEF (-1L) */
211/* #define _POSIX2_PBS (-1L) */
212/* #define _POSIX2_PBS_ACCOUNTING (-1L) */
213/* #define _POSIX2_PBS_CHECKPOINT (-1L) */
214/* #define _POSIX2_PBS_LOCATE (-1L) */
215/* #define _POSIX2_PBS_MESSAGE (-1L) */
216/* #define _POSIX2_PBS_TRACK (-1L) */
217/* #define _POSIX2_SW_DEV (-1L) */
218/* #define _POSIX2_UPE (-1L) */
219
220/*
221 * X/Open System Interfaces
222 */
223#define _XOPEN_VERSION 700
224/* #define _XOPEN_CRYPT (-1L) */
225/* #define _XOPEN_ENH_I18N (-1L) */
226/* #define _XOPEN_REALTIME (-1L) */
227/* #define _XOPEN_REALTIME_THREADS (-1L) */
228/* #define _XOPEN_SHM (-1L) */
229
230#ifdef CONFIG_XOPEN_STREAMS
231#define _XOPEN_STREAMS _XOPEN_VERSION
232#endif
233
234/* #define _XOPEN_UNIX (-1L) */
235/* #define _XOPEN_UUCP (-1L) */
236
237/* Maximum values */
238#define _POSIX_CLOCKRES_MIN (20000000L)
239
240/* Minimum values */
241#define _POSIX_AIO_LISTIO_MAX (2)
242#define _POSIX_AIO_MAX (1)
243#define _POSIX_ARG_MAX (4096)
244#define _POSIX_CHILD_MAX (25)
245#define _POSIX_DELAYTIMER_MAX \
246 COND_CODE_1(CONFIG_POSIX_TIMERS, (CONFIG_POSIX_DELAYTIMER_MAX), (0))
247#define _POSIX_HOST_NAME_MAX \
248 COND_CODE_1(CONFIG_POSIX_NETWORKING, (CONFIG_POSIX_HOST_NAME_MAX), (0))
249#define _POSIX_LINK_MAX (8)
250#define _POSIX_LOGIN_NAME_MAX (9)
251#define _POSIX_MAX_CANON (255)
252#define _POSIX_MAX_INPUT (255)
253#define _POSIX_MQ_OPEN_MAX \
254 COND_CODE_1(CONFIG_POSIX_MESSAGE_PASSING, (CONFIG_POSIX_MQ_OPEN_MAX), (0))
255#define _POSIX_MQ_PRIO_MAX (32)
256#define _POSIX_NAME_MAX (14)
257#define _POSIX_NGROUPS_MAX (8)
258#define _POSIX_OPEN_MAX CONFIG_POSIX_OPEN_MAX
259#define _POSIX_PATH_MAX (256)
260#define _POSIX_PIPE_BUF (512)
261#define _POSIX_RE_DUP_MAX (255)
262#define _POSIX_RTSIG_MAX \
263 COND_CODE_1(CONFIG_POSIX_REALTIME_SIGNALS, (CONFIG_POSIX_RTSIG_MAX), (0))
264#define _POSIX_SEM_NSEMS_MAX \
265 COND_CODE_1(CONFIG_POSIX_SEMAPHORES, (CONFIG_POSIX_SEM_NSEMS_MAX), (0))
266#define _POSIX_SEM_VALUE_MAX \
267 COND_CODE_1(CONFIG_POSIX_SEMAPHORES, (CONFIG_POSIX_SEM_VALUE_MAX), (0))
268#define _POSIX_SIGQUEUE_MAX (32)
269#define _POSIX_SSIZE_MAX (32767)
270#define _POSIX_SS_REPL_MAX (4)
271#define _POSIX_STREAM_MAX (8)
272#define _POSIX_SYMLINK_MAX (255)
273#define _POSIX_SYMLOOP_MAX (8)
274#define _POSIX_THREAD_DESTRUCTOR_ITERATIONS (4)
275#define _POSIX_THREAD_KEYS_MAX \
276 COND_CODE_1(CONFIG_POSIX_THREADS, (CONFIG_POSIX_THREAD_KEYS_MAX), (0))
277#define _POSIX_THREAD_THREADS_MAX \
278 COND_CODE_1(CONFIG_POSIX_THREADS, (CONFIG_POSIX_THREAD_THREADS_MAX), (0))
279#define _POSIX_TIMER_MAX \
280 COND_CODE_1(CONFIG_POSIX_TIMERS, (CONFIG_POSIX_TIMER_MAX), (0))
281#define _POSIX_TRACE_EVENT_NAME_MAX (30)
282#define _POSIX_TRACE_NAME_MAX (8)
283#define _POSIX_TRACE_SYS_MAX (8)
284#define _POSIX_TRACE_USER_EVENT_MAX (32)
285#define _POSIX_TTY_NAME_MAX (9)
286#define _POSIX_TZNAME_MAX (6)
287#define _POSIX2_BC_BASE_MAX (99)
288#define _POSIX2_BC_DIM_MAX (2048)
289#define _POSIX2_BC_SCALE_MAX (99)
290#define _POSIX2_BC_STRING_MAX (1000)
291#define _POSIX2_CHARCLASS_NAME_MAX (14)
292#define _POSIX2_COLL_WEIGHTS_MAX (2)
293#define _POSIX2_EXPR_NEST_MAX (32)
294#define _POSIX2_LINE_MAX (2048)
295#define _XOPEN_IOV_MAX (16)
296#define _XOPEN_NAME_MAX (255)
297#define _XOPEN_PATH_MAX (1024)
298
299/* Other invariant values */
300#define NL_LANGMAX (14)
301#define NL_MSGMAX (32767)
302#define NL_SETMAX (255)
303#define NL_TEXTMAX (_POSIX2_LINE_MAX)
304#define NZERO (20)
305
306/* Runtime invariant values */
307#define AIO_LISTIO_MAX _POSIX_AIO_LISTIO_MAX
308#define AIO_MAX _POSIX_AIO_MAX
309#define AIO_PRIO_DELTA_MAX (0)
310#define DELAYTIMER_MAX _POSIX_DELAYTIMER_MAX
311#define HOST_NAME_MAX _POSIX_HOST_NAME_MAX
312#define LOGIN_NAME_MAX _POSIX_LOGIN_NAME_MAX
313#define MQ_OPEN_MAX _POSIX_MQ_OPEN_MAX
314#define MQ_PRIO_MAX _POSIX_MQ_PRIO_MAX
315
316#ifndef ATEXIT_MAX
317#define ATEXIT_MAX 8
318#endif
319
320#define PAGE_SIZE CONFIG_POSIX_PAGE_SIZE
321#define PAGESIZE PAGE_SIZE
322
323#define PTHREAD_DESTRUCTOR_ITERATIONS _POSIX_THREAD_DESTRUCTOR_ITERATIONS
324#define PTHREAD_KEYS_MAX _POSIX_THREAD_KEYS_MAX
325#define PTHREAD_THREADS_MAX _POSIX_THREAD_THREADS_MAX
326#define RTSIG_MAX _POSIX_RTSIG_MAX
327#define SEM_NSEMS_MAX _POSIX_SEM_NSEMS_MAX
328#define SEM_VALUE_MAX _POSIX_SEM_VALUE_MAX
329#define SIGQUEUE_MAX _POSIX_SIGQUEUE_MAX
330#define STREAM_MAX _POSIX_STREAM_MAX
331#define SYMLOOP_MAX _POSIX_SYMLOOP_MAX
332#define TIMER_MAX _POSIX_TIMER_MAX
333#define TTY_NAME_MAX _POSIX_TTY_NAME_MAX
334#ifndef TZNAME_MAX
335#define TZNAME_MAX _POSIX_TZNAME_MAX
336#endif
337
338/* Pathname variable values */
339#define FILESIZEBITS (32)
340#define POSIX_ALLOC_SIZE_MIN (256)
341#define POSIX_REC_INCR_XFER_SIZE (1024)
342#define POSIX_REC_MAX_XFER_SIZE (32767)
343#define POSIX_REC_MIN_XFER_SIZE (1)
344#define POSIX_REC_XFER_ALIGN (4)
345#define SYMLINK_MAX _POSIX_SYMLINK_MAX
346
347#endif /* INCLUDE_ZEPHYR_POSIX_POSIX_FEATURES_H_ */
Macro utilities.