Skip to content

Commit be6f05e

Browse files
author
Christopher Friedt
committed
posix: split supported features into separate Kconfig files
This change is setting up for switching over to proper POSIX option requirements, feature test macros, and a dependency structure that is reflective of the standard. Signed-off-by: Christopher Friedt <cfriedt@meta.com>
1 parent e9cad7f commit be6f05e

18 files changed

+261
-161
lines changed

lib/posix/Kconfig

Lines changed: 22 additions & 161 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Copyright (c) 2018 Intel Corporation
2+
# Copyright (c) 2023 Meta
3+
#
24
# SPDX-License-Identifier: Apache-2.0
35

4-
source "lib/posix/getopt/Kconfig"
5-
66
config POSIX_MAX_FDS
77
int "Maximum number of open file descriptors"
88
default 16 if POSIX_API
@@ -18,144 +18,6 @@ config POSIX_API
1818
Enable mostly-standards-compliant implementations of
1919
various POSIX (IEEE 1003.1) APIs.
2020

21-
config PTHREAD_IPC
22-
bool "POSIX pthread IPC API"
23-
default y if POSIX_API
24-
depends on POSIX_CLOCK
25-
help
26-
This enables a mostly-standards-compliant implementation of
27-
the pthread mutex, condition variable and barrier IPC
28-
mechanisms.
29-
30-
if PTHREAD_IPC
31-
config MAX_PTHREAD_COUNT
32-
int "Maximum simultaneously active pthread count in POSIX application"
33-
default 5
34-
range 0 255
35-
help
36-
Maximum number of simultaneously active threads in a POSIX application.
37-
38-
config PTHREAD_CREATE_BARRIER
39-
bool "Use a pthread_barrier_t to serialize pthread_create()"
40-
help
41-
When running several SMP applications in parallel instances of Qemu,
42-
e.g. via twister, explicit serialization may be required between
43-
pthread_create() and zephyr_thread_wrapper() when spawning and joining
44-
many pthreads concurrently.
45-
46-
On such systems, say Y here to introduce explicit serialization
47-
via pthread_barrier_wait().
48-
49-
config MAX_PTHREAD_MUTEX_COUNT
50-
int "Maximum simultaneously active mutex count in POSIX application"
51-
default 5
52-
range 0 255
53-
help
54-
Maximum number of simultaneously active mutexes in a POSIX application.
55-
56-
config MAX_PTHREAD_COND_COUNT
57-
int "Maximum simultaneously active condition variables in a POSIX application"
58-
default 5
59-
range 0 255
60-
help
61-
Maximum number of simultaneously active condition variables in a POSIX application.
62-
63-
config MAX_PTHREAD_KEY_COUNT
64-
int "Maximum simultaneously active keys in a POSIX application"
65-
default 5
66-
range 0 255
67-
help
68-
Maximum number of simultaneously active keys in a POSIX application.
69-
70-
config MAX_PTHREAD_BARRIER_COUNT
71-
int "Maximum simultaneously active barriers in a POSIX application"
72-
default 5
73-
range 0 255
74-
help
75-
Maximum number of simultaneously active keys in a POSIX application.
76-
77-
config MAX_PTHREAD_SPINLOCK_COUNT
78-
int "Maximum simultaneously active spinlocks in a POSIX application"
79-
default 5
80-
range 0 255
81-
help
82-
Maximum number of simultaneously active spinlocks in a POSIX application.
83-
84-
config SEM_VALUE_MAX
85-
int "Maximum semaphore limit"
86-
default 32767
87-
range 1 32767
88-
help
89-
Maximum semaphore count in POSIX compliant Application.
90-
91-
endif # PTHREAD_IPC
92-
93-
config POSIX_CLOCK
94-
bool "POSIX clock, timer, and sleep APIs"
95-
default y if POSIX_API
96-
help
97-
This enables POSIX clock\_\*(), timer\_\*(), and \*sleep()
98-
functions.
99-
100-
config MAX_TIMER_COUNT
101-
int "Maximum timer count in POSIX application"
102-
default 5
103-
range 0 255
104-
help
105-
Mention maximum number of timers in POSIX compliant application.
106-
107-
config TIMER_CREATE_WAIT
108-
int "Time to wait for timer availability (in msec) in POSIX application"
109-
default 100
110-
range 0 1000
111-
help
112-
This controls how long to wait for resources to come available to create
113-
a new timer in POSIX compliant application
114-
115-
config POSIX_MQUEUE
116-
bool "POSIX message queue"
117-
default y if POSIX_API
118-
help
119-
This enabled POSIX message queue related APIs.
120-
121-
if POSIX_MQUEUE
122-
config MSG_COUNT_MAX
123-
int "Maximum number of messages in message queue"
124-
default 16
125-
help
126-
Mention maximum number of messages in message queue in POSIX compliant
127-
application.
128-
129-
config MSG_SIZE_MAX
130-
int "Maximum size of a message"
131-
default 16
132-
help
133-
Mention maximum size of message in bytes.
134-
135-
config MQUEUE_NAMELEN_MAX
136-
int "Maximum size of a name length"
137-
default 16
138-
range 2 255
139-
help
140-
Mention length of message queue name in number of characters.
141-
142-
endif
143-
144-
config POSIX_FS
145-
bool "POSIX file system API support"
146-
default y if POSIX_API
147-
depends on FILE_SYSTEM
148-
help
149-
This enables POSIX style file system related APIs.
150-
151-
config POSIX_MAX_OPEN_FILES
152-
int "Maximum number of open file descriptors"
153-
default 16
154-
depends on POSIX_FS
155-
help
156-
Maximum number of open files. Note that this setting
157-
is additionally bounded by CONFIG_POSIX_MAX_FDS.
158-
15921
# The name of this option is mandated by zephyr_interface_library_named
16022
# cmake directive.
16123
config APP_LINK_WITH_POSIX_SUBSYS
@@ -165,27 +27,26 @@ config APP_LINK_WITH_POSIX_SUBSYS
16527
help
16628
Add POSIX subsystem header files to the 'app' include path.
16729

