posix: separate shell utilities and posix api implementation
Previously, the POSIX shell utilities were intermixed with the POSIX API implementation. The POSIX shell utilities only depend on the public POSIX API, so it makes sense to keep them in a separate subdirectory. Signed-off-by: Christopher Friedt <cfriedt@meta.com>
This commit is contained in:
parent
5957da5830
commit
855b8bc6ca
65 changed files with 238 additions and 189 deletions
|
@ -1,69 +1,4 @@
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
set(GEN_DIR ${ZEPHYR_BINARY_DIR}/include/generated)
|
add_subdirectory(options)
|
||||||
|
add_subdirectory(shell)
|
||||||
zephyr_syscall_header(
|
|
||||||
posix_clock.h
|
|
||||||
)
|
|
||||||
|
|
||||||
zephyr_interface_library_named(posix_subsys)
|
|
||||||
|
|
||||||
if(CONFIG_POSIX_API)
|
|
||||||
zephyr_include_directories(${ZEPHYR_BASE}/include/zephyr/posix)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(CONFIG_POSIX_SIGNAL)
|
|
||||||
set(STRSIGNAL_TABLE_H ${GEN_DIR}/posix/strsignal_table.h)
|
|
||||||
|
|
||||||
add_custom_command(
|
|
||||||
OUTPUT ${STRSIGNAL_TABLE_H}
|
|
||||||
COMMAND
|
|
||||||
${PYTHON_EXECUTABLE}
|
|
||||||
${ZEPHYR_BASE}/scripts/build/gen_strsignal_table.py
|
|
||||||
-i ${ZEPHYR_BASE}/include/zephyr/posix/signal.h
|
|
||||||
-o ${STRSIGNAL_TABLE_H}
|
|
||||||
DEPENDS ${ZEPHYR_BASE}/include/zephyr/posix/signal.h
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(CONFIG_POSIX_API OR CONFIG_PTHREAD_IPC OR CONFIG_POSIX_CLOCK 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
|
|
||||||
zephyr_compile_options($<$<COMPILE_LANGUAGE:C>:-D_POSIX_THREADS>)
|
|
||||||
zephyr_compile_options($<$<COMPILE_LANGUAGE:CXX>:-D_POSIX_THREADS>)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
zephyr_library()
|
|
||||||
add_subdirectory_ifdef(CONFIG_GETOPT getopt)
|
|
||||||
add_subdirectory_ifdef(CONFIG_SHELL shell)
|
|
||||||
zephyr_library_sources_ifdef(CONFIG_EVENTFD eventfd.c)
|
|
||||||
zephyr_library_sources_ifdef(CONFIG_FNMATCH fnmatch.c)
|
|
||||||
zephyr_library_sources_ifdef(CONFIG_POSIX_API perror.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_FS fs.c)
|
|
||||||
zephyr_library_sources_ifdef(CONFIG_POSIX_MQUEUE mqueue.c)
|
|
||||||
zephyr_library_sources_ifdef(CONFIG_POSIX_SIGNAL signal.c ${STRSIGNAL_TABLE_H})
|
|
||||||
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)
|
|
||||||
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_PTHREAD_IPC semaphore.c)
|
|
||||||
zephyr_library_sources_ifdef(CONFIG_PTHREAD_SPINLOCK spinlock.c)
|
|
||||||
zephyr_library_sources_ifdef(CONFIG_TIMER timer.c)
|
|
||||||
zephyr_library_sources_ifdef(CONFIG_POSIX_PUTMSG stropts.c)
|
|
||||||
|
|
||||||
zephyr_library_include_directories(
|
|
||||||
${ZEPHYR_BASE}/kernel/include
|
|
||||||
${ARCH_DIR}/${ARCH}/include
|
|
||||||
)
|
|
||||||
|
|
||||||
zephyr_library_link_libraries(posix_subsys)
|
|
||||||
zephyr_library_property(ALLOW_EMPTY TRUE)
|
|
||||||
|
|
|
@ -1,82 +1,10 @@
|
||||||
# Copyright (c) 2018 Intel Corporation
|
# Copyright (c) 2024 Meta
|
||||||
# Copyright (c) 2023 Meta
|
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
menu "POSIX API Support"
|
menu "POSIX API Support"
|
||||||
|
|
||||||
config POSIX_MAX_FDS
|
rsource "options/Kconfig"
|
||||||
int "Maximum number of open file descriptors"
|
|
||||||
default 16 if WIFI_NM_WPA_SUPPLICANT
|
|
||||||
default 16 if POSIX_API
|
|
||||||
default 4
|
|
||||||
help
|
|
||||||
Maximum number of open file descriptors, this includes
|
|
||||||
files, sockets, special devices, etc.
|
|
||||||
|
|
||||||
config POSIX_API
|
|
||||||
depends on !NATIVE_APPLICATION
|
|
||||||
bool "POSIX APIs"
|
|
||||||
help
|
|
||||||
Enable mostly-standards-compliant implementations of
|
|
||||||
various POSIX (IEEE 1003.1) APIs.
|
|
||||||
|
|
||||||
# The name of this option is mandated by zephyr_interface_library_named
|
|
||||||
# cmake directive.
|
|
||||||
config APP_LINK_WITH_POSIX_SUBSYS
|
|
||||||
bool "Make POSIX headers available to application"
|
|
||||||
default y
|
|
||||||
depends on POSIX_API
|
|
||||||
help
|
|
||||||
Add POSIX subsystem header files to the 'app' include path.
|
|
||||||
|
|
||||||
config PTHREAD_IPC
|
|
||||||
bool "POSIX pthread IPC API"
|
|
||||||
default y if POSIX_API
|
|
||||||
depends on POSIX_CLOCK
|
|
||||||
help
|
|
||||||
This enables a mostly-standards-compliant implementation of
|
|
||||||
the pthread mutex, condition variable and barrier IPC
|
|
||||||
mechanisms.
|
|
||||||
|
|
||||||
config POSIX_SYSCONF
|
|
||||||
bool "Support for sysconf"
|
|
||||||
default y if POSIX_API
|
|
||||||
help
|
|
||||||
The sysconf() function provides a method for the application to determine
|
|
||||||
the current value of a configurable system limit or option (variable).
|
|
||||||
|
|
||||||
config POSIX_PAGE_SIZE_BITS
|
|
||||||
int "Number of bits to use for PAGE_SIZE"
|
|
||||||
range 6 16
|
|
||||||
default 12 if POSIX_API
|
|
||||||
default 6
|
|
||||||
help
|
|
||||||
Define PAGE_SIZE as BIT(n), where n is the value configured here.
|
|
||||||
PAGE_SIZE is supported in the range [64, 65536]
|
|
||||||
If CONFIG_POSIX_API=y, PAGE_SIZE defaults to 4096, otherwise, it is 64 bytes.
|
|
||||||
|
|
||||||
source "lib/posix/Kconfig.barrier"
|
|
||||||
source "lib/posix/Kconfig.clock"
|
|
||||||
source "lib/posix/Kconfig.cond"
|
|
||||||
source "lib/posix/Kconfig.eventfd"
|
|
||||||
source "lib/posix/Kconfig.fnmatch"
|
|
||||||
source "lib/posix/Kconfig.fs"
|
|
||||||
source "lib/posix/Kconfig.getopt"
|
|
||||||
source "lib/posix/Kconfig.key"
|
|
||||||
source "lib/posix/Kconfig.limits"
|
|
||||||
source "lib/posix/Kconfig.mqueue"
|
|
||||||
source "lib/posix/Kconfig.mutex"
|
|
||||||
source "lib/posix/Kconfig.pthread"
|
|
||||||
source "lib/posix/Kconfig.rwlock"
|
|
||||||
source "lib/posix/Kconfig.sched"
|
|
||||||
source "lib/posix/Kconfig.semaphore"
|
|
||||||
source "lib/posix/Kconfig.signal"
|
|
||||||
source "lib/posix/Kconfig.spinlock"
|
|
||||||
source "lib/posix/Kconfig.timer"
|
|
||||||
source "lib/posix/Kconfig.uname"
|
|
||||||
source "lib/posix/Kconfig.stropts"
|
|
||||||
|
|
||||||
rsource "shell/Kconfig"
|
rsource "shell/Kconfig"
|
||||||
|
|
||||||
endmenu # "POSIX API Support"
|
endmenu # "POSIX API Support"
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
# Copyright (c) 2023 Meta
|
|
||||||
#
|
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
|
||||||
|
|
||||||
if POSIX_SIGNAL
|
|
||||||
config POSIX_LIMITS_RTSIG_MAX
|
|
||||||
int "_POSIX_RTSIG_MAX value in limits.h"
|
|
||||||
default 8
|
|
||||||
help
|
|
||||||
Define the _POSIX_RTSIG_MAX value in limits.h.
|
|
||||||
IEEE 1003.1 defines this to be 8.
|
|
||||||
|
|
||||||
endif
|
|
68
lib/posix/options/CMakeLists.txt
Normal file
68
lib/posix/options/CMakeLists.txt
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
set(GEN_DIR ${ZEPHYR_BINARY_DIR}/include/generated)
|
||||||
|
|
||||||
|
zephyr_syscall_header(
|
||||||
|
posix_clock.h
|
||||||
|
)
|
||||||
|
|
||||||
|
zephyr_interface_library_named(posix_subsys)
|
||||||
|
|
||||||
|
if(CONFIG_POSIX_API)
|
||||||
|
zephyr_include_directories(${ZEPHYR_BASE}/include/zephyr/posix)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(CONFIG_POSIX_SIGNAL)
|
||||||
|
set(STRSIGNAL_TABLE_H ${GEN_DIR}/posix/strsignal_table.h)
|
||||||
|
|
||||||
|
add_custom_command(
|
||||||
|
OUTPUT ${STRSIGNAL_TABLE_H}
|
||||||
|
COMMAND
|
||||||
|
${PYTHON_EXECUTABLE}
|
||||||
|
${ZEPHYR_BASE}/scripts/build/gen_strsignal_table.py
|
||||||
|
-i ${ZEPHYR_BASE}/include/zephyr/posix/signal.h
|
||||||
|
-o ${STRSIGNAL_TABLE_H}
|
||||||
|
DEPENDS ${ZEPHYR_BASE}/include/zephyr/posix/signal.h
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(CONFIG_POSIX_API OR CONFIG_PTHREAD_IPC OR CONFIG_POSIX_CLOCK 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
|
||||||
|
zephyr_compile_options($<$<COMPILE_LANGUAGE:C>:-D_POSIX_THREADS>)
|
||||||
|
zephyr_compile_options($<$<COMPILE_LANGUAGE:CXX>:-D_POSIX_THREADS>)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
zephyr_library()
|
||||||
|
add_subdirectory_ifdef(CONFIG_GETOPT getopt)
|
||||||
|
zephyr_library_sources_ifdef(CONFIG_EVENTFD eventfd.c)
|
||||||
|
zephyr_library_sources_ifdef(CONFIG_FNMATCH fnmatch.c)
|
||||||
|
zephyr_library_sources_ifdef(CONFIG_POSIX_API perror.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_FS fs.c)
|
||||||
|
zephyr_library_sources_ifdef(CONFIG_POSIX_MQUEUE mqueue.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_UNAME uname.c)
|
||||||
|
zephyr_library_sources_ifdef(CONFIG_PTHREAD_IPC _common.c)
|
||||||
|
zephyr_library_sources_ifdef(CONFIG_PTHREAD_BARRIER barrier.c)
|
||||||
|
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_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
|
||||||
|
${ARCH_DIR}/${ARCH}/include
|
||||||
|
)
|
||||||
|
|
||||||
|
zephyr_library_link_libraries(posix_subsys)
|
||||||
|
zephyr_library_property(ALLOW_EMPTY TRUE)
|
58
lib/posix/options/Kconfig
Normal file
58
lib/posix/options/Kconfig
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
# Copyright (c) 2018 Intel Corporation
|
||||||
|
# Copyright (c) 2023 Meta
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
menu "POSIX Options"
|
||||||
|
|
||||||
|
config POSIX_API
|
||||||
|
depends on !NATIVE_APPLICATION
|
||||||
|
bool "POSIX APIs"
|
||||||
|
help
|
||||||
|
Enable mostly-standards-compliant implementations of
|
||||||
|
various POSIX (IEEE 1003.1) APIs.
|
||||||
|
|
||||||
|
# The name of this option is mandated by zephyr_interface_library_named
|
||||||
|
# cmake directive.
|
||||||
|
config APP_LINK_WITH_POSIX_SUBSYS
|
||||||
|
bool "Make POSIX headers available to application"
|
||||||
|
default y
|
||||||
|
depends on POSIX_API
|
||||||
|
help
|
||||||
|
Add POSIX subsystem header files to the 'app' include path.
|
||||||
|
|
||||||
|
if POSIX_CLOCK
|
||||||
|
|
||||||
|
config PTHREAD_IPC
|
||||||
|
bool "POSIX pthread IPC API"
|
||||||
|
default y if POSIX_API
|
||||||
|
help
|
||||||
|
This enables a mostly-standards-compliant implementation of
|
||||||
|
the pthread mutex, condition variable and barrier IPC
|
||||||
|
mechanisms.
|
||||||
|
|
||||||
|
endif # POSIX_CLOCK
|
||||||
|
|
||||||
|
rsource "Kconfig.barrier"
|
||||||
|
rsource "Kconfig.clock"
|
||||||
|
rsource "Kconfig.cond"
|
||||||
|
rsource "Kconfig.eventfd"
|
||||||
|
rsource "Kconfig.fdtable"
|
||||||
|
rsource "Kconfig.fnmatch"
|
||||||
|
rsource "Kconfig.fs"
|
||||||
|
rsource "Kconfig.getopt"
|
||||||
|
rsource "Kconfig.key"
|
||||||
|
rsource "Kconfig.mqueue"
|
||||||
|
rsource "Kconfig.mutex"
|
||||||
|
rsource "Kconfig.pthread"
|
||||||
|
rsource "Kconfig.rwlock"
|
||||||
|
rsource "Kconfig.sched"
|
||||||
|
rsource "Kconfig.semaphore"
|
||||||
|
rsource "Kconfig.signal"
|
||||||
|
rsource "Kconfig.spinlock"
|
||||||
|
rsource "Kconfig.stropts"
|
||||||
|
rsource "Kconfig.sysconf"
|
||||||
|
rsource "Kconfig.timer"
|
||||||
|
rsource "Kconfig.uname"
|
||||||
|
|
||||||
|
endmenu # "POSIX Options"
|
|
@ -6,7 +6,7 @@
|
||||||
TYPE = PTHREAD_BARRIER
|
TYPE = PTHREAD_BARRIER
|
||||||
type = pthread_barrier_t
|
type = pthread_barrier_t
|
||||||
type-function = pthread_barrier_wait
|
type-function = pthread_barrier_wait
|
||||||
source "lib/posix/Kconfig.template.pooled_ipc_type"
|
rsource "Kconfig.template.pooled_ipc_type"
|
||||||
|
|
||||||
if PTHREAD_BARRIER
|
if PTHREAD_BARRIER
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
config POSIX_CLOCK
|
config POSIX_CLOCK
|
||||||
bool "POSIX clock and sleep APIs"
|
bool "clock and sleep APIs"
|
||||||
default y if POSIX_API
|
default y if POSIX_API
|
||||||
imply TIMER
|
imply TIMER
|
||||||
depends on !NATIVE_LIBC
|
depends on !NATIVE_LIBC
|
|
@ -6,4 +6,4 @@
|
||||||
TYPE = PTHREAD_COND
|
TYPE = PTHREAD_COND
|
||||||
type = pthread_cond_t
|
type = pthread_cond_t
|
||||||
type-function = pthread_cond_wait
|
type-function = pthread_cond_wait
|
||||||
source "lib/posix/Kconfig.template.pooled_ipc_type"
|
rsource "Kconfig.template.pooled_ipc_type"
|
|
@ -3,7 +3,7 @@
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
config EVENTFD
|
menuconfig EVENTFD
|
||||||
bool "Support for eventfd"
|
bool "Support for eventfd"
|
||||||
depends on !NATIVE_APPLICATION
|
depends on !NATIVE_APPLICATION
|
||||||
select POLL
|
select POLL
|
16
lib/posix/options/Kconfig.fdtable
Normal file
16
lib/posix/options/Kconfig.fdtable
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
# Copyright (c) 2018 Linaro
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
menu "File descriptor table options"
|
||||||
|
|
||||||
|
config POSIX_MAX_FDS
|
||||||
|
int "Maximum number of open file descriptors"
|
||||||
|
default 16 if WIFI_NM_WPA_SUPPLICANT
|
||||||
|
default 16 if POSIX_API
|
||||||
|
default 4
|
||||||
|
help
|
||||||
|
Maximum number of open file descriptors, this includes
|
||||||
|
files, sockets, special devices, etc.
|
||||||
|
|
||||||
|
endmenu # "File descriptor table options"
|
|
@ -2,7 +2,7 @@
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
config POSIX_FS
|
menuconfig POSIX_FS
|
||||||
bool "POSIX file system API support"
|
bool "POSIX file system API support"
|
||||||
default y if POSIX_API
|
default y if POSIX_API
|
||||||
depends on FILE_SYSTEM
|
depends on FILE_SYSTEM
|
|
@ -2,4 +2,4 @@
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
source "lib/posix/getopt/Kconfig"
|
rsource "getopt/Kconfig"
|
|
@ -6,4 +6,4 @@
|
||||||
TYPE = PTHREAD_KEY
|
TYPE = PTHREAD_KEY
|
||||||
type = pthread_key_t
|
type = pthread_key_t
|
||||||
type-function = pthread_setspecific
|
type-function = pthread_setspecific
|
||||||
source "lib/posix/Kconfig.template.pooled_ipc_type"
|
rsource "Kconfig.template.pooled_ipc_type"
|
|
@ -2,8 +2,8 @@
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
config POSIX_MQUEUE
|
menuconfig POSIX_MQUEUE
|
||||||
bool "POSIX message queue"
|
bool "Message queue support"
|
||||||
default y if POSIX_API
|
default y if POSIX_API
|
||||||
help
|
help
|
||||||
This enabled POSIX message queue related APIs.
|
This enabled POSIX message queue related APIs.
|
|
@ -6,4 +6,4 @@
|
||||||
TYPE = PTHREAD_MUTEX
|
TYPE = PTHREAD_MUTEX
|
||||||
type = pthread_mutex_t
|
type = pthread_mutex_t
|
||||||
type-function = pthread_mutex_lock
|
type-function = pthread_mutex_lock
|
||||||
source "lib/posix/Kconfig.template.pooled_ipc_type"
|
rsource "Kconfig.template.pooled_ipc_type"
|
|
@ -6,7 +6,7 @@
|
||||||
TYPE = PTHREAD
|
TYPE = PTHREAD
|
||||||
type = pthread_t
|
type = pthread_t
|
||||||
type-function = pthread_create
|
type-function = pthread_create
|
||||||
source "lib/posix/Kconfig.template.pooled_ipc_type"
|
rsource "Kconfig.template.pooled_ipc_type"
|
||||||
|
|
||||||
if PTHREAD
|
if PTHREAD
|
||||||
|
|
|
@ -5,4 +5,4 @@
|
||||||
TYPE = PTHREAD_RWLOCK
|
TYPE = PTHREAD_RWLOCK
|
||||||
type = pthread_rwlock_t
|
type = pthread_rwlock_t
|
||||||
type-function = pthread_rwlock_timedrdlock
|
type-function = pthread_rwlock_timedrdlock
|
||||||
source "lib/posix/Kconfig.template.pooled_ipc_type"
|
rsource "Kconfig.template.pooled_ipc_type"
|
|
@ -3,7 +3,7 @@
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
config POSIX_PRIORITY_SCHEDULING
|
config POSIX_PRIORITY_SCHEDULING
|
||||||
bool "_POSIX_PRIORITY_SCHEDULING API support"
|
bool "Priority scheduling"
|
||||||
default y if PTHREAD
|
default y if PTHREAD
|
||||||
default y if POSIX_API
|
default y if POSIX_API
|
||||||
depends on PTHREAD
|
depends on PTHREAD
|
|
@ -2,6 +2,8 @@
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
menu "sem_t support"
|
||||||
|
|
||||||
config SEM_VALUE_MAX
|
config SEM_VALUE_MAX
|
||||||
int "Maximum semaphore limit"
|
int "Maximum semaphore limit"
|
||||||
default 32767
|
default 32767
|
||||||
|
@ -16,3 +18,5 @@ config SEM_NAMELEN_MAX
|
||||||
help
|
help
|
||||||
Maximum length of name for a named semaphore.
|
Maximum length of name for a named semaphore.
|
||||||
The max value of 255 corresponds to {NAME_MAX}.
|
The max value of 255 corresponds to {NAME_MAX}.
|
||||||
|
|
||||||
|
endmenu # "sem_t support"
|
|
@ -2,6 +2,17 @@
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
menu "Signal support"
|
||||||
|
|
||||||
|
# needed outside of if clause above to define constants & types in signal.h
|
||||||
|
config POSIX_RTSIG_MAX
|
||||||
|
int "Maximum number of realtime signals"
|
||||||
|
default 31 if POSIX_SIGNAL
|
||||||
|
default 0
|
||||||
|
help
|
||||||
|
Define the maximum number of realtime signals (RTSIG_MAX).
|
||||||
|
The range of realtime signals is [SIGRTMIN .. (SIGRTMIN+RTSIG_MAX)]
|
||||||
|
|
||||||
config POSIX_SIGNAL
|
config POSIX_SIGNAL
|
||||||
bool "Support for POSIX signal APIs"
|
bool "Support for POSIX signal APIs"
|
||||||
default y if POSIX_API
|
default y if POSIX_API
|
||||||
|
@ -17,13 +28,13 @@ config POSIX_SIGNAL_STRING_DESC
|
||||||
Use full description for the strsignal API.
|
Use full description for the strsignal API.
|
||||||
Will use 256 bytes of ROM.
|
Will use 256 bytes of ROM.
|
||||||
|
|
||||||
|
config POSIX_LIMITS_RTSIG_MAX
|
||||||
|
int "_POSIX_RTSIG_MAX value in limits.h"
|
||||||
|
default 8
|
||||||
|
help
|
||||||
|
Define the _POSIX_RTSIG_MAX value in limits.h.
|
||||||
|
IEEE 1003.1 defines this to be 8.
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# needed outside of if clause above to define constants & types in signal.h
|
endmenu # "Signal support"
|
||||||
config POSIX_RTSIG_MAX
|
|
||||||
int "Maximum number of realtime signals"
|
|
||||||
default 31 if POSIX_SIGNAL
|
|
||||||
default 0
|
|
||||||
help
|
|
||||||
Define the maximum number of realtime signals (RTSIG_MAX).
|
|
||||||
The range of realtime signals is [SIGRTMIN .. (SIGRTMIN+RTSIG_MAX)]
|
|
|
@ -5,4 +5,4 @@
|
||||||
TYPE = PTHREAD_SPINLOCK
|
TYPE = PTHREAD_SPINLOCK
|
||||||
type = pthread_spinlock_t
|
type = pthread_spinlock_t
|
||||||
type-function = pthread_spin_lock
|
type-function = pthread_spin_lock
|
||||||
source "lib/posix/Kconfig.template.pooled_ipc_type"
|
rsource "Kconfig.template.pooled_ipc_type"
|
24
lib/posix/options/Kconfig.sysconf
Normal file
24
lib/posix/options/Kconfig.sysconf
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
# Copyright (c) 2024 BayLibre SAS
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
menu "Sysconf support"
|
||||||
|
|
||||||
|
config POSIX_SYSCONF
|
||||||
|
bool "Support for sysconf"
|
||||||
|
default y if POSIX_API
|
||||||
|
help
|
||||||
|
The sysconf() function provides a method for the application to determine
|
||||||
|
the current value of a configurable system limit or option (variable).
|
||||||
|
|
||||||
|
config POSIX_PAGE_SIZE_BITS
|
||||||
|
int "Number of bits to use for PAGE_SIZE"
|
||||||
|
range 6 16
|
||||||
|
default 12 if POSIX_API
|
||||||
|
default 6
|
||||||
|
help
|
||||||
|
Define PAGE_SIZE as BIT(n), where n is the value configured here.
|
||||||
|
PAGE_SIZE is supported in the range [64, 65536]
|
||||||
|
If CONFIG_POSIX_API=y, PAGE_SIZE defaults to 4096, otherwise, it is 64 bytes.
|
||||||
|
|
||||||
|
endmenu # "Sysconf support"
|
|
@ -2,12 +2,11 @@
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
source "lib/posix/Kconfig.template.with_url"
|
rsource "Kconfig.template.with_url"
|
||||||
source "lib/posix/Kconfig.template.with_logging"
|
|
||||||
|
|
||||||
# Not user configurable (i.e. private for now)
|
# Not user configurable (i.e. private for now)
|
||||||
config $(TYPE)
|
menuconfig $(TYPE)
|
||||||
bool "POSIX $(type) support"
|
bool "$(type) support"
|
||||||
depends on PTHREAD_IPC
|
depends on PTHREAD_IPC
|
||||||
default y
|
default y
|
||||||
help
|
help
|
||||||
|
@ -15,10 +14,16 @@ config $(TYPE)
|
||||||
For more info, see
|
For more info, see
|
||||||
$(posix-url-base)/$(type-function).html
|
$(posix-url-base)/$(type-function).html
|
||||||
|
|
||||||
|
if $(TYPE)
|
||||||
|
|
||||||
# eventually, this size should be defaulted to 0
|
# eventually, this size should be defaulted to 0
|
||||||
config MAX_$(TYPE)_COUNT
|
config MAX_$(TYPE)_COUNT
|
||||||
int "Maximum simultaneously active $(type) in POSIX application"
|
int "Maximum number of $(type)"
|
||||||
default 5
|
default 5
|
||||||
depends on $(TYPE)
|
depends on $(TYPE)
|
||||||
help
|
help
|
||||||
Maximum simultaneously active $(type) in a POSIX application.
|
Maximum simultaneously active $(type) in a POSIX application.
|
||||||
|
|
||||||
|
rsource "Kconfig.template.with_logging"
|
||||||
|
|
||||||
|
endif # $(TYPE)
|
|
@ -2,19 +2,24 @@
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
source "lib/posix/Kconfig.template.with_url"
|
rsource "Kconfig.template.with_url"
|
||||||
source "lib/posix/Kconfig.template.with_logging"
|
|
||||||
|
|
||||||
# This is mainly for TIMER currently.
|
# This is mainly for TIMER currently.
|
||||||
config $(TYPE)
|
menuconfig $(TYPE)
|
||||||
bool "POSIX $(type) support"
|
bool "$(type) support"
|
||||||
help
|
help
|
||||||
For more info, see
|
For more info, see
|
||||||
$(posix-url-base)/$(type-function).html
|
$(posix-url-base)/$(type-function).html
|
||||||
|
|
||||||
|
if $(TYPE)
|
||||||
|
|
||||||
# eventually, this size should be defaulted to 0 as a safe value
|
# eventually, this size should be defaulted to 0 as a safe value
|
||||||
config MAX_$(TYPE)_COUNT
|
config MAX_$(TYPE)_COUNT
|
||||||
int "Maximum simultaneously active $(type) in POSIX application"
|
int "Maximum number of $(type)"
|
||||||
default 5
|
default 5
|
||||||
help
|
help
|
||||||
Maximum simultaneously active $(type) in a POSIX application.
|
Maximum simultaneously active $(type) in a POSIX application.
|
||||||
|
|
||||||
|
rsource "Kconfig.template.with_logging"
|
||||||
|
|
||||||
|
endif # $(TYPE)
|
|
@ -5,7 +5,9 @@
|
||||||
TYPE = TIMER
|
TYPE = TIMER
|
||||||
type = timer_t
|
type = timer_t
|
||||||
type-function = timer_create
|
type-function = timer_create
|
||||||
source "lib/posix/Kconfig.template.pooled_type"
|
rsource "Kconfig.template.pooled_type"
|
||||||
|
|
||||||
|
if TIMER
|
||||||
|
|
||||||
config TIMER_CREATE_WAIT
|
config TIMER_CREATE_WAIT
|
||||||
int "Time to wait for timer availability (in msec) in POSIX application"
|
int "Time to wait for timer availability (in msec) in POSIX application"
|
||||||
|
@ -21,3 +23,5 @@ config TIMER_DELAYTIMER_MAX
|
||||||
help
|
help
|
||||||
This controls the maximum number of times a timer can overrun before
|
This controls the maximum number of times a timer can overrun before
|
||||||
timer_getoverrun() in POSIX compliant application.
|
timer_getoverrun() in POSIX compliant application.
|
||||||
|
|
||||||
|
endif # TIMER
|
|
@ -2,7 +2,7 @@
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
config POSIX_UNAME
|
menuconfig POSIX_UNAME
|
||||||
bool "Support for uname"
|
bool "Support for uname"
|
||||||
default y if POSIX_API
|
default y if POSIX_API
|
||||||
help
|
help
|
|
@ -1,6 +1,8 @@
|
||||||
# Copyright (c) 2024 Meta
|
# Copyright (c) 2024 Meta
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
menu "POSIX Shell Utilities"
|
||||||
|
|
||||||
if SHELL
|
if SHELL
|
||||||
|
|
||||||
config POSIX_SHELL
|
config POSIX_SHELL
|
||||||
|
@ -11,3 +13,5 @@ config POSIX_SHELL
|
||||||
rsource "Kconfig.uname"
|
rsource "Kconfig.uname"
|
||||||
|
|
||||||
endif # SHELL
|
endif # SHELL
|
||||||
|
|
||||||
|
endmenu # "POSIX Shell Utilities"
|
||||||
|
|
|
@ -7,4 +7,4 @@ project(posix_philosophers)
|
||||||
target_sources(app PRIVATE src/main.c)
|
target_sources(app PRIVATE src/main.c)
|
||||||
# For translating POSIX scheduler policies and priorities to
|
# For translating POSIX scheduler policies and priorities to
|
||||||
# Zephyr priorities.
|
# Zephyr priorities.
|
||||||
target_include_directories(app PRIVATE ${ZEPHYR_BASE}/lib/posix)
|
target_include_directories(app PRIVATE ${ZEPHYR_BASE}/lib/posix/options)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue