man.bsd.lv manual page server

Manual Page Search Parameters
SYSINIT(9) Kernel Developer's Manual SYSINIT(9)

SYSINITSubsystem initialization

#include <sys/kernel.h>

SYSINIT(uniquifier, subsystem, order, func, ident);

SYSINIT is a mechanism used in the initialization of kernel subsystems. The function func is called with the argument ident either when the kernel is booted or when a module is loaded, depending on where the invocation is found.

The subsystem and order parameters control when the function is called during initialization. The kernel calls all of the functions in a subsystem before advancing to the next one.

Most SYSINIT invocations will use one of these identifiers for subsystem:

Device driver initialization
Virtual file system, vnodes, vnode recovery, namecache
Helper threads (used by random number generator)
DV SI_SUB_KTHREAD_VM
VM daemon initialization
Idle-time kernel threads

These subsystems are initialized in the order they are listed. For the complete list of subsystems, consult <sys/kernel.h>.

The order parameter controls when in a subsystem a function is called. The SI_ORDER_FIRST parameter marks a function to be called first in subsystem. The SI_ORDER_SECOND and SI_ORDER_THIRD flags mark a function to be called second and third, respectively. The SI_ORDER_MIDDLE flag marks a function to be called somewhere in the middle of a subsystem's initialization. The SI_ORDER_ANY flag marks a function to be called after all other types of functions.

The uniquifier parameter is a unique identifier for this SYSINIT invocation.

This example calls the function rand_thread_init() with a NULL argument at any point while initializing helper threads:

SYSINIT(rand, SI_SUB_HELPER_THREADS, SI_ORDER_ANY, rand_thread_init, NULL);
September 29, 2010 DragonFly-5.6.1