Skip to content

Conversation

@cfriedt
Copy link
Member

@cfriedt cfriedt commented Oct 7, 2025

This change means that we no longer need to have include/zephyr/posix in the library search path for C libraries that have (at least mostly) conformant POSIX headers. In other words, we use the C library's POSIX headers.

What is nice about this is that it

  1. Eliminates conflicts between Zephyr's POSIX headers and the libc headers
  • C library headers and types used as-is whenever possible
  • Still possible to "fix up" libc headers, as needed, via #include_next <foo.h>
  1. It allows non-POSIX C libraries to also have POSIX support in Zephyr
  2. Ensures that POSIX applications are actually portable (at the source level)
  3. Paves the way for Zephyr's POSIX implementation to become a module
  4. Allows us to finally deprecate CONFIG_POSIX_API (follow-up PR)
    ... probably a lot more

The main commits from this PR are:

  • posix: remove zephyr/posix in header prefixes
    • This was more of a mechanical commit of simply changing <zephyr/posix/...h> to <...h>
  • posix: changes required after removal of zephyr/posix include prefix
    • This could be squashed with the previous commit prior to merging

Dependent changes broken-out to separate PRs:

Note

Compliance checks are a false positives

In some cases, POSIX headers needed to be re-written to take advantage of _FOO_DECLARED and __foo_t_defined macros for types that needed to be present in the header. In those cases, they have been re-assigned the Apache-2.0 license, and their definitions follow that of the specification as closely as possible. E.g. <fnmatch.h>, <sys/stat.h>, <dirent.h>. These were only the POSIX headers that were necessary to change. Remaining POSIX includes will get a makeover as well to follow the specification more strictly at a later date.

Note

This is the last change required before deprecation of CONFIG_POSIX_API in #97855

@cfriedt cfriedt force-pushed the remove-include-zephyr-posix-from-search-path branch 30 times, most recently from 3a5d01c to feb309a Compare October 15, 2025 05:53
@stephanosio stephanosio assigned cfriedt and unassigned stephanosio Oct 18, 2025
@cfriedt cfriedt force-pushed the remove-include-zephyr-posix-from-search-path branch from 59a7b38 to 6af489e Compare October 19, 2025 00:40
#endif

/* pull in sys/timespec.h for struct timespec and _TIMESPEC_DECLARED */
#include "sys/timespec.h"
Copy link
Contributor

Choose a reason for hiding this comment

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

time.h in the arcmwdt toolchain already includes sys/_timespec.h (as you asked earlier), so this line isn’t needed. Otherwise, we’d need to add #define _TIMESPEC_DECLARED here — in arcmwdt, the timespec structure is declared but protected by a different guard. We can add this define temporarily until the headers are aligned in upcoming releases.

Copy link
Member Author

@cfriedt cfriedt Oct 19, 2025

Choose a reason for hiding this comment

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

Ok - I don't have access to the arcmwdt compiler, so this was really just my best attempt as to how to (externally) avoid conflicts.

However, _TIMESPEC_DECLARED would likely also need to be added (it can be done in Zephyr) to ensure that the types aren't mistakenly redefined elsewhere.

What is the arcmwdt guard for struct timespec?

Copy link
Contributor

Choose a reason for hiding this comment

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

In the arcmwdt toolchain, struct timespec is currently guarded by a misleading macro _TIMEVAL_H_ (the same one used in _timeval.h that defines struct timeval).

I’ll handle this on the arcmwdt side to make the guards more consistent. For now, adding #define _TIMESPEC_DECLARED here would be a temporary workaround until the mwdt headers are updated.


