posix: timers: deprecate CONFIG_POSIX_CLOCK and TIMER
The POSIX_CLOCK option does not correspond to any standard option. It was used to active features of several distinct POSIX Options and Option Groups, which complicated API and application configuration as a result. POSIX_CLOCK is being deprecated in order to ensure that Zephyr's POSIX Kconfig variables correspond to those defined in the specification, as of IEEE 1003.1-2017. Additionally, CONFIG_TIMER is being deprecated because it does not match the corresponding POSIX Option (_POSIX_TIMERS). With this deprecation, we introduce the following Kconfig options that map directly to standard POSIX Option Groups by simply removing "CONFIG_": * CONFIG_POSIX_TIMERS Similarly, we introduce the following Kconfig options that map directly to standard POSIX Options by simply removing "CONFIG": * CONFIG_POSIX_CLOCK_SELECTION * CONFIG_POSIX_CPUTIME * CONFIG_POSIX_DELAYTIMER_MAX * CONFIG_POSIX_MONOTONIC_CLOCK * CONFIG_POSIX_TIMEOUTS * CONFIG_POSIX_TIMER_MAX In order to maintain parity with the current feature set, we introduce the following Kconfig options that map directly to standard POSIX Option Groups by simply removing "CONFIG_": * CONFIG_POSIX_MULTI_PROCESS - sleep() Similarly, in order to maintain parity with the current feature set, we introduce the following additional Kconfig options that map directly to standard POSIX Options by simply removing "CONFIG": * CONFIG_XSI_SINGLE_PROCESS - gettimeofday() Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
This commit is contained in:
parent
e2fc78af23
commit
4a5c4e5f73
36 changed files with 343 additions and 178 deletions
|
@ -16,7 +16,7 @@ choice LIBC_IMPLEMENTATION
|
|||
config ARMCLANG_STD_LIBC
|
||||
bool "ARM Compiler C library"
|
||||
select COMMON_LIBC_STRNLEN
|
||||
select COMMON_LIBC_TIME if POSIX_CLOCK
|
||||
select COMMON_LIBC_TIME if POSIX_TIMERS
|
||||
help
|
||||
Use the full Arm Compiler runtime libraries.
|
||||
A reduced Zephyr minimal libc will be used for library functionality
|
||||
|
|
|
@ -521,7 +521,7 @@ engine.
|
|||
|
||||
Data caches depends on one of the SenML data formats
|
||||
:kconfig:option:`CONFIG_LWM2M_RW_SENML_CBOR_SUPPORT` or
|
||||
:kconfig:option:`CONFIG_LWM2M_RW_SENML_JSON_SUPPORT` and needs :kconfig:option:`CONFIG_POSIX_CLOCK`
|
||||
:kconfig:option:`CONFIG_LWM2M_RW_SENML_JSON_SUPPORT` and needs :kconfig:option:`CONFIG_POSIX_TIMERS`
|
||||
so it can request a timestamp from the system and :kconfig:option:`CONFIG_RING_BUFFER` for ring
|
||||
buffer.
|
||||
|
||||
|
|
|
@ -63,12 +63,12 @@ The *Minimal Realtime System Profile* (PSE51) includes all of the
|
|||
:ref:`_POSIX_FSYNC <posix_option_fsync>`, 200809L, :kconfig:option:`CONFIG_POSIX_FSYNC`
|
||||
:ref:`_POSIX_MEMLOCK <posix_option_memlock>`, -1,
|
||||
:ref:`_POSIX_MEMLOCK_RANGE <posix_option_memlock_range>`, -1,
|
||||
:ref:`_POSIX_MONOTONIC_CLOCK <posix_option_monotonic_clock>`, 200809L, :kconfig:option:`CONFIG_POSIX_CLOCK`
|
||||
:ref:`_POSIX_MONOTONIC_CLOCK <posix_option_monotonic_clock>`, 200809L, :kconfig:option:`CONFIG_POSIX_MONOTONIC_CLOCK`
|
||||
:ref:`_POSIX_SHARED_MEMORY_OBJECTS <posix_shared_memory_objects>`, -1,
|
||||
:ref:`_POSIX_SYNCHRONIZED_IO <posix_option_synchronized_io>`, -1,
|
||||
:ref:`_POSIX_THREAD_ATTR_STACKADDR<posix_option_thread_attr_stackaddr>`, 200809L, :kconfig:option:`CONFIG_PTHREAD`
|
||||
:ref:`_POSIX_THREAD_ATTR_STACKSIZE<posix_option_thread_attr_stacksize>`, 200809L, :kconfig:option:`CONFIG_PTHREAD`
|
||||
:ref:`_POSIX_THREAD_CPUTIME <posix_option_thread_cputime>`, -1,
|
||||
:ref:`_POSIX_THREAD_CPUTIME <posix_option_thread_cputime>`, 200809L, :kconfig:option:`CONFIG_POSIX_CPUTIME`
|
||||
_POSIX_THREAD_PRIO_INHERIT, 200809L, :kconfig:option:`CONFIG_PTHREAD_MUTEX`
|
||||
_POSIX_THREAD_PRIO_PROTECT, -1,
|
||||
:ref:`_POSIX_THREAD_PRIORITY_SCHEDULING<posix_option_thread_priority_scheduling>`, 200809L, :kconfig:option:`CONFIG_POSIX_PRIORITY_SCHEDULING`
|
||||
|
@ -150,7 +150,7 @@ The *Dedicated Realtime System Profile* (PSE53) includes all features from PSE52
|
|||
:header: Symbol, Support, Remarks
|
||||
:widths: 50, 10, 50
|
||||
|
||||
_POSIX_CPUTIME, -1,
|
||||
:ref:`_POSIX_CPUTIME <posix_option_cputime>`, 200809L, :kconfig:option:`CONFIG_POSIX_CPUTIME`
|
||||
_POSIX_PRIORITIZED_IO, -1,
|
||||
:ref:`_POSIX_PRIORITY_SCHEDULING <posix_option_priority_scheduling>`, -1,
|
||||
_POSIX_RAW_SOCKETS, 200809L, :kconfig:option:`CONFIG_NET_SOCKETS_PACKET`
|
||||
|
|
|
@ -63,7 +63,7 @@ POSIX System Interfaces
|
|||
_POSIX_VERSION, 200809L,
|
||||
:ref:`_POSIX_ASYNCHRONOUS_IO<posix_option_asynchronous_io>`, 200809L, :ref:`†<posix_undefined_behaviour>`
|
||||
:ref:`_POSIX_BARRIERS<posix_option_group_barriers>`, 200809L, :kconfig:option:`CONFIG_PTHREAD_BARRIER`
|
||||
:ref:`_POSIX_CLOCK_SELECTION<posix_option_group_clock_selection>`, 200809L, :kconfig:option:`CONFIG_POSIX_CLOCK`
|
||||
: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`
|
||||
|
@ -72,8 +72,8 @@ POSIX System Interfaces
|
|||
:ref:`_POSIX_SPIN_LOCKS<posix_option_group_spin_locks>`, 200809L, :kconfig:option:`CONFIG_PTHREAD_SPINLOCK`
|
||||
:ref:`_POSIX_THREAD_SAFE_FUNCTIONS<posix_thread_safe_functions>`, -1,
|
||||
:ref:`_POSIX_THREADS<posix_option_group_threads_base>`, -1, :kconfig:option:`CONFIG_PTHREAD_IPC`
|
||||
:ref:`_POSIX_TIMEOUTS<posix_option_timeouts>`, 200809L, :kconfig:option:`CONFIG_PTHREAD_IPC`
|
||||
:ref:`_POSIX_TIMERS<posix_option_group_timers>`, 200809L, :kconfig:option:`CONFIG_POSIX_CLOCK`
|
||||
:ref:`_POSIX_TIMEOUTS<posix_option_timeouts>`, 200809L, :kconfig:option:`CONFIG_POSIX_TIMEOUTS`
|
||||
:ref:`_POSIX_TIMERS<posix_option_group_timers>`, 200809L, :kconfig:option:`CONFIG_POSIX_TIMERS`
|
||||
_POSIX2_C_BIND, 200809L,
|
||||
|
||||
.. csv-table:: POSIX System Interfaces (Optional)
|
||||
|
@ -81,13 +81,13 @@ POSIX System Interfaces
|
|||
:widths: 50, 10, 50
|
||||
|
||||
_POSIX_ADVISORY_INFO, -1,
|
||||
_POSIX_CPUTIME, 200809L, :kconfig:option:`CONFIG_POSIX_CLOCK`
|
||||
:ref:`_POSIX_CPUTIME<posix_option_cputime>`, 200809L, :kconfig:option:`CONFIG_POSIX_CPUTIME`
|
||||
:ref:`_POSIX_FSYNC<posix_option_fsync>`, 200809L, :kconfig:option:`CONFIG_POSIX_FSYNC`
|
||||
_POSIX_IPV6, 200809L, :kconfig:option:`CONFIG_NET_IPV6`
|
||||
_POSIX_MEMLOCK, -1,
|
||||
_POSIX_MEMLOCK_RANGE, -1,
|
||||
:ref:`_POSIX_MESSAGE_PASSING<posix_option_message_passing>`, 200809L, :kconfig:option:`CONFIG_POSIX_MQUEUE`
|
||||
:ref:`_POSIX_MONOTONIC_CLOCK<posix_option_monotonic_clock>`, 200809L, :kconfig:option:`CONFIG_POSIX_CLOCK`
|
||||
:ref:`_POSIX_MONOTONIC_CLOCK<posix_option_monotonic_clock>`, 200809L, :kconfig:option:`CONFIG_POSIX_MONOTONIC_CLOCK`
|
||||
_POSIX_PRIORITIZED_IO, -1,
|
||||
:ref:`_POSIX_PRIORITY_SCHEDULING<posix_option_priority_scheduling>`, 200809L, :kconfig:option:`CONFIG_POSIX_PRIORITY_SCHEDULING`
|
||||
_POSIX_RAW_SOCKETS, 200809L, :kconfig:option:`CONFIG_NET_SOCKETS_PACKET`
|
||||
|
@ -97,7 +97,7 @@ POSIX System Interfaces
|
|||
_POSIX_SYNCHRONIZED_IO, -1,
|
||||
:ref:`_POSIX_THREAD_ATTR_STACKADDR<posix_option_thread_attr_stackaddr>`, 200809L, :kconfig:option:`CONFIG_PTHREAD`
|
||||
:ref:`_POSIX_THREAD_ATTR_STACKSIZE<posix_option_thread_attr_stacksize>`, 200809L, :kconfig:option:`CONFIG_PTHREAD`
|
||||
_POSIX_THREAD_CPUTIME, -1,
|
||||
:ref:`_POSIX_THREAD_CPUTIME <posix_option_thread_cputime>`, 200809L, :kconfig:option:`CONFIG_POSIX_CPUTIME`
|
||||
_POSIX_THREAD_PRIO_INHERIT, 200809L, :kconfig:option:`CONFIG_PTHREAD_MUTEX`
|
||||
_POSIX_THREAD_PRIO_PROTECT, -1,
|
||||
:ref:`_POSIX_THREAD_PRIORITY_SCHEDULING<posix_option_thread_priority_scheduling>`, 200809L, :kconfig:option:`CONFIG_PTHREAD`
|
||||
|
|
|
@ -17,7 +17,6 @@ implementation of the POSIX API.
|
|||
* :kconfig:option:`CONFIG_MAX_PTHREAD_KEY_COUNT`
|
||||
* :kconfig:option:`CONFIG_MAX_PTHREAD_MUTEX_COUNT`
|
||||
* :kconfig:option:`CONFIG_MAX_PTHREAD_SPINLOCK_COUNT`
|
||||
* :kconfig:option:`CONFIG_MAX_TIMER_COUNT`
|
||||
* :kconfig:option:`CONFIG_MQUEUE_NAMELEN_MAX`
|
||||
* :kconfig:option:`CONFIG_MSG_COUNT_MAX`
|
||||
* :kconfig:option:`CONFIG_MSG_SIZE_MAX`
|
||||
|
@ -25,7 +24,6 @@ implementation of the POSIX API.
|
|||
* :kconfig:option:`CONFIG_NET_SOCKETS`
|
||||
* :kconfig:option:`CONFIG_NET_SOCKETS_POLL_MAX`
|
||||
* :kconfig:option:`CONFIG_POSIX_API`
|
||||
* :kconfig:option:`CONFIG_POSIX_CLOCK`
|
||||
* :kconfig:option:`CONFIG_POSIX_FS`
|
||||
* :kconfig:option:`CONFIG_POSIX_MAX_FDS`
|
||||
* :kconfig:option:`CONFIG_POSIX_MAX_OPEN_FILES`
|
||||
|
@ -46,4 +44,4 @@ implementation of the POSIX API.
|
|||
* :kconfig:option:`CONFIG_PTHREAD_RECYCLER_DELAY_MS`
|
||||
* :kconfig:option:`CONFIG_PTHREAD_SPINLOCK`
|
||||
* :kconfig:option:`CONFIG_SEM_VALUE_MAX`
|
||||
* :kconfig:option:`CONFIG_TIMER`
|
||||
* :kconfig:option:`CONFIG_TIMER_CREATE_WAIT`
|
||||
|
|
|
@ -543,6 +543,17 @@ _POSIX_ASYNCHRONOUS_IO
|
|||
aio_write(),yes (will fail with ``ENOSYS``:ref:`†<posix_undefined_behaviour>`)
|
||||
lio_listio(),yes (will fail with ``ENOSYS``:ref:`†<posix_undefined_behaviour>`)
|
||||
|
||||
.. _posix_option_cputime:
|
||||
|
||||
_POSIX_CPUTIME
|
||||
++++++++++++++
|
||||
|
||||
.. csv-table:: _POSIX_CPUTIME
|
||||
:header: API, Supported
|
||||
:widths: 50,10
|
||||
|
||||
CLOCK_PROCESS_CPUTIME_ID,yes
|
||||
|
||||
.. _posix_option_fsync:
|
||||
|
||||
_POSIX_FSYNC
|
||||
|
|
|
@ -31,11 +31,13 @@
|
|||
#define _POSIX_BARRIERS _POSIX_VERSION
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_POSIX_CLOCK
|
||||
#ifdef CONFIG_POSIX_CLOCK_SELECTION
|
||||
#define _POSIX_CLOCK_SELECTION _POSIX_VERSION
|
||||
#endif
|
||||
|
||||
/* #define _POSIX_CPUTIME (-1L) */
|
||||
#ifdef CONFIG_POSIX_CPUTIME
|
||||
#define _POSIX_CPUTIME _POSIX_VERSION
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_POSIX_FSYNC
|
||||
#define _POSIX_FSYNC _POSIX_VERSION
|
||||
|
@ -55,7 +57,7 @@
|
|||
#define _POSIX_MESSAGE_PASSING _POSIX_VERSION
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_POSIX_CLOCK
|
||||
#ifdef CONFIG_POSIX_MONOTONIC_CLOCK
|
||||
#define _POSIX_MONOTONIC_CLOCK _POSIX_VERSION
|
||||
#endif
|
||||
|
||||
|
@ -100,7 +102,9 @@
|
|||
#define _POSIX_THREAD_ATTR_STACKSIZE _POSIX_VERSION
|
||||
#endif
|
||||
|
||||
/* #define _POSIX_THREAD_CPUTIME (-1L) */
|
||||
#ifdef CONFIG_POSIX_THREAD_CPUTIME
|
||||
#define _POSIX_THREAD_CPUTIME _POSIX_VERSION
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PTHREAD_IPC
|
||||
#define _POSIX_THREAD_PRIO_INHERIT _POSIX_VERSION
|
||||
|
@ -124,11 +128,11 @@
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_POSIX_CLOCK
|
||||
#ifdef CONFIG_POSIX_TIMEOUTS
|
||||
#define _POSIX_TIMEOUTS _POSIX_VERSION
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_POSIX_CLOCK
|
||||
#ifdef CONFIG_POSIX_TIMERS
|
||||
#define _POSIX_TIMERS _POSIX_VERSION
|
||||
#endif
|
||||
|
||||
|
@ -161,7 +165,6 @@
|
|||
#define _POSIX2_C_BIND _POSIX2_VERSION
|
||||
#define _POSIX2_C_DEV _POSIX2_VERSION
|
||||
/* #define _POSIX2_CHAR_TERM (-1L) */
|
||||
/* #define _POSIX2_DELAYTIMER_MAX (-1L) */
|
||||
/* #define _POSIX2_FORT_DEV (-1L) */
|
||||
/* #define _POSIX2_FORT_RUN (-1L) */
|
||||
/* #define _POSIX2_LOCALEDEF (-1L) */
|
||||
|
|
|
@ -141,55 +141,73 @@ enum {
|
|||
_SC_TZNAME_MAX,
|
||||
};
|
||||
|
||||
#define __z_posix_sysconf_SC_ADVISORY_INFO _POSIX_ADVISORY_INFO
|
||||
#define __z_posix_sysconf_SC_ASYNCHRONOUS_IO _POSIX_ASYNCHRONOUS_IO
|
||||
#define __z_posix_sysconf_SC_BARRIERS _POSIX_BARRIERS
|
||||
#define __z_posix_sysconf_SC_CLOCK_SELECTION _POSIX_CLOCK_SELECTION
|
||||
#define __z_posix_sysconf_SC_CPUTIME _POSIX_CPUTIME
|
||||
#define __z_posix_sysconf_SC_FSYNC _POSIX_FSYNC
|
||||
#define __z_posix_sysconf_SC_IPV6 _POSIX_IPV6
|
||||
#define __z_posix_sysconf_SC_JOB_CONTROL _POSIX_JOB_CONTROL
|
||||
#define __z_posix_sysconf_SC_MAPPED_FILES _POSIX_MAPPED_FILES
|
||||
#define __z_posix_sysconf_SC_MEMLOCK _POSIX_MEMLOCK
|
||||
#define __z_posix_sysconf_SC_MEMLOCK_RANGE _POSIX_MEMLOCK_RANGE
|
||||
#define __z_posix_sysconf_SC_MEMORY_PROTECTION _POSIX_MEMORY_PROTECTION
|
||||
#define __z_posix_sysconf_SC_MESSAGE_PASSING _POSIX_MESSAGE_PASSING
|
||||
#define __z_posix_sysconf_SC_MONOTONIC_CLOCK _POSIX_MONOTONIC_CLOCK
|
||||
#define __z_posix_sysconf_SC_PRIORITIZED_IO _POSIX_PRIORITIZED_IO
|
||||
#define __z_posix_sysconf_SC_PRIORITY_SCHEDULING _POSIX_PRIORITY_SCHEDULING
|
||||
#define __z_posix_sysconf_SC_RAW_SOCKETS _POSIX_RAW_SOCKETS
|
||||
#define __z_posix_sysconf_SC_RE_DUP_MAX _POSIX_RE_DUP_MAX
|
||||
#define __z_posix_sysconf_SC_READER_WRITER_LOCKS _POSIX_READER_WRITER_LOCKS
|
||||
#define __z_posix_sysconf_SC_REALTIME_SIGNALS _POSIX_REALTIME_SIGNALS
|
||||
#define __z_posix_sysconf_SC_REGEXP _POSIX_REGEXP
|
||||
#define __z_posix_sysconf_SC_SAVED_IDS _POSIX_SAVED_IDS
|
||||
#define __z_posix_sysconf_SC_SEMAPHORES _POSIX_SEMAPHORES
|
||||
#define __z_posix_sysconf_SC_SHARED_MEMORY_OBJECTS _POSIX_SHARED_MEMORY_OBJECTS
|
||||
#define __z_posix_sysconf_SC_SHELL _POSIX_SHELL
|
||||
#define __z_posix_sysconf_SC_SPAWN _POSIX_SPAWN
|
||||
#define __z_posix_sysconf_SC_SPIN_LOCKS _POSIX_SPIN_LOCKS
|
||||
#define __z_posix_sysconf_SC_SPORADIC_SERVER _POSIX_SPORADIC_SERVER
|
||||
#define __z_posix_sysconf_SC_SS_REPL_MAX _POSIX_SS_REPL_MAX
|
||||
#define __z_posix_sysconf_SC_SYNCHRONIZED_IO _POSIX_SYNCHRONIZED_IO
|
||||
#define __z_posix_sysconf_SC_THREAD_ATTR_STACKADDR _POSIX_THREAD_ATTR_STACKADDR
|
||||
#define __z_posix_sysconf_SC_THREAD_ATTR_STACKSIZE _POSIX_THREAD_ATTR_STACKSIZE
|
||||
#define __z_posix_sysconf_SC_THREAD_CPUTIME _POSIX_THREAD_CPUTIME
|
||||
#define __z_posix_sysconf_SC_THREAD_PRIO_INHERIT _POSIX_THREAD_PRIO_INHERIT
|
||||
#define __z_posix_sysconf_SC_THREAD_PRIO_PROTECT _POSIX_THREAD_PRIO_PROTECT
|
||||
#define __z_posix_sysconf_SC_THREAD_PRIORITY_SCHEDULING _POSIX_THREAD_PRIORITY_SCHEDULING
|
||||
#define __z_posix_sysconf_SC_THREAD_PROCESS_SHARED _POSIX_THREAD_PROCESS_SHARED
|
||||
#define __z_posix_sysconf_SC_THREAD_ROBUST_PRIO_INHERIT _POSIX_THREAD_ROBUST_PRIO_INHERIT
|
||||
#define __z_posix_sysconf_SC_THREAD_ROBUST_PRIO_PROTECT _POSIX_THREAD_ROBUST_PRIO_PROTECT
|
||||
#define __z_posix_sysconf_SC_THREAD_SAFE_FUNCTIONS _POSIX_THREAD_SAFE_FUNCTIONS
|
||||
#define __z_posix_sysconf_SC_THREAD_SPORADIC_SERVER _POSIX_THREAD_SPORADIC_SERVER
|
||||
#define __z_posix_sysconf_SC_THREADS _POSIX_THREADS
|
||||
#define __z_posix_sysconf_SC_TIMEOUTS _POSIX_TIMEOUTS
|
||||
#define __z_posix_sysconf_SC_TIMERS _POSIX_TIMERS
|
||||
#define __z_posix_sysconf_SC_TRACE _POSIX_TRACE
|
||||
#define __z_posix_sysconf_SC_TRACE_EVENT_FILTER _POSIX_TRACE_EVENT_FILTER
|
||||
#define __z_posix_sysconf_SC_TRACE_EVENT_NAME_MAX _POSIX_TRACE_EVENT_NAME_MAX
|
||||
#define __z_posix_sysconf_SC_TRACE_INHERIT _POSIX_TRACE_INHERIT
|
||||
#define __z_posix_sysconf_SC_TRACE_LOG _POSIX_TRACE_LOG
|
||||
#define __z_posix_sysconf_SC_ADVISORY_INFO (-1L)
|
||||
#define __z_posix_sysconf_SC_ASYNCHRONOUS_IO \
|
||||
COND_CODE_1(CONFIG_POSIX_ASYNCHRONOUS_IO, (_POSIX_ASYNCHRONOUS_IO), (-1L))
|
||||
#define __z_posix_sysconf_SC_BARRIERS COND_CODE_1(CONFIG_PTHREAD_BARRIER, (_POSIX_BARRIERS), (-1L))
|
||||
#define __z_posix_sysconf_SC_CLOCK_SELECTION \
|
||||
COND_CODE_1(CONFIG_POSIX_CLOCK_SELECTION, (_POSIX_CLOCK_SELECTION), (-1L))
|
||||
#define __z_posix_sysconf_SC_CPUTIME \
|
||||
COND_CODE_1(CONFIG_POSIX_CPUTIME, (_POSIX_CPUTIME), (-1L))
|
||||
#define __z_posix_sysconf_SC_FSYNC \
|
||||
COND_CODE_1(CONFIG_POSIX_FSYNC, (_POSIX_FSYNC), (-1L))
|
||||
#define __z_posix_sysconf_SC_IPV6 COND_CODE_1(CONFIG_NET_IPV6, (_POSIX_IPV6), (-1L))
|
||||
#define __z_posix_sysconf_SC_JOB_CONTROL (-1L)
|
||||
#define __z_posix_sysconf_SC_MAPPED_FILES (-1L)
|
||||
#define __z_posix_sysconf_SC_MEMLOCK (-1L)
|
||||
#define __z_posix_sysconf_SC_MEMLOCK_RANGE (-1L)
|
||||
#define __z_posix_sysconf_SC_MEMORY_PROTECTION (-1L)
|
||||
#define __z_posix_sysconf_SC_MESSAGE_PASSING \
|
||||
COND_CODE_1(CONFIG_POSIX_MQUEUE, (_POSIX_MESSAGE_PASSING), (-1L))
|
||||
#define __z_posix_sysconf_SC_MONOTONIC_CLOCK \
|
||||
COND_CODE_1(CONFIG_POSIX_MONOTONIC_CLOCK, (_POSIX_MONOTONIC_CLOCK), (-1L))
|
||||
#define __z_posix_sysconf_SC_PRIORITIZED_IO (-1L)
|
||||
#define __z_posix_sysconf_SC_PRIORITY_SCHEDULING \
|
||||
COND_CODE_1(CONFIG_POSIX_PRIORITY_SCHEDULING, (_POSIX_PRIORITY_SCHEDULING), (-1L))
|
||||
#define __z_posix_sysconf_SC_RAW_SOCKETS \
|
||||
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))
|
||||
#define __z_posix_sysconf_SC_REALTIME_SIGNALS (-1L)
|
||||
#define __z_posix_sysconf_SC_REGEXP (-1L)
|
||||
#define __z_posix_sysconf_SC_SAVED_IDS (-1L)
|
||||
#define __z_posix_sysconf_SC_SEMAPHORES \
|
||||
COND_CODE_1(CONFIG_PTHREAD_IPC, (_POSIX_SEMAPHORES), (-1L))
|
||||
#define __z_posix_sysconf_SC_SHARED_MEMORY_OBJECTS (-1L)
|
||||
#define __z_posix_sysconf_SC_SHELL (-1L)
|
||||
#define __z_posix_sysconf_SC_SPAWN (-1L)
|
||||
#define __z_posix_sysconf_SC_SPIN_LOCKS \
|
||||
COND_CODE_1(CONFIG_PTHREAD_SPINLOCK, (_POSIX_SPIN_LOCKS), (-1L))
|
||||
#define __z_posix_sysconf_SC_SPORADIC_SERVER (-1L)
|
||||
#define __z_posix_sysconf_SC_SS_REPL_MAX _POSIX_SS_REPL_MAX
|
||||
#define __z_posix_sysconf_SC_SYNCHRONIZED_IO (-1L)
|
||||
#define __z_posix_sysconf_SC_THREAD_ATTR_STACKADDR \
|
||||
COND_CODE_1(CONFIG_PTHREAD_IPC, (_POSIX_THREAD_ATTR_STACKADDR), (-1))
|
||||
#define __z_posix_sysconf_SC_THREAD_ATTR_STACKSIZE \
|
||||
COND_CODE_1(CONFIG_PTHREAD_IPC, (_POSIX_THREAD_ATTR_STACKSIZE), (-1L))
|
||||
#define __z_posix_sysconf_SC_THREAD_CPUTIME (-1L)
|
||||
#define __z_posix_sysconf_SC_THREAD_PRIO_INHERIT \
|
||||
COND_CODE_1(CONFIG_PTHREAD_IPC, (_POSIX_THREAD_PRIO_INHERIT), (-1L))
|
||||
#define __z_posix_sysconf_SC_THREAD_PRIO_PROTECT (-1L)
|
||||
#define __z_posix_sysconf_SC_THREAD_PRIORITY_SCHEDULING (-1L)
|
||||
#define __z_posix_sysconf_SC_THREAD_PROCESS_SHARED (-1L)
|
||||
#define __z_posix_sysconf_SC_THREAD_ROBUST_PRIO_INHERIT (-1L)
|
||||
#define __z_posix_sysconf_SC_THREAD_ROBUST_PRIO_PROTECT (-1L)
|
||||
#define __z_posix_sysconf_SC_THREAD_SAFE_FUNCTIONS \
|
||||
COND_CODE_1(CONFIG_PTHREAD_IPC, (_POSIX_THREAD_SAFE_FUNCTIONS), (-1L))
|
||||
#define __z_posix_sysconf_SC_THREAD_SPORADIC_SERVER (-1L)
|
||||
#define __z_posix_sysconf_SC_THREADS \
|
||||
COND_CODE_1(CONFIG_PTHREAD_IPC, (_POSIX_THREADS), (-1L))
|
||||
#define __z_posix_sysconf_SC_TIMEOUTS \
|
||||
COND_CODE_1(CONFIG_POSIX_TIMEOUTS, (_POSIX_TIMEOUTS), (-1L))
|
||||
#define __z_posix_sysconf_SC_TIMERS \
|
||||
COND_CODE_1(CONFIG_POSIX_TIMEOUTS, (_POSIX_TIMERS), (-1))
|
||||
#define __z_posix_sysconf_SC_TRACE (-1L)
|
||||
#define __z_posix_sysconf_SC_TRACE_EVENT_FILTER (-1L)
|
||||
#define __z_posix_sysconf_SC_TRACE_EVENT_NAME_MAX _POSIX_TRACE_NAME_MAX
|
||||
#define __z_posix_sysconf_SC_TRACE_INHERIT (-1L)
|
||||
#define __z_posix_sysconf_SC_TRACE_LOG (-1L)
|
||||
#define __z_posix_sysconf_SC_TRACE_NAME_MAX _POSIX_TRACE_NAME_MAX
|
||||
#define __z_posix_sysconf_SC_TRACE_SYS_MAX _POSIX_TRACE_SYS_MAX
|
||||
#define __z_posix_sysconf_SC_TRACE_USER_EVENT_MAX _POSIX_TRACE_USER_EVENT_MAX
|
||||
|
@ -211,7 +229,7 @@ enum {
|
|||
#define __z_posix_sysconf_SC_2_C_DEV _POSIX2_C_DEV
|
||||
#define __z_posix_sysconf_SC_2_CHAR_TERM (-1L)
|
||||
#define __z_posix_sysconf_SC_COLL_WEIGHTS_MAX _POSIX2_COLL_WEIGHTS_MAX
|
||||
#define __z_posix_sysconf_SC_DELAYTIMER_MAX _POSIX2_DELAYTIMER_MAX
|
||||
#define __z_posix_sysconf_SC_DELAYTIMER_MAX _POSIX_DELAYTIMER_MAX
|
||||
#define __z_posix_sysconf_SC_EXPR_NEST_MAX _POSIX2_EXPR_NEST_MAX
|
||||
#define __z_posix_sysconf_SC_2_FORT_DEV (-1L)
|
||||
#define __z_posix_sysconf_SC_2_FORT_RUN (-1L)
|
||||
|
|
|
@ -73,6 +73,10 @@ extern "C" {
|
|||
#define CLOCK_PROCESS_CPUTIME_ID 2
|
||||
#endif
|
||||
|
||||
#ifndef CLOCK_THREAD_CPUTIME_ID
|
||||
#define CLOCK_THREAD_CPUTIME_ID 3
|
||||
#endif
|
||||
|
||||
#ifndef CLOCK_MONOTONIC
|
||||
#define CLOCK_MONOTONIC 4
|
||||
#endif
|
||||
|
|
|
@ -78,13 +78,13 @@ config MINIMAL_LIBC_RAND
|
|||
|
||||
config MINIMAL_LIBC_TIME
|
||||
bool "Time functions"
|
||||
select COMMON_LIBC_TIME if POSIX_CLOCK
|
||||
select COMMON_LIBC_TIME if POSIX_TIMERS
|
||||
select COMMON_LIBC_GMTIME_R
|
||||
default y
|
||||
help
|
||||
Enable time() and gmtime_r() for the minimal libc.
|
||||
|
||||
time() requires CONFIG_POSIX_CLOCK=y because it relies on the POSIX
|
||||
time() requires CONFIG_POSIX_TIMERS=y because it relies on the POSIX
|
||||
clock_gettime() function.
|
||||
|
||||
In order to make use of the non-reentrant gmtime(), it is necessary
|
||||
|
|
|
@ -565,7 +565,7 @@ void *_sbrk_r(struct _reent *r, int count)
|
|||
|
||||
int _gettimeofday(struct timeval *__tp, void *__tzp)
|
||||
{
|
||||
#ifdef CONFIG_POSIX_CLOCK
|
||||
#ifdef CONFIG_XSI_SINGLE_PROCESS
|
||||
return gettimeofday(__tp, __tzp);
|
||||
#else
|
||||
/* Non-posix systems should not call gettimeofday() here as it will
|
||||
|
|
|
@ -24,7 +24,7 @@ if(CONFIG_POSIX_SIGNAL)
|
|||
)
|
||||
endif()
|
||||
|
||||
if(CONFIG_POSIX_API OR CONFIG_PTHREAD_IPC OR CONFIG_POSIX_CLOCK OR
|
||||
if(CONFIG_POSIX_API OR CONFIG_PTHREAD_IPC OR CONFIG_POSIX_TIMERS OR
|
||||
CONFIG_POSIX_MQUEUE OR CONFIG_POSIX_FS OR CONFIG_EVENTFD OR CONFIG_GETOPT)
|
||||
# This is a temporary workaround so that Newlib declares the appropriate
|
||||
# types for us. POSIX features to be formalized as part of #51211
|
||||
|
@ -39,18 +39,22 @@ zephyr_library_sources_ifdef(CONFIG_FNMATCH fnmatch.c)
|
|||
zephyr_library_sources_ifdef(CONFIG_GETENTROPY getentropy.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_POSIX_API perror.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_POSIX_ASYNCHRONOUS_IO aio.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_POSIX_CLOCK clock.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_POSIX_CLOCK nanosleep.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_POSIX_CLOCK sleep.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_POSIX_CONFSTR confstr.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_POSIX_ENV env.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_POSIX_FS fs.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_POSIX_MQUEUE mqueue.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_POSIX_MULTI_PROCESS
|
||||
sleep.c
|
||||
)
|
||||
zephyr_library_sources_ifdef(CONFIG_POSIX_NETWORKING net.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_POSIX_PUTMSG stropts.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_POSIX_SIGNAL signal.c ${STRSIGNAL_TABLE_H})
|
||||
zephyr_library_sources_ifdef(CONFIG_POSIX_SYSCONF_IMPL_FULL sysconf.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_POSIX_SYSLOG syslog.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_POSIX_TIMERS
|
||||
clock.c
|
||||
timer.c
|
||||
)
|
||||
zephyr_library_sources_ifdef(CONFIG_POSIX_UNAME uname.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_PTHREAD_IPC _common.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_PTHREAD_BARRIER barrier.c)
|
||||
|
@ -62,7 +66,6 @@ zephyr_library_sources_ifdef(CONFIG_PTHREAD_RWLOCK rwlock.c)
|
|||
zephyr_library_sources_ifdef(CONFIG_POSIX_PRIORITY_SCHEDULING sched.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_PTHREAD_IPC semaphore.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_PTHREAD_SPINLOCK spinlock.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_TIMER timer.c)
|
||||
|
||||
zephyr_library_include_directories(
|
||||
${ZEPHYR_BASE}/kernel/include
|
||||
|
|
|
@ -14,21 +14,17 @@ config POSIX_API
|
|||
Enable mostly-standards-compliant implementations of
|
||||
various POSIX (IEEE 1003.1) APIs.
|
||||
|
||||
if POSIX_CLOCK
|
||||
|
||||
config PTHREAD_IPC
|
||||
bool "POSIX pthread IPC API"
|
||||
default y if POSIX_API
|
||||
depends on POSIX_TIMERS
|
||||
help
|
||||
This enables a mostly-standards-compliant implementation of
|
||||
the pthread mutex, condition variable and barrier IPC
|
||||
mechanisms.
|
||||
|
||||
endif # POSIX_CLOCK
|
||||
|
||||
rsource "Kconfig.aio"
|
||||
rsource "Kconfig.barrier"
|
||||
rsource "Kconfig.clock"
|
||||
rsource "Kconfig.cond"
|
||||
rsource "Kconfig.confstr"
|
||||
rsource "Kconfig.env"
|
||||
|
@ -42,6 +38,7 @@ rsource "Kconfig.key"
|
|||
rsource "Kconfig.mqueue"
|
||||
rsource "Kconfig.mutex"
|
||||
rsource "Kconfig.net"
|
||||
rsource "Kconfig.procN"
|
||||
rsource "Kconfig.pthread"
|
||||
rsource "Kconfig.rwlock"
|
||||
rsource "Kconfig.sched"
|
||||
|
@ -53,6 +50,7 @@ rsource "Kconfig.sysconf"
|
|||
rsource "Kconfig.syslog"
|
||||
rsource "Kconfig.timer"
|
||||
rsource "Kconfig.uname"
|
||||
rsource "Kconfig.xsi"
|
||||
|
||||
rsource "Kconfig.deprecated"
|
||||
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
# Copyright (c) 2018 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
config POSIX_CLOCK
|
||||
bool "clock and sleep APIs"
|
||||
default y if POSIX_API
|
||||
imply TIMER
|
||||
depends on !NATIVE_LIBC
|
||||
help
|
||||
This enables POSIX clock\_\*() and \*sleep() functions.
|
|
@ -6,6 +6,28 @@
|
|||
|
||||
menu "Deprecated POSIX options"
|
||||
|
||||
config MAX_TIMER_COUNT
|
||||
int "Maximum number of timer_t [DEPRECATED]"
|
||||
default POSIX_TIMER_MAX if POSIX_TIMERS
|
||||
default 0
|
||||
help
|
||||
This option is deprecated.
|
||||
|
||||
Please use CONFIG_POSIX_TIMER_MAX instead.
|
||||
|
||||
config POSIX_CLOCK
|
||||
bool "clock and sleep APIs [DEPRECATED]"
|
||||
select DEPRECATED
|
||||
select POSIX_CLOCK_SELECTION
|
||||
select POSIX_CPUTIME
|
||||
select POSIX_MONOTONIC_CLOCK
|
||||
select POSIX_TIMERS
|
||||
select POSIX_TIMEOUTS
|
||||
help
|
||||
This option is deprecated.
|
||||
|
||||
Please use CONFIG_POSIX_TIMERS instead.
|
||||
|
||||
config POSIX_LIMITS_RTSIG_MAX
|
||||
int "_POSIX_RTSIG_MAX value in limits.h [DEPRECATED]"
|
||||
default POSIX_RTSIG_MAX if POSIX_REALTIME_SIGNALS
|
||||
|
@ -15,4 +37,22 @@ config POSIX_LIMITS_RTSIG_MAX
|
|||
|
||||
Please use CONFIG_POSIX_RTSIG_MAX instead.
|
||||
|
||||
config TIMER
|
||||
bool "Timer support [DEPRECATED]"
|
||||
select DEPRECATED
|
||||
select POSIX_TIMERS
|
||||
help
|
||||
This option is deprecated.
|
||||
|
||||
Please use CONFIG_POSIX_TIMERS instead.
|
||||
|
||||
config TIMER_DELAYTIMER_MAX
|
||||
int "Maximum count returned my timer_getoverrun() in POSIX application [DEPRECATED]"
|
||||
default POSIX_DELAYTIMER_MAX if POSIX_TIMERS
|
||||
default 0
|
||||
help
|
||||
This option is deprecated.
|
||||
|
||||
Please use CONFIG_POSIX_DELAYTIMER_MAX instead.
|
||||
|
||||
endmenu
|
||||
|
|
16
lib/posix/options/Kconfig.procN
Normal file
16
lib/posix/options/Kconfig.procN
Normal file
|
@ -0,0 +1,16 @@
|
|||
# Copyright (c) 2024 Tenstorrent AI ULC
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
config POSIX_MULTI_PROCESS
|
||||
bool "POSIX multi-process support [EXPERIMENTAL]"
|
||||
default y if POSIX_API
|
||||
select EXPERIMENTAL
|
||||
help
|
||||
Support for multi-processing.
|
||||
|
||||
Note: Currently Zephyr does not support multiple processes and therefore much of this option
|
||||
group is not implemented and is considered undefined behaviour.
|
||||
|
||||
For more information, please see
|
||||
https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_subprofiles.html
|
|
@ -1,13 +1,91 @@
|
|||
# Copyright (c) 2018 Intel Corporation
|
||||
# Copyright (c) 2024 Tenstorrent AI ULC
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
TYPE = TIMER
|
||||
type = timer_t
|
||||
type-function = timer_create
|
||||
rsource "Kconfig.template.pooled_type"
|
||||
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(),
|
||||
timer_settime(), and timer_gettime().
|
||||
|
||||
if TIMER
|
||||
For more information, please see
|
||||
https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_subprofiles.html
|
||||
|
||||
if POSIX_TIMERS
|
||||
|
||||
config POSIX_THREAD_CPUTIME
|
||||
bool "POSIX per-thread CPU-time clocks"
|
||||
default y
|
||||
help
|
||||
This enables CLOCK_THREAD_CPUTIME_ID.
|
||||
|
||||
For more information, please see
|
||||
https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_port.html
|
||||
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_118
|
||||
https://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_08_05_04
|
||||
|
||||
config POSIX_MONOTONIC_CLOCK
|
||||
bool "POSIX Monotonic clock support"
|
||||
default y
|
||||
help
|
||||
This enables CLOCK_MONOTONIC.
|
||||
|
||||
For more information, please see
|
||||
https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_port.html
|
||||
https://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_08_05_03
|
||||
|
||||
config POSIX_CPUTIME
|
||||
bool "POSIX per-process CPU-time clocks"
|
||||
default y
|
||||
help
|
||||
This enables CLOCK_PROCESS_CPUTIME_ID.
|
||||
|
||||
For more information, please see
|
||||
https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_port.html
|
||||
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_118
|
||||
https://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_08_05_04
|
||||
|
||||
config POSIX_CLOCK_SELECTION
|
||||
bool "POSIX Clock selection"
|
||||
default y
|
||||
help
|
||||
This enables POSIX clock selection.
|
||||
|
||||
For more information, please see
|
||||
https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_port.html
|
||||
https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_port.html#tag_24_03_04
|
||||
|
||||
config POSIX_DELAYTIMER_MAX
|
||||
int "Maximum count returned my timer_getoverrun() in POSIX application"
|
||||
default 32
|
||||
help
|
||||
This controls the maximum number of times a timer can overrun before
|
||||
timer_getoverrun() in POSIX compliant application.
|
||||
|
||||
For more information, please see
|
||||
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/limits.h.html
|
||||
|
||||
config POSIX_TIMER_MAX
|
||||
int "Maximum number of POSIX timers per process"
|
||||
default 32
|
||||
help
|
||||
Maximum simultaneously active timer_t in a POSIX application.
|
||||
|
||||
For more information, please see
|
||||
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/limits.h.html
|
||||
|
||||
config POSIX_TIMEOUTS
|
||||
bool "Support timeouts for some blocking POSIX services"
|
||||
default y
|
||||
help
|
||||
Enable mandatory timeouts for some blocking operations.
|
||||
|
||||
For more information, please see
|
||||
https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_port.html
|
||||
https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xbd_chap02.html
|
||||
|
||||
config TIMER_CREATE_WAIT
|
||||
int "Time to wait for timer availability (in msec) in POSIX application"
|
||||
|
@ -17,11 +95,8 @@ config TIMER_CREATE_WAIT
|
|||
This controls how long to wait for resources to come available to create
|
||||
a new timer in POSIX compliant application
|
||||
|
||||
config TIMER_DELAYTIMER_MAX
|
||||
int "Maximum count returned my timer_getoverrun() in POSIX application"
|
||||
default 20
|
||||
help
|
||||
This controls the maximum number of times a timer can overrun before
|
||||
timer_getoverrun() in POSIX compliant application.
|
||||
module = TIMER
|
||||
module-str = POSIX Timers
|
||||
source "subsys/logging/Kconfig.template.log_config"
|
||||
|
||||
endif # TIMER
|
||||
endif # POSIX_TIMERS
|
||||
|
|
16
lib/posix/options/Kconfig.xsi
Normal file
16
lib/posix/options/Kconfig.xsi
Normal file
|
@ -0,0 +1,16 @@
|
|||
# Copyright (c) 2024 Tenstorrent AI ULC
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
config XSI_SINGLE_PROCESS
|
||||
bool "X/Open single process"
|
||||
default y if POSIX_API
|
||||
depends on POSIX_ENV
|
||||
depends on POSIX_UNAME
|
||||
depends on POSIX_CLOCK_SELECTION
|
||||
help
|
||||
Select 'y' here and Zephyr will provide implementations of
|
||||
gethostid(), gettimeofday(), and putenv().
|
||||
|
||||
For more information, please see
|
||||
https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_subprofiles.html
|
|
@ -8,7 +8,7 @@
|
|||
#include <ksched.h>
|
||||
#include <zephyr/posix/time.h>
|
||||
|
||||
#ifdef CONFIG_POSIX_CLOCK
|
||||
#ifdef CONFIG_POSIX_TIMERS
|
||||
int64_t timespec_to_timeoutms(const struct timespec *abstime)
|
||||
{
|
||||
int64_t milli_secs, secs, nsecs;
|
||||
|
@ -30,4 +30,4 @@ int64_t timespec_to_timeoutms(const struct timespec *abstime)
|
|||
|
||||
return milli_secs;
|
||||
}
|
||||
#endif /* CONFIG_POSIX_CLOCK */
|
||||
#endif /* CONFIG_POSIX_TIMERS */
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2018 Intel Corporation
|
||||
* Copyright (c) 2018 Friedt Professional Engineering Services, Inc
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
@ -156,14 +157,43 @@ int clock_settime(clockid_t clock_id, const struct timespec *tp)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Note: usleep() was removed in Issue 7.
|
||||
*
|
||||
* It is kept here for compatibility purposes.
|
||||
*
|
||||
* For more information, please see
|
||||
* https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xsh_chap01.html
|
||||
* https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xsh_chap03.html
|
||||
*/
|
||||
int usleep(useconds_t useconds)
|
||||
{
|
||||
int32_t rem;
|
||||
|
||||
if (useconds >= USEC_PER_SEC) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
rem = k_usleep(useconds);
|
||||
__ASSERT_NO_MSG(rem >= 0);
|
||||
if (rem > 0) {
|
||||
/* sleep was interrupted by a call to k_wakeup() */
|
||||
errno = EINTR;
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Suspend execution for a nanosecond interval, or
|
||||
* until some absolute time relative to the specified clock.
|
||||
*
|
||||
* See IEEE 1003.1
|
||||
*/
|
||||
int clock_nanosleep(clockid_t clock_id, int flags, const struct timespec *rqtp,
|
||||
struct timespec *rmtp)
|
||||
static int __z_clock_nanosleep(clockid_t clock_id, int flags, const struct timespec *rqtp,
|
||||
struct timespec *rmtp)
|
||||
{
|
||||
uint64_t ns;
|
||||
uint64_t us;
|
||||
|
@ -225,6 +255,17 @@ do_rmtp_update:
|
|||
return 0;
|
||||
}
|
||||
|
||||
int nanosleep(const struct timespec *rqtp, struct timespec *rmtp)
|
||||
{
|
||||
return __z_clock_nanosleep(CLOCK_MONOTONIC, 0, rqtp, rmtp);
|
||||
}
|
||||
|
||||
int clock_nanosleep(clockid_t clock_id, int flags, const struct timespec *rqtp,
|
||||
struct timespec *rmtp)
|
||||
{
|
||||
return __z_clock_nanosleep(clock_id, flags, rqtp, rmtp);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get current real time.
|
||||
*
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2018 Friedt Professional Engineering Services, Inc
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <zephyr/kernel.h>
|
||||
#include <limits.h>
|
||||
#include <errno.h>
|
||||
/* required for struct timespec */
|
||||
#include <zephyr/posix/time.h>
|
||||
#include <zephyr/sys/util.h>
|
||||
#include <zephyr/sys_clock.h>
|
||||
|
||||
/**
|
||||
* @brief Suspend execution for nanosecond intervals.
|
||||
*
|
||||
* See IEEE 1003.1
|
||||
*/
|
||||
int nanosleep(const struct timespec *rqtp, struct timespec *rmtp)
|
||||
{
|
||||
return clock_nanosleep(CLOCK_MONOTONIC, 0, rqtp, rmtp);
|
||||
}
|
|
@ -23,27 +23,3 @@ unsigned sleep(unsigned int seconds)
|
|||
|
||||
return rem / MSEC_PER_SEC;
|
||||
}
|
||||
/**
|
||||
* @brief Suspend execution for microsecond intervals.
|
||||
*
|
||||
* See IEEE 1003.1
|
||||
*/
|
||||
int usleep(useconds_t useconds)
|
||||
{
|
||||
int32_t rem;
|
||||
|
||||
if (useconds >= USEC_PER_SEC) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
rem = k_usleep(useconds);
|
||||
__ASSERT_NO_MSG(rem >= 0);
|
||||
if (rem > 0) {
|
||||
/* sleep was interrupted by a call to k_wakeup() */
|
||||
errno = EINTR;
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -29,8 +29,8 @@ struct timer_obj {
|
|||
uint32_t status;
|
||||
};
|
||||
|
||||
K_MEM_SLAB_DEFINE(posix_timer_slab, sizeof(struct timer_obj),
|
||||
CONFIG_MAX_TIMER_COUNT, __alignof__(struct timer_obj));
|
||||
K_MEM_SLAB_DEFINE(posix_timer_slab, sizeof(struct timer_obj), CONFIG_POSIX_TIMER_MAX,
|
||||
__alignof__(struct timer_obj));
|
||||
|
||||
static void zephyr_timer_wrapper(struct k_timer *ztimer)
|
||||
{
|
||||
|
@ -306,8 +306,8 @@ int timer_getoverrun(timer_t timerid)
|
|||
|
||||
int overruns = k_timer_status_get(&timer->ztimer) - 1;
|
||||
|
||||
if (overruns > CONFIG_TIMER_DELAYTIMER_MAX) {
|
||||
overruns = CONFIG_TIMER_DELAYTIMER_MAX;
|
||||
if (overruns > CONFIG_POSIX_DELAYTIMER_MAX) {
|
||||
overruns = CONFIG_POSIX_DELAYTIMER_MAX;
|
||||
}
|
||||
|
||||
return overruns;
|
||||
|
|
|
@ -15,7 +15,7 @@ config SIMPLELINK_HOST_DRIVER
|
|||
select REQUIRES_FULL_LIBC
|
||||
select ERRNO
|
||||
select PTHREAD_IPC
|
||||
select POSIX_CLOCK
|
||||
select POSIX_TIMERS
|
||||
help
|
||||
Build the SimpleLink host driver
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
config WIFI_NM_WPA_SUPPLICANT
|
||||
bool "WPA Suplicant from hostap project [EXPERIMENTAL]"
|
||||
select POSIX_CLOCK
|
||||
select POSIX_TIMERS
|
||||
select POSIX_SIGNAL
|
||||
select POSIX_API
|
||||
select NET_SOCKETS
|
||||
|
|
|
@ -13,7 +13,6 @@ CONFIG_HW_STACK_PROTECTION=y
|
|||
CONFIG_REQUIRES_FULL_LIBC=y
|
||||
CONFIG_SNTP=y
|
||||
CONFIG_JSON_LIBRARY=y
|
||||
CONFIG_POSIX_CLOCK=y
|
||||
CONFIG_POSIX_API=y
|
||||
|
||||
# DNS
|
||||
|
|
|
@ -4,8 +4,8 @@ CONFIG_SHELL_BACKEND_SERIAL_CHECK_DTR=y
|
|||
CONFIG_UART_LINE_CTRL=y
|
||||
CONFIG_USB_DEVICE_INITIALIZE_AT_BOOT=n
|
||||
|
||||
# POSIX_CLOCK requires an embedded C library while the native USB driver is incompatible with it.
|
||||
# POSIX_TIMERS requires an embedded C library while the native USB driver is incompatible with it.
|
||||
# So let's disable it. Once USB_NATIVE_POSIX supports embedded C libraries this can be removed.
|
||||
CONFIG_POSIX_CLOCK=n
|
||||
# DATE_SHELL requires POSIX_CLOCK
|
||||
CONFIG_POSIX_TIMERS=n
|
||||
# DATE_SHELL requires POSIX_TIMERS
|
||||
CONFIG_DATE_SHELL=n
|
||||
|
|
|
@ -9,7 +9,7 @@ CONFIG_THREAD_MONITOR=y
|
|||
CONFIG_BOOT_BANNER=n
|
||||
CONFIG_THREAD_NAME=y
|
||||
CONFIG_DEVICE_SHELL=y
|
||||
CONFIG_POSIX_CLOCK=y
|
||||
CONFIG_POSIX_TIMERS=y
|
||||
CONFIG_DATE_SHELL=y
|
||||
CONFIG_THREAD_RUNTIME_STATS=y
|
||||
CONFIG_THREAD_RUNTIME_STATS_USE_TIMING_FUNCTIONS=y
|
||||
|
|
|
@ -9,6 +9,6 @@ CONFIG_THREAD_MONITOR=y
|
|||
CONFIG_BOOT_BANNER=n
|
||||
CONFIG_THREAD_NAME=y
|
||||
CONFIG_DEVICE_SHELL=y
|
||||
CONFIG_POSIX_CLOCK=y
|
||||
CONFIG_POSIX_TIMERS=y
|
||||
CONFIG_DATE_SHELL=y
|
||||
CONFIG_THREAD_RUNTIME_STATS=y
|
||||
|
|
|
@ -8,7 +8,7 @@ CONFIG_THREAD_MONITOR=y
|
|||
CONFIG_BOOT_BANNER=n
|
||||
CONFIG_THREAD_NAME=y
|
||||
CONFIG_DEVICE_SHELL=y
|
||||
CONFIG_POSIX_CLOCK=y
|
||||
CONFIG_POSIX_TIMERS=y
|
||||
CONFIG_DATE_SHELL=y
|
||||
CONFIG_THREAD_RUNTIME_STATS=y
|
||||
|
||||
|
|
|
@ -161,7 +161,7 @@ config LOG_TIMESTAMP_64BIT
|
|||
config LOG_TIMESTAMP_USE_REALTIME
|
||||
bool "Use real time clock for timestamp"
|
||||
select LOG_TIMESTAMP_64BIT
|
||||
depends on POSIX_CLOCK
|
||||
depends on POSIX_TIMERS
|
||||
help
|
||||
When enabled, real time clock is used for timestamping.
|
||||
|
||||
|
|
|
@ -227,7 +227,7 @@ config LWM2M_RD_CLIENT_MAX_RETRIES
|
|||
config LWM2M_RESOURCE_DATA_CACHE_SUPPORT
|
||||
bool "Resource Time series data cache support"
|
||||
depends on (LWM2M_RW_SENML_JSON_SUPPORT || LWM2M_RW_SENML_CBOR_SUPPORT)
|
||||
depends on (POSIX_CLOCK && RING_BUFFER)
|
||||
depends on (POSIX_TIMERS && RING_BUFFER)
|
||||
help
|
||||
Enable time series data storage.
|
||||
Requires time() to provide current Unix timestamp.
|
||||
|
|
|
@ -34,7 +34,7 @@ config DEVICE_SHELL
|
|||
|
||||
config DATE_SHELL
|
||||
bool "Date shell"
|
||||
depends on POSIX_CLOCK
|
||||
depends on POSIX_TIMERS
|
||||
default y if !SHELL_MINIMAL
|
||||
help
|
||||
This shell provides access to date and time based on Unix time.
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
CONFIG_ZTEST=y
|
||||
CONFIG_POSIX_CLOCK=y
|
||||
CONFIG_POSIX_TIMERS=y
|
||||
CONFIG_PICOLIBC=y
|
||||
|
|
|
@ -4,8 +4,10 @@
|
|||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <zephyr/ztest.h>
|
||||
#include <sys/utsname.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <zephyr/ztest.h>
|
||||
|
||||
ZTEST(uname, test_uname)
|
||||
{
|
||||
|
|
|
@ -16,7 +16,7 @@ CONFIG_NET_SOCKETPAIR=y
|
|||
# for when CONFIG_POSIX_API is not selected
|
||||
CONFIG_PTHREAD_IPC=y
|
||||
CONFIG_POSIX_FS=y
|
||||
CONFIG_POSIX_CLOCK=y
|
||||
CONFIG_POSIX_TIMERS=y
|
||||
CONFIG_POSIX_MQUEUE=y
|
||||
CONFIG_EVENTFD=y
|
||||
CONFIG_GETOPT=y
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue