Skip to content

Fix accept4 (socketcall 18) unimplemented issue causing Go applications to fail#2752

Open
FRLP wants to merge 5 commits into
ish-app:masterfrom
FRLP:master
Open

Fix accept4 (socketcall 18) unimplemented issue causing Go applications to fail#2752
FRLP wants to merge 5 commits into
ish-app:masterfrom
FRLP:master

Conversation

@FRLP

@FRLP FRLP commented Jun 15, 2026

Copy link
Copy Markdown

Fixes #1819

Problem

On Linux x86_32, socket operations are multiplexed through socketcall (syscall 102). While most socketcall operations were implemented in iSH, accept4 (operation 18) was left unimplemented and returned ENOSYS.

The Go runtime prefers accept4 over accept on Linux. As a result, Go-based server applications such as Kubo (go-ipfs) could not start because accept4 failed immediately.

Changes

  • Move F_* fcntl constants from fs/fd.c to fs/fd.h so they can be shared with fs/sock.c
  • Implement sys_accept4 using sys_accept followed by fcntl configuration
  • Preserve existing file status flags via F_GETFL_ when applying O_NONBLOCK_
  • Validate flags and return EINVAL for unsupported values
  • Replace socketcall dispatch table entry 18 from NULL to sys_accept4
  • Add an e2e test covering accept4 behavior

Verification

Verified by directly invoking socketcall(102, 18, ...) from Python using ctypes.

Before:

  • accept4 returned ENOSYS (errno 38)

After:

  • accept4 successfully returns a connected client file descriptor

CI status:

  • build-linux: passing
  • build-mac: passing

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.

accept4() support

1 participant