fs/proc/internal.h
Source file repositories/reference/linux-study-clean/fs/proc/internal.h
File Facts
- System
- Linux kernel
- Corpus path
fs/proc/internal.h- Extension
.h- Size
- 12890 bytes
- Lines
- 438
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/proc_fs.hlinux/proc_ns.hlinux/refcount.hlinux/spinlock.hlinux/atomic.hlinux/binfmts.hlinux/sched/coredump.hlinux/sched/task.hlinux/mm.h
Detected Declarations
struct ctl_table_headerstruct mempolicystruct proc_dir_entrystruct proc_inodestruct pde_openerstruct mem_size_statsstruct proc_maps_locking_ctxstruct proc_maps_privatefunction pde_is_permanentfunction pde_make_permanentfunction pde_has_proc_read_iterfunction pde_has_proc_compat_ioctlfunction pde_has_proc_lseekfunction folio_precise_page_mapcountfunction folio_precise_page_mapcountfunction folio_average_page_mapcountfunction pde_getfunction is_empty_pdefunction proc_net_initfunction proc_sys_initfunction proc_tty_initfunction pde_force_lookup
Annotated Snippet
const struct file_operations *proc_dir_ops;
};
union {
const struct seq_operations *seq_ops;
int (*single_show)(struct seq_file *, void *);
};
proc_write_t write;
void *data;
unsigned int state_size;
unsigned int low_ino;
nlink_t nlink;
kuid_t uid;
kgid_t gid;
loff_t size;
struct proc_dir_entry *parent;
struct rb_root subdir;
struct rb_node subdir_node;
char *name;
umode_t mode;
u8 flags;
u8 namelen;
char inline_name[];
} __randomize_layout;
#define SIZEOF_PDE ( \
sizeof(struct proc_dir_entry) < 128 ? 128 : \
sizeof(struct proc_dir_entry) < 192 ? 192 : \
sizeof(struct proc_dir_entry) < 256 ? 256 : \
sizeof(struct proc_dir_entry) < 512 ? 512 : \
0)
#define SIZEOF_PDE_INLINE_NAME (SIZEOF_PDE - sizeof(struct proc_dir_entry))
static inline bool pde_is_permanent(const struct proc_dir_entry *pde)
{
return pde->flags & PROC_ENTRY_PERMANENT;
}
/* This is for builtin code, not even for modules which are compiled in. */
static inline void pde_make_permanent(struct proc_dir_entry *pde)
{
/* Ensure magic flag does something. */
static_assert(PROC_ENTRY_PERMANENT != 0);
pde->flags |= PROC_ENTRY_PERMANENT;
}
static inline bool pde_has_proc_read_iter(const struct proc_dir_entry *pde)
{
return pde->flags & PROC_ENTRY_proc_read_iter;
}
static inline bool pde_has_proc_compat_ioctl(const struct proc_dir_entry *pde)
{
#ifdef CONFIG_COMPAT
return pde->flags & PROC_ENTRY_proc_compat_ioctl;
#else
return false;
#endif
}
static inline bool pde_has_proc_lseek(const struct proc_dir_entry *pde)
{
return pde->flags & PROC_ENTRY_proc_lseek;
}
extern struct kmem_cache *proc_dir_entry_cache;
void pde_free(struct proc_dir_entry *pde);
union proc_op {
int (*proc_get_link)(struct dentry *, struct path *, struct task_struct *);
int (*proc_show)(struct seq_file *m,
struct pid_namespace *ns, struct pid *pid,
struct task_struct *task);
int lsmid;
};
struct proc_inode {
struct pid *pid;
unsigned int fd;
union proc_op op;
struct proc_dir_entry *pde;
struct ctl_table_header *sysctl;
const struct ctl_table *sysctl_entry;
struct hlist_node sibling_inodes;
const struct proc_ns_operations *ns_ops;
struct inode vfs_inode;
} __randomize_layout;
/*
* General functions
*/
Annotation
- Immediate include surface: `linux/proc_fs.h`, `linux/proc_ns.h`, `linux/refcount.h`, `linux/spinlock.h`, `linux/atomic.h`, `linux/binfmts.h`, `linux/sched/coredump.h`, `linux/sched/task.h`.
- Detected declarations: `struct ctl_table_header`, `struct mempolicy`, `struct proc_dir_entry`, `struct proc_inode`, `struct pde_opener`, `struct mem_size_stats`, `struct proc_maps_locking_ctx`, `struct proc_maps_private`, `function pde_is_permanent`, `function pde_make_permanent`.
- Atlas domain: Core OS / VFS And Filesystem Core.
- Implementation status: pattern implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.