Data Structures

The kernel defines several data structures for managing sysctls. As usual, let's take a closer look at them before examining their implementation. Because sysctls are arranged hierarchically (each larger kernel subsystem defines its own sysctl list with its various subsections), the data structure must not only hold information on the individual sysctls and their read and write operations, it must also provide ways of mapping the hierarchy between the individual entries.

Each sysctl entry has its own ctl_table instance:

struct ctl_table {

int ctl_name; const char *procname; void *data; int maxlen; mode_t mode;

struct ctl_table *child; struct ctl_table *parent; proc_handler *proc_handler; ctl_handler *strategy;

/* Automatically set */ /* Callback for text formatting */ /* Callback function for all r/w */

struct proc_dir_entry *de; /* /proc control block */

void *extra1; void *extra2;

Continue reading here: The name of the structure is misleading A sysctl table is an array of sysctl structures whereas a single instance of the structure is called a sysctl entry despite the word table in its name

Was this article helpful?

0 0