1# Copyright (c) 2024 Tenstorrent
2#
3# SPDX-License-Identifier: Apache-2.0
4
5config POSIX_SYSTEM_HEADERS
6	bool
7	select NATIVE_LIBC_INCOMPATIBLE
8	help
9	  Make POSIX headers available to the system without the "zephyr/posix" prefix.
10
11config POSIX_API
12	bool "POSIX APIs"
13	select NATIVE_LIBC_INCOMPATIBLE
14	select POSIX_SYSTEM_HEADERS
15	select POSIX_BASE_DEFINITIONS # clock_gettime(), pthread_create(), sem_get(), etc
16	select POSIX_AEP_REALTIME_MINIMAL # CLOCK_MONOTONIC, pthread_attr_setstack(), etc
17	select POSIX_NETWORKING if NETWORKING # inet_ntoa(), socket(), etc
18	imply EVENTFD # eventfd(), eventfd_read(), eventfd_write()
19	imply POSIX_FD_MGMT # open(), close(), read(), write()
20	imply POSIX_MULTI_PROCESS # sleep(), getpid(), etc
21	imply XSI_SINGLE_PROCESS # gettimeofday()
22	help
23	  This option enables the required POSIX System Interfaces (base definitions), all of PSE51,
24	  and some features found in PSE52.
25
26	  Note: in the future, this option may be deprecated in favour of subprofiling options.
27
28choice POSIX_AEP_CHOICE
29	prompt "POSIX Subprofile"
30	default POSIX_AEP_CHOICE_NONE
31	help
32	  This choice is intended to help users select the correct POSIX profile for their
33	  application. Choices are based on IEEE 1003.13-2003 (now inactive / reserved) and
34	  extrapolated to the more recent Subprofiling Option Groups in IEEE 1003.3-2017.
35
36	  For more information, please refer to
37	  https://standards.ieee.org/ieee/1003.13/3322/
38	  https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_subprofiles.html
39
40config POSIX_AEP_CHOICE_NONE
41	bool "No pre-defined POSIX subprofile"
42	help
43	  No pre-defined POSIX profile is selected.
44
45config POSIX_AEP_CHOICE_BASE
46	bool "Base definitions (system interfaces)"
47	select NATIVE_LIBC_INCOMPATIBLE
48	select POSIX_BASE_DEFINITIONS
49	help
50	  Only enable the base definitions required for all POSIX systems.
51
52	  For more information, please see
53	  https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap02.html#tag_02_01_03_01
54
55config POSIX_AEP_CHOICE_PSE51
56	bool "Minimal Realtime System Profile (PSE51)"
57	select NATIVE_LIBC_INCOMPATIBLE
58	select POSIX_BASE_DEFINITIONS
59	select POSIX_AEP_REALTIME_MINIMAL
60	help
61	  PSE51 includes the POSIX Base Definitions (System Interfaces) as well as several Options and
62	  Option Groups to facilitate device I/O, signals, mandatory configuration utilities, and
63	  threading.
64
65	  For more information, please see
66	  https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_subprofiles.html
67
68config POSIX_AEP_CHOICE_PSE52
69	bool "Realtime Controller System Profile (PSE52)"
70	select NATIVE_LIBC_INCOMPATIBLE
71	select POSIX_BASE_DEFINITIONS
72	select POSIX_AEP_REALTIME_MINIMAL
73	select POSIX_AEP_REALTIME_CONTROLLER
74	help
75	  PSE52 includes the POSIX Base Definitions (System Interfaces) as well as all features of
76	  PSE51. Additionally, it includes interfaces for file descriptor management, filesystem
77	  support, support for message queues, and tracing.
78
79	  For more information, please see
80	  https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_subprofiles.html
81
82config POSIX_AEP_CHOICE_PSE53
83	bool "Dedicated Realtime System Profile (PSE53)"
84	select NATIVE_LIBC_INCOMPATIBLE
85	select POSIX_BASE_DEFINITIONS
86	select POSIX_AEP_REALTIME_MINIMAL
87	select POSIX_AEP_REALTIME_CONTROLLER
88	select POSIX_AEP_REALTIME_DEDICATED
89	help
90	  PSE53 includes the POSIX Base Definitions (System Interfaces) as well as all features of
91	  PSE52. Additionally, it includes interfaces for POSIX multi-processing, networking, pipes,
92	  and prioritized I/O.
93
94	  For more information, please see
95	  https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_subprofiles.html
96
97# TODO: PSE54: Multi-purpose Realtime System Profile
98
99endchoice # POSIX_AEP_CHOICE
100
101# Base Definitions (System Interfaces)
102config POSIX_BASE_DEFINITIONS
103	bool
104	select POSIX_SYSTEM_HEADERS
105	select POSIX_ASYNCHRONOUS_IO
106	select POSIX_BARRIERS
107	select POSIX_CLOCK_SELECTION
108	select POSIX_MAPPED_FILES
109	select POSIX_MEMORY_PROTECTION
110	select POSIX_READER_WRITER_LOCKS
111	select POSIX_REALTIME_SIGNALS
112	select POSIX_SEMAPHORES
113	select POSIX_SPIN_LOCKS
114	select POSIX_THREAD_SAFE_FUNCTIONS
115	select POSIX_THREADS
116	select POSIX_TIMEOUTS
117	select POSIX_TIMERS
118	help
119	  This option is not user configurable. It may be configured indirectly by selecting
120	  CONFIG_POSIX_AEP_CHOICE_BASE=y.
121
122	  For more information, please see
123	  https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap02.html#tag_02_01_03_01
124
125config POSIX_AEP_REALTIME_MINIMAL
126	bool
127	# Option Groups
128	select POSIX_DEVICE_IO
129	select POSIX_SIGNALS
130	select POSIX_SINGLE_PROCESS
131	select XSI_THREADS_EXT
132	# Options
133	select POSIX_FSYNC
134	select POSIX_MEMLOCK
135	select POSIX_MEMLOCK_RANGE
136	select POSIX_MONOTONIC_CLOCK
137	select POSIX_SHARED_MEMORY_OBJECTS
138	select POSIX_SYNCHRONIZED_IO
139	select POSIX_THREAD_ATTR_STACKADDR
140	select POSIX_THREAD_ATTR_STACKSIZE
141	select POSIX_THREAD_CPUTIME
142	select POSIX_THREAD_PRIO_INHERIT
143	select POSIX_THREAD_PRIO_PROTECT
144	select POSIX_THREAD_PRIORITY_SCHEDULING
145	# select POSIX_THREAD_SPORADIC_SERVER
146	help
147	  This option is not user configurable. It may be configured indirectly by selecting
148	  CONFIG_POSIX_AEP_CHOICE_PSE51=y.
149
150	  For more information, please see
151	  https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_subprofiles.html
152
153config POSIX_AEP_REALTIME_CONTROLLER
154	bool
155	# Option Groups
156	select POSIX_FD_MGMT
157	select POSIX_FILE_SYSTEM
158	# Options
159	select POSIX_MESSAGE_PASSING
160	# select POSIX_TRACE
161	# select POSIX_TRACE_EVENT_FILTER
162	# select POSIX_TRACE_LOG
163	help
164	  This option is not user configurable. It may be configured indirectly by selecting
165	  CONFIG_POSIX_AEP_CHOICE_PSE52=y.
166
167	  For more information, please see
168	  https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_subprofiles.html
169
170config POSIX_AEP_REALTIME_DEDICATED
171	bool
172	# Option Groups
173	select POSIX_MULTI_PROCESS
174	select POSIX_NETWORKING
175	# select POSIX_PIPE
176	# select POSIX_SIGNAL_JUMP
177	# Options
178	select POSIX_CPUTIME
179	# select POSIX_PRIORITIZED_IO
180	select POSIX_PRIORITY_SCHEDULING
181	select POSIX_RAW_SOCKETS
182	# select POSIX_SPAWN
183	# select POSIX_SPORADIC_SERVER
184	help
185	  This option is not user configurable. It may be configured indirectly by selecting
186	  CONFIG_POSIX_AEP_CHOICE_PSE53=y.
187
188	  For more information, please see
189	  https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_subprofiles.html
190