tools/testing/selftests/proc/proc.h
Source file repositories/reference/linux-study-clean/tools/testing/selftests/proc/proc.h
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/proc/proc.h- Extension
.h- Size
- 846 bytes
- Lines
- 52
- 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
assert.hdirent.herrno.hstdbool.hstdlib.hstring.hunistd.hsys/syscall.h
Detected Declarations
function sys_getpidfunction sys_gettidfunction streqfunction xstrtoull
Annotated Snippet
#pragma once
#undef NDEBUG
#include <assert.h>
#include <dirent.h>
#include <errno.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/syscall.h>
static inline pid_t sys_getpid(void)
{
return syscall(SYS_getpid);
}
static inline pid_t sys_gettid(void)
{
return syscall(SYS_gettid);
}
static inline bool streq(const char *s1, const char *s2)
{
return strcmp(s1, s2) == 0;
}
static unsigned long long xstrtoull(const char *p, char **end)
{
if (*p == '0') {
*end = (char *)p + 1;
return 0;
} else if ('1' <= *p && *p <= '9') {
unsigned long long val;
errno = 0;
val = strtoull(p, end, 10);
assert(errno == 0);
return val;
} else
assert(0);
}
static struct dirent *xreaddir(DIR *d)
{
struct dirent *de;
errno = 0;
de = readdir(d);
assert(de || errno == 0);
return de;
}
Annotation
- Immediate include surface: `assert.h`, `dirent.h`, `errno.h`, `stdbool.h`, `stdlib.h`, `string.h`, `unistd.h`, `sys/syscall.h`.
- Detected declarations: `function sys_getpid`, `function sys_gettid`, `function streq`, `function xstrtoull`.
- 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.