-
Notifications
You must be signed in to change notification settings - Fork 346
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
Use close_range where possible #758
Conversation
Signed-off-by: Furisto <24721048+Furisto@users.noreply.github.com>
Signed-off-by: Furisto <24721048+Furisto@users.noreply.github.com>
Signed-off-by: Furisto <24721048+Furisto@users.noreply.github.com>
Codecov Report
@@ Coverage Diff @@
## main #758 +/- ##
==========================================
- Coverage 72.24% 72.22% -0.02%
==========================================
Files 86 86
Lines 11756 11792 +36
==========================================
+ Hits 8493 8517 +24
- Misses 3263 3275 +12 |
Signed-off-by: Furisto <24721048+Furisto@users.noreply.github.com>
@YJDoc2 Done |
} | ||
|
||
#[cfg(test)] | ||
mod tests { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
syscall | ||
.close_range(preserve_fds) | ||
.with_context(|| "failed to clean up extra fds")?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice improvement!
Use the close_range system call to close file descriptors when creating the container. This supersedes our userspace implementation of this feature for kernels >=5.11. Close_range has better performance and does not require a mounted procfs.
More info