tools/testing/selftests/proc/proc-multiple-procfs.c
Source file repositories/reference/linux-study-clean/tools/testing/selftests/proc/proc-multiple-procfs.c
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/proc/proc-multiple-procfs.c- Extension
.c- Size
- 1595 bytes
- Lines
- 49
- 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.hstdlib.hstdio.hsys/mount.hsys/types.hsys/stat.h
Detected Declarations
function main
Annotated Snippet
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <sys/mount.h>
#include <sys/types.h>
#include <sys/stat.h>
int main(void)
{
struct stat proc_st1, proc_st2;
char procbuff[] = "/tmp/proc.XXXXXX/meminfo";
char procdir1[] = "/tmp/proc.XXXXXX";
char procdir2[] = "/tmp/proc.XXXXXX";
assert(mkdtemp(procdir1) != NULL);
assert(mkdtemp(procdir2) != NULL);
assert(!mount("proc", procdir1, "proc", 0, "hidepid=1"));
assert(!mount("proc", procdir2, "proc", 0, "hidepid=2"));
snprintf(procbuff, sizeof(procbuff), "%s/meminfo", procdir1);
assert(!stat(procbuff, &proc_st1));
snprintf(procbuff, sizeof(procbuff), "%s/meminfo", procdir2);
assert(!stat(procbuff, &proc_st2));
umount(procdir1);
umount(procdir2);
assert(proc_st1.st_dev != proc_st2.st_dev);
return 0;
}
Annotation
- Immediate include surface: `assert.h`, `stdlib.h`, `stdio.h`, `sys/mount.h`, `sys/types.h`, `sys/stat.h`.
- Detected declarations: `function main`.
- 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.