#if defined(_POSIX_C_SOURCE)
/*
* POSIX requires time.h to define pid_t and clockid_t
Copy link
Contributor

Choose a reason for hiding this comment

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

pid_t and clockid_t are already defined by time.h in the arcmwdt toolchain, but under different guards. Would it make sense to only add the corresponding guard definitions here instead of redefining the types?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes - I don't have access to the arcmwdt toolchain, so this is all just best effort.

We'll still need either _PID_T_DECLARED or __pid_t_defined in Zephyr to avoid possible conflicts though.

What are the guards used by the arcmwdt toolchain for pid_t and clockid_t? If they are consistent for all types / structs / unions, etc, that would be ideal.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for your effort.

For clockid_t, the guard used in the arcmwdt toolchain is __defined_clockid_t, and there’s currently no guard for pid_t.

Similar to the timespec case, I’ll handle this on the arcmwdt side to ensure all these types are consistently guarded. It’ll take some time until the changes are included in the next release, so for now, we can keep the temporary guards in Zephyr.

@M-Moawad
Copy link
Contributor

M-Moawad commented Oct 19, 2025

Hi @cfriedt

I have tested on arcmwdt the latest changes in this PR, Including those already merged on this PR #97472,
with adding minor local change for timespec struct as descriped in this comment #97152 (comment)
and most of the previously reported issues fixed but still there are some issues as following:

1- Tests portability.posix.headers.arcmwdtlib.with_posix_api and portability.posix.eventfd.arcmwdtlib

[11/222] Building C object CMakeFiles/app.dir/src/_main.c.obj
FAILED: CMakeFiles/app.dir/src/_main.c.obj 
.../MetaWare/arc/bin/ccac -DKERNEL -DK_HEAP_MEM_POOL_SIZE=808 -DTC_RUNID=f79cda01183dffd56b40364a6561b6be -D_POSIX2_C_BIND=200809L -D_POSIX_ASYNCHRONOUS_IO=200809L -D_POSIX_BARRIERS=200809L -D_POSIX_CLOCK_SELECTION=200809L -D_POSIX_CPUTIME=200809L -D_POSIX_C_SOURCE=200809L -D_POSIX_MAPPED_FILES=200809L -D_POSIX_MEMORY_PROTECTION=200809L -D_POSIX_MONOTONIC_CLOCK=200809L -D_POSIX_MULTI_PROCESS=200809L -D_POSIX_PRIORITY_SCHEDULING=200809L -D_POSIX_READER_WRITER_LOCKS=200809L -D_POSIX_REALTIME_SIGNALS=200809L -D_POSIX_SEMAPHORES=200809L -D_POSIX_SIGNALS=200809L -D_POSIX_SPIN_LOCKS=200809L -D_POSIX_THREADS=200809L -D_POSIX_THREAD_ATTR_STACKADDR=200809L -D_POSIX_THREAD_ATTR_STACKSIZE=200809L -D_POSIX_THREAD_CPUTIME=200809L -D_POSIX_THREAD_PRIORITY_SCHEDULING=200809L -D_POSIX_THREAD_PRIO_INHERIT=200809L -D_POSIX_THREAD_PRIO_PROTECT=200809L -D_POSIX_THREAD_PROCESS_SHARED=200809L -D_POSIX_THREAD_SAFE_FUNCTIONS=200809L -D_POSIX_TIMEOUTS=200809L -D_POSIX_TIMERS=200809L -D_POSIX_VERSION=200809L -D_XOPEN_SOURCE=700 -D_XOPEN_STREAMS=200809L -D_XOPEN_UNIX=700 -D_XOPEN_VERSION=700 -D__ZEPHYR__=1 -I.../zephyr/twister-out/nsim_nsim_em/arcmwdt/tests/posix/eventfd/portability.posix.eventfd.arcmwdtlib/zephyr/include/generated/zephyr -I.../zephyr/include -I.../zephyr/twister-out/nsim_nsim_em/arcmwdt/tests/posix/eventfd/portability.posix.eventfd.arcmwdtlib/zephyr/include/generated -I.../zephyr/soc/snps/nsim/arc_classic -I.../zephyr/lib/posix/c_lib_ext/getopt -I.../zephyr/lib/midi2/. -I.../zephyr/subsys/testsuite/include -I.../zephyr/subsys/testsuite/coverage -I.../zephyr/subsys/testsuite/ztest/include -I.../modules/hal/microchip/include -I.../modules/hal/ti/mspm0/source/ti/devices/msp/. -I.../modules/hal/ti/mspm0/source/ti/devices/msp/m0p -I.../modules/hal/ti/mspm0/source/ti/devices/msp/peripherals -I.../modules/hal/ti/mspm0/source/ti/devices/msp/peripherals/m0p -I.../modules/hal/ti/mspm0/source/ti/devices/msp/peripherals/m0p/sysctl -isystem .../zephyr/lib/libc/arcmwdt/include -isystem .../zephyr/lib/libc/common/include -fno-strict-aliasing -Werror -Os -imacros .../zephyr/twister-out/nsim_nsim_em/arcmwdt/tests/posix/eventfd/portability.posix.eventfd.arcmwdtlib/zephyr/include/generated/zephyr/autoconf.h -fno-common -g -Hnocopyr -HL -Hnosdata -Hoff=Stackcheck_alloca -imacros .../zephyr/include/zephyr/toolchain/zephyr_stdint.h -Wformat -Wformat-security -Wno-format-zero-length -Wno-unaligned-pointer-conversion -Wno-incompatible-pointer-types-discards-qualifiers -Wno-typedef-redefinition -Wdouble-promotion -Wno-pointer-sign -Wpointer-arith -Wno-sometimes-uninitialized -Wno-shift-overflow -Wno-missing-braces -Wno-self-assign -Wno-address-of-packed-member -Wno-unused-function -Wno-initializer-overrides -Wno-section -Wno-unknown-warning-option -Wno-unused-variable -Wno-format-invalid-specifier -Wno-gnu -Wno-tautological-compare -Werror=implicit-int -Wno-vla -fmacro-prefix-map=.../zephyr/tests/posix/eventfd=CMAKE_SOURCE_DIR -fmacro-prefix-map=.../zephyr=ZEPHYR_BASE -fmacro-prefix-map=...=WEST_TOPDIR -ffunction-sections -fdata-sections -gdwarf-2 -arcv2em -core3 -Xdiv_rem=radix2 -Xmpy_option=mpyd -Xbitscan -Xswap -Xbarrel_shifter -Xshift_assist -Xdsp2 -Xdsp_complex -Xdsp_divsqrt=radix2 -Xdsp_itu -Xdsp_accshift=full -Xfpus_div -Xfpu_mac -Xfpuda -Xfpus_mpy_slow -Xfpus_div_slow -Xbitstream -Xtimer0 -Xtimer1 -std=c99 -MD -MT CMakeFiles/app.dir/src/_main.c.obj -MF CMakeFiles/app.dir/src/_main.c.obj.d -o CMakeFiles/app.dir/src/_main.c.obj -c .../zephyr/tests/posix/eventfd/src/_main.c
In file included from .../zephyr/tests/posix/eventfd/src/_main.c:7:
In file included from .../zephyr/tests/posix/eventfd/src/_main.h:13:
In file included from .../zephyr/include/zephyr/net/socket.h:1283:
In file included from .../zephyr/lib/libc/arcmwdt/include/arpa/inet.h:10:
.../zephyr/include/zephyr/posix/arpa/inet.h:11:10: fatal error: 'netinet/in.h' file not found
   11 | #include <netinet/in.h>
      |          ^~~~~~~~~~~~~~

2- Test: portability.posix.common.arcmwdtlib

[13/201] Building C object CMakeFiles/app.dir/src/cond.c.obj
FAILED: CMakeFiles/app.dir/src/cond.c.obj 
.../MetaWare/arc/bin/ccac -DKERNEL -DK_HEAP_MEM_POOL_SIZE=4096 -DTC_RUNID=5021328ff1bd6e705209ff31c73071cf -D_POSIX2_C_BIND=200809L -D_POSIX_ASYNCHRONOUS_IO=200809L -D_POSIX_BARRIERS=200809L -D_POSIX_CLOCK_SELECTION=200809L -D_POSIX_CPUTIME=200809L -D_POSIX_C_SOURCE=200809L -D_POSIX_MAPPED_FILES=200809L -D_POSIX_MEMORY_PROTECTION=200809L -D_POSIX_MONOTONIC_CLOCK=200809L -D_POSIX_MULTI_PROCESS=200809L -D_POSIX_PRIORITY_SCHEDULING=200809L -D_POSIX_READER_WRITER_LOCKS=200809L -D_POSIX_REALTIME_SIGNALS=200809L -D_POSIX_SEMAPHORES=200809L -D_POSIX_SIGNALS=200809L -D_POSIX_SPIN_LOCKS=200809L -D_POSIX_THREADS=200809L -D_POSIX_THREAD_ATTR_STACKADDR=200809L -D_POSIX_THREAD_ATTR_STACKSIZE=200809L -D_POSIX_THREAD_CPUTIME=200809L -D_POSIX_THREAD_PRIORITY_SCHEDULING=200809L -D_POSIX_THREAD_PRIO_INHERIT=200809L -D_POSIX_THREAD_PRIO_PROTECT=200809L -D_POSIX_THREAD_PROCESS_SHARED=200809L -D_POSIX_THREAD_SAFE_FUNCTIONS=200809L -D_POSIX_TIMEOUTS=200809L -D_POSIX_TIMERS=200809L -D_POSIX_VERSION=200809L -D_XOPEN_SOURCE=700 -D_XOPEN_STREAMS=200809L -D_XOPEN_UNIX=700 -D_XOPEN_VERSION=700 -D__ZEPHYR__=1 -I.../zephyr/lib/posix/options -I.../zephyr/twister-out/nsim_nsim_em/arcmwdt/tests/posix/common/portability.posix.common.arcmwdtlib/zephyr/include/generated/zephyr -I.../zephyr/include -I.../zephyr/twister-out/nsim_nsim_em/arcmwdt/tests/posix/common/portability.posix.common.arcmwdtlib/zephyr/include/generated -I.../zephyr/soc/snps/nsim/arc_classic -I.../zephyr/lib/posix/c_lib_ext/getopt -I.../zephyr/lib/midi2/. -I.../zephyr/subsys/testsuite/include -I.../zephyr/subsys/testsuite/coverage -I.../zephyr/subsys/testsuite/ztest/include -I.../modules/hal/microchip/include -I.../modules/hal/ti/mspm0/source/ti/devices/msp/. -I.../modules/hal/ti/mspm0/source/ti/devices/msp/m0p -I.../modules/hal/ti/mspm0/source/ti/devices/msp/peripherals -I.../modules/hal/ti/mspm0/source/ti/devices/msp/peripherals/m0p -I.../modules/hal/ti/mspm0/source/ti/devices/msp/peripherals/m0p/sysctl -I.../zephyr/lib/posix -isystem .../zephyr/lib/libc/arcmwdt/include -isystem .../zephyr/lib/libc/common/include -U_POSIX_C_SOURCE -D_POSIX_C_SOURCE=200809L -fno-strict-aliasing -Werror -Os -imacros .../zephyr/twister-out/nsim_nsim_em/arcmwdt/tests/posix/common/portability.posix.common.arcmwdtlib/zephyr/include/generated/zephyr/autoconf.h -fno-common -g -Hnocopyr -HL -Hnosdata -Hoff=Stackcheck_alloca -imacros .../zephyr/include/zephyr/toolchain/zephyr_stdint.h -Wformat -Wformat-security -Wno-format-zero-length -Wno-unaligned-pointer-conversion -Wno-incompatible-pointer-types-discards-qualifiers -Wno-typedef-redefinition -Wdouble-promotion -Wno-pointer-sign -Wpointer-arith -Wno-sometimes-uninitialized -Wno-shift-overflow -Wno-missing-braces -Wno-self-assign -Wno-address-of-packed-member -Wno-unused-function -Wno-initializer-overrides -Wno-section -Wno-unknown-warning-option -Wno-unused-variable -Wno-format-invalid-specifier -Wno-gnu -Wno-tautological-compare -Werror=implicit-int -Wno-vla -fmacro-prefix-map=.../zephyr/tests/posix/common=CMAKE_SOURCE_DIR -fmacro-prefix-map=.../zephyr=ZEPHYR_BASE -fmacro-prefix-map=...=WEST_TOPDIR -ffunction-sections -fdata-sections -gdwarf-2 -arcv2em -core3 -Xdiv_rem=radix2 -Xmpy_option=mpyd -Xbitscan -Xswap -Xbarrel_shifter -Xshift_assist -Xdsp2 -Xdsp_complex -Xdsp_divsqrt=radix2 -Xdsp_itu -Xdsp_accshift=full -Xfpus_div -Xfpu_mac -Xfpuda -Xfpus_mpy_slow -Xfpus_div_slow -Xbitstream -Xtimer0 -Xtimer1 -std=c99 -MD -MT CMakeFiles/app.dir/src/cond.c.obj -MF CMakeFiles/app.dir/src/cond.c.obj.d -o CMakeFiles/app.dir/src/cond.c.obj -c .../zephyr/tests/posix/common/src/cond.c
.../zephyr/tests/posix/common/src/cond.c:7:10: fatal error: 'pthread.h' file not found
    7 | #include <pthread.h>
      |          ^~~~~~~~~~~

3- Test: portability.xsi.single_process.arcmwdtlib

[14/185] Building C object CMakeFiles/app.dir/src/putenv.c.obj
FAILED: CMakeFiles/app.dir/src/putenv.c.obj 
.../MetaWare/arc/bin/ccac -DKERNEL -DK_HEAP_MEM_POOL_SIZE=512 -DTC_RUNID=712d1fc26058069b83fc8af7f6b37309 -D_POSIX2_C_BIND=200809L -D_POSIX_ASYNCHRONOUS_IO=200809L -D_POSIX_BARRIERS=200809L -D_POSIX_CLOCK_SELECTION=200809L -D_POSIX_CPUTIME=200809L -D_POSIX_C_SOURCE=200809L -D_POSIX_MAPPED_FILES=200809L -D_POSIX_MEMORY_PROTECTION=200809L -D_POSIX_MONOTONIC_CLOCK=200809L -D_POSIX_MULTI_PROCESS=200809L -D_POSIX_PRIORITY_SCHEDULING=200809L -D_POSIX_READER_WRITER_LOCKS=200809L -D_POSIX_REALTIME_SIGNALS=200809L -D_POSIX_SEMAPHORES=200809L -D_POSIX_SIGNALS=200809L -D_POSIX_SPIN_LOCKS=200809L -D_POSIX_THREADS=200809L -D_POSIX_THREAD_ATTR_STACKADDR=200809L -D_POSIX_THREAD_ATTR_STACKSIZE=200809L -D_POSIX_THREAD_CPUTIME=200809L -D_POSIX_THREAD_PRIORITY_SCHEDULING=200809L -D_POSIX_THREAD_PRIO_INHERIT=200809L -D_POSIX_THREAD_PRIO_PROTECT=200809L -D_POSIX_THREAD_PROCESS_SHARED=200809L -D_POSIX_THREAD_SAFE_FUNCTIONS=200809L -D_POSIX_TIMEOUTS=200809L -D_POSIX_TIMERS=200809L -D_POSIX_VERSION=200809L -D_XOPEN_SOURCE=700 -D_XOPEN_UNIX=700 -D_XOPEN_VERSION=700 -D__ZEPHYR__=1 -I.../zephyr/lib/posix/options -I.../zephyr/twister-out/nsim_nsim_em/arcmwdt/tests/posix/xsi_single_process/portability.xsi.single_process.arcmwdtlib/zephyr/include/generated/zephyr -I.../zephyr/include -I.../zephyr/twister-out/nsim_nsim_em/arcmwdt/tests/posix/xsi_single_process/portability.xsi.single_process.arcmwdtlib/zephyr/include/generated -I.../zephyr/soc/snps/nsim/arc_classic -I.../zephyr/lib/posix/c_lib_ext/getopt -I.../zephyr/lib/midi2/. -I.../zephyr/subsys/testsuite/include -I.../zephyr/subsys/testsuite/coverage -I.../zephyr/subsys/testsuite/ztest/include -I.../modules/hal/microchip/include -I.../modules/hal/ti/mspm0/source/ti/devices/msp/. -I.../modules/hal/ti/mspm0/source/ti/devices/msp/m0p -I.../modules/hal/ti/mspm0/source/ti/devices/msp/peripherals -I.../modules/hal/ti/mspm0/source/ti/devices/msp/peripherals/m0p -I.../modules/hal/ti/mspm0/source/ti/devices/msp/peripherals/m0p/sysctl -isystem .../zephyr/lib/libc/arcmwdt/include -isystem .../zephyr/lib/libc/common/include -U_POSIX_C_SOURCE -D_POSIX_C_SOURCE=200809L -U_XOPEN_SOURCE -D_XOPEN_SOURCE=700 -fno-strict-aliasing -Werror -Os -imacros .../zephyr/twister-out/nsim_nsim_em/arcmwdt/tests/posix/xsi_single_process/portability.xsi.single_process.arcmwdtlib/zephyr/include/generated/zephyr/autoconf.h -fno-common -g -Hnocopyr -HL -Hnosdata -Hoff=Stackcheck_alloca -imacros .../zephyr/include/zephyr/toolchain/zephyr_stdint.h -Wformat -Wformat-security -Wno-format-zero-length -Wno-unaligned-pointer-conversion -Wno-incompatible-pointer-types-discards-qualifiers -Wno-typedef-redefinition -Wdouble-promotion -Wno-pointer-sign -Wpointer-arith -Wno-sometimes-uninitialized -Wno-shift-overflow -Wno-missing-braces -Wno-self-assign -Wno-address-of-packed-member -Wno-unused-function -Wno-initializer-overrides -Wno-section -Wno-unknown-warning-option -Wno-unused-variable -Wno-format-invalid-specifier -Wno-gnu -Wno-tautological-compare -Werror=implicit-int -Wno-vla -fmacro-prefix-map=.../zephyr/tests/posix/xsi_single_process=CMAKE_SOURCE_DIR -fmacro-prefix-map=.../zephyr=ZEPHYR_BASE -fmacro-prefix-map=...=WEST_TOPDIR -ffunction-sections -fdata-sections -gdwarf-2 -arcv2em -core3 -Xdiv_rem=radix2 -Xmpy_option=mpyd -Xbitscan -Xswap -Xbarrel_shifter -Xshift_assist -Xdsp2 -Xdsp_complex -Xdsp_divsqrt=radix2 -Xdsp_itu -Xdsp_accshift=full -Xfpus_div -Xfpu_mac -Xfpuda -Xfpus_mpy_slow -Xfpus_div_slow -Xbitstream -Xtimer0 -Xtimer1 -std=c99 -MD -MT CMakeFiles/app.dir/src/putenv.c.obj -MF CMakeFiles/app.dir/src/putenv.c.obj.d -o CMakeFiles/app.dir/src/putenv.c.obj -c .../zephyr/tests/posix/xsi_single_process/src/putenv.c
.../zephyr/tests/posix/xsi_single_process/src/putenv.c:42:22: error: call to undeclared function 'putenv'; ISO C99 and later do not support implicit function declarations [-Werror,-Wimplicit-function-declaration]
   42 |                         zexpect_equal(-1, putenv(s), "putenv(%s) unexpectedly succeeded", s);
      |                                           ^
.../zephyr/tests/posix/xsi_single_process/src/putenv.c:42:22: note: did you mean 'getenv'?
.../MetaWare/arc/inc/stdlib.h:141:25: note: 'getenv' declared here
  141 | extern  char *          getenv(const char *__name);
      |                         ^
.../zephyr/tests/posix/xsi_single_process/src/putenv.c:57:15: error: call to undeclared function 'putenv'; ISO C99 and later do not support implicit function declarations [-Werror,-Wimplicit-function-declaration]
   57 |                         zexpect_ok(putenv(buf), "putenv(%s) failed: %d", buf, errno);
      |                                    ^

4- Test: sample.posix.philosopher

[197/202] Linking C executable zephyr/zephyr_pre0.elf
FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map .../zephyr/twister-out/nsim_nsim_em/arcmwdt/samples/posix/philosophers/sample.posix.philosopher/zephyr/zephyr_pre0.map 
: && .../MetaWare/arc/bin/ccac  -Os zephyr/CMakeFiles/zephyr_pre0.dir/misc/empty_file.c.obj -o zephyr/zephyr_pre0.elf  zephyr/CMakeFiles/offsets.dir/./arch/arc/core/offsets/offsets.c.obj  -Wl,-T.../zephyr/twister-out/nsim_nsim_em/arcmwdt/samples/posix/philosophers/sample.posix.philosopher/zephyr/linker_zephyr_pre0.cmd  -Wl,--gc-sections  -Wl,--entry=__start  -Wl,--Map=.../zephyr/twister-out/nsim_nsim_em/arcmwdt/samples/posix/philosophers/sample.posix.philosopher/zephyr/zephyr_pre0.map  -Wl,--whole-archive  app/libapp.a  zephyr/libzephyr.a  zephyr/arch/common/libarch__common.a  zephyr/arch/arch/arc/core/libarch__arc__core.a  zephyr/arch/arch/arc/core/mpu/libarch__arc__core__mpu.a  zephyr/lib/libc/minimal/liblib__libc__minimal.a  zephyr/lib/libc/common/liblib__libc__common.a  zephyr/lib/posix/eventfd/liblib__posix__eventfd.a  zephyr/lib/posix/c_lib_ext/liblib__posix__c_lib_ext.a  zephyr/lib/posix/options/liblib__posix__options.a  zephyr/lib/os/zvfs/liblib__os__zvfs.a  zephyr/subsys/fs/libsubsys__fs.a  zephyr/drivers/interrupt_controller/libdrivers__interrupt_controller.a  zephyr/drivers/console/libdrivers__console.a  zephyr/drivers/hwinfo/libdrivers__hwinfo.a  zephyr/drivers/serial/libdrivers__serial.a  zephyr/drivers/timer/libdrivers__timer.a  -Wl,--no-whole-archive  zephyr/kernel/libkernel.a  -L.../zephyr/twister-out/nsim_nsim_em/arcmwdt/samples/posix/philosophers/sample.posix.philosopher/zephyr  zephyr/arch/common/libisr_tables.a  -Wl,--fatal-warnings  -Wl,--sort-section=alignment  -Wl,-u_OffsetAbsSyms  -Wl,-u_ConfigAbsSyms  -Hnosdata  -Xtimer0  -Hnoxcheck_obj  -Hnocplus  -Hhostlib=  -Hheap=0  -Hnoivt  -Hnocrt  -Hlld  -Hnolib  -Hldopt=-lmw  -Wl,--orphan-handling=warn  -Wl,-u_sw_isr_table  -Wl,-u_irq_vector_table && cd .../zephyr/twister-out/nsim_nsim_em/arcmwdt/samples/posix/philosophers/sample.posix.philosopher/zephyr && /usr/bin/cmake -E true
LLD 19.1.7 ([email protected]:MetaWare/mwdt-llvm-project.git 6e6a2977c910af2789d5d84f158849b1a3cebb54)
lldac: error: zephyr/libzephyr.a(thread_info.c.obj):(.dbg_thread_info._kernel_thread_info_offsets) is absent from any SECTIONS specification and has been appended to '.dbg_thread_info'
lldac: error: zephyr/libzephyr.a(thread_info.c.obj):(.dbg_thread_info._kernel_thread_info_num_offsets) is absent from any SECTIONS specification and has been appended to '.dbg_thread_info'
lldac: error: zephyr/libzephyr.a(thread_info.c.obj):(.dbg_thread_info._kernel_thread_info_size_t_size) is absent from any SECTIONS specification and has been appended to '.dbg_thread_info'

5- Test: portability.posix.single_process.arcmwdtlib

[11/139] Building C object CMakeFiles/app.dir/src/confstr.c.obj
FAILED: CMakeFiles/app.dir/src/confstr.c.obj 
.../MetaWare/arc/bin/ccac -DKERNEL -DK_HEAP_MEM_POOL_SIZE=0 -DTC_RUNID=7c625f08c0f0d8ff4ca56a8ce4a6b0d0 -D_BSD_SOURCE -D_POSIX2_C_BIND=200809L -D_POSIX_C_SOURCE=200809L -D_POSIX_THREAD_SAFE_FUNCTIONS=200809L -D_POSIX_VERSION=200809L -D__ZEPHYR__=1 -I.../zephyr/twister-out/nsim_nsim_em/arcmwdt/tests/posix/single_process/portability.posix.single_process.arcmwdtlib/zephyr/include/generated/zephyr -I.../zephyr/include -I.../zephyr/twister-out/nsim_nsim_em/arcmwdt/tests/posix/single_process/portability.posix.single_process.arcmwdtlib/zephyr/include/generated -I.../zephyr/soc/snps/nsim/arc_classic -I.../zephyr/lib/posix/c_lib_ext/getopt -I.../zephyr/lib/midi2/. -I.../zephyr/subsys/testsuite/include -I.../zephyr/subsys/testsuite/coverage -I.../zephyr/subsys/testsuite/ztest/include -I.../modules/hal/microchip/include -I.../modules/hal/ti/mspm0/source/ti/devices/msp/. -I.../modules/hal/ti/mspm0/source/ti/devices/msp/m0p -I.../modules/hal/ti/mspm0/source/ti/devices/msp/peripherals -I.../modules/hal/ti/mspm0/source/ti/devices/msp/peripherals/m0p -I.../modules/hal/ti/mspm0/source/ti/devices/msp/peripherals/m0p/sysctl -isystem .../zephyr/lib/libc/arcmwdt/include -isystem .../zephyr/lib/libc/common/include -U_POSIX_C_SOURCE -D_POSIX_C_SOURCE=200809L -fno-strict-aliasing -Werror -Os -imacros .../zephyr/twister-out/nsim_nsim_em/arcmwdt/tests/posix/single_process/portability.posix.single_process.arcmwdtlib/zephyr/include/generated/zephyr/autoconf.h -fno-common -g -Hnocopyr -HL -Hnosdata -Hoff=Stackcheck_alloca -imacros .../zephyr/include/zephyr/toolchain/zephyr_stdint.h -Wformat -Wformat-security -Wno-format-zero-length -Wno-unaligned-pointer-conversion -Wno-incompatible-pointer-types-discards-qualifiers -Wno-typedef-redefinition -Wdouble-promotion -Wno-pointer-sign -Wpointer-arith -Wno-sometimes-uninitialized -Wno-shift-overflow -Wno-missing-braces -Wno-self-assign -Wno-address-of-packed-member -Wno-unused-function -Wno-initializer-overrides -Wno-section -Wno-unknown-warning-option -Wno-unused-variable -Wno-format-invalid-specifier -Wno-gnu -Wno-tautological-compare -Werror=implicit-int -Wno-vla -fmacro-prefix-map=.../zephyr/tests/posix/single_process=CMAKE_SOURCE_DIR -fmacro-prefix-map=.../zephyr=ZEPHYR_BASE -fmacro-prefix-map=...=WEST_TOPDIR -ffunction-sections -fdata-sections -gdwarf-2 -arcv2em -core3 -Xdiv_rem=radix2 -Xmpy_option=mpyd -Xbitscan -Xswap -Xbarrel_shifter -Xshift_assist -Xdsp2 -Xdsp_complex -Xdsp_divsqrt=radix2 -Xdsp_itu -Xdsp_accshift=full -Xfpus_div -Xfpu_mac -Xfpuda -Xfpus_mpy_slow -Xfpus_div_slow -Xbitstream -Xtimer0 -Xtimer1 -std=c99 -MD -MT CMakeFiles/app.dir/src/confstr.c.obj -MF CMakeFiles/app.dir/src/confstr.c.obj.d -o CMakeFiles/app.dir/src/confstr.c.obj -c .../zephyr/tests/posix/single_process/src/confstr.c
.../zephyr/tests/posix/single_process/src/confstr.c:33:5: error: use of undeclared identifier '_CS_PATH'
   33 |                         {_CS_PATH, NULL, 0},
      |                          ^
.../zephyr/tests/posix/single_process/src/confstr.c:34:5: error: use of undeclared identifier '_CS_PATH'
   34 |                         {_CS_PATH, buf, 0},
      |                          ^
.../zephyr/tests/posix/single_process/src/confstr.c:38:5: error: use of undeclared identifier '_CS_PATH'
   38 |                         {_CS_PATH, NULL, sizeof(buf)},
      |                          ^
.../zephyr/tests/posix/single_process/src/confstr.c:43:21: error: call to undeclared function 'confstr'; ISO C99 and later do not support implicit function declarations [-Werror,-Wimplicit-function-declaration]
   43 |                         zassert_equal(0, confstr(arg->name, arg->buf, arg->len));
      |                                          ^
.../zephyr/tests/posix/single_process/src/confstr.c:47:3: error: invalid application of 'sizeof' to an incomplete type 'const struct arg[]'
   47 |                 ARRAY_FOR_EACH_PTR(arg2s, arg) {
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.../zephyr/include/zephyr/sys/util.h:237:72: note: expanded from macro 'ARRAY_FOR_EACH_PTR'
  237 |         for (__typeof__(*(array)) *ptr = (array); (size_t)((ptr) - (array)) < ARRAY_SIZE(array);   \
      |                                                                               ^~~~~~~~~~~~~~~~~
.../zephyr/include/zephyr/sys/util.h:118:62: note: expanded from macro 'ARRAY_SIZE'
  118 | #define ARRAY_SIZE(array) ((size_t)(IS_ARRAY(array) + (sizeof(array) / sizeof((array)[0]))))
      |                                                              ^~~~~~~
.../zephyr/tests/posix/single_process/src/confstr.c:50:17: error: call to undeclared function 'confstr'; ISO C99 and later do not support implicit function declarations [-Werror,-Wimplicit-function-declaration]
   50 |                         zassert_true(confstr(arg->name, arg->buf, arg->len) > 0);
      |                                      ^
.../zephyr/tests/posix/single_process/src/confstr.c:55:3: error: invalid application of 'sizeof' to an incomplete type 'const struct arg[]'
   55 |                 ARRAY_FOR_EACH_PTR(arg3s, arg) {
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.../zephyr/include/zephyr/sys/util.h:237:72: note: expanded from macro 'ARRAY_FOR_EACH_PTR'
  237 |         for (__typeof__(*(array)) *ptr = (array); (size_t)((ptr) - (array)) < ARRAY_SIZE(array);   \
      |                                                                               ^~~~~~~~~~~~~~~~~
.../zephyr/include/zephyr/sys/util.h:118:62: note: expanded from macro 'ARRAY_SIZE'
  118 | #define ARRAY_SIZE(array) ((size_t)(IS_ARRAY(array) + (sizeof(array) / sizeof((array)[0]))))
      |                                                              ^~~~~~~
.../zephyr/tests/posix/single_process/src/confstr.c:57:17: error: call to undeclared function 'confstr'; ISO C99 and later do not support implicit function declarations [-Werror,-Wimplicit-function-declaration]
   57 |                         zassert_true(confstr(arg->name, arg->buf, arg->len) > 0);
      |                                      ^
.../zephyr/tests/posix/single_process/src/confstr.c:63:15: error: call to undeclared function 'confstr'; ISO C99 and later do not support implicit function declarations [-Werror,-Wimplicit-function-declaration]
   63 |         zassert_true(confstr(_CS_PATH, buf, sizeof(buf) > 0));
      |                      ^
.../zephyr/tests/posix/single_process/src/confstr.c:63:23: error: use of undeclared identifier '_CS_PATH'
   63 |         zassert_true(confstr(_CS_PATH, buf, sizeof(buf) > 0));
      |                              ^

6- Tests: portability.posix.headers.arcmwdtlib.without_posix_api, portability.posix.headers.minimal.without_posix_api and portability.posix.headers.without_posix_api

warning: POSIX_DEVICE_IO (defined at lib/posix/options/Kconfig.device_io:7) was assigned the value
'y' but got the value 'n'. Check these unsatisfied dependencies: POSIX_SYSTEM_INTERFACES (=n). See
http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_POSIX_DEVICE_IO and/or look up
POSIX_DEVICE_IO in the menuconfig/guiconfig interface. The Application Development Primer, Setting
Configuration Values, and Kconfig - Tips and Best Practices sections of the manual might be helpful
too.


warning: POSIX_FILE_SYSTEM (defined at lib/posix/options/Kconfig.fs:5) was assigned the value 'y'
but got the value 'n'. Check these unsatisfied dependencies: POSIX_SYSTEM_INTERFACES (=n). See
http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_POSIX_FILE_SYSTEM and/or look up
POSIX_FILE_SYSTEM in the menuconfig/guiconfig interface. The Application Development Primer, Setting
Configuration Values, and Kconfig - Tips and Best Practices sections of the manual might be helpful
too.


warning: POSIX_MESSAGE_PASSING (defined at lib/posix/options/Kconfig.mqueue:5) was assigned the
value 'y' but got the value 'n'. Check these unsatisfied dependencies: POSIX_SYSTEM_INTERFACES (=n).
See http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_POSIX_MESSAGE_PASSING and/or look up
POSIX_MESSAGE_PASSING in the menuconfig/guiconfig interface. The Application Development Primer,
Setting Configuration Values, and Kconfig - Tips and Best Practices sections of the manual might be
helpful too.


warning: POSIX_NETWORKING (defined at lib/posix/options/Kconfig.net:5) was assigned the value 'y'
but got the value 'n'. Check these unsatisfied dependencies: POSIX_SYSTEM_INTERFACES (=n). See
http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_POSIX_NETWORKING and/or look up
POSIX_NETWORKING in the menuconfig/guiconfig interface. The Application Development Primer, Setting
Configuration Values, and Kconfig - Tips and Best Practices sections of the manual might be helpful
too.


warning: POSIX_THREADS (defined at lib/posix/options/Kconfig.pthread:7) was assigned the value 'y'
but got the value 'n'. Check these unsatisfied dependencies: POSIX_SYSTEM_INTERFACES (=n). See
http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_POSIX_THREADS and/or look up POSIX_THREADS
in the menuconfig/guiconfig interface. The Application Development Primer, Setting Configuration
Values, and Kconfig - Tips and Best Practices sections of the manual might be helpful too.


warning: POSIX_PRIORITY_SCHEDULING (defined at lib/posix/options/Kconfig.sched:7) was assigned the
value 'y' but got the value 'n'. Check these unsatisfied dependencies: POSIX_SYSTEM_INTERFACES (=n).
See http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_POSIX_PRIORITY_SCHEDULING and/or look
up POSIX_PRIORITY_SCHEDULING in the menuconfig/guiconfig interface. The Application Development
Primer, Setting Configuration Values, and Kconfig - Tips and Best Practices sections of the manual
might be helpful too.


warning: POSIX_TIMERS (defined at lib/posix/options/Kconfig.timer:6) was assigned the value 'y' but
got the value 'n'. Check these unsatisfied dependencies: POSIX_SYSTEM_INTERFACES (=n). See
http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_POSIX_TIMERS and/or look up POSIX_TIMERS in
the menuconfig/guiconfig interface. The Application Development Primer, Setting Configuration
Values, and Kconfig - Tips and Best Practices sections of the manual might be helpful too.


warning: XSI_STREAMS (defined at lib/posix/options/Kconfig.xsi_streams:5) was assigned the value 'y'
but got the value 'n'. Check these unsatisfied dependencies: XSI (=n), POSIX_SYSTEM_INTERFACES (=n).
See http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_XSI_STREAMS and/or look up XSI_STREAMS
in the menuconfig/guiconfig interface. The Application Development Primer, Setting Configuration
Values, and Kconfig - Tips and Best Practices sections of the manual might be helpful too.

Parsing .../zephyr/Kconfig
Loaded configuration '.../zephyr/boards/snps/nsim/arc_classic/nsim_nsim_em_defconfig'
Merged configuration '.../zephyr/tests/posix/headers/prj.conf'
Merged configuration '.../zephyr/build/zephyr/misc/generated/extra_kconfig_options.conf'
Configuration saved to '.../zephyr/build/zephyr/.config'
Kconfig header saved to '.../zephyr/build/zephyr/include/generated/zephyr/autoconf.h'
-- Found GNU objcopy helper for MWDT: .../zephyr-sdk-0.17.1/arc-zephyr-elf/bin/arc-zephyr-elf-objcopy (Zephyr SDK 0.17.1)
-- Found GNU strip helper for MWDT: .../zephyr-sdk-0.17.1/arc-zephyr-elf/bin/arc-zephyr-elf-strip (Zephyr SDK 0.17.1)
-- The C compiler identification is Clang 19.1.7
-- The CXX compiler identification is Clang 19.1.7
-- The ASM compiler identification is unknown
-- Found assembler: .../MetaWare/arc/bin/ccac
-- Warning: Did not find file Compiler/-ASM
CMake Deprecation Warning at .../zephyr/cmake/modules/FindDeprecated.cmake:45 (message):
  The macro/function 'toolchain_ld_base' is deprecated.  Please use
  'arcmwdt/linker_flags.cmake' and define the appropriate linker flags as
  properties instead.  See
  '.../zephyr/cmake/linker/linker_flags_template.cmake'
  for known linker properties.
Call Stack (most recent call first):
  .../zephyr/CMakeLists.txt:471 (find_package)


CMake Deprecation Warning at .../zephyr/cmake/modules/FindDeprecated.cmake:61 (message):
  The macro/function 'toolchain_ld_baremetal' is deprecated.  Please use
  'arcmwdt/linker_flags.cmake' and define the appropriate linker flags as
  properties instead.  See
  '.../zephyr/cmake/linker/linker_flags_template.cmake'
  for known linker properties.
Call Stack (most recent call first):
  .../zephyr/CMakeLists.txt:503 (find_package)


CMake Warning at .../zephyr/subsys/random/CMakeLists.txt:12 (message):
  

      Warning: CONFIG_TIMER_RANDOM_GENERATOR and CONFIG_TEST_CSPRNG_GENERATOR are
      not truly random generators. This capability is not secure and it is
      provided for testing purposes only. Use it carefully.


-- Warning: Did not find file Compiler/-ASM
-- Found gen_kobject_list: .../zephyr/scripts/build/gen_kobject_list.py
CMake Warning at .../zephyr/CMakeLists.txt:1124 (message):
  No SOURCES given to Zephyr library: drivers__entropy

  Excluding target from build.


-- Configuring done (35.3s)
-- Generating done (1.4s)
-- Build files have been written to: .../zephyr/build
-- west build: building application
[1/202] Preparing syscall dependency handling

[3/202] Generating include/generated/zephyr/version.h
-- Zephyr version: 4.2.99 (.../zephyr), build: v4.2.0-6174-gaf2b4a2ee08d
[12/202] Building C object CMakeFiles/app.dir/src/aio_h.c.obj
FAILED: CMakeFiles/app.dir/src/aio_h.c.obj 
.../MetaWare/arc/bin/ccac -DKERNEL -DK_HEAP_MEM_POOL_SIZE=0 -D_POSIX_THREAD_SAFE_FUNCTIONS=200809L -D__ZEPHYR__=1 -I.../zephyr/build/zephyr/include/generated/zephyr -I.../zephyr/include -I.../zephyr/build/zephyr/include/generated -I.../zephyr/soc/snps/nsim/arc_classic -I.../zephyr/include/zephyr/posix -I.../zephyr/lib/posix/c_lib_ext/getopt -I.../zephyr/lib/midi2/. -I.../zephyr/subsys/testsuite/include -I.../zephyr/subsys/testsuite/coverage -I.../zephyr/subsys/testsuite/ztest/include -I.../modules/hal/microchip/include -I.../modules/hal/ti/mspm0/source/ti/devices/msp/. -I.../modules/hal/ti/mspm0/source/ti/devices/msp/m0p -I.../modules/hal/ti/mspm0/source/ti/devices/msp/peripherals -I.../modules/hal/ti/mspm0/source/ti/devices/msp/peripherals/m0p -I.../modules/hal/ti/mspm0/source/ti/devices/msp/peripherals/m0p/sysctl -isystem .../zephyr/lib/libc/minimal/include -isystem .../zephyr/lib/libc/common/include -isystem .../MetaWare/../MetaWare/arc/inc -U_POSIX_C_SOURCE -D_POSIX_C_SOURCE=200809L -fno-strict-aliasing -Os -imacros .../zephyr/build/zephyr/include/generated/zephyr/autoconf.h -Hnocrt -fno-common -g -Hnocopyr -HL -Hnosdata -Hoff=Stackcheck_alloca -fno-builtin -imacros .../zephyr/include/zephyr/toolchain/zephyr_stdint.h -Wformat -Wformat-security -Wno-format-zero-length -Wno-unaligned-pointer-conversion -Wno-incompatible-pointer-types-discards-qualifiers -Wno-typedef-redefinition -Wdouble-promotion -Wno-pointer-sign -Wpointer-arith -Wno-sometimes-uninitialized -Wno-shift-overflow -Wno-missing-braces -Wno-self-assign -Wno-address-of-packed-member -Wno-unused-function -Wno-initializer-overrides -Wno-section -Wno-unknown-warning-option -Wno-unused-variable -Wno-format-invalid-specifier -Wno-gnu -Wno-tautological-compare -Werror=implicit-int -Wno-vla -fmacro-prefix-map=.../zephyr/tests/posix/headers=CMAKE_SOURCE_DIR -fmacro-prefix-map=.../zephyr=ZEPHYR_BASE -fmacro-prefix-map=...=WEST_TOPDIR -ffunction-sections -fdata-sections -gdwarf-2 -arcv2em -core3 -Xdiv_rem=radix2 -Xmpy_option=mpyd -Xbitscan -Xswap -Xbarrel_shifter -Xshift_assist -Xdsp2 -Xdsp_complex -Xdsp_divsqrt=radix2 -Xdsp_itu -Xdsp_accshift=full -Xfpus_div -Xfpu_mac -Xfpuda -Xfpus_mpy_slow -Xfpus_div_slow -Xbitstream -Xtimer0 -Xtimer1 -std=c99 -Hno_default_include -Hnoarcexlib -U__STDC_LIB_EXT1__ -MD -MT CMakeFiles/app.dir/src/aio_h.c.obj -MF CMakeFiles/app.dir/src/aio_h.c.obj.d -o CMakeFiles/app.dir/src/aio_h.c.obj -c .../zephyr/tests/posix/headers/src/aio_h.c
In file included from .../zephyr/tests/posix/headers/src/aio_h.c:9:
In file included from .../zephyr/include/zephyr/posix/aio.h:13:
In file included from .../zephyr/lib/libc/minimal/include/signal.h:41:
.../zephyr/include/zephyr/posix/posix_signal.h:142:15: error: field has incomplete type 'union sigval'
  142 |         union sigval si_value;
      |                      ^
.../zephyr/include/zephyr/posix/posix_signal.h:142:8: note: forward declaration of 'union sigval'
  142 |         union sigval si_value;
      |               ^

@cfriedt cfriedt force-pushed the remove-include-zephyr-posix-from-search-path branch from 6af489e to 753df37 Compare October 20, 2025 00:19
@cfriedt
Copy link
Member Author

cfriedt commented Oct 20, 2025

@M-Moawad - another revision which maybe addresses address all of your concerns (🤷‍♂️)

A side note, we may be breaking a world record for the least efficient way to compile code. Without having arcmwdt in CI or having a copy of the toolchain myself, this could take a while.

Would it make sense for Synopsys to add a bugfix PR post-feature-freeze? There is still quite a bit of time to fix bugs after October 24th, but not a lot of time to get these fairly critical changes in before then.

From what I can tell, the arcmwdt headers are very similar to newlib headers, so it might work to clone many of the workarounds for that libc for yours.

@M-Moawad
Copy link
Contributor

Would it make sense for Synopsys to add a bugfix PR post-feature-freeze? There is still quite a bit of time to fix bugs after October 24th, but not a lot of time to get these fairly critical changes in before then.

I focused on this PR because you specifically pointed me to it from the reported issue. I understand your points, so let’s keep going to get this PR merged. I’ll continue with the bug fixes after that.

CONFIG_XOPEN_STREAMS does not follow the pattern of other XSI Option
Groups, where the Option Group name is not the same as the feature
test macro that indicates it is supported by the implementation.

Deprecate CONFIG_XOPEN_STREAMS and rename it to CONFIG_XSI_STREAMS.

For more information, please see
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/\
V1_chap02.html#tag_02_01_05_09

Signed-off-by: Chris Friedt <[email protected]>
Deprecate the CONFIG_XOPEN_STREAMS Kconfig option in favour of
CONFIG_XSI_STREAMS, which matches the naming conventions of other XSI
Kconfig options and the actual Option Group name in the specification.

Please use CONFIG_XSI_STREAMS instead.

Signed-off-by: Chris Friedt <[email protected]>
This change mitigates some code sonar issues (from SonarQube).

1. explicit 'U' after 0xffffffff

> A cast shall not remove any const or volatile qualification from the
> type of a pointer or reference c:S859

2. check return value from call to pthread_barrierattr_getpshared()

> Unused assignments should be removed c:S1854

Signed-off-by: Chris Friedt <[email protected]>
This mitigates a sonarqube warning

"Value stored to 'cvalue' is never read"

> Unused assignments should be removed c:S1854

https://sonarcloud.io/project/issues?pullRequest=97152&\
open=AZnAZi4C7BgzESPFIGwf&id=zephyrproject-rtos_zephyr

Signed-off-by: Chris Friedt <[email protected]>
This change mitigates a sonarqube warning about uninitialized variables.

"1st function call argument is an uninitialized value"

> Variables should be initialized before use c:S836

https://sonarcloud.io/project/issues?pullRequest=97152&\
open=AZnAZi0m7BgzESPFIGwe&id=zephyrproject-rtos_zephyr

Signed-off-by: Chris Friedt <[email protected]>
If C libraries provide conformant POSIX headers, then use the headers
provided by the C library.

Otherwise, C library maintainers may add `include/zephyr/posix` to their
standard search path.

Signed-off-by: Chris Friedt <[email protected]>
This change removes the requirement to have `<zephyr/posix/...>` prefixing
all standard POSIX includes in Zephyr.

The main reason that it was required was due to conflicts between C
library time.h, signal.h and the fact that Zephyr posix headers were being
somewhat ad-hoc mixed with libc posix headers.

Now, any (even partially) POSIX-conformant C libraries are expected to
provide their own types, constants, and headers, and Zephyr's
implementation uses those definitions.

If any definitions are missing, we define them on a per-libc basis. This
can also be done out-of-tree, which allows for implementors to take
advantage of the `CONFIG_TC_PROVIDES_POSIX..` options.

This is likely the last major commit required before we deprecate the
`CONFIG_POSIX_API` Kconfig option in favour of POSIX subprofiling \o/

Signed-off-by: Chris Friedt <[email protected]>
Additional workarounds for POSIX compatibility with the arcmwdt
toolchain.

This commit addresses issues described in the comment linked below.

https://github.com/zephyrproject-rtos/zephyr/pull/97152#\
issuecomment-3409956230

Signed-off-by: Chris Friedt <[email protected]>
@cfriedt cfriedt force-pushed the remove-include-zephyr-posix-from-search-path branch from 753df37 to 3a97fd0 Compare October 20, 2025 20:09
@cfriedt
Copy link
Member Author

cfriedt commented Oct 20, 2025

@M-Moawad - can we keep the chat going via Discord?

@cfriedt
Copy link
Member Author

cfriedt commented Oct 20, 2025

@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
D Security Rating on New Code (required ≥ C)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@cfriedt
Copy link
Member Author

cfriedt commented Oct 21, 2025

@M-Moawad - going to close this in favour of #97855.

Please get in touch with me on discord if there are any changes I can make I'm the meantime

@cfriedt cfriedt closed this Oct 21, 2025
@M-Moawad
Copy link
Contributor

Please get in touch with me on discord if there are any changes I can make I'm the meantime

Discord isn't accessible from my work machine where the logs are located, and I can't access the logs from my personal account.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants