Skip to content

Networking subsystem should not use extensions to the C library beyond the allowed subset #98212

@aescolar

Description

@aescolar

Problem Description

Our coding guidelines limit what C library functions Zephyr code may use:
https://docs.zephyrproject.org/latest/contribute/coding_guidelines/index.html#rule-a-5-c-standard-library-usage-restrictions-in-zephyr-codebase
Today the networking code is using some extensions beyond this. This either limits the C library which can be used to one which supports this extensions, or requires enabling the POSIX_API subsystem (which should not be required by core Zephyr code).

Proposed Change

One way forward/option would be that

  1. We locate all offending uses (for ex. after Networking subsystem should not (re)define C library types, macros or functions #97050 is solved, we (locally) build the networking subsystem ensuring we disable the POSIX subsystem and do not enable any of the feature test macros to enable extensions and see what breaks).
  2. We add to this RFC the list of all offenders, and once we have done that we decide how to proceed for each.
  3. Options may be to either:
    a) Eliminate the use where it can be replaced simply enough with standard functionality
    b) Accept that particular function use as an extra exception to rule Rule A.5: C, and provide it as an option from the common libc, which C libraries can enable if needed.
    c) Accept that particular function use, which is used from the POSIX subsystem if not provided by the C library, but ensure it is a clearly separate component which then networking would enable thru kconfig (without enabling/pulling anything else).
    d) ...

(Added 2025/10/31..) Known so far:

Dependencies

Networking, C library, POSIX_API/POSIX compatibility layer subsystem.

Additional info

This is related to but it is not the same than:

Metadata

Metadata

Assignees

Labels

RFCRequest For Comments: want input from the communityarea: Networkingarea: POSIXPOSIX API Library

Type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions