Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

posix: standardize kconfig options #73047

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
19d72fb
tests: posix: headers: remove tests for varying features
May 21, 2024
eb741ab
tests: posix: headers: check some structs only when posix_api=y
May 21, 2024
4f746c3
posix: sysconf: correct typo on _SC_MAPPED_FILE(S)
May 20, 2024
dd491e4
tests: posix: headers: enable checks for sysconf() constants
May 21, 2024
d230b2a
tests: posix: headers: enable checks for confstr() constants
May 21, 2024
7262d5d
posix: unistd: move posix features to separate header file
May 20, 2024
760307e
posix: features: leave feature test macros undefined if unimpl
May 20, 2024
f88fa00
posix: sysconf: define z sysconf macros with COND_CODE_1
May 20, 2024
4f71c4c
posix: add Kconfig.deprecated
May 20, 2024
ab5665a
posix: signals: deprecate CONFIG_POSIX_LIMITS_RTSIG_MAX
May 21, 2024
d8c658d
posix: timers: deprecate CONFIG_POSIX_CLOCK and TIMER
May 20, 2024
0220d93
posix: fd_mgmt: add fd_mgmt option group
May 22, 2024
557dc39
posix: deprecate POSIX_MAX_FDS and add POSIX_DEVICE_IO
May 22, 2024
5179636
posix: deprecate PTHREAD_BARRIER for POSIX_BARRIERS
May 22, 2024
2ed489f
posix: deprecate POSIX_ENV _CONFSTR _SYSCONF and _UNAME
May 22, 2024
06ac6d7
posix: deprecate PTHREAD_SPINLOCK for POSIX_SPIN_LOCKS
May 22, 2024
31d0fd5
posix: deprecate POSIX_MQUEUE in favour of POSIX_MESSAGE_PASSING
May 22, 2024
6d4f3bb
posix: deprecate PTHREAD_RWLOCK for POSIX_READER_WRITER_LOCKS
May 22, 2024
f4c3611
posix: deprecate POSIX_FNMATCH GETOPT GETENTROPY
May 22, 2024
12f6f5c
posix: deprecate POSIX_FS for POSIX_FILE_SYSTEM
May 22, 2024
556bb28
posix: deprecate SEM_VALUE_MAX and SEM_NAMELEN_MAX
May 23, 2024
bff8d12
doc: posix: add kconfig link for async io
May 23, 2024
00312c3
posix: deprecate POSIX_SYSLOG for XSI_SYSTEM_LOGGING
May 23, 2024
20d87fc
posix: deprecate POSIX_PUTMSG for XOPEN_STREAMS
May 23, 2024
b0f0529
posix: deprecate PTHREAD_IPC _MUTEX _COND and _KEY
May 23, 2024
ebfb83e
posix: relocate Kconfig.eventfd to Kconfig.compat
May 23, 2024
81326bf
posix: deprecate POSIX_SIGNAL in favour of POSIX_SIGNALS
May 23, 2024
e41c3ee
posix: reword aio and sched options. add experimental
May 23, 2024
fa8bb98
posix: move getpid() to Kconfig.procN and doc MULTI_PROCESS
May 23, 2024
2b2a2c5
doc: posix: clean up some Kconfig options
May 23, 2024
3d3e8e4
posix: net: update for POSIX_NETWORKING
May 23, 2024
7c32ec4
doc: posix: misc cleanup and add links to system interfaces
May 24, 2024
80869ec
posix: eventfd: remove deprecated eventfd macros
May 28, 2024
b925935
posix: eventfd: fix dependency cycle between net and posix
May 28, 2024
f54caa6
posix: create kconfig options for pse51, pse52, pse53
May 24, 2024
283f24d
doc: release: posix: deprecate non-normative POSIX Kconfig
May 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/services/portability/posix/conformance/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ POSIX System Interfaces
:ref:`_POSIX_CLOCK_SELECTION<posix_option_group_clock_selection>`, 200809L, :kconfig:option:`CONFIG_POSIX_CLOCK_SELECTION`
_POSIX_MAPPED_FILES, -1, :ref:`†<posix_undefined_behaviour>`
_POSIX_MEMORY_PROTECTION, -1, :ref:`†<posix_undefined_behaviour>`
:ref:`_POSIX_READER_WRITER_LOCKS<posix_option_reader_writer_locks>`, 200809L, :kconfig:option:`CONFIG_PTHREAD_IPC`
:ref:`_POSIX_READER_WRITER_LOCKS<posix_option_reader_writer_locks>`, 200809L, :kconfig:option:`CONFIG_POSIX_READER_WRITER_LOCKS`
:ref:`_POSIX_REALTIME_SIGNALS<posix_option_group_realtime_signals>`, -1,
:ref:`_POSIX_SEMAPHORES<posix_option_group_semaphores>`, 200809L, :kconfig:option:`CONFIG_PTHREAD_IPC`
:ref:`_POSIX_SPIN_LOCKS<posix_option_group_spin_locks>`, 200809L, :kconfig:option:`CONFIG_POSIX_SPIN_LOCKS`
Expand Down
2 changes: 1 addition & 1 deletion include/zephyr/posix/posix_features.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
#define _POSIX_RAW_SOCKETS _POSIX_VERSION
#endif

#ifdef CONFIG_PTHREAD_IPC
#ifdef CONFIG_POSIX_READER_WRITER_LOCKS
#define _POSIX_READER_WRITER_LOCKS _POSIX_VERSION
#endif

Expand Down
2 changes: 1 addition & 1 deletion include/zephyr/posix/pthread.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ int pthread_condattr_setclock(pthread_condattr_t *att, clockid_t clock_id);
*
* Initialize a rwlock with the default rwlock attributes.
*/
#define PTHREAD_RWLOCK_INITIALIZER (-1)
#define POSIX_RWLOCK_INITIALIZER (-1)
Copy link
Member

