xref: /freebsd/share/examples/kld/cdev/README (revision 7f3dea244c40159a41ab22da77a434d7c5b5e85a)
1# Copyright (c) 1998 Rajesh Vaidheeswarran
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. All advertising materials mentioning features or use of this software
13#    must display the following acknowledgement:
14#      This product includes software developed by Rajesh Vaidheeswarran
15# 4. The name Rajesh Vaidheeswarran may not be used to endorse or promote
16#    products derived from this software without specific prior written
17#    permission.
18#
19# THIS SOFTWARE IS PROVIDED BY RAJESH VAIDHEESWARRAN ``AS IS'' AND ANY
20# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22# ARE DISCLAIMED.  IN NO EVENT SHALL THE RAJESH VAIDHEESWARRAN BE LIABLE
23# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29# SUCH DAMAGE.
30#
31# Copyright (c) 1993 Terrence R. Lambert.
32# All rights reserved.
33#
34# Redistribution and use in source and binary forms, with or without
35# modification, are permitted provided that the following conditions
36# are met:
37# 1. Redistributions of source code must retain the above copyright
38#    notice, this list of conditions and the following disclaimer.
39# 2. Redistributions in binary form must reproduce the above copyright
40#    notice, this list of conditions and the following disclaimer in the
41#    documentation and/or other materials provided with the distribution.
42# 3. All advertising materials mentioning features or use of this software
43#    must display the following acknowledgement:
44#      This product includes software developed by Terrence R. Lambert.
45# 4. The name Terrence R. Lambert may not be used to endorse or promote
46#    products derived from this software without specific prior written
47#    permission.
48#
49# THIS SOFTWARE IS PROVIDED BY TERRENCE R. LAMBERT ``AS IS'' AND ANY
50# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
51# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
52# ARE DISCLAIMED.  IN NO EVENT SHALL THE TERRENCE R. LAMBERT BE LIABLE
53# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
54# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
55# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
56# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
57# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
58# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
59# SUCH DAMAGE.
60#
61
621.0	Overview
63
64	This is the README file for the sample kld module
65	that mimics a character device driver.
66
67	A kld module may be used to load any data or
68	program into the kernel that can be made available by
69	modifying a table, pointer, or other kernel data to inform
70	the kernel that the module should be used instead of the
71	previous code/data path.
72
73	Generally, it is assumed that a loadable module is one of
74	a set of similar modules (such as a file system or console
75	terminal emulation), and that the reference is through a
76	table (such as vfssw[]), and that a "special" value is
77	assigned to the slots which are allowed to be replaced.
78	This is not enforced, so you may use the kld module
79	any way you see fit.
80
81	As with the loadable system calls, it may be desirable to
82	allow the module loader to replace an *existing* entry to
83	try out changes to kernel code without rebuilding and
84	booting from the new kernel.
85
86
872.0	Directions
88
89	To test the module, do the following:
90
91		cd module
92		make load
93
94	A load message (the copyright) will be printed on the console.
95
96		cd ../test
97		make load
98
99	The system call prints a message on the console when called.
100	This message will be printed when running "make load" in
101	the "test" subdirectory.
102
103
1043.0	Recovering resources
105
106	The module consumes memory when loaded; it can be freed up by
107	unloading it.  To unload it, type the following from the directory
108	this file is in:
109
110		cd module
111		make unload
112
113	The miscellaneous module will be unloaded by name.
114
115
1164.0	END OF DOCUMENT
117