168-
config EVENTFD
169-
bool "Support for eventfd"
170-
depends on !NATIVE_APPLICATION
171-
select POLL
30+
config PTHREAD_IPC
31+
bool "POSIX pthread IPC API"
17232
default y if POSIX_API
33+
depends on POSIX_CLOCK
17334
help
174-
Enable support for event file descriptors, eventfd. An eventfd can
175-
be used as an event wait/notify mechanism together with POSIX calls
176-
like read, write and poll.
177-
178-
config EVENTFD_MAX
179-
int "Maximum number of eventfd's"
180-
depends on EVENTFD
181-
default 1
182-
range 1 4096
183-
help
184-
The maximum number of supported event file descriptors.
35+
This enables a mostly-standards-compliant implementation of
36+
the pthread mutex, condition variable and barrier IPC
37+
mechanisms.
18538

186-
config FNMATCH
187-
bool "Support for fnmatch"
188-
default y if POSIX_API
189-
help
190-
Match filenames using the the fnmatch function. For example, the pattern
191-
"*.c" matches the filename "hello.c".
39+
source "lib/posix/Kconfig.barrier"
40+
source "lib/posix/Kconfig.clock"
41+
source "lib/posix/Kconfig.cond"
42+
source "lib/posix/Kconfig.eventfd"
43+
source "lib/posix/Kconfig.fnmatch"
44+
source "lib/posix/Kconfig.fs"
45+
source "lib/posix/Kconfig.getopt"
46+
source "lib/posix/Kconfig.key"
47+
source "lib/posix/Kconfig.mqueue"
48+
source "lib/posix/Kconfig.mutex"
49+
source "lib/posix/Kconfig.pthread"
50+
source "lib/posix/Kconfig.semaphore"
51+
source "lib/posix/Kconfig.spinlock"
52+
source "lib/posix/Kconfig.timer"

lib/posix/Kconfig.barrier

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Copyright (c) 2017 Intel Corporation
2+
# Copyright (c) 2023 Meta
3+
#
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
TYPE = PTHREAD_BARRIER
7+
type = pthread_barrier_t
8+
type-function = pthread_barrier_wait
9+
source "lib/posix/Kconfig.template.pooled_ipc_type"
10+
11+
if PTHREAD_BARRIER
12+
13+
config PTHREAD_CREATE_BARRIER
14+
bool "Use a pthread_barrier_t to serialize pthread_create()"
15+
help
16+
When running several SMP applications in parallel instances of Qemu,
17+
e.g. via twister, explicit serialization may be required between
18+
pthread_create() and zephyr_thread_wrapper() when spawning and joining
19+
many pthreads concurrently.
20+
21+
On such systems, say Y here to introduce explicit serialization
22+
via pthread_barrier_wait().
23+
24+
endif

