Skip to content

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
pr/unix-domain-sockets
Mar 2, 2026
Merged

feat(kernel): added unix domain socket subsystem with socketpair, bind/listen/accept/connect, and fcntl#60
FlareCoding merged 6 commits intostellux-3.0-prototypingfrom
pr/unix-domain-sockets

Conversation

@FlareCoding
Copy link
Owner

@FlareCoding FlareCoding commented Mar 2, 2026

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, and connect.

Extends the VFS/resource layers to support sockets end-to-end: introduces fs::node_type::socket and fs::socket_node, adds fs::resolve_parent_path and directory create_socket(), and adds a resource_type::SOCKET with new socket resource ops.

Introduces per-handle flags in the handle table and threads them through resource read/write ops; adds a minimal fcntl implementation (F_GETFL/F_SETFL) to control O_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.

- 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>
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
@FlareCoding FlareCoding merged commit 92c6e50 into stellux-3.0-prototyping Mar 2, 2026
15 checks passed
@FlareCoding FlareCoding deleted the pr/unix-domain-sockets branch March 2, 2026 13:42
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.

2 participants