Skip to content

Close FD gap in [1024, 32768)#20

Closed
minhsun-c wants to merge 1 commit intosysprog21:mainfrom
minhsun-c:fd
Closed

Close FD gap in [1024, 32768)#20
minhsun-c wants to merge 1 commit intosysprog21:mainfrom
minhsun-c:fd

Conversation

@minhsun-c
Copy link

@minhsun-c minhsun-c commented Mar 24, 2026

Expand KBOX_LOW_FD_MAX from 1024 to 32768 so that
low_fds[] covers the entire range below KBOX_FD_BASE. Previously, dup2/dup3 targeting FDs in the gap returned EBADF because fd_lookup() returned NULL for that range.

This is Option A from issue #8: a simple constant change with ~1MB additional memory per instance.

Update unit tests to remove gap-expects-failure assertions and add coverage for FDs 1023, 10000, and 32767.

Resolves #8

Change-Id: I6c685c3ff473a9b393dbb3f373886abdaef5d7cd


Summary by cubic

Expand KBOX_LOW_FD_MAX to 32768 to cover all FDs below KBOX_FD_BASE and close the low-FD gap. Fixes EBADF from dup2/dup3 to FDs 1024-32767 (Option A in #8).

  • Bug Fixes
    • fd_lookup() now maps 0-32767; ~1MB extra memory per instance.
    • Tests updated: removed gap-failure asserts; added cases for 1023, 10000, 32767.

Written for commit ab90366. Summary will update on new commits.

Expand KBOX_LOW_FD_MAX from 1024 to 32768 so that
low_fds[] covers the entire range below KBOX_FD_BASE.
Previously, dup2/dup3 targeting FDs in the gap returned
EBADF because fd_lookup() returned NULL for that range.

This is Option A from issue sysprog21#8: a simple constant change
with ~1MB additional memory per instance.

Update unit tests to remove gap-expects-failure assertions
and add coverage for FDs 1023, 10000, and 32767.

Resolves sysprog21#8

Change-Id: I6c685c3ff473a9b393dbb3f373886abdaef5d7cd
Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 2 files

@jserv
Copy link
Contributor

jserv commented Mar 24, 2026

Before submitting pull requests, you should first discuss them in #8 , addressing considerations and known limitations in advance.

@minhsun-c minhsun-c closed this Mar 24, 2026
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.

FD gap: virtual FDs in [1024, 32768) are untracked

2 participants