summaryrefslogtreecommitdiff
path: root/internal/generate/family_test.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-05-29 17:53:10 +0300
committerPaul Buetow <paul@buetow.org>2026-05-29 17:53:10 +0300
commitb86b817594ac8a4dc7fe2b80649df2c7a62f1b59 (patch)
treebfe09e28771102384cb3f04cae68f7bc907d8eab /internal/generate/family_test.go
parent2d87d048eb0c629990445eac81229424fe50c215 (diff)
test(fallocate): lock in FS family, KindFd enter, UNCLASSIFIED ret
Audit of fallocate(2) found the tracing correct and consistent with its fd-based siblings, so add lock-in tests rather than fixing anything: - fallocate(int fd, int mode, off_t offset, off_t len) returns int 0/-1 (a status code, NOT a transferred byte count). Its exit must stay a plain ret_event with ret_type UNCLASSIFIED so it is never mistaken for a READ/WRITE/TRANSFER byte count. - The enter tracepoint carries a leading fd field (args[0]); only fd is captured into a fd_event (KindFd), matching fadvise64/ftruncate/ sync_file_range which likewise drop their trailing offset/len/advice args. - fallocate belongs to FamilyFS alongside fadvise64/ftruncate/ sync_file_range. TestClassifyFallocateEnterFd and TestClassifyExitFallocateUnclassifiedRet assert the per-syscall behavior; TestClassifySyscallFamily now also covers fallocate/fadvise64/ftruncate so a stray reclassification trips a test. No classification logic or generated artifacts changed. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Diffstat (limited to 'internal/generate/family_test.go')
-rw-r--r--internal/generate/family_test.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/internal/generate/family_test.go b/internal/generate/family_test.go
index 827e592..af40e7d 100644
--- a/internal/generate/family_test.go
+++ b/internal/generate/family_test.go
@@ -86,6 +86,18 @@ func TestClassifySyscallFamily(t *testing.T) {
{"sys_enter_fsync", FamilyFS},
{"sys_enter_fdatasync", FamilyFS},
{"sys_enter_sync_file_range", FamilyFS},
+ // fallocate(2) manipulates the allocated disk space (preallocate,
+ // punch-hole, collapse, zero, insert) for the file referred to by its
+ // args[0] fd; it is a per-file space-management syscall and shares
+ // FamilyFS with its fd-based siblings fadvise64(2) (access-pattern
+ // advice), ftruncate(2) (resize by fd), and sync_file_range(2) (flush a
+ // byte range). Assert the group so a stray reclassification of any one
+ // trips this test. Keep in sync with the FS list in
+ // docs/syscall-tracing-plan.md.
+ {"sys_enter_fallocate", FamilyFS},
+ {"sys_exit_fallocate", FamilyFS},
+ {"sys_enter_fadvise64", FamilyFS},
+ {"sys_enter_ftruncate", FamilyFS},
{"sys_enter_epoll_wait", FamilyPolling},
{"sys_enter_io_uring_enter", FamilyAIO},
{"sys_enter_bpf", FamilySecurity},