Skip to content

feat(c/net): restore common native networking APIs - #44

Draft
MeteorsLiu wants to merge 8 commits into
goplus:mainfrom
MeteorsLiu:codex/c-net-generated-bindings
Draft

MeteorsLiu wants to merge 8 commits into
goplus:mainfrom
MeteorsLiu:codex/c-net-generated-bindings

Conversation

@MeteorsLiu

@MeteorsLiu MeteorsLiu commented Oct 19, 2026 •

Copy link
Copy Markdown
Member

Restore common native networking APIs and verify every retained symbol on macOS arm64 and Linux amd64/arm64.

The implementation includes:

  • Generate one classified networking binding per platform from macOS 14 and Bootlin glibc 2.24 headers, using unmodified llcppg.
  • Replace duplicate handwritten declarations under the established function names, remove the Native duplicates, retain the original *SockaddrIn arguments for Bind/Accept, and derive socket-storage padding constants from each native layout.
  • Preserve existing *c.Char string contracts, Send/Recv length types, untyped socket constants, and macOS byte-order declarations; root c.Char and c.Printf remain unchanged.
  • Remove kernel/private C entry points and the explicitly approved Linux bindresvport6 declaration, which has no libc export.
  • Check every retained C function's link address and prototype ABI, all generated type layouts and constants, global symbols, and union accessors; exercise binary socket I/O, IPv4/IPv6 numeric resolution, interface enumeration, and TCP loopback.

LLGo v1.0.8 (c171abfa130108bc6451e01fcf15a8a3474eb0a7) passes executed GC and nogc tests on all three targets. These runs use the root c files from #45 at 99ddac92c7335a53a1c996174e1753bcd72c5050; merge #45 first to supply c.Iovec. Standalone CI currently stops at undefined: c.Iovec while that prerequisite is unmerged. This draft changes only c/net, with complete symbol checks making missing exports and ABI regressions visible.

@MeteorsLiu MeteorsLiu changed the title feat(c/net): add generated libc networking bindings feat(c): add native net, OS and pthread bindings Oct 19, 2026
@MeteorsLiu
MeteorsLiu marked this pull request as draft October 19, 2026 05:41
@MeteorsLiu
MeteorsLiu force-pushed the codex/c-net-generated-bindings branch from d813d06 to 9676cd3 Compare October 19, 2026 05:52
@MeteorsLiu MeteorsLiu changed the title feat(c): add native net, OS and pthread bindings feat(c/net): add native libc networking bindings Oct 19, 2026
@MeteorsLiu
MeteorsLiu force-pushed the codex/c-net-generated-bindings branch from 9676cd3 to a6206a0 Compare October 19, 2026 06:00
@MeteorsLiu

MeteorsLiu commented Oct 19, 2026 •

Copy link
Copy Markdown
Member Author

Merge order: #45 → #51 → #48 → #49 → #44 → #47 → #46 → #50 → #52.

This draft changes only c/net. Merge #45 first to supply the shared c.Iovec; validation used its root c files at 99ddac92c7335a53a1c996174e1753bcd72c5050 together with the current networking sources.

The current update removes duplicate Native declarations, preserves the original Bind/Accept IPv4 pointer signatures, and fixes Linux socket-storage padding constants. Existing character-pointer and Send/Recv length contracts remain compatible. Kernel/private C entry points and the explicitly approved Linux bindresvport6 declaration are excluded.

Executed llgo test -count=1 -v ./c/net runs pass on macOS arm64, Linux amd64 and Linux arm64, both with GC and -tags=nogc, using LLGo v1.0.8 (c171abfa). Every retained C function is covered by a link-address and native-prototype check; layouts, constants, globals and generated union accessors also have coverage. The PR remains draft.

Standalone CI currently stops at c/net/libc_linux_amd64.go:886:16: undefined: c.Iovec because #45 has not merged. The six passing package test runs include that documented prerequisite.

@MeteorsLiu MeteorsLiu changed the title feat(c/net): add native libc networking bindings feat(c/net): generate native networking bindings for three targets Oct 19, 2026
@MeteorsLiu MeteorsLiu changed the title feat(c/net): generate native networking bindings for three targets feat(c/net): add classified native networking bindings Oct 19, 2026
@MeteorsLiu MeteorsLiu changed the title feat(c/net): add classified native networking bindings feat(c/net): restore common native networking APIs Oct 19, 2026
@MeteorsLiu
MeteorsLiu force-pushed the codex/c-net-generated-bindings branch from 167ab79 to 661a2a7 Compare October 22, 2026 04:45
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.

1 participant