Skip to content

Call fcntl through a non-variadic wrapper - #634

Merged
kazu-yamamoto merged 1 commit into
haskell:masterfrom
kazu-yamamoto:fcntl-get
Nov 13, 2026
Merged

kazu-yamamoto merged 1 commit into
haskell:masterfrom
kazu-yamamoto:fcntl-get

Conversation

@kazu-yamamoto

Copy link
Copy Markdown
Collaborator

Supersedes #494.

fcntl is variadic, and ccall cannot call a variadic C function portably (on aarch64-darwin, for instance, variadic arguments go on the stack). The only uses are F_GETFD and F_GETFL in getCloseOnExec and getNonBlock, which take no third argument, so this adds hsnet_fcntl_get(fd, cmd) to HsNet.h, following the other hsnet_* wrappers, and calls it instead.

#494 used capi, which broke doctest; a plain C wrapper does not.

Tested on macOS (GHC 9.12.4): 118 examples, 0 failures, and doctest runs as before.

🤖 Generated with Claude Code

ccall cannot call a variadic C function portably.  The only uses are
F_GETFD and F_GETFL, which take no argument, so the wrapper takes none.
Unlike capi (haskell#494), this keeps doctest working.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kazu-yamamoto
kazu-yamamoto merged commit 8172cae into haskell:master Nov 13, 2026
11 checks passed
kazu-yamamoto added a commit that referenced this pull request Nov 13, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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