nrelease - fix/improve livecd
[dragonfly.git] / share / man / man4 / kld.4
1 .\" Copyright (c) 1993 Christopher G. Demetriou
2 .\" All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\"    notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\"    notice, this list of conditions and the following disclaimer in the
11 .\"    documentation and/or other materials provided with the distribution.
12 .\" 3. The name of the author may not be used to endorse or promote products
13 .\"    derived from this software without specific prior written permission
14 .\"
15 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 .\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 .\"
26 .\" $FreeBSD: src/share/man/man4/kld.4,v 1.5.2.6 2001/08/17 13:08:38 ru Exp $
27 .\"
28 .Dd December 12, 2014
29 .Dt KLD 4
30 .Os
31 .Sh NAME
32 .Nm kld
33 .Nd dynamic kernel linker facility
34 .Sh DESCRIPTION
35 The LKM (Loadable Kernel Modules) facility has been deprecated in
36 .Fx 3.0
37 and above in favor of the
38 .Nm
39 interface.
40 This interface, like its
41 predecessor, allows the system administrator to dynamically add and remove
42 functionality from a running system.
43 This ability also helps software
44 developers to develop new parts of the kernel without constantly rebooting
45 to test their changes.
46 .Pp
47 Various types of modules can be loaded into the system.
48 There are several defined module types, listed below, which can
49 be added to the system in a predefined way.
50 In addition, there
51 is a generic type, for which the module itself handles loading and
52 unloading.
53 .Pp
54 The
55 .Dx
56 system makes extensive use of loadable kernel modules, and provides loadable
57 versions of most filesystems, the
58 .Tn NFS
59 client and server, and all the screen-savers.
60 .Nm
61 modules are placed by default in the
62 .Pa /boot/kernel
63 directory.
64 .Pp
65 The
66 .Nm
67 interface is used through the
68 .Xr kldload 8 ,
69 .Xr kldunload 8
70 and
71 .Xr kldstat 8
72 programs.
73 .Pp
74 The
75 .Xr kldload 8
76 program can load either
77 .Xr a.out 5
78 or ELF formatted loadable modules.
79 The
80 .Xr kldunload 8
81 program unloads any given loaded module, if no other module is dependent
82 upon the given module.
83 The
84 .Xr kldstat 8
85 program is used to check the status of the modules currently loaded into the
86 system.
87 .Sh FILES
88 .Bl -tag -width ".In sys/module.h" -compact
89 .It Pa /boot/kernel
90 directory containing module binaries shipped with the system
91 .It In sys/module.h
92 file containing definitions required to compile a
93 .Nm
94 module
95 .It Pa /usr/share/examples/kld
96 example source code implementing a sample kld module
97 .El
98 .Sh SEE ALSO
99 .Xr kldfind 2 ,
100 .Xr kldfirstmod 2 ,
101 .Xr kldload 2 ,
102 .Xr kldnext 2 ,
103 .Xr kldstat 2 ,
104 .Xr kldunload 2 ,
105 .Xr kldload 8 ,
106 .Xr kldstat 8 ,
107 .Xr kldunload 8
108 .Sh HISTORY
109 The
110 .Nm
111 facility appeared in
112 .Fx 3.0
113 and was designed as a replacement for the
114 .Xr lkm 4
115 facility, which was similar in functionality to the loadable kernel modules
116 facility provided by
117 .Tn SunOS
118 4.1.3.
119 .Sh AUTHORS
120 The
121 .Nm
122 facility was originally implemented by
123 .An Doug Rabson Aq Mt dfr@FreeBSD.org .
124 .Sh BUGS
125 If a module B, is dependent on another module A, but is not compiled with
126 module A as a dependency, then
127 .Xr kldload 8
128 fails to load module B, even if module A is already present in the system.
129 .Pp
130 If multiple modules are dependent on module A, and are compiled with module
131 A as a dependency, then
132 .Xr kldload 8
133 loads an instance of module A when any of the modules are loaded.
134 .Pp
135 If a custom entry point is used for a module, and the module is compiled as
136 an
137 .Sq ELF
138 binary, then
139 .Xr kldload 8
140 fails to execute the entry point.
141 .Pp
142 .Xr kldload 8
143 returns the cryptic message
144 .Sq Li "Exec format error"
145 for any error encountered while loading a module.
146 .Pp
147 When system internal interfaces change, old modules often cannot
148 detect this, and such modules when loaded will often cause crashes or
149 mysterious failures.