Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 8 Nov 1998 17:01:48 -0800 (PST)
From:      rv@fore.com
To:        freebsd-gnats-submit@FreeBSD.ORG
Subject:   docs/8611: kld man page
Message-ID:  <199811090101.RAA15669@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         8611
>Category:       docs
>Synopsis:       kld man page
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-doc
>State:          open
>Quarter:
>Keywords:
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sun Nov  8 17:10:00 PST 1998
>Last-Modified:
>Originator:     Rajesh V
>Organization:
>Release:        3.0-CURRENT
>Environment:
FreeBSD freebsd.eng.fore.com 3.0-CURRENT FreeBSD 3.0-CURRENT #0: Sat Nov  7 16:30:15 EST 1998     bash@freebsd.eng.fore.com:/usr/src/sys/compile/FB30  i386

>Description:
an introductory man page to kld
>How-To-Repeat:

>Fix:
.\" Copyright (c) 1998 ???
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\" 3. The name of the author may not be used to endorse or promote products
.\"    derived from this software without specific prior written permission
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\"     $Id: kld.4,v 1.10 1998/11/08 18:35:17 rv Exp $
.\"
.Dd November 08, 1998
.Dt KLD 4
.Os FreeBSD 3.0
.Sh NAME
.Nm kld
.Nd dynamic kernel linker facility
.Sh DESCRIPTION
The LKM (Loadable Kernel Modules) facility has been deprecated in FreeBSD
3.0 and above in favor of the 
.Nm
interface. This interface, like its
predecessor allows the system administrator to dynamically add and remove
functionality from a running system.  This ability also helps software
developers to develop new parts of the kernel without constantly rebooting
to test their changes.
.Pp
Various types of modules can be loaded into the system.
There are several defined module types, listed below, which can
be added to the system in a predefined way.  In addition, there
is a generic type, for which the module itself handles loading and
unloading.
.Pp
The
.Tn FreeBSD
system makes extensive use of loadable kernel modules, and provides loadable
versions of most filesystems, the
.Tn NFS
client and server, all the screen-savers, and the
.Tn iBCS2
and
.Tn Linux
emulators.  Modules distributed with the system are found in the
.Pa /lkm
directory. All of these are in the process of being converted to
.Nm
modules, which will be placed by default in the
.Pa /modules
directory.
.Pp
The
.Nm
interface is used through 
.Xr kldload 8
,
.Xr kldunload 8
or
.Xr kldstat 8
programs.
.Pp
The 
.Xr kldload 8
program can load either
.Xr a.out 5
or ELF formatted loadable modules.
The 
.Xr kldunload 8
program unloads any given loaded module, if no other module is dependent
upon the given module.
The
.Xr kldstat 8
program is used to check the status of the modules currently loaded into the
system.
.Sh "MODULE TYPES"
.Bl -ohang
.It Em "Device Driver modules"
New block and character device
drivers may be loaded into the system with
.Nm KLD .
The major problem with loading
a device driver is that the driver's
device nodes must be exist for the
devices to be accessed.  They are usually
created by using
.Xr MAKEDEV 8
or 
.Xr mknod 8 
(if the device is not supported by the
.Xr MAKEDEV 8
script) or, by writing a
shell script to run 
.Xr kldload 8
which should run the appropriate program to create the devices when the
driver has been successfully loaded.
.El
.Sh FILES
.Bl -tag -width /usr/share/examples/kld -compact
.It Pa /modules
directory containing module binaries shipped with the system
.It Pa /usr/include/sys/module.h
file containing definitions required to compile a 
.Nm
module 
.It Pa /usr/share/examples/kld
example source code implementing a sample kld module
.Sh SEE ALSO
.Xr kldload 8 ,
.Xr kldstat 8 ,
.Xr kldunload 8
.Sh BUGS
If a module B, is dependent on another module A, but is not compiled with
module A as a dependency, then
.Xr kldload 8
fails to load module B, even if module A is already present in the system.
.Pp
If multiple modules are dependent on module A, and are compiled with module
A as a dependency, then
.Xr kldload 8
loads an instance of module A when any of the modules are loaded.
.Pp
If a custom entry point is used for a module, and the module is compiled as
an 'ELF' binary, then
.Xr kldload 8
fails to execute the entry point.
.Pp
.Xr kldload 8
returns cryptic ENOEXEC (Exec format error) for any error encountered while
loading a module.
.Pp
When system internal interfaces change, old modules often cannot
detect this, and such modules when loaded will often cause crashes or
mysterious failures.
.Sh AUTHORS
The
.Nm
facility was originally implemented by ??
.Sh HISTORY
The
.Nm
facility appeared in FreeBSD 3.0 and was designed as a replacement for the
.Xr lkm 4
facility, which was similar in functionality to the loadable kernel modules
facility provided by
.Tn SunOS
4.1.3.

>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-doc" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199811090101.RAA15669>