Skip to content

feat(libkernel): implement socketpair - #1728

Closed
HyperDarkmoon wants to merge 1 commit into
boykopovar:mainfrom
HyperDarkmoon:feat/libkernel-socketpair
Closed

HyperDarkmoon wants to merge 1 commit into
boykopovar:mainfrom
HyperDarkmoon:feat/libkernel-socketpair

Conversation

@HyperDarkmoon

Copy link
Copy Markdown

feat(libkernel): implement socketpair

Nineteen titles in the #1578 audit import socketpair from libkernel and
no built module exports it, so the loader stops at start-up.

The pair is two guest sockets of family 1, AF_UNIX as FreeBSD numbers
it: a host socketpair(AF_UNIX, ...) on Linux, and on Windows, where
Winsock has none, both ends of one loopback TCP connection for a stream
pair and two loopback UDP sockets connected to each other for a datagram
pair. Both ends are registered under one lock and both descriptors are
written together, so a failure leaves them at -1.

An unnamed socketpair end carries no name, so getsockname, getpeername
and recvfrom report the two-byte address an unnamed end has rather than
the loopback names the Windows pair would otherwise hand out, and
connect on an end returns EISCONN. Those choices, and the Windows pair
itself, are recorded in TechnicalDebt.

guest_socketpair covers both types in both directions, the unnamed
addresses, EISCONN, and the argument errors.

Nineteen titles in the boykopovar#1578 audit import socketpair from libkernel and
no built module exports it, so the loader stops at start-up.

The pair is two guest sockets of family 1, AF_UNIX as FreeBSD numbers
it: a host socketpair(AF_UNIX, ...) on Linux, and on Windows, where
Winsock has none, both ends of one loopback TCP connection for a stream
pair and two loopback UDP sockets connected to each other for a datagram
pair. Both ends are registered under one lock and both descriptors are
written together, so a failure leaves them at -1.

An unnamed socketpair end carries no name, so getsockname, getpeername
and recvfrom report the two-byte address an unnamed end has rather than
the loopback names the Windows pair would otherwise hand out, and
connect on an end returns EISCONN. Those choices, and the Windows pair
itself, are recorded in TechnicalDebt.

guest_socketpair covers both types in both directions, the unnamed
addresses, EISCONN, and the argument errors.
@github-actions github-actions Bot mentioned this pull request Oct 8, 2026
9 tasks done
@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
#1711 core/libs/prx/libkernel/CMakeLists.txt L408
core/libs/prx/libkernel/Socket/src/Udp.cpp L288, L363, L373, L432-433
socketpair_nid_postfix

@HyperDarkmoon

Copy link
Copy Markdown
Author

Closing in favor of #1711 which has a more complete socketpair implementation with Windows pair details and broader semantics; this branch is redundant.

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