Skip to content

Commit a5f0778

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 611a38d commit a5f0778

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
@@ -161,7 +161,8 @@
161161
/* #define _POSIX_THREAD_ROBUST_PRIO_INHERIT (-1L) */
162162
/* #define _POSIX_THREAD_ROBUST_PRIO_PROTECT (-1L) */
163163

164-
#ifdef CONFIG_POSIX_THREAD_SAFE_FUNCTIONS
164+
#if defined(CONFIG_POSIX_C_LANG_SUPPORT_R) && defined(CONFIG_POSIX_FILE_LOCKING) && \
165+
defined(CONFIG_POSIX_FILE_SYSTEM_R) && defined(CONFIG_POSIX_SYSTEM_DATABASE_R)
165166
#define _POSIX_THREAD_SAFE_FUNCTIONS _POSIX_VERSION
166167
#endif
167168

lib/posix/options/Kconfig.pthread

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

160160
config POSIX_THREAD_SAFE_FUNCTIONS
161161
bool "POSIX thread-safe functions"
162-
select POSIX_FILE_SYSTEM_R
163162
select POSIX_C_LANG_SUPPORT_R
163+
select POSIX_FILE_LOCKING
164+
select POSIX_FILE_SYSTEM_R
165+
select POSIX_SYSTEM_DATABASE_R
166+
select POSIX_SYNCHRONIZED_IO
164167
help
165168
Select 'y' here to enable POSIX thread-safe functions including asctime_r(), ctime_r(),
166169
flockfile(), ftrylockfile(), funlockfile(), getc_unlocked(), getchar_unlocked(),

0 commit comments

Comments
 (0)