lib/posix/Kconfig.clock

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Copyright (c) 2018 Intel Corporation
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
config POSIX_CLOCK
6+
bool "POSIX clock, timer, and sleep APIs"
7+
default y if POSIX_API
8+
help
9+
This enables POSIX clock\_\*(), timer\_\*(), and \*sleep()
10+
functions.

lib/posix/Kconfig.cond

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Copyright (c) 2017 Intel Corporation
2+
# Copyright (c) 2023 Meta
3+
#
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
TYPE = PTHREAD_COND
7+
type = pthread_cond_t
8+
type-function = pthread_cond_wait
9+
source "lib/posix/Kconfig.template.pooled_ipc_type"

lib/posix/Kconfig.eventfd

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Copyright (c) 2020 Tobias Svehagen
2+
# Copyright (c) 2023 Meta
3+
#
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
config EVENTFD
7+
bool "Support for eventfd"
8+
depends on !NATIVE_APPLICATION
9+
select POLL
10+
default y if POSIX_API
11+
help
12+
Enable support for event file descriptors, eventfd. An eventfd can
13+
be used as an event wait/notify mechanism together with POSIX calls
14+
like read, write and poll.
15+
16+
config EVENTFD_MAX
17+
int "Maximum number of eventfd's"
18+
depends on EVENTFD
19+
default 1
20+
range 1 4096
21+
help
22+
The maximum number of supported event file descriptors.

lib/posix/Kconfig.fnmatch

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Copyright (c) 2018 Nordic Semiconductor ASA
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
config FNMATCH
6+
bool "Support for fnmatch"
7+
default y if POSIX_API
8+
help
9+
Match filenames using the the fnmatch function. For example, the pattern
10+
"*.c" matches the filename "hello.c".

lib/posix/Kconfig.fs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Copyright (c) 2018 Intel Corporation
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
config POSIX_FS
6+
bool "POSIX file system API support"
7+
default y if POSIX_API
8+
depends on FILE_SYSTEM
9+
help
10+
This enables POSIX style file system related APIs.
11+
12+
config POSIX_MAX_OPEN_FILES
13+
int "Maximum number of open file descriptors"
14+
default 16
15+
depends on POSIX_FS
16+
help
17+
Maximum number of open files. Note that this setting
18+
is additionally bounded by CONFIG_POSIX_MAX_FDS.

lib/posix/Kconfig.getopt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Copyright (c) 2021 Nordic Semiconductor ASA
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
source "lib/posix/getopt/Kconfig"

lib/posix/Kconfig.key

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Copyright (c) 2018 Intel Corporation
2+
# Copyright (c) 2023 Meta
3+
#
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
TYPE = PTHREAD_KEY
7+
type = pthread_key_t
8+
type-function = pthread_setspecific
9+
source "lib/posix/Kconfig.template.pooled_ipc_type"

lib/posix/Kconfig.mqueue

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Copyright (c) 2017 Intel Corporation
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
config POSIX_MQUEUE
6+
bool "POSIX message queue"
7+
default y if POSIX_API
8+
help
9+
This enabled POSIX message queue related APIs.
10+
11+
if POSIX_MQUEUE
12+
13+
config MSG_COUNT_MAX
14+
int "Maximum number of messages in message queue"
15+
default 16
16+
help
17+
Mention maximum number of messages in message queue in POSIX compliant
18+
application.
19+
20+
config MSG_SIZE_MAX
21+
int "Maximum size of a message"
22+
default 16
23+
help
24+
Mention maximum size of message in bytes.
25+
26+
config MQUEUE_NAMELEN_MAX
27+
int "Maximum size of a name length"
28+
default 16
29+
range 2 255
30+
help
31+
Mention length of message queue name in number of characters.
32+
33+
endif

0 commit comments

Comments
 (0)