feat(kernel): added unix domain socket subsystem with socketpair, bind/listen/accept/connect, and fcntl#60
Merged
FlareCoding merged 6 commits intostellux-3.0-prototypingfrom Mar 2, 2026
Conversation
…d/listen/accept/connect, and fcntl
- alloc_handle: explicitly zero entry.flags on slot reuse to prevent stale O_NONBLOCK from leaking across handle lifetimes - init socketpair demo: guard buf[nr] null-termination with nr >= 0 check to prevent stack buffer underflow when read() returns -1 Co-authored-by: Albert Slepak <FlareCoding@users.noreply.github.com>
Retrieve per-handle flags via get_handle_object and return EAGAIN immediately when O_NONBLOCK is set and the accept queue is empty, consistent with the read/write paths. Co-authored-by: Albert Slepak <FlareCoding@users.noreply.github.com>
… impl Co-authored-by: Albert Slepak <FlareCoding@users.noreply.github.com>
…istener - connect: move client_sock mutation before wake_one and insert smp_write barrier so AArch64 readers never see CONNECTED state with a null channel pointer - accept: check ls->closed before returning EAGAIN on nonblock path to avoid infinite retry loops on a permanently closed listener Co-authored-by: Albert Slepak <FlareCoding@users.noreply.github.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
EISCONN only for CONNECTED, EINVAL for LISTENING, and allow BOUND sockets to proceed with connect (matching Linux semantics). Co-authored-by: Albert Slepak <FlareCoding@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
High Risk
Adds a new AF_UNIX socket subsystem and multiple syscall handlers, plus changes the core resource I/O ABI to thread per-handle flags (e.g.,
O_NONBLOCK) through read/write paths. This touches kernel synchronization, handle lifecycle, and VFS interactions, so regressions could affect basic I/O and syscall behavior.Overview
Adds a new in-kernel UNIX domain stream socket implementation (ring-buffer backed) and wires it into the syscall layer with
socket,socketpair,bind,listen,accept, andconnect.Extends the VFS/resource layers to support sockets end-to-end: introduces
fs::node_type::socketandfs::socket_node, addsfs::resolve_parent_pathand directorycreate_socket(), and adds aresource_type::SOCKETwith new socket resource ops.Introduces per-handle
flagsin the handle table and threads them throughresourceread/writeops; adds a minimalfcntlimplementation (F_GETFL/F_SETFL) to controlO_NONBLOCK/O_APPEND, plus new error mappings (EAGAIN,EPIPE,EISCONN, etc.).Written by Cursor Bugbot for commit 399e4b6. This will update automatically on new commits. Configure here.