Skip to content

Contradicting SOL_TCP and SOL_UDP definition for p1 #855

Description

@ChihweiLHBird

They are not defined within the p1 scope in libc-bottom-half/headers/public/__header_sys_socket.h:

#define SOL_TCP 6
#define SOL_UDP 17

But they are included in expected/wasm32-wasip1/predefined-macros.txt:
https://github.com/WebAssembly/wasi-libc/blob/0d5332aceea8e72698b6abc270550e666ba97aea/expected/wasm32-wasip1/predefined-macros.txt

Which one should be the source of truth?

Activity

  1. Hokila commented on Aug 29, 2026

    @Hokila

    Thanks for filing this. I traced the current p1/p2/p3 header split at commit e1655e8:

    • In libc-bottom-half/headers/public/__header_sys_socket.h, SOL_TCP 6 and SOL_UDP 17 are defined only in the __wasip2__ || __wasip3__ branch; the __wasip1__ branch includes <wasi/api.h> and defines the MSG constants but not these two socket-level constants.
    • libc-top-half/musl/include/netinet/tcp.h and udp.h define SOL_TCP 6 and SOL_UDP 17, respectively.
    • The generated p1 predefined-macro snapshot nevertheless contains both values, while the p2/p3 snapshots get them from the public socket header path.

    Before I write the regression test, could you confirm the intended source of truth for p1: should SOL_TCP/SOL_UDP be added to the p1 branch of __header_sys_socket.h, or should the generated p1 expectation remain derived through the netinet headers? I will keep the patch scoped to p1 and preserve the p2/p3 behavior.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions