diff --git a/doc/services/portability/posix/aep/index.rst b/doc/services/portability/posix/aep/index.rst index b70ec23c92bd54e..3896d052184ffd5 100644 --- a/doc/services/portability/posix/aep/index.rst +++ b/doc/services/portability/posix/aep/index.rst @@ -42,7 +42,7 @@ The *Minimal Realtime System Profile* (PSE51) includes all of the :header: Symbol, Support, Remarks :widths: 50, 10, 50 - _POSIX_AEP_REALTIME_MINIMAL, -1, + _POSIX_AEP_REALTIME_MINIMAL, -1, :kconfig:option:`CONFIG_POSIX_AEP_REALTIME_MINIMAL` .. csv-table:: PSE51 Option Groups :header: Symbol, Support, Remarks @@ -94,7 +94,7 @@ The *Realtime Controller System Profile* (PSE52) includes all features from PSE5 :header: Symbol, Support, Remarks :widths: 50, 10, 50 - _POSIX_AEP_REALTIME_CONTROLLER, -1, + _POSIX_AEP_REALTIME_CONTROLLER, -1, :kconfig:option:`CONFIG_POSIX_AEP_REALTIME_CONTROLLER` .. csv-table:: PSE52 Option Groups :header: Symbol, Support, Remarks @@ -134,7 +134,7 @@ The *Dedicated Realtime System Profile* (PSE53) includes all features from PSE52 :header: Symbol, Support, Remarks :widths: 50, 10, 50 - _POSIX_AEP_REALTIME_DEDICATED, -1, + _POSIX_AEP_REALTIME_DEDICATED, -1, :kconfig:option:`CONFIG_POSIX_AEP_REALTIME_DEDICATED` .. csv-table:: PSE53 Option Groups :header: Symbol, Support, Remarks diff --git a/doc/services/portability/posix/overview/index.rst b/doc/services/portability/posix/overview/index.rst index 2df6d39bbf5bed5..6c352cf245433f1 100644 --- a/doc/services/portability/posix/overview/index.rst +++ b/doc/services/portability/posix/overview/index.rst @@ -122,22 +122,43 @@ Configuration Like most features in Zephyr, POSIX features are :ref:`highly configurable` but disabled by default. Users must -explicitly choose to enable POSIX options via :ref:`Kconfig` selection. Indeed, there are -:ref:`many Kconfig options in Zephyr` for the POSIX API to allow for -feature selection at various levels of granularity. +explicitly choose to enable POSIX options via :ref:`Kconfig` selection. -Alternatively, users may enable one of the Kconfig options below as a shortcut to enable multiple -:ref:`Option Groups`. +Subprofiles ++++++++++++ -* :kconfig:option:`CONFIG_POSIX_API` - Enables all implemented POSIX API Options and Option Groups +Enable one of the Kconfig options below to quickly configure a pre-defined +:ref:`POSIX subprofile `. -.. note:: - Since the POSIX environment in Zephyr is fully configurable via :ref:`Kconfig`, - configurations that require modifying features should not be made if strict compliance is - required (POSIX-1.2017, section 2.1.3.1). +* :kconfig:option:`CONFIG_POSIX_AEP_CHOICE_BASE` (:ref:`Base `) +* :kconfig:option:`CONFIG_POSIX_AEP_CHOICE_PSE51` (:ref:`PSE51 `) +* :kconfig:option:`CONFIG_POSIX_AEP_CHOICE_PSE52` (:ref:`PSE52 `) +* :kconfig:option:`CONFIG_POSIX_AEP_CHOICE_PSE53` (:ref:`PSE53 `) + +Additional POSIX :ref:`Options and Option Groups ` may be enabled as needed +via Kconfig (e.g. ``CONFIG_POSIX_C_LIB_EXT=y``). Further fine-tuning may be accomplished via +:ref:`additional POSIX-related Kconfig options `. + +Subprofiles, Options, and Option Groups should be considered the preferred way to configure POSIX +in Zephyr going forward. + +Legacy +++++++ + +Historically, Zephyr used :kconfig:option:`CONFIG_POSIX_API` to configure a set of POSIX features +that was overloaded and always increasing in size. + +* :kconfig:option:`CONFIG_POSIX_API` + +The option is now frozen, and can be considered equivalent to the following: + +* :kconfig:option:`CONFIG_POSIX_AEP_CHOICE_PSE51` +* :kconfig:option:`CONFIG_POSIX_FD_MGMT` +* :kconfig:option:`CONFIG_POSIX_MESSAGE_PASSING` +* :kconfig:option:`CONFIG_POSIX_NETWORKING` -.. - TODO: create Kconfig shortcuts for PSE51, PSE52, and PSE53 +However, :kconfig:option:`CONFIG_POSIX_API` should be considered legacy and should not be used for +new Zephyr applications. .. _IEEE: https://www.ieee.org/ .. _IEEE Computer Society: https://www.computer.org/ diff --git a/drivers/wifi/simplelink/Kconfig.simplelink b/drivers/wifi/simplelink/Kconfig.simplelink index f2c5ccacbab3106..c325a50f2cd4e2d 100644 --- a/drivers/wifi/simplelink/Kconfig.simplelink +++ b/drivers/wifi/simplelink/Kconfig.simplelink @@ -9,6 +9,7 @@ menuconfig WIFI_SIMPLELINK select WIFI_OFFLOAD select NET_L2_WIFI_MGMT select FDTABLE + select POSIX_SEMAPHORES if WIFI_SIMPLELINK diff --git a/include/zephyr/posix/posix_features.h b/include/zephyr/posix/posix_features.h index c8d29206e1469a6..f582c19c541ea81 100644 --- a/include/zephyr/posix/posix_features.h +++ b/include/zephyr/posix/posix_features.h @@ -11,6 +11,22 @@ #include /* CONFIG_* */ #include /* COND_CODE_1() */ +/* + * POSIX Application Environment Profiles (AEP - IEEE Std 1003.13-2003) + */ + +#ifdef CONFIG_POSIX_AEP_REALTIME_MINIMAL +#define _POSIX_AEP_REALTIME_MINIMAL 200312L +#endif + +#ifdef CONFIG_POSIX_AEP_REALTIME_CONTROLLER +#define _POSIX_AEP_REALTIME_CONTROLLER 200312L +#endif + +#ifdef CONFIG_POSIX_AEP_REALTIME_DEDICATED +#define _POSIX_AEP_REALTIME_DEDICATED 200312L +#endif + /* * POSIX System Interfaces */ diff --git a/lib/posix/options/Kconfig b/lib/posix/options/Kconfig index ee5161da899b785..bdf0ed4901f0519 100644 --- a/lib/posix/options/Kconfig +++ b/lib/posix/options/Kconfig @@ -6,13 +6,7 @@ menu "POSIX Options" -config POSIX_API - depends on !NATIVE_APPLICATION - bool "POSIX APIs" - select NATIVE_LIBC_INCOMPATIBLE - help - Enable mostly-standards-compliant implementations of - various POSIX (IEEE 1003.1) APIs. +rsource "Kconfig.profile" rsource "Kconfig.aio" rsource "Kconfig.barrier" diff --git a/lib/posix/options/Kconfig.aio b/lib/posix/options/Kconfig.aio index cf99ae1d30c520b..43e681f39abc809 100644 --- a/lib/posix/options/Kconfig.aio +++ b/lib/posix/options/Kconfig.aio @@ -4,7 +4,6 @@ config POSIX_ASYNCHRONOUS_IO bool "POSIX asynchronous I/O [EXPERIMENTAL]" - default y if POSIX_API select EXPERIMENTAL help Enable this option for asynchronous I/O. This option is present for conformance purposes diff --git a/lib/posix/options/Kconfig.barrier b/lib/posix/options/Kconfig.barrier index 1a6b2e46410d306..b349d0376551b37 100644 --- a/lib/posix/options/Kconfig.barrier +++ b/lib/posix/options/Kconfig.barrier @@ -6,7 +6,6 @@ menuconfig POSIX_BARRIERS bool "POSIX barriers" - default y if POSIX_API help Select 'y' here to enable POSIX barriers. diff --git a/lib/posix/options/Kconfig.c_lib_ext b/lib/posix/options/Kconfig.c_lib_ext index 8acfead9b342ceb..e8c55d8818b19a4 100644 --- a/lib/posix/options/Kconfig.c_lib_ext +++ b/lib/posix/options/Kconfig.c_lib_ext @@ -4,7 +4,6 @@ menuconfig POSIX_C_LIB_EXT bool "POSIX general C library extension" - default y if POSIX_API help Select 'y' here and Zephyr will provide an implementation of the POSIX_C_LIB_EXT Option Group, consisting of fnmatch(), getopt(), getsubopt(), optarg, opterr, optind, optopt, diff --git a/lib/posix/options/Kconfig.device_io b/lib/posix/options/Kconfig.device_io index 17d16db783613ca..f815ab76b207846 100644 --- a/lib/posix/options/Kconfig.device_io +++ b/lib/posix/options/Kconfig.device_io @@ -4,7 +4,6 @@ menuconfig POSIX_DEVICE_IO bool "POSIX device I/O [EXPERIMENTAL]" - default y if POSIX_API select FDTABLE select EXPERIMENTAL help diff --git a/lib/posix/options/Kconfig.fd_mgmt b/lib/posix/options/Kconfig.fd_mgmt index f1bacac36d69eda..ca165395601482a 100644 --- a/lib/posix/options/Kconfig.fd_mgmt +++ b/lib/posix/options/Kconfig.fd_mgmt @@ -4,7 +4,6 @@ menuconfig POSIX_FD_MGMT bool "POSIX file descriptor management [EXPERIMENTAL]" - default y if POSIX_API select EXPERIMENTAL help Select 'y' here and Zephyr will provide implementations for the POSIX_FD_MGMT Option Group. diff --git a/lib/posix/options/Kconfig.mem b/lib/posix/options/Kconfig.mem index ad3f0a94ec2d4d8..5a5783340919d5e 100644 --- a/lib/posix/options/Kconfig.mem +++ b/lib/posix/options/Kconfig.mem @@ -5,7 +5,7 @@ config POSIX_PAGE_SIZE_BITS int "Number of bits to use for PAGE_SIZE" range 6 16 - default 12 if POSIX_API + default 12 if POSIX_BASE_DEFINITIONS default 6 help Define PAGE_SIZE as BIT(n), where n is the value configured here. diff --git a/lib/posix/options/Kconfig.mqueue b/lib/posix/options/Kconfig.mqueue index 607885b21cf7585..4a1e9925fdaf133 100644 --- a/lib/posix/options/Kconfig.mqueue +++ b/lib/posix/options/Kconfig.mqueue @@ -4,7 +4,6 @@ menuconfig POSIX_MESSAGE_PASSING bool "POSIX message queue support" - default y if POSIX_API help This enabled POSIX message queue related APIs. diff --git a/lib/posix/options/Kconfig.net b/lib/posix/options/Kconfig.net index 9f3181872c044be..b474910d1783fcd 100644 --- a/lib/posix/options/Kconfig.net +++ b/lib/posix/options/Kconfig.net @@ -4,7 +4,6 @@ menuconfig POSIX_NETWORKING bool "POSIX Networking API" - default y if POSIX_API select NETWORKING select NET_HOSTNAME_ENABLE select NET_HOSTNAME_DYNAMIC @@ -36,7 +35,6 @@ config POSIX_IPV6 config POSIX_RAW_SOCKETS bool "POSIX IPv6 support" - default y select NET_SOCKETS_PACKET help Enable this option to support the raw sockets. diff --git a/lib/posix/options/Kconfig.proc1 b/lib/posix/options/Kconfig.proc1 index 90e57a58dfc3d42..654b81acbfaa17e 100644 --- a/lib/posix/options/Kconfig.proc1 +++ b/lib/posix/options/Kconfig.proc1 @@ -6,7 +6,6 @@ menuconfig POSIX_SINGLE_PROCESS bool "POSIX single process support" - default y if POSIX_API imply COMMON_LIBC_MALLOC # for env.c help Select 'y' here to use confstr(), environ, errno, getenv(), setenv(), sysconf(), uname(), diff --git a/lib/posix/options/Kconfig.procN b/lib/posix/options/Kconfig.procN index 7cc248e1abee0eb..b3a467b88b9d3db 100644 --- a/lib/posix/options/Kconfig.procN +++ b/lib/posix/options/Kconfig.procN @@ -4,7 +4,6 @@ menuconfig POSIX_MULTI_PROCESS bool "POSIX multi-process support [EXPERIMENTAL]" - default y if POSIX_API select EXPERIMENTAL help Support for multi-processing. diff --git a/lib/posix/options/Kconfig.profile b/lib/posix/options/Kconfig.profile new file mode 100644 index 000000000000000..a068570f1c37248 --- /dev/null +++ b/lib/posix/options/Kconfig.profile @@ -0,0 +1,168 @@ +# Copyright (c) 2024 Tenstorrent +# +# SPDX-License-Identifier: Apache-2.0 + +config POSIX_API + depends on !NATIVE_APPLICATION + bool "All POSIX APIs" + select NATIVE_LIBC_INCOMPATIBLE + select POSIX_BASE_DEFINITIONS + select POSIX_AEP_REALTIME_MINIMAL + select POSIX_FD_MGMT + select POSIX_MESSAGE_PASSING + select POSIX_NETWORKING + select POSIX_MULTI_PROCESS + help + This option enables the required POSIX System Interfaces (base definitions), as well as + features found in PSE51 and PSE52. + + Note: in the future, this option may be deprecated in favour of subprofiling options. + +choice POSIX_AEP_CHOICE + prompt "POSIX Subprofile" + default POSIX_AEP_CHOICE_NONE + help + This choice is intended to help users select the correct POSIX profile for their + application. Choices are based on IEEE 1003.13-2003 (now inactive / reserved) and + extrapolated to the more recent Subprofiling Option Groups in IEEE 1003.3-2017. + + For more information, please refer to + https://standards.ieee.org/ieee/1003.13/3322/ + +config POSIX_AEP_CHOICE_NONE + bool "No pre-defined POSIX subprofile" + help + No pre-defined POSIX profile is selected. + +config POSIX_AEP_CHOICE_BASE + bool "Base definitions (system interfaces)" + depends on !NATIVE_APPLICATION + select NATIVE_LIBC_INCOMPATIBLE + select POSIX_BASE_DEFINITIONS + help + Only enable the base definitions required for all POSIX systems. + +config POSIX_AEP_CHOICE_PSE51 + bool "Minimal Realtime System Profile (PSE51)" + depends on !NATIVE_APPLICATION + select NATIVE_LIBC_INCOMPATIBLE + select POSIX_BASE_DEFINITIONS + select POSIX_AEP_REALTIME_MINIMAL + help + PSE51 includes the POSIX Base Definitions (System Interfaces) as well as several Options and + Option Groups to facilitate device I/O, signals, mandatory configuration utilities, and + threading. + + For more information, please see + https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_subprofiles.html + https://docs.zephyrproject.org/latest/services/portability/posix/aep/index.html + +config POSIX_AEP_CHOICE_PSE52 + bool "Realtime Controller System Profile (PSE52)" + depends on !NATIVE_APPLICATION + select NATIVE_LIBC_INCOMPATIBLE + select POSIX_BASE_DEFINITIONS + select POSIX_AEP_REALTIME_MINIMAL + select POSIX_AEP_REALTIME_CONTROLLER + help + PSE52 includes the POSIX Base Definitions (System Interfaces) as well as all features of + PSE51. Additionally, it includes interfaces for file descriptor management, filesystem + support, support for message queues, and tracing. + + For more information, please see + https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_subprofiles.html + https://docs.zephyrproject.org/latest/services/portability/posix/aep/index.html + +config POSIX_AEP_CHOICE_PSE53 + bool "Dedicated Realtime System Profile (PSE53)" + depends on !NATIVE_APPLICATION + select NATIVE_LIBC_INCOMPATIBLE + select POSIX_BASE_DEFINITIONS + select POSIX_AEP_REALTIME_MINIMAL + select POSIX_AEP_REALTIME_CONTROLLER + select POSIX_AEP_REALTIME_DEDICATED + help + PSE53 includes the POSIX Base Definitions (System Interfaces) as well as all features of + PSE52. Additionally, it includes interfaces for POSIX multi-processing, networking, pipes, + and prioritized I/O. + + For more information, please see + https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_subprofiles.html + https://docs.zephyrproject.org/latest/services/portability/posix/aep/index.html + +# TODO: PSE54: Multi-purpose Realtime System Profile + +endchoice # POSIX_AEP_CHOICE + +# Base Definitions (System Interfaces) +config POSIX_BASE_DEFINITIONS + bool + select POSIX_ASYNCHRONOUS_IO + select POSIX_BARRIERS + select POSIX_CLOCK_SELECTION + # select POSIX_MAPPED_FILES + # select POSIX_MEMORY_PROTECTION + select POSIX_READER_WRITER_LOCKS + select POSIX_REALTIME_SIGNALS + select POSIX_SEMAPHORES + select POSIX_SPIN_LOCKS + select POSIX_THREAD_SAFE_FUNCTIONS + select POSIX_THREADS + select POSIX_TIMEOUTS + select POSIX_TIMERS + help + This option is not user configurable. + +config POSIX_AEP_REALTIME_MINIMAL + bool + # Option Groups + select POSIX_DEVICE_IO + select POSIX_SIGNALS + select POSIX_SINGLE_PROCESS + select XSI_THREADS_EXT + # Options + select POSIX_FSYNC + # select POSIX_MEMLOCK + # select POSIX_MEMLOCK_RANGE + select POSIX_MONOTONIC_CLOCK + # select POSIX_SHARED_MEMORY_OBJECTS + select POSIX_SYNCHRONIZED_IO + select POSIX_THREAD_ATTR_STACKADDR + select POSIX_THREAD_ATTR_STACKSIZE + select POSIX_THREAD_CPUTIME + select POSIX_THREAD_PRIO_INHERIT + select POSIX_THREAD_PRIO_PROTECT + select POSIX_THREAD_PRIORITY_SCHEDULING + # select POSIX_THREAD_SPORADIC_SERVER + help + This option is not user configurable. + +config POSIX_AEP_REALTIME_CONTROLLER + bool + # Option Groups + select POSIX_FD_MGMT + select POSIX_FILE_SYSTEM + # Options + select POSIX_MESSAGE_PASSING + # select POSIX_TRACE + # select POSIX_TRACE_EVENT_FILTER + # select POSIX_TRACE_LOG + help + This option is not user configurable. + +config POSIX_AEP_REALTIME_DEDICATED + bool + # Option Groups + select POSIX_MULTI_PROCESS + select POSIX_NETWORKING + # select POSIX_PIPE + # select POSIX_SIGNAL_JUMP + # Options + select POSIX_CPUTIME + # select POSIX_PRIORITIZED_IO + select POSIX_PRIORITY_SCHEDULING + select POSIX_RAW_SOCKETS + # select POSIX_SPAWN + # select POSIX_SPORADIC_SERVER + help + This option is not user configurable. diff --git a/lib/posix/options/Kconfig.pthread b/lib/posix/options/Kconfig.pthread index 8c1b813c872e314..ec38286ff49a3e2 100644 --- a/lib/posix/options/Kconfig.pthread +++ b/lib/posix/options/Kconfig.pthread @@ -6,7 +6,6 @@ menuconfig POSIX_THREADS bool "POSIX thread support" - default y if POSIX_API help Select 'y' here to enable POSIX threads, mutexes, condition variables, and thread-specific storage. @@ -65,7 +64,6 @@ config PTHREAD_RECYCLER_DELAY_MS config POSIX_THREAD_ATTR_STACKADDR bool "Support getting and setting POSIX thread stack addresses" - default y help Enable this option to use pthread_attr_getstackaddr() and pthread_attr_setstackaddr(). @@ -80,7 +78,6 @@ config POSIX_THREAD_ATTR_STACKADDR config POSIX_THREAD_ATTR_STACKSIZE bool "Support getting and setting POSIX thread stack sizes" - default y help Enable this option to use pthread_attr_getstacksize() or pthread_attr_setstacksize(). @@ -90,7 +87,6 @@ config POSIX_THREAD_ATTR_STACKSIZE config POSIX_THREADS_EXT bool "Extended POSIX thread support" - default y help Enable this option to use pthread_attr_getguardsize(), pthread_attr_setguardsize(), pthread_mutexattr_gettype(), or pthread_mutexattr_settype(). @@ -100,7 +96,6 @@ config POSIX_THREADS_EXT config POSIX_THREAD_PRIORITY_SCHEDULING bool "Run POSIX threads with different priorities and schedulers" - default y help Enabling this option allows the application to configure different priorities and scheduling algorithms for different threads via functions such as pthread_setschedparam() @@ -145,7 +140,6 @@ config POSIX_PTHREAD_ATTR_GUARDSIZE_DEFAULT config POSIX_THREAD_PRIO_INHERIT bool "POSIX mutex priority inheritance" - default y help Select 'y' here to enable POSIX mutex priority inheritance. @@ -154,7 +148,6 @@ config POSIX_THREAD_PRIO_INHERIT config POSIX_THREAD_PRIO_PROTECT bool "POSIX mutex priority protection" - default y help Select 'y' here to enable POSIX mutex priority protection. @@ -163,7 +156,6 @@ config POSIX_THREAD_PRIO_PROTECT config POSIX_THREAD_SAFE_FUNCTIONS bool "POSIX thread-safe functions" - default y help Select 'y' here to enable POSIX thread-safe functions including asctime_r(), ctime_r(), flockfile(), ftrylockfile(), funlockfile(), getc_unlocked(), getchar_unlocked(), diff --git a/lib/posix/options/Kconfig.rwlock b/lib/posix/options/Kconfig.rwlock index 5195c6b434f2874..bcfd7f4a1e3c6af 100644 --- a/lib/posix/options/Kconfig.rwlock +++ b/lib/posix/options/Kconfig.rwlock @@ -4,7 +4,6 @@ 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. diff --git a/lib/posix/options/Kconfig.sched b/lib/posix/options/Kconfig.sched index f8dbbf6931b2e14..7e0dc70fca119e7 100644 --- a/lib/posix/options/Kconfig.sched +++ b/lib/posix/options/Kconfig.sched @@ -6,7 +6,6 @@ menu "POSIX scheduler options" config POSIX_PRIORITY_SCHEDULING bool "POSIX priority-based process scheduling [EXPERIMENTAL]" - default y if POSIX_API select EXPERIMENTAL help This enables POSIX scheduling APIs (_POSIX_PRIORITY_SCHEDULING). diff --git a/lib/posix/options/Kconfig.semaphore b/lib/posix/options/Kconfig.semaphore index 231565f3258a23e..65bc2a686930b83 100644 --- a/lib/posix/options/Kconfig.semaphore +++ b/lib/posix/options/Kconfig.semaphore @@ -4,7 +4,6 @@ menuconfig POSIX_SEMAPHORES bool "POSIX semaphore support" - default y if POSIX_API help Enable this option for POSIX semaphore support. diff --git a/lib/posix/options/Kconfig.signal b/lib/posix/options/Kconfig.signal index 81fcd6a696ce9ca..4507302e3f32d0d 100644 --- a/lib/posix/options/Kconfig.signal +++ b/lib/posix/options/Kconfig.signal @@ -6,7 +6,6 @@ menu "POSIX signals" config POSIX_REALTIME_SIGNALS bool "POSIX realtime signals [EXPERIMENTAL]" - default y if POSIX_API select EXPERIMENTAL help Enable support for POSIX realtime signals. @@ -24,7 +23,6 @@ endif # POSIX_REALTIME_SIGNALS config POSIX_SIGNALS bool "POSIX signals [EXPERIMENTAL]" - default y if POSIX_API select EXPERIMENTAL help Enable support for POSIX signals. diff --git a/lib/posix/options/Kconfig.spinlock b/lib/posix/options/Kconfig.spinlock index d5eb4a7028ae814..312a432ce38e90d 100644 --- a/lib/posix/options/Kconfig.spinlock +++ b/lib/posix/options/Kconfig.spinlock @@ -4,7 +4,6 @@ menuconfig POSIX_SPIN_LOCKS bool "POSIX spin locks" - default y if POSIX_API help Select 'y' here to enable POSIX spin locks. diff --git a/lib/posix/options/Kconfig.timer b/lib/posix/options/Kconfig.timer index cd53379716a53df..42eed40bce68dc6 100644 --- a/lib/posix/options/Kconfig.timer +++ b/lib/posix/options/Kconfig.timer @@ -5,7 +5,6 @@ menuconfig POSIX_TIMERS bool "POSIX timers, clocks, and sleep functions" - default y if POSIX_API help Select 'y' here and Zephyr will provide implementations of clock_getres(), clock_gettime(), clock_settime(), nanosleep(), timer_create(), timer_delete(), timer_getoverrun(), @@ -18,7 +17,6 @@ if POSIX_TIMERS config POSIX_THREAD_CPUTIME bool "POSIX per-thread CPU-time clocks" - default y help This enables CLOCK_THREAD_CPUTIME_ID. @@ -29,7 +27,6 @@ config POSIX_THREAD_CPUTIME config POSIX_MONOTONIC_CLOCK bool "POSIX Monotonic clock support" - default y help This enables CLOCK_MONOTONIC. @@ -39,7 +36,6 @@ config POSIX_MONOTONIC_CLOCK config POSIX_CPUTIME bool "POSIX per-process CPU-time clocks" - default y help This enables CLOCK_PROCESS_CPUTIME_ID. @@ -50,7 +46,6 @@ config POSIX_CPUTIME config POSIX_CLOCK_SELECTION bool "POSIX Clock selection" - default y help This enables POSIX clock selection. @@ -79,7 +74,6 @@ config POSIX_TIMER_MAX config POSIX_TIMEOUTS bool "Support timeouts for some blocking POSIX services" - default y help Enable mandatory timeouts for some blocking operations. diff --git a/lib/posix/options/Kconfig.xsi b/lib/posix/options/Kconfig.xsi index ac66838b8921765..f8be61e245d5d27 100644 --- a/lib/posix/options/Kconfig.xsi +++ b/lib/posix/options/Kconfig.xsi @@ -6,7 +6,6 @@ menu "X/Open system interfaces" config XSI_SINGLE_PROCESS bool "X/Open single process" - default y if POSIX_API depends on POSIX_SINGLE_PROCESS depends on POSIX_TIMERS help @@ -18,7 +17,6 @@ config XSI_SINGLE_PROCESS config XOPEN_STREAMS bool "X/Open streams" - default y if POSIX_API help This option provides support for the X/Open Streams interface, including functions such as fattach(), fdetach(), getmsg(), getpmsg(), putmsg(), and putpmsg(). @@ -28,7 +26,6 @@ config XOPEN_STREAMS config XSI_SYSTEM_LOGGING bool "X/Open system logging" - default y if POSIX_API help This option provides support for closelog(), openlog(), syslog(), setlogmask(), and vsyslog(). @@ -38,7 +35,6 @@ config XSI_SYSTEM_LOGGING config XSI_THREADS_EXT bool "X/Open threads extensions" - default y if POSIX_API help This option provides support for pthread_attr_getstack(), pthread_attr_setstack(), pthread_getconcurrency(), and pthread_setconcurrency(). diff --git a/tests/posix/common/prj.conf b/tests/posix/common/prj.conf index 51c709dee7bc601..130e950f754c68e 100644 --- a/tests/posix/common/prj.conf +++ b/tests/posix/common/prj.conf @@ -1,7 +1,6 @@ CONFIG_POSIX_API=y CONFIG_POSIX_THREAD_THREADS_MAX=6 CONFIG_ZTEST=y -CONFIG_POSIX_NETWORKING=n CONFIG_POSIX_SEM_VALUE_MAX=32767 CONFIG_POSIX_MESSAGE_PASSING=y CONFIG_POSIX_PRIORITY_SCHEDULING=y @@ -10,3 +9,18 @@ CONFIG_THREAD_NAME=y CONFIG_DYNAMIC_THREAD=y CONFIG_THREAD_STACK_INFO=y CONFIG_DYNAMIC_THREAD_POOL_SIZE=6 + +# for fnmatch() +CONFIG_POSIX_C_LIB_EXT=y + +# for putmsg() +CONFIG_XOPEN_STREAMS=y + +# for sleep(), getpid() +CONFIG_POSIX_MULTI_PROCESS=y + +# for syslog() +CONFIG_XSI_SYSTEM_LOGGING=y + +# for sched_get_priority_min(), sched_get_priority_max() +CONFIG_POSIX_PRIORITY_SCHEDULING=y diff --git a/tests/posix/headers/src/arpa_inet_h.c b/tests/posix/headers/src/arpa_inet_h.c index 06541e1cd7b6090..1b3b90dc0de1b35 100644 --- a/tests/posix/headers/src/arpa_inet_h.c +++ b/tests/posix/headers/src/arpa_inet_h.c @@ -24,7 +24,7 @@ ZTEST(posix_headers, test_arpa_inet_h) zassert_not_equal(-1, ntohl(0)); zassert_not_equal(-1, ntohs(0)); - if (IS_ENABLED(CONFIG_POSIX_API)) { + if (IS_ENABLED(CONFIG_POSIX_NETWORKING)) { /* zassert_not_null(inet_addr); */ /* not implemented */ /* zassert_not_null(inet_ntoa); */ /* not implemented */ zassert_not_null(inet_ntop); diff --git a/tests/posix/headers/src/net_if_h.c b/tests/posix/headers/src/net_if_h.c index bc88e992f68e02b..3843d2b83d62068 100644 --- a/tests/posix/headers/src/net_if_h.c +++ b/tests/posix/headers/src/net_if_h.c @@ -24,7 +24,7 @@ ZTEST(posix_headers, test_net_if_h) zassert_not_equal(-1, IF_NAMESIZE); - if (IS_ENABLED(CONFIG_POSIX_API)) { + if (IS_ENABLED(CONFIG_POSIX_NETWORKING)) { zassert_not_null(if_freenameindex); zassert_not_null(if_indextoname); zassert_not_null(if_nameindex); diff --git a/tests/posix/headers/src/netdb_h.c b/tests/posix/headers/src/netdb_h.c index 85e69fb7c55c9e8..9426c56b5a389c0 100644 --- a/tests/posix/headers/src/netdb_h.c +++ b/tests/posix/headers/src/netdb_h.c @@ -76,7 +76,7 @@ ZTEST(posix_headers, test_netdb_h) zassert_not_equal(-1, EAI_SYSTEM); zassert_not_equal(-1, EAI_OVERFLOW); - if (IS_ENABLED(CONFIG_POSIX_API)) { + if (IS_ENABLED(CONFIG_POSIX_NETWORKING)) { zassert_not_null(endhostent); zassert_not_null(endnetent); zassert_not_null(endprotoent); diff --git a/tests/posix/headers/src/poll_h.c b/tests/posix/headers/src/poll_h.c index ff4257939ddfe0c..f858ed070ca95e9 100644 --- a/tests/posix/headers/src/poll_h.c +++ b/tests/posix/headers/src/poll_h.c @@ -36,7 +36,7 @@ ZTEST(posix_headers, test_poll_h) zassert_not_equal(-1, POLLHUP); zassert_not_equal(-1, POLLNVAL); - if (IS_ENABLED(CONFIG_POSIX_API)) { + if (IS_ENABLED(CONFIG_POSIX_DEVICE_IO)) { zassert_not_null(poll); } } diff --git a/tests/posix/headers/src/sys_select_h.c b/tests/posix/headers/src/sys_select_h.c index 6ea986cbae268ff..5cca45419712dde 100644 --- a/tests/posix/headers/src/sys_select_h.c +++ b/tests/posix/headers/src/sys_select_h.c @@ -27,7 +27,7 @@ ZTEST(posix_headers, test_sys_select_h) FD_SET(0, &fds); FD_ZERO(&fds); - if (IS_ENABLED(CONFIG_POSIX_API)) { + if (IS_ENABLED(CONFIG_POSIX_DEVICE_IO)) { /* zassert_not_null(pselect); */ /* not implemented */ zassert_not_null(select); } diff --git a/tests/posix/headers/src/sys_socket_h.c b/tests/posix/headers/src/sys_socket_h.c index 52ec01a21312d4e..843e6c16d76788d 100644 --- a/tests/posix/headers/src/sys_socket_h.c +++ b/tests/posix/headers/src/sys_socket_h.c @@ -100,7 +100,7 @@ ZTEST(posix_headers, test_sys_socket_h) zassert_not_equal(-1, SHUT_RDWR); zassert_not_equal(-1, SHUT_WR); - if (IS_ENABLED(CONFIG_POSIX_API)) { + if (IS_ENABLED(CONFIG_POSIX_NETWORKING)) { zassert_not_null(accept); zassert_not_null(bind); zassert_not_null(connect); diff --git a/tests/posix/pthread_pressure/prj.conf b/tests/posix/pthread_pressure/prj.conf index e2b190b19feeaa2..4af4ae83e921e2e 100644 --- a/tests/posix/pthread_pressure/prj.conf +++ b/tests/posix/pthread_pressure/prj.conf @@ -1,6 +1,6 @@ CONFIG_ZTEST=y CONFIG_POSIX_API=y -CONFIG_POSIX_NETWORKING=n +CONFIG_POSIX_PRIORITY_SCHEDULING=y ## Note: for benchmarking purposes, uncomment the Kconfig below # CONFIG_TEST_DURATION_S=60