Skip to content

libkernel_sys: fpathconf on a kqueue or shm descriptor returns the UFS constants instead of EOPNOTSUPP #11291

Closed

Description

@oneandonlydean

fpathconf on a descriptor with no vnode only special-cases FIFOs and sockets, so a kqueue and a shm_open(SHM_ANON, ...) descriptor still get the UFS constants. I haven't run this myself; the numbers are from wachi35676's runs on Windows and WSL2 in #10427 (comment).

In those runs _PC_LINK_MAX / _PC_NAME_MAX / _PC_PIPE_BUF return 32767 / 255 / 512 for both descriptor kinds. FreeBSD 11.4 returns -1 with EOPNOTSUPP (kern_fpathconf, kern_descrip.c:1411-1429): after _PC_ASYNC_IO, which is answered for every descriptor and is 200112 on both sides, only descriptors with a vnode, pipes and sockets are answered.

The code is _fpathconf_nid_postfix in core/libs/prx/libkernel_sys/Export.cpp. This isn't caused by #10427; that PR just made the gap visible. A guest test next to the existing socket cases would cover it.

Activity

  1. MarcZX10 commented on Oct 26, 2026

    @MarcZX10
    Contributor

    I checked current main and the open fpathconf work. _fpathconf_nid_postfix currently treats FIFOs and sockets specially; PR #10427 adds Windows socket recognition but does not cover kqueue or shared-memory descriptors, so this issue remains a distinct gap. FreeBSD 11.4 kern_fpathconf confirms the stated split: vnode-backed descriptors use VOP_PATHCONF, pipes/sockets get PIPE_BUF only for _PC_PIPE_BUF, and other descriptors without a vnode return EOPNOTSUPP (source: https://github.com/freebsd/freebsd-src/blob/8c639945a44588f6cfdddfb057bb5aad88735da0/sys/kern/kern_descrip.c). The Windows/WSL observations are useful host evidence; as the issue says, they do not establish console-measured behavior.

  2. MarcZX10 commented on Oct 26, 2026

    @MarcZX10
    Contributor

    Open PR #11296 adds the fpathconf special case and its focused descriptor tests, but the latest Windows run in that PR reports the SHM_ANON case still returning UFS values (3/3 failures). The Windows anonymous shared-memory object is backed by a temporary file and is not in the descriptor registry that the new branch checks. The PR remains changes requested for coverage of that case; this issue is not resolved yet.

  3. MarcZX10 commented on Oct 26, 2026

    @MarcZX10
    Contributor

    Status update on #11296: its latest head 52c8d6749a3dadd8268ec6ade827c3634896ab76 changed the regression from SHM_ANON to a named shared-memory object. That gives cross-platform coverage for the named descriptor case, which the author reports is recognized on Windows and returns EOPNOTSUPP. The original issue specifically reports shm_open(SHM_ANON, ...); the author confirms Windows still backs that object with an unregistered temporary file, so the new shared-memory predicate remains false and the reported Windows descriptor still gets the UFS values. I asked on #11296 to either cover Windows anonymous-descriptor recognition and test both platforms, or narrow the PR claim and keep this SHM_ANON case explicitly unresolved. The PR also needs a current-main refresh and exact-head Linux/Windows rerun; no closure is implied.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions