Skip to content

Add close_range() system call #43

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: trunk
Choose a base branch
from

Conversation

ricardobranco777
Copy link

@ricardobranco777 ricardobranco777 commented Feb 16, 2025

Adapt existing code in compat_linux for close_range and make it use the new native system call.

The existing test code for closefrom(3) was adapted and extended for close_range(2).

The manpage was adapted from FreeBSD using the Linux names for the parameters:
https://man.freebsd.org/cgi/man.cgi?query=close_range&sektion=2&n=1

Fixes kern/59081

CLOSE_RANGE_UNSHARE was removed as it doesn't make sense on NetBSD which lacks unshare(2). From the Linux documentation:

       CLOSE_RANGE_UNSHARE is conceptually equivalent to
           unshare(CLONE_FILES);
           close_range(first, last, 0);

@ricardobranco777 ricardobranco777 force-pushed the close_range branch 7 times, most recently from 673e298 to 4b530cb Compare February 16, 2025 21:37
@zoulasc
Copy link
Contributor

zoulasc commented Mar 25, 2025

I think UNSHARE was implemented before and it was the same way sharing is done and undone in the clone system call. I added it back. I patched, I am doing a build now and will fix the sets.

@ricardobranco777 ricardobranco777 force-pushed the close_range branch 3 times, most recently from 5898156 to 5774026 Compare July 19, 2025 08:49
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