fs/proc/root.c
Source file repositories/reference/linux-study-clean/fs/proc/root.c
File Facts
- System
- Linux kernel
- Corpus path
fs/proc/root.c- Extension
.c- Size
- 11899 bytes
- Lines
- 469
- Domain
- Core OS
- Bucket
- VFS And Filesystem Core
- Inferred role
- Core OS: operation-table or driver-model contract
- Status
- pattern implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/errno.hlinux/time.hlinux/proc_fs.hlinux/stat.hlinux/init.hlinux/sched.hlinux/sched/stat.hlinux/module.hlinux/bitops.hlinux/user_namespace.hlinux/fs_context.hlinux/mount.hlinux/pid_namespace.hlinux/fs_parser.hlinux/cred.hlinux/magic.hlinux/slab.hinternal.h
Detected Declarations
struct proc_fs_contextenum proc_paramfunction valid_hidepidfunction proc_parse_hidepid_paramfunction proc_parse_subset_paramfunction proc_parse_pidns_paramfunction pidns_installfunction proc_parse_paramfunction proc_sb_infofunction proc_apply_optionsfunction proc_fill_superfunction proc_reconfigurefunction proc_get_treefunction proc_fs_context_freefunction proc_init_fs_contextfunction proc_kill_sbfunction proc_root_initfunction proc_root_getattrfunction proc_root_readdir
Annotated Snippet
static const struct file_operations proc_root_operations = {
.read = generic_read_dir,
.iterate_shared = proc_root_readdir,
.llseek = generic_file_llseek,
};
/*
* proc root can do almost nothing..
*/
static const struct inode_operations proc_root_inode_operations = {
.lookup = proc_root_lookup,
.getattr = proc_root_getattr,
};
/*
* This is the root "inode" in the /proc tree..
*/
struct proc_dir_entry proc_root = {
.low_ino = PROCFS_ROOT_INO,
.namelen = 5,
.mode = S_IFDIR | S_IRUGO | S_IXUGO,
.nlink = 2,
.refcnt = REFCOUNT_INIT(1),
.proc_iops = &proc_root_inode_operations,
.proc_dir_ops = &proc_root_operations,
.parent = &proc_root,
.subdir = RB_ROOT,
.name = "/proc",
};
Annotation
- Immediate include surface: `linux/errno.h`, `linux/time.h`, `linux/proc_fs.h`, `linux/stat.h`, `linux/init.h`, `linux/sched.h`, `linux/sched/stat.h`, `linux/module.h`.
- Detected declarations: `struct proc_fs_context`, `enum proc_param`, `function valid_hidepid`, `function proc_parse_hidepid_param`, `function proc_parse_subset_param`, `function proc_parse_pidns_param`, `function pidns_install`, `function proc_parse_param`, `function proc_sb_info`, `function proc_apply_options`.
- Atlas domain: Core OS / VFS And Filesystem Core.
- Implementation status: pattern implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
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.