tools/perf/util/rlimit.c
Source file repositories/reference/linux-study-clean/tools/perf/util/rlimit.c
File Facts
- System
- Linux kernel
- Corpus path
tools/perf/util/rlimit.c- Extension
.c- Size
- 1254 bytes
- Lines
- 58
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: implementation source
- Status
- source implementation candidate
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
errno.hutil/debug.hutil/rlimit.hsys/time.hsys/resource.h
Detected Declarations
function rlimit__bump_memlockfunction rlimit__increase_nofile
Annotated Snippet
if (setrlimit(RLIMIT_MEMLOCK, &rlim) < 0) {
rlim.rlim_cur /= 2;
rlim.rlim_max /= 2;
if (setrlimit(RLIMIT_MEMLOCK, &rlim) < 0)
pr_debug("Couldn't bump rlimit(MEMLOCK), failures may take place when creating BPF maps, etc\n");
}
}
}
bool rlimit__increase_nofile(enum rlimit_action *set_rlimit)
{
int old_errno;
struct rlimit l;
if (*set_rlimit < INCREASED_MAX) {
old_errno = errno;
if (getrlimit(RLIMIT_NOFILE, &l) == 0) {
if (*set_rlimit == NO_CHANGE) {
l.rlim_cur = l.rlim_max;
} else {
l.rlim_cur = l.rlim_max + 1000;
l.rlim_max = l.rlim_cur;
}
if (setrlimit(RLIMIT_NOFILE, &l) == 0) {
(*set_rlimit) += 1;
errno = old_errno;
return true;
}
}
errno = old_errno;
}
return false;
}
Annotation
- Immediate include surface: `errno.h`, `util/debug.h`, `util/rlimit.h`, `sys/time.h`, `sys/resource.h`.
- Detected declarations: `function rlimit__bump_memlock`, `function rlimit__increase_nofile`.
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.