xref: /dflybsd-src/share/man/man9/SYSINIT.9 (revision 86d7f5d305c6adaa56ff4582ece9859d73106103)
1*86d7f5d3SJohn Marino.\"
2*86d7f5d3SJohn Marino.\" Copyright (c) 2010, Venkatesh Srinivas <me@endeavour.zapto.org>
3*86d7f5d3SJohn Marino.\"
4*86d7f5d3SJohn Marino.\" Permission to use, copy, modify, or distribute this software for any
5*86d7f5d3SJohn Marino.\" purpose with or without fee is hereby granted, provided that the above
6*86d7f5d3SJohn Marino.\" copyright notice and this permission notice appear in all copies.
7*86d7f5d3SJohn Marino.\"
8*86d7f5d3SJohn Marino.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9*86d7f5d3SJohn Marino.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10*86d7f5d3SJohn Marino.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11*86d7f5d3SJohn Marino.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12*86d7f5d3SJohn Marino.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13*86d7f5d3SJohn Marino.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14*86d7f5d3SJohn Marino.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15*86d7f5d3SJohn Marino.\"
16*86d7f5d3SJohn Marino.Dd September 29, 2010
17*86d7f5d3SJohn Marino.Dt SYSINIT 9
18*86d7f5d3SJohn Marino.Os
19*86d7f5d3SJohn Marino.Sh NAME
20*86d7f5d3SJohn Marino.Nm SYSINIT
21*86d7f5d3SJohn Marino.Nd Subsystem initialization
22*86d7f5d3SJohn Marino.Sh SYNOPSIS
23*86d7f5d3SJohn Marino.In sys/kernel.h
24*86d7f5d3SJohn Marino.Fn SYSINIT "uniquifier" "subsystem" "order" "func" "ident"
25*86d7f5d3SJohn Marino.Sh DESCRIPTION
26*86d7f5d3SJohn Marino.Nm
27*86d7f5d3SJohn Marinois a mechanism used in the initialization of kernel subsystems.
28*86d7f5d3SJohn MarinoThe function
29*86d7f5d3SJohn Marino.Fa func
30*86d7f5d3SJohn Marinois called with the argument
31*86d7f5d3SJohn Marino.Fa ident
32*86d7f5d3SJohn Marinoeither when the kernel is booted or when a module is loaded, depending on where
33*86d7f5d3SJohn Marinothe invocation is found.
34*86d7f5d3SJohn Marino.Pp
35*86d7f5d3SJohn MarinoThe
36*86d7f5d3SJohn Marino.Fa subsystem
37*86d7f5d3SJohn Marinoand
38*86d7f5d3SJohn Marino.Fa order
39*86d7f5d3SJohn Marinoparameters control when the function is called during initialization.
40*86d7f5d3SJohn MarinoThe kernel
41*86d7f5d3SJohn Marinocalls all of the functions in a subsystem before advancing to the next one.
42*86d7f5d3SJohn Marino.Pp
43*86d7f5d3SJohn MarinoMost
44*86d7f5d3SJohn Marino.Nm
45*86d7f5d3SJohn Marinoinvocations will use one of these identifiers for
46*86d7f5d3SJohn Marino.Fa subsystem :
47*86d7f5d3SJohn Marino.Bl -tag -width ".Dv SI_SUB_HELPER_THREADS"
48*86d7f5d3SJohn Marino.It Dv SI_SUB_DRIVERS
49*86d7f5d3SJohn MarinoDevice driver initialization
50*86d7f5d3SJohn Marino.It Dv SI_SUB_VFS
51*86d7f5d3SJohn MarinoVirtual file system, vnodes, vnode recovery, namecache
52*86d7f5d3SJohn Marino.It Dv SI_SUB_HELPER_THREADS
53*86d7f5d3SJohn MarinoHelper threads (used by random number generator)
54*86d7f5d3SJohn Marino.It DV SI_SUB_KTHREAD_VM
55*86d7f5d3SJohn MarinoVM daemon initialization
56*86d7f5d3SJohn Marino.It Dv SI_SUB_KTHREAD_IDLE
57*86d7f5d3SJohn MarinoIdle-time kernel threads
58*86d7f5d3SJohn Marino.El
59*86d7f5d3SJohn Marino.Pp
60*86d7f5d3SJohn MarinoThese subsystems are initialized in the order they are listed.
61*86d7f5d3SJohn MarinoFor the complete list of subsystems, consult
62*86d7f5d3SJohn Marino.In sys/kernel.h .
63*86d7f5d3SJohn Marino.Pp
64*86d7f5d3SJohn MarinoThe
65*86d7f5d3SJohn Marino.Fa order
66*86d7f5d3SJohn Marinoparameter controls when in a subsystem a function is called.
67*86d7f5d3SJohn MarinoThe
68*86d7f5d3SJohn Marino.Dv SI_ORDER_FIRST
69*86d7f5d3SJohn Marinoparameter marks a function to be called first in subsystem.
70*86d7f5d3SJohn MarinoThe
71*86d7f5d3SJohn Marino.Dv SI_ORDER_SECOND
72*86d7f5d3SJohn Marinoand
73*86d7f5d3SJohn Marino.Dv SI_ORDER_THIRD
74*86d7f5d3SJohn Marinoflags mark a function to be called second and third, respectively.
75*86d7f5d3SJohn MarinoThe
76*86d7f5d3SJohn Marino.Dv SI_ORDER_MIDDLE
77*86d7f5d3SJohn Marinoflag marks a function to be called somewhere in the middle of a
78*86d7f5d3SJohn Marinosubsystem's initialization.
79*86d7f5d3SJohn MarinoThe
80*86d7f5d3SJohn Marino.Dv SI_ORDER_ANY
81*86d7f5d3SJohn Marinoflag marks a function to be called after all other types of functions.
82*86d7f5d3SJohn Marino.Pp
83*86d7f5d3SJohn MarinoThe
84*86d7f5d3SJohn Marino.Fa uniquifier
85*86d7f5d3SJohn Marinoparameter is a unique identifier for this
86*86d7f5d3SJohn Marino.Nm
87*86d7f5d3SJohn Marinoinvocation.
88*86d7f5d3SJohn Marino.Sh EXAMPLES
89*86d7f5d3SJohn MarinoThis example calls the function
90*86d7f5d3SJohn Marino.Fn rand_thread_init
91*86d7f5d3SJohn Marinowith a
92*86d7f5d3SJohn Marino.Dv NULL
93*86d7f5d3SJohn Marinoargument at any point while initializing helper threads:
94*86d7f5d3SJohn Marino.Bd -literal
95*86d7f5d3SJohn MarinoSYSINIT(rand, SI_SUB_HELPER_THREADS, SI_ORDER_ANY, rand_thread_init, NULL);
96*86d7f5d3SJohn Marino.Ed
97