ml(1M) ml(1M)
NAME
ml - load dynamic kernel modules
SYNOPSIS
ml list [-rlb]
ml [ld|reg] [-d] [-v] -[cbBfmljir] module.o -p prefix
[-s major major ...] [-a modname] [-t autounload_delay]
ml [unld|unreg] [-v] id ...
ml debug [-vsn]
DESCRIPTION
The ml command provides a means of loading and unloading dynamic kernel
modules. The first argument to ml specifies its action from one of the
following: list, load, unload, register, unregister. With no options,
ml acts as if it were invoked as ml list -b. The ld, unld, reg, and
unreg options are available only to the superuser. If successful, the ml
command executes silently, unless the -v option is specified.
ml list provides a list of modules that are currently known by the
kernel. The following options to ml list are recognized:
-r Print registered modules only.
-l Print loaded modules only.
-b Print both loaded and registered modules.
ml ld causes a kernel module to be loaded into memory and prepared to be
executed as part of the kernel. ml reg is similar to ml ld, except that
the module is not loaded until the first time the module is opened. If
the -v option is specified, ml ld and ml reg list a module ID number on
standard output that can be used for subsequent unloading. The -d option
allows the module's static symbols to be added to its symbol table. This
allows symmon to have access to all of the module's symbols and is useful
for debugging. The module type must be specified by one of the following
options to ml ld and ml reg:
-c Module is a character device driver.
-b Module is a block and character device driver.
-B Module is a block device driver only.
-f Module is a streams device driver.
-m Module is a pushable streams module.
-l Module is a library module.
-j Module is a filesystem.
Page 1
ml(1M) ml(1M)
-i Module is the kernel debug module.
-r Module is a symbol table module.
The argument following the module type must be the name of the object
file for the module.
With the exception of the kernel debug module, a module prefix must be
specified with the -p option. The module prefix is the string used to
find the various entrypoints within a module.
Modules of type c, b, B, or f can specify an external device major number
with the -s option. If a specific major number is not requested, one is
provided from the unused major numbers in the system. If the major
number is already in use, the module is not loaded.
Modules of type m can provide a streams module name with the -a option
that is entered into the fmodsw structure in the kernel. If a streams
module name is not provided, the module is given the same name as the
object file, with any trailing .o removed. If the module name is already
in use, the module is not loaded.
Modules of type i are special kernel debugging modules to be used in
conjunction with the idbg(1M) command.
Modules of type r are symbol table modules. A symbol table is created
from the ELF symbol information in the file specified. This symbol table
can be used by other modules to link against when loaded. A kernel
runtime symbol table can be created manually using this command. For
more information, see mload(4).
Modules that are registered are automatically auto-unloaded after last
close by using a default auto-unload delay that is systuneable. A
specific delay can be specified, in minutes, using the -t option.
Modules can also be configured to not be auto-unloaded by using -t -2.
ml unld unloads the loaded kernel modules specified by id. Likewise, ml
unreg unregisters the registered kernel modules specified by id. Both
commands accept a list of module identifiers as arguments. If a
registered module has been loaded into memory after its first open, it
must be unloaded before it can be unregistered.
ml debug can be used to turn verbose debugging messages on or off or to
disable the loading and registering of modules:
-v Turn verbose debugging on.
-n Disable loading and registering of modules.
-s Silence verbose debugging and allow loading and registering of
modules.
Page 2
ml(1M) ml(1M)
WARNINGS
A loaded module has all of the system privileges of kernel mode
execution.
EXAMPLES
List all loaded and registered modules:
ml
Load a streams driver with prefix sdrv and major number 13:
ml ld -v -f strdrv.o -p sdrv -s 13
Register a streams module with prefix tmod and module name testmod:
ml reg -m tmod.o -p tmod -a testmod
Register a streams module with prefix tmod and default module name tmod:
ml reg -m tmod.o -p tmod
Unload the module with id 1015:
ml unld 1015
Load the kernel debug module:
ml ld -i /var/sysgen/boot/idbg.o -p idbg
FAILURES
ml failure codes and descriptions are listed in the header file
/usr/include/sys/mload.h.
SEE ALSO
mload(4).
BUGS
The ml command does not provide a way to create edt structures for
drivers. Driver initialization can only be done from the driver's init
and start functions. See the lboot(1M) reference page for loading
drivers with edt functions.
Page 3