include/linux/sysctl.h
Source file repositories/reference/linux-study-clean/include/linux/sysctl.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/sysctl.h- Extension
.h- Size
- 10924 bytes
- Lines
- 312
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- Inferred role
- Core OS: implementation source
- Status
- source 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/list.hlinux/rcupdate.hlinux/wait.hlinux/rbtree.hlinux/uidgid.huapi/linux/sysctl.h
Detected Declarations
struct completionstruct ctl_tablestruct nsproxystruct ctl_table_rootstruct ctl_table_headerstruct ctl_dirstruct ctl_table_pollstruct ctl_tablestruct ctl_nodestruct ctl_table_headerstruct ctl_dirstruct ctl_table_setstruct ctl_table_rootfunction register_sysctl_initfunction unregister_sysctl_table
Annotated Snippet
struct ctl_table_poll {
atomic_t event;
wait_queue_head_t wait;
};
static inline void *proc_sys_poll_event(struct ctl_table_poll *poll)
{
return (void *)(unsigned long)atomic_read(&poll->event);
}
#define __CTL_TABLE_POLL_INITIALIZER(name) { \
.event = ATOMIC_INIT(0), \
.wait = __WAIT_QUEUE_HEAD_INITIALIZER(name.wait) }
#define DEFINE_CTL_TABLE_POLL(name) \
struct ctl_table_poll name = __CTL_TABLE_POLL_INITIALIZER(name)
/* A sysctl table is an array of struct ctl_table: */
struct ctl_table {
const char *procname; /* Text ID for /proc/sys */
void *data;
int maxlen;
umode_t mode;
proc_handler *proc_handler; /* Callback for text formatting */
struct ctl_table_poll *poll;
void *extra1;
void *extra2;
} __randomize_layout;
struct ctl_node {
struct rb_node node;
struct ctl_table_header *header;
};
/**
* struct ctl_table_header - maintains dynamic lists of struct ctl_table trees
* @ctl_table: pointer to the first element in ctl_table array
* @ctl_table_size: number of elements pointed by @ctl_table
* @used: The entry will never be touched when equal to 0.
* @count: Upped every time something is added to @inodes and downed every time
* something is removed from inodes
* @nreg: When nreg drops to 0 the ctl_table_header will be unregistered.
* @rcu: Delays the freeing of the inode. Introduced with "unfuck proc_sysctl ->d_compare()"
*
* @type: Enumeration to differentiate between ctl target types
* @type.SYSCTL_TABLE_TYPE_DEFAULT: ctl target with no special considerations
* @type.SYSCTL_TABLE_TYPE_PERMANENTLY_EMPTY: Identifies a permanently empty dir
* target to serve as a mount point
*/
struct ctl_table_header {
union {
struct {
const struct ctl_table *ctl_table;
int ctl_table_size;
int used;
int count;
int nreg;
};
struct rcu_head rcu;
};
struct completion *unregistering;
const struct ctl_table *ctl_table_arg;
struct ctl_table_root *root;
struct ctl_table_set *set;
struct ctl_dir *parent;
struct ctl_node *node;
struct hlist_head inodes; /* head for proc_inode->sysctl_inodes */
enum {
SYSCTL_TABLE_TYPE_DEFAULT,
SYSCTL_TABLE_TYPE_PERMANENTLY_EMPTY,
} type;
};
struct ctl_dir {
/* Header must be at the start of ctl_dir */
struct ctl_table_header header;
struct rb_root root;
};
struct ctl_table_set {
int (*is_seen)(struct ctl_table_set *);
struct ctl_dir dir;
};
struct ctl_table_root {
struct ctl_table_set default_set;
struct ctl_table_set *(*lookup)(struct ctl_table_root *root);
void (*set_ownership)(struct ctl_table_header *head,
kuid_t *uid, kgid_t *gid);
int (*permissions)(struct ctl_table_header *head, const struct ctl_table *table);
Annotation
- Immediate include surface: `linux/list.h`, `linux/rcupdate.h`, `linux/wait.h`, `linux/rbtree.h`, `linux/uidgid.h`, `uapi/linux/sysctl.h`.
- Detected declarations: `struct completion`, `struct ctl_table`, `struct nsproxy`, `struct ctl_table_root`, `struct ctl_table_header`, `struct ctl_dir`, `struct ctl_table_poll`, `struct ctl_table`, `struct ctl_node`, `struct ctl_table_header`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: source 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.