xref: /dflybsd-src/share/man/man9/SYSINIT.9 (revision 86d7f5d305c6adaa56ff4582ece9859d73106103)
186d7f5d3SJohn Marino.\"
286d7f5d3SJohn Marino.\" Copyright (c) 2010, Venkatesh Srinivas <me@endeavour.zapto.org>
386d7f5d3SJohn Marino.\"
486d7f5d3SJohn Marino.\" Permission to use, copy, modify, or distribute this software for any
586d7f5d3SJohn Marino.\" purpose with or without fee is hereby granted, provided that the above
686d7f5d3SJohn Marino.\" copyright notice and this permission notice appear in all copies.
786d7f5d3SJohn Marino.\"
886d7f5d3SJohn Marino.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
986d7f5d3SJohn Marino.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
1086d7f5d3SJohn Marino.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
1186d7f5d3SJohn Marino.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
1286d7f5d3SJohn Marino.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
1386d7f5d3SJohn Marino.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
1486d7f5d3SJohn Marino.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1586d7f5d3SJohn Marino.\"
1686d7f5d3SJohn Marino.Dd September 29, 2010
1786d7f5d3SJohn Marino.Dt SYSINIT 9
1886d7f5d3SJohn Marino.Os
1986d7f5d3SJohn Marino.Sh NAME
2086d7f5d3SJohn Marino.Nm SYSINIT
2186d7f5d3SJohn Marino.Nd Subsystem initialization
2286d7f5d3SJohn Marino.Sh SYNOPSIS
2386d7f5d3SJohn Marino.In sys/kernel.h
2486d7f5d3SJohn Marino.Fn SYSINIT "uniquifier" "subsystem" "order" "func" "ident"
2586d7f5d3SJohn Marino.Sh DESCRIPTION
2686d7f5d3SJohn Marino.Nm
2786d7f5d3SJohn Marinois a mechanism used in the initialization of kernel subsystems.
2886d7f5d3SJohn MarinoThe function
2986d7f5d3SJohn Marino.Fa func
3086d7f5d3SJohn Marinois called with the argument
3186d7f5d3SJohn Marino.Fa ident
3286d7f5d3SJohn Marinoeither when the kernel is booted or when a module is loaded, depending on where
3386d7f5d3SJohn Marinothe invocation is found.
3486d7f5d3SJohn Marino.Pp
3586d7f5d3SJohn MarinoThe
3686d7f5d3SJohn Marino.Fa subsystem
3786d7f5d3SJohn Marinoand
3886d7f5d3SJohn Marino.Fa order
3986d7f5d3SJohn Marinoparameters control when the function is called during initialization.
4086d7f5d3SJohn MarinoThe kernel
4186d7f5d3SJohn Marinocalls all of the functions in a subsystem before advancing to the next one.
4286d7f5d3SJohn Marino.Pp
4386d7f5d3SJohn MarinoMost
4486d7f5d3SJohn Marino.Nm
4586d7f5d3SJohn Marinoinvocations will use one of these identifiers for
4686d7f5d3SJohn Marino.Fa subsystem :
4786d7f5d3SJohn Marino.Bl -tag -width ".Dv SI_SUB_HELPER_THREADS"
4886d7f5d3SJohn Marino.It Dv SI_SUB_DRIVERS
4986d7f5d3SJohn MarinoDevice driver initialization
5086d7f5d3SJohn Marino.It Dv SI_SUB_VFS
5186d7f5d3SJohn MarinoVirtual file system, vnodes, vnode recovery, namecache
5286d7f5d3SJohn Marino.It Dv SI_SUB_HELPER_THREADS
5386d7f5d3SJohn MarinoHelper threads (used by random number generator)
5486d7f5d3SJohn Marino.It DV SI_SUB_KTHREAD_VM
5586d7f5d3SJohn MarinoVM daemon initialization
5686d7f5d3SJohn Marino.It Dv SI_SUB_KTHREAD_IDLE
5786d7f5d3SJohn MarinoIdle-time kernel threads
5886d7f5d3SJohn Marino.El
5986d7f5d3SJohn Marino.Pp
6086d7f5d3SJohn MarinoThese subsystems are initialized in the order they are listed.
6186d7f5d3SJohn MarinoFor the complete list of subsystems, consult
6286d7f5d3SJohn Marino.In sys/kernel.h .
6386d7f5d3SJohn Marino.Pp
6486d7f5d3SJohn MarinoThe
6586d7f5d3SJohn Marino.Fa order
6686d7f5d3SJohn Marinoparameter controls when in a subsystem a function is called.
6786d7f5d3SJohn MarinoThe
6886d7f5d3SJohn Marino.Dv SI_ORDER_FIRST
6986d7f5d3SJohn Marinoparameter marks a function to be called first in subsystem.
7086d7f5d3SJohn MarinoThe
7186d7f5d3SJohn Marino.Dv SI_ORDER_SECOND
7286d7f5d3SJohn Marinoand
7386d7f5d3SJohn Marino.Dv SI_ORDER_THIRD
7486d7f5d3SJohn Marinoflags mark a function to be called second and third, respectively.
7586d7f5d3SJohn MarinoThe
7686d7f5d3SJohn Marino.Dv SI_ORDER_MIDDLE
7786d7f5d3SJohn Marinoflag marks a function to be called somewhere in the middle of a
7886d7f5d3SJohn Marinosubsystem's initialization.
7986d7f5d3SJohn MarinoThe
8086d7f5d3SJohn Marino.Dv SI_ORDER_ANY
8186d7f5d3SJohn Marinoflag marks a function to be called after all other types of functions.
8286d7f5d3SJohn Marino.Pp
8386d7f5d3SJohn MarinoThe
8486d7f5d3SJohn Marino.Fa uniquifier
8586d7f5d3SJohn Marinoparameter is a unique identifier for this
8686d7f5d3SJohn Marino.Nm
8786d7f5d3SJohn Marinoinvocation.
8886d7f5d3SJohn Marino.Sh EXAMPLES
8986d7f5d3SJohn MarinoThis example calls the function
9086d7f5d3SJohn Marino.Fn rand_thread_init
9186d7f5d3SJohn Marinowith a
9286d7f5d3SJohn Marino.Dv NULL
9386d7f5d3SJohn Marinoargument at any point while initializing helper threads:
9486d7f5d3SJohn Marino.Bd -literal
9586d7f5d3SJohn MarinoSYSINIT(rand, SI_SUB_HELPER_THREADS, SI_ORDER_ANY, rand_thread_init, NULL);
9686d7f5d3SJohn Marino.Ed
97