@fabiobaltieri fabiobaltieri Jun 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hey @cfriedt is this correct? I bumped into a library that was using PTHREAD_RWLOCK_INITIALIZER (boringssl) and now does not build anymore, I see that /usr/include/pthread.h on my system defines PTHREAD_RWLOCK_INITIALIZER as well

If the change is intentional does this need a migration guide entry?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fabiobaltieri - good find. PTHREAD_RWLOCK_INITIALIZER is the standard macro name. Are you good to submit a fix?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah I can do that

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there you go #73808


/*
* Mutex attributes - type
Expand Down
2 changes: 1 addition & 1 deletion include/zephyr/posix/sys/sysconf.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ enum {
COND_CODE_1(CONFIG_NET_SOCKETS_PACKET, (_POSIX_RAW_SOCKETS), (-1L))
#define __z_posix_sysconf_SC_RE_DUP_MAX _POSIX_RE_DUP_MAX
#define __z_posix_sysconf_SC_READER_WRITER_LOCKS \
COND_CODE_1(CONFIG_PTHREAD_IPC, (_POSIX_READER_WRITER_LOCKS), (-1L))
COND_CODE_1(CONFIG_POSIX_READER_WRITER_LOCKS, (_POSIX_READER_WRITER_LOCKS), (-1L))
#define __z_posix_sysconf_SC_REALTIME_SIGNALS (-1L)
#define __z_posix_sysconf_SC_REGEXP (-1L)
#define __z_posix_sysconf_SC_SAVED_IDS (-1L)
Expand Down
2 changes: 1 addition & 1 deletion lib/posix/options/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ zephyr_library_sources_ifdef(CONFIG_PTHREAD_COND cond.c)
zephyr_library_sources_ifdef(CONFIG_PTHREAD_KEY key.c)
zephyr_library_sources_ifdef(CONFIG_PTHREAD_MUTEX mutex.c)
zephyr_library_sources_ifdef(CONFIG_PTHREAD pthread.c)
zephyr_library_sources_ifdef(CONFIG_PTHREAD_RWLOCK rwlock.c)
zephyr_library_sources_ifdef(CONFIG_POSIX_PRIORITY_SCHEDULING sched.c)
zephyr_library_sources_ifdef(CONFIG_POSIX_READER_WRITER_LOCKS rwlock.c)
zephyr_library_sources_ifdef(CONFIG_PTHREAD_IPC semaphore.c)

zephyr_library_include_directories(
Expand Down
9 changes: 9 additions & 0 deletions lib/posix/options/Kconfig.deprecated
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,15 @@ config PTHREAD_BARRIER

Please use CONFIG_POSIX_BARRIERS instead.

config PTHREAD_RWLOCK
bool "pthread_spinlock_t support [DEPRECATED]"
select DEPRECATED
select POSIX_READER_WRITER_LOCKS
help
This option is deprecated.

Please use CONFIG_POSIX_READER_WRITER_LOCKS instead.

config PTHREAD_SPINLOCK
bool "pthread_spinlock_t support [DEPRECATED]"
select DEPRECATED
Expand Down
28 changes: 24 additions & 4 deletions lib/posix/options/Kconfig.rwlock
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,27 @@
#
# SPDX-License-Identifier: Apache-2.0

TYPE = PTHREAD_RWLOCK
type = pthread_rwlock_t
type-function = pthread_rwlock_timedrdlock
rsource "Kconfig.template.pooled_ipc_type"
menuconfig POSIX_READER_WRITER_LOCKS
bool "POSIX reader-writer locks"
default y if POSIX_API
help
Select 'y' here to enable POSIX reader-writer locks.

For more information please see
https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_subprofiles.html

if POSIX_READER_WRITER_LOCKS

config MAX_PTHREAD_RWLOCK_COUNT
int "Maximum number of POSIX reader-writer locks"
default 5
help
Maximum simultaneously active reader-writer locks in a POSIX application.

Note: this is a non-standard option.

module = PTHREAD_RWLOCK
module-str = POSIX Reader-Writer Locks
source "subsys/logging/Kconfig.template.log_config"

endif # POSIX_READER_WRITER_LOCKS
4 changes: 2 additions & 2 deletions lib/posix/options/rwlock.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ struct posix_rwlock *to_posix_rwlock(pthread_rwlock_t *rwlock)
size_t bit;
struct posix_rwlock *rwl;

if (*rwlock != PTHREAD_RWLOCK_INITIALIZER) {
if (*rwlock != POSIX_RWLOCK_INITIALIZER) {
return get_posix_rwlock(*rwlock);
}

Expand Down Expand Up @@ -116,7 +116,7 @@ int pthread_rwlock_init(pthread_rwlock_t *rwlock,
struct posix_rwlock *rwl;

ARG_UNUSED(attr);
*rwlock = PTHREAD_RWLOCK_INITIALIZER;
*rwlock = POSIX_RWLOCK_INITIALIZER;

rwl = to_posix_rwlock(rwlock);
if (rwl == NULL) {
Expand Down
2 changes: 1 addition & 1 deletion tests/posix/headers/src/pthread_h.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ ZTEST(posix_headers, test_pthread_h)

pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
pthread_mutex_t mu = PTHREAD_MUTEX_INITIALIZER;
/* pthread_rwlock_t lock = PTHREAD_RWLOCK_INITIALIZER; */ /* not implemented */
/* pthread_rwlock_t lock = POSIX_READER_WRITER_LOCKS_INITIALIZER; */ /* not implemented */

zassert_not_null(pthread_atfork);
zassert_not_null(pthread_attr_destroy);
Expand Down