summaryrefslogtreecommitdiff
path: root/integrationtests/close_test.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-05-28 10:43:37 +0300
committerPaul Buetow <paul@buetow.org>2026-05-28 10:43:37 +0300
commitff8774b5ce3f6b37e5152d0dc06ae46b7a36d1da (patch)
tree7224ccb001a0945216d6e30b5b9c326396ceba76 /integrationtests/close_test.go
parent99e99c6ea35ae97e84d727449f9ad7c4c0a9fa23 (diff)
close_range: honor last bound and CLOSE_RANGE_CLOEXEC flag
close_range was captured as a single-fd fd_event carrying only first, so the runtime evicted every tracked fd >= first, ignoring the last upper bound and the flags. Bounded calls wrongly dropped still-open higher fds, and CLOSE_RANGE_CLOEXEC (which keeps fds open) was treated as a full close. Reclassify close_range to the two_fd_event kind, mapping fd_a/fd_b/extra to first/last/flags. The runtime now closes only the inclusive [first, last] range (a negative last from ~0U means unbounded) and skips eviction when CLOSE_RANGE_CLOEXEC is set or the syscall fails. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Diffstat (limited to 'integrationtests/close_test.go')
-rw-r--r--integrationtests/close_test.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/integrationtests/close_test.go b/integrationtests/close_test.go
index 3689fb8..36db476 100644
--- a/integrationtests/close_test.go
+++ b/integrationtests/close_test.go
@@ -24,6 +24,23 @@ func TestCloseRange(t *testing.T) {
})
}
+func TestCloseRangeBounded(t *testing.T) {
+ runScenario(t, "close-range-bounded", []ExpectedEvent{
+ {
+ PathContains: "closerangelow-",
+ Tracepoint: "enter_close_range",
+ Comm: "ioworkload",
+ MinCount: 1,
+ },
+ {
+ PathContains: "closerangehigh.txt",
+ Tracepoint: "enter_write",
+ Comm: "ioworkload",
+ MinCount: 1,
+ },
+ })
+}
+
func TestCloseInvalidFd(t *testing.T) {
runScenario(t, "close-invalid-fd", []ExpectedEvent{
{