Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
KLD(4)		       FreeBSD Kernel Interfaces Manual 		KLD(4)

NAME
     kld - dynamic kernel linker facility

DESCRIPTION
     The LKM (Loadable Kernel Modules) facility has been deprecated in FreeBSD
     3.0 and above in favor of the kld interface.  This interface, like its
     predecessor, allows the system administrator to dynamically add and re­
     move functionality from a running system.	This ability also helps soft­
     ware developers to develop new parts of the kernel without constantly re­
     booting to test their changes.

     Various types of modules can be loaded into the system.  There are sever­
     al 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.

     The FreeBSD system makes extensive use of loadable kernel modules, and
     provides loadable versions of most filesystems, the NFS client and serv­
     er, all the screen-savers, and the iBCS2 and Linux emulators.  kld mod­
     ules are placed by default in the /modules directory.

     The kld interface is used through the kldload(8),	kldunload(8) and kld­
     stat(8) programs.

     The kldload(8) program can load either a.out(5) or ELF formatted loadable
     modules.  The kldunload(8) program unloads any given loaded module, if no
     other module is dependent upon the given module.  The kldstat(8) program
     is used to check the status of the modules currently loaded into the sys­
     tem.

MODULE TYPES
     Device Driver modules
     New block and character device drivers may be loaded into the system with
     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 usu­
     ally created by using MAKEDEV(8) or mknod(8) (if the device is not sup­
     ported by the MAKEDEV(8) script) or, by writing a shell script to run
     kldload(8) which should run the appropriate program to create the devices
     when the driver has been successfully loaded.

FILES
     /modules			directory containing module binaries shipped
				with the system
     /usr/include/sys/module.h	file containing definitions required to com­
				pile a kld module
     /usr/share/examples/kld	example source code implementing a sample kld
				module

SEE ALSO
     kldfind(2),  kldfirstmod(2),  kldload(2),	kldnext(2),  kldstat(2),
     kldunload(2),  kldload(8),  kldstat(8),  kldunload(8)

BUGS
     If a module B, is dependent on another module A, but is not compiled with
     module A as a dependency, then kldload(8) fails to load module B, even if
     module A is already present in the system.

     If multiple modules are dependent on module A, and are compiled with mod­
     ule A as a dependency, then kldload(8) loads an instance of module A when
     any of the modules are loaded.

     If a custom entry point is used for a module, and the module is compiled
     as an `ELF' binary, then kldload(8) fails to execute the entry point.

     kldload(8) returns the cryptic message `ENOEXEC (Exec format error)' for
     any error encountered while loading a module.

     When system internal interfaces change, old modules often cannot detect
     this, and such modules when loaded will often cause crashes or mysterious
     failures.

AUTHORS
     The kld facility was originally implemented by Doug Rabson
     <dfr@FreeBSD.org>.

HISTORY
     The kld facility appeared in FreeBSD 3.0 and was designed as a replace­
     ment for the lkm(4) facility, which was similar in functionality to the
     loadable kernel modules facility provided by SunOS 4.1.3.

			       November 08, 1998			     2

NAME | DESCRIPTION | MODULE TYPES | FILES | SEE ALSO | BUGS | AUTHORS | HISTORY

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=kld&sektion=4&manpath=FreeBSD+4.2-RELEASE>

home | help