1.. _posix_conformance:
2
3POSIX Conformance
4#################
5
6As per `IEEE 1003.1-2017`_, this section details Zephyr's POSIX conformance.
7
8.. _IEEE 1003.1-2017: https://standards.ieee.org/ieee/1003.1/7101/
9
10.. _posix_system_interfaces:
11
12POSIX System Interfaces
13=======================
14
15.. The following have values greater than -1 in Zephyr, conformant with the POSIX specification.
16
17.. csv-table:: POSIX System Interfaces
18   :header: Symbol, Support, Remarks
19   :widths: 50, 10, 50
20
21    _POSIX_CHOWN_RESTRICTED, 0,
22    _POSIX_NO_TRUNC, 0,
23    _POSIX_VDISABLE, ``'\0'``,
24
25.. TODO: POSIX_ASYNCHRONOUS_IO, and other interfaces below, are mandatory. That means that a
26   strictly conforming application need not be modified in order to compile against Zephyr.
27   However, we may add implementations that simply fail with ENOSYS as long as the functional
28   modification is clearly documented. The implementation is not required for PSE51 or PSE52
29   and beyond that POSIX async I/O functions are rarely used in practice.
30
31.. _posix_system_interfaces_required:
32
33.. csv-table:: POSIX System Interfaces
34   :header: Symbol, Support, Remarks
35   :widths: 50, 10, 50
36
37    _POSIX_VERSION, 200809L,
38    :ref:`_POSIX_ASYNCHRONOUS_IO<posix_option_asynchronous_io>`, 200809L, :kconfig:option:`CONFIG_POSIX_ASYNCHRONOUS_IO`:ref:`†<posix_undefined_behaviour>`
39    :ref:`_POSIX_BARRIERS<posix_option_group_barriers>`, 200809L, :kconfig:option:`CONFIG_POSIX_BARRIERS`
40    :ref:`_POSIX_CLOCK_SELECTION<posix_option_group_clock_selection>`, 200809L, :kconfig:option:`CONFIG_POSIX_CLOCK_SELECTION`
41    :ref:`_POSIX_MAPPED_FILES<posix_option_group_mapped_files>`, 200809L, :kconfig:option:`CONFIG_POSIX_MAPPED_FILES`
42    :ref:`_POSIX_MEMORY_PROTECTION<posix_option_group_memory_protection>`, 200809L, :kconfig:option:`CONFIG_POSIX_MEMORY_PROTECTION` :ref:`†<posix_undefined_behaviour>`
43    :ref:`_POSIX_READER_WRITER_LOCKS<posix_option_reader_writer_locks>`, 200809L, :kconfig:option:`CONFIG_POSIX_READER_WRITER_LOCKS`
44    :ref:`_POSIX_REALTIME_SIGNALS<posix_option_group_realtime_signals>`, -1, :kconfig:option:`CONFIG_POSIX_REALTIME_SIGNALS`
45    :ref:`_POSIX_SEMAPHORES<posix_option_group_semaphores>`, 200809L, :kconfig:option:`CONFIG_POSIX_SEMAPHORES`
46    :ref:`_POSIX_SPIN_LOCKS<posix_option_group_spin_locks>`, 200809L, :kconfig:option:`CONFIG_POSIX_SPIN_LOCKS`
47    :ref:`_POSIX_THREAD_SAFE_FUNCTIONS<posix_option_thread_safe_functions>`, -1, :kconfig:option:`CONFIG_POSIX_THREAD_SAFE_FUNCTIONS`
48    :ref:`_POSIX_THREADS<posix_option_group_threads_base>`, -1, :kconfig:option:`CONFIG_POSIX_THREADS`
49    :ref:`_POSIX_TIMEOUTS<posix_option_timeouts>`, 200809L, :kconfig:option:`CONFIG_POSIX_TIMEOUTS`
50    :ref:`_POSIX_TIMERS<posix_option_group_timers>`, 200809L, :kconfig:option:`CONFIG_POSIX_TIMERS`
51    _POSIX2_C_BIND, 200809L,
52
53.. The following should be valued greater than zero in Zephyr, in order to be strictly conformant
54    with the POSIX specification.
55
56.. csv-table:: POSIX System Interfaces (Unsupported)
57   :header: Symbol, Support, Remarks
58   :widths: 50, 10, 50
59
60    _POSIX_JOB_CONTROL, -1, :ref:`†<posix_undefined_behaviour>`
61    _POSIX_REGEXP, -1, :ref:`†<posix_undefined_behaviour>`
62    _POSIX_SAVED_IDS, -1, :ref:`†<posix_undefined_behaviour>`
63    _POSIX_SHELL, -1, :ref:`†<posix_undefined_behaviour>`
64
65.. csv-table:: POSIX System Interfaces (Optional)
66   :header: Symbol, Support, Remarks
67   :widths: 50, 10, 50
68
69    _POSIX_ADVISORY_INFO, -1,
70    :ref:`_POSIX_CPUTIME<posix_option_cputime>`, 200809L, :kconfig:option:`CONFIG_POSIX_CPUTIME`
71    :ref:`_POSIX_FSYNC<posix_option_fsync>`, 200809L, :kconfig:option:`CONFIG_POSIX_FSYNC`
72    :ref:`_POSIX_IPV6<posix_option_ipv6>`, 200809L, :kconfig:option:`CONFIG_POSIX_IPV6`
73    :ref:`_POSIX_MEMLOCK <posix_option_memlock>`, 200809L, :kconfig:option:`CONFIG_POSIX_MEMLOCK` :ref:`†<posix_undefined_behaviour>`
74    :ref:`_POSIX_MEMLOCK_RANGE <posix_option_memlock_range>`, 200809L, :kconfig:option:`CONFIG_POSIX_MEMLOCK_RANGE`
75    :ref:`_POSIX_MESSAGE_PASSING<posix_option_message_passing>`, 200809L, :kconfig:option:`CONFIG_POSIX_MESSAGE_PASSING`
76    :ref:`_POSIX_MONOTONIC_CLOCK<posix_option_monotonic_clock>`, 200809L, :kconfig:option:`CONFIG_POSIX_MONOTONIC_CLOCK`
77    _POSIX_PRIORITIZED_IO, -1,
78    :ref:`_POSIX_PRIORITY_SCHEDULING<posix_option_priority_scheduling>`, 200809L, :kconfig:option:`CONFIG_POSIX_PRIORITY_SCHEDULING`
79    :ref:`_POSIX_RAW_SOCKETS<posix_option_raw_sockets>`, 200809L, :kconfig:option:`CONFIG_POSIX_RAW_SOCKETS`
80    :ref:`_POSIX_SHARED_MEMORY_OBJECTS <posix_shared_memory_objects>`, 200809L, :kconfig:option:`CONFIG_POSIX_SHARED_MEMORY_OBJECTS`
81    _POSIX_SPAWN, -1, :ref:`†<posix_undefined_behaviour>`
82    _POSIX_SPORADIC_SERVER, -1, :ref:`†<posix_undefined_behaviour>`
83    :ref:`_POSIX_SYNCHRONIZED_IO <posix_option_synchronized_io>`, 200809L, :kconfig:option:`CONFIG_POSIX_SYNCHRONIZED_IO`
84    :ref:`_POSIX_THREAD_ATTR_STACKADDR<posix_option_thread_attr_stackaddr>`, 200809L, :kconfig:option:`CONFIG_POSIX_THREAD_ATTR_STACKADDR`
85    :ref:`_POSIX_THREAD_ATTR_STACKSIZE<posix_option_thread_attr_stacksize>`, 200809L, :kconfig:option:`CONFIG_POSIX_THREAD_ATTR_STACKSIZE`
86    :ref:`_POSIX_THREAD_CPUTIME <posix_option_thread_cputime>`, 200809L, :kconfig:option:`CONFIG_POSIX_CPUTIME`
87    :ref:`_POSIX_THREAD_PRIO_INHERIT <posix_option_thread_prio_inherit>`, 200809L, :kconfig:option:`CONFIG_POSIX_THREAD_PRIO_INHERIT`
88    :ref:`_POSIX_THREAD_PRIO_PROTECT <posix_option_thread_prio_protect>`, 200809L, :kconfig:option:`CONFIG_POSIX_THREAD_PRIO_PROTECT`
89    :ref:`_POSIX_THREAD_PRIORITY_SCHEDULING <posix_option_thread_priority_scheduling>`, 200809L, :kconfig:option:`CONFIG_POSIX_THREAD_PRIORITY_SCHEDULING`
90    _POSIX_THREAD_PROCESS_SHARED, -1,
91    _POSIX_THREAD_SPORADIC_SERVER, -1,
92    _POSIX_TRACE, -1,
93    _POSIX_TRACE_EVENT_FILTER, -1,
94    _POSIX_TRACE_INHERIT, -1,
95    _POSIX_TRACE_LOG, -1,
96    _POSIX_TYPED_MEMORY_OBJECTS, -1,
97    _XOPEN_CRYPT, -1,
98    _XOPEN_REALTIME, -1,
99    _XOPEN_REALTIME_THREADS, -1,
100    :ref:`_XOPEN_STREAMS<posix_option_xopen_streams>`, 200809L, :kconfig:option:`CONFIG_XOPEN_STREAMS`
101    _XOPEN_UNIX, -1,
102
103
104POSIX Shell and Utilities
105=========================
106
107Zephyr does not support a POSIX shell or utilities at this time.
108
109.. csv-table:: POSIX Shell and Utilities
110   :header: Symbol, Support, Remarks
111   :widths: 50, 10, 50
112
113    _POSIX2_C_DEV, -1, :ref:`†<posix_undefined_behaviour>`
114    _POSIX2_CHAR_TERM, -1, :ref:`†<posix_undefined_behaviour>`
115    _POSIX2_FORT_DEV, -1, :ref:`†<posix_undefined_behaviour>`
116    _POSIX2_FORT_RUN, -1, :ref:`†<posix_undefined_behaviour>`
117    _POSIX2_LOCALEDEF, -1, :ref:`†<posix_undefined_behaviour>`
118    _POSIX2_PBS, -1, :ref:`†<posix_undefined_behaviour>`
119    _POSIX2_PBS_ACCOUNTING, -1, :ref:`†<posix_undefined_behaviour>`
120    _POSIX2_PBS_LOCATE, -1, :ref:`†<posix_undefined_behaviour>`
121    _POSIX2_PBS_MESSAGE, -1, :ref:`†<posix_undefined_behaviour>`
122    _POSIX2_PBS_TRACK, -1, :ref:`†<posix_undefined_behaviour>`
123    _POSIX2_SW_DEV, -1, :ref:`†<posix_undefined_behaviour>`
124    _POSIX2_UPE, -1, :ref:`†<posix_undefined_behaviour>`
125    _POSIX2_UNIX, -1, :ref:`†<posix_undefined_behaviour>`
126    _POSIX2_UUCP, -1, :ref:`†<posix_undefined_behaviour>`
127
128XSI Conformance
129###############
130
131X/Open System Interfaces
132========================
133
134.. csv-table:: X/Open System Interfaces
135   :header: Symbol, Support, Remarks
136   :widths: 50, 10, 50
137
138    :ref:`_POSIX_FSYNC<posix_option_fsync>`, 200809L, :kconfig:option:`CONFIG_POSIX_FSYNC`
139    :ref:`_POSIX_THREAD_ATTR_STACKADDR<posix_option_thread_attr_stackaddr>`, 200809L, :kconfig:option:`CONFIG_POSIX_THREAD_ATTR_STACKADDR`
140    :ref:`_POSIX_THREAD_ATTR_STACKSIZE<posix_option_thread_attr_stacksize>`, 200809L, :kconfig:option:`CONFIG_POSIX_THREAD_ATTR_STACKSIZE`
141    _POSIX_THREAD_PROCESS_SHARED, -1,
142
143.. _posix_undefined_behaviour:
144
145.. note::
146   Some features may exhibit undefined behaviour as they fall beyond the scope of Zephyr's current
147   design and capabilities. For example, multi-processing, ad-hoc memory-mapping, multiple users,
148   or regular expressions are features that are uncommon in low-footprint embedded systems.
149   Such undefined behaviour is denoted with the † (obelus) symbol. Additional details
150   :ref:`here <posix_option_groups>`.
151
152.. _posix_libc_provided:
153
154.. note::
155    Features listed in various POSIX Options or Option Groups may be provided in whole or in part
156    by a conformant C library implementation. This includes (but is not limited to) POSIX
157    Extensions to the ISO C Standard (`CX`_).
158
159.. _CX: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap01.html
160