Fixed SYS_close_range in syscall wrapper#1218
Conversation
WalkthroughAdjusted a preprocessor condition in src/miscwrappers.cpp to compile the SYS_close_range handling only when building against Linux kernel 5.9+ and GLIBC 2.34+. The runtime logic inside the case remains unchanged. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests
Tip 👮 Agentic pre-merge checks are now available in preview!Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.
Please see the documentation for more information. Example: reviews:
pre_merge_checks:
custom_checks:
- name: "Undocumented Breaking Changes"
mode: "warning"
instructions: |
Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).Please share your feedback with us on this Discord post. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/miscwrappers.cpp (1)
347-354: Tighten the guard and match the official signature.
- Prefer checking the syscall macro plus glibc version instead of LINUX_VERSION_CODE (kernel header version is a poor proxy in userland).
- Use unsigned int for fd1/fd2 to match glibc’s close_range prototype.
Apply this diff within this block:
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 9, 0) && __GLIBC_PREREQ(2, 34) +#if defined(SYS_close_range) && __GLIBC_PREREQ(2, 34) case SYS_close_range: { - SYSCALL_GET_ARGS_3(int, fd1, int, fd2, unsigned int, flags); + SYSCALL_GET_ARGS_3(unsigned int, fd1, unsigned int, fd2, unsigned int, flags); ret = close_range(fd1, fd2, flags); break; } #endifAlso, since you don’t use CLOSE_RANGE_* here, consider dropping the
#include <linux/close_range.h>at Lines 46–50 to avoid a hard dependency on kernel UAPI headers. If needed elsewhere, gate it with__has_include(<linux/close_range.h>).
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/miscwrappers.cpp(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: build
🔇 Additional comments (1)
src/miscwrappers.cpp (1)
347-354: Good fix: avoid building the case when glibc lacks close_range().This prevents compile/link issues on systems where SYS_close_range exists but the libc wrapper does not.
|
@xuyao0127 , Thanks for fixing this. This bug was preventing DMTCP from compiling on Rocky Linux 8 (an older distro). |
This is a follow up of PR #1210. On Khoury Login,
SYS_close_rangeis defined, although theclose_range()syscall is not available. Therefore, I added the version check before using close_range() in thesyscall()wrapper.Summary by CodeRabbit