From 6d23a960dbe54b5fcf38e372ebf7f57e0e3c99ce Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Mon, 25 Sep 2023 12:30:16 +0000 Subject: [PATCH] lib: os: build fdtable conditionally Stop building fdtable by default, make it conditional and build it only when needed. Signed-off-by: Anas Nashif --- drivers/wifi/simplelink/Kconfig.simplelink | 1 + lib/os/CMakeLists.txt | 2 +- lib/os/Kconfig | 7 +++++++ lib/posix/Kconfig.eventfd | 1 + lib/posix/Kconfig.fs | 1 + subsys/net/lib/sockets/Kconfig | 1 + tests/lib/fdtable/prj.conf | 1 + 7 files changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/wifi/simplelink/Kconfig.simplelink b/drivers/wifi/simplelink/Kconfig.simplelink index 6e59c3702d3..f2c5ccacbab 100644 --- a/drivers/wifi/simplelink/Kconfig.simplelink +++ b/drivers/wifi/simplelink/Kconfig.simplelink @@ -8,6 +8,7 @@ menuconfig WIFI_SIMPLELINK select SIMPLELINK_HOST_DRIVER select WIFI_OFFLOAD select NET_L2_WIFI_MGMT + select FDTABLE if WIFI_SIMPLELINK diff --git a/lib/os/CMakeLists.txt b/lib/os/CMakeLists.txt index 5ed076b47ab..4f082716c48 100644 --- a/lib/os/CMakeLists.txt +++ b/lib/os/CMakeLists.txt @@ -9,7 +9,6 @@ zephyr_sources_ifdef(CONFIG_BASE64 base64.c) zephyr_sources( cbprintf_packaged.c dec.c - fdtable.c hex.c printk.c rb.c @@ -22,6 +21,7 @@ zephyr_sources( multi_heap.c ) +zephyr_sources_ifdef(CONFIG_FDTABLE fdtable.c) zephyr_sources_ifdef(CONFIG_ONOFF onoff.c) zephyr_sources_ifdef(CONFIG_NOTIFY notify.c) diff --git a/lib/os/Kconfig b/lib/os/Kconfig index 42465b24f60..f7ad7385df7 100644 --- a/lib/os/Kconfig +++ b/lib/os/Kconfig @@ -3,6 +3,13 @@ menu "OS Support Library" +config FDTABLE + bool "File descriptor table" + help + This file provides generic file descriptor table implementation, suitable + for any I/O object implementing POSIX I/O semantics (i.e. read/write + + aux operations). + config JSON_LIBRARY bool "Build JSON library" help diff --git a/lib/posix/Kconfig.eventfd b/lib/posix/Kconfig.eventfd index 52f9b461f55..0b6fa171741 100644 --- a/lib/posix/Kconfig.eventfd +++ b/lib/posix/Kconfig.eventfd @@ -7,6 +7,7 @@ config EVENTFD bool "Support for eventfd" depends on !NATIVE_APPLICATION select POLL + select FDTABLE default y if POSIX_API help Enable support for event file descriptors, eventfd. An eventfd can diff --git a/lib/posix/Kconfig.fs b/lib/posix/Kconfig.fs index 6ad72fbcff5..1d032910539 100644 --- a/lib/posix/Kconfig.fs +++ b/lib/posix/Kconfig.fs @@ -6,6 +6,7 @@ config POSIX_FS bool "POSIX file system API support" default y if POSIX_API depends on FILE_SYSTEM + select FDTABLE help This enables POSIX style file system related APIs. diff --git a/subsys/net/lib/sockets/Kconfig b/subsys/net/lib/sockets/Kconfig index 655d321ab9b..80f2e94ceec 100644 --- a/subsys/net/lib/sockets/Kconfig +++ b/subsys/net/lib/sockets/Kconfig @@ -5,6 +5,7 @@ menuconfig NET_SOCKETS bool "BSD Sockets compatible API" + select FDTABLE help Provide BSD Sockets like API on top of native Zephyr networking API. diff --git a/tests/lib/fdtable/prj.conf b/tests/lib/fdtable/prj.conf index a6c7e5f1d54..f14a42c8a0e 100644 --- a/tests/lib/fdtable/prj.conf +++ b/tests/lib/fdtable/prj.conf @@ -1,3 +1,4 @@ CONFIG_ZTEST=y CONFIG_POSIX_API=y CONFIG_ZTEST_NEW_API=y +CONFIG_FDTABLE=y