.TH "register_sysctl_table" 9 "register_sysctl_table" "25 May 1998" "Kernel Hacker's Manual" LINUX .SH NAME register_sysctl_table \- register a sysctl hierarchy .SH SYNOPSIS .B "struct ctl_table_header *" register_sysctl_table .BI "(ctl_table *" table "," .BI "int " insert_at_head ");" .SH ARGUMENTS .IP "table" 12 the top-level table structure .IP "insert_at_head" 12 whether the entry should be inserted in front or at the end .SH "DESCRIPTION" Register a sysctl table hierarchy. \fItable\fP should be a filled in ctl_table array. An entry with a ctl_name of 0 terminates the table. The members of the \fBctl_table\fP structure are used as follows: ctl_name - This is the numeric sysctl value used by sysctl(2). The number must be unique within that level of sysctl procname - the name of the sysctl file under /proc/sys. Set to NULL to not enter a sysctl file data - a pointer to data for use by proc_handler maxlen - the maximum size in bytes of the data mode - the file permissions for the /proc/sys file, and for sysctl(2) child - a pointer to the child sysctl table if this entry is a directory, or NULL. proc_handler - the text handler routine (described below) strategy - the strategy routine (described below) de - for internal use by the sysctl routines extra1, extra2 - extra pointers usable by the proc handler routines Leaf nodes in the sysctl tree will be represented by a single file under /proc; non-leaf nodes will be represented by directories. sysctl(2) can automatically manage read and write requests through the sysctl table. The data and maxlen fields of the ctl_table struct enable minimal validation of the values being written to be performed, and the mode field allows minimal authentication. More sophisticated management can be enabled by the provision of a strategy routine with the table entry. This will be called before any automatic read or write of the data is performed. The strategy routine may return < 0 - Error occurred (error is passed to user process) 0 - OK - proceed with automatic read or write. > 0 - OK - read or write has been done by the strategy routine, so return immediately. There must be a proc_handler routine for any terminal nodes mirrored under /proc/sys (non-terminals are handled by a built-in directory handler). Several default handlers are available to cover common cases - \fBproc_dostring\fP, \fBproc_dointvec\fP, \fBproc_dointvec_jiffies\fP, \fBproc_dointvec_minmax\fP, \fBproc_doulongvec_ms_jiffies_minmax\fP, \fBproc_doulongvec_minmax\fP It is the handler's job to read the input buffer from user memory and process it. The handler should return 0 on success. This routine returns NULL on a failure to register, and a pointer to the table header on success.