Skip to content

Commit 1f02b05

Browse files
committed
posix: options: define threadsafe fns in terms of option groups
The functions associated with the _POSIX_THREAD_SAFE_FUNCTIONS Option are members of other POSIX Option Groups. Specifically, POSIX_C_LANG_SUPPORT_R, POSIX_FILE_LOCKING, POSIX_FILE_SYSTEM_R, and POSIX_SYSTEM_DATABASE_R. Moreover, _POSIX_THREAD_SAFE_FUNCTIONS is required to be available with any conforming implementation. Therefore, it does not make sense to have a Kconfig option to turn it off or on; it should be enabled or disabled based on whether the required POSIX Option Groups are active. Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
1 parent 3359bb4 commit 1f02b05

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

include/zephyr/posix/posix_features.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,8 @@
156156
/* #define _POSIX_THREAD_ROBUST_PRIO_INHERIT (-1L) */
157157
/* #define _POSIX_THREAD_ROBUST_PRIO_PROTECT (-1L) */
158158

159-
#ifdef CONFIG_POSIX_THREAD_SAFE_FUNCTIONS
159+
#if defined(CONFIG_POSIX_C_LANG_SUPPORT_R) && defined(CONFIG_POSIX_FILE_LOCKING) && \
160+
defined(CONFIG_POSIX_FILE_SYSTEM_R) && defined(CONFIG_POSIX_SYSTEM_DATABASE_R)
160161
#define _POSIX_THREAD_SAFE_FUNCTIONS _POSIX_VERSION
161162
#endif
162163

lib/posix/options/Kconfig.pthread

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,11 @@ config POSIX_THREAD_PRIO_PROTECT
156156

157157
config POSIX_THREAD_SAFE_FUNCTIONS
158158
bool "POSIX thread-safe functions"
159-
select POSIX_FILE_SYSTEM_R
160159
select POSIX_C_LANG_SUPPORT_R
160+
select POSIX_FILE_LOCKING
161+
select POSIX_FILE_SYSTEM_R
162+
select POSIX_SYSTEM_DATABASE_R
163+
select POSIX_SYNCHRONIZED_IO
161164
help
162165
Select 'y' here to enable POSIX thread-safe functions including asctime_r(), ctime_r(),
163166
flockfile(), ftrylockfile(), funlockfile(), getc_unlocked(), getchar_unlocked(),

0 commit comments

Comments
 (0)