xref: /illumos-gate/usr/src/man/man8/modunload.8 (revision 35e0963c135e57db23f111dfe9dbf1dae97a9fc3)
1'\"
2.\" The contents of this file are subject to the terms of the Common
3.\" Development and Distribution License (the "License").  You may not use this
4.\" file except in compliance with the License.
5.\"
6.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
7.\" or http://www.opensolaris.org/os/licensing.
8.\" See the License for the specific language governing permissions
9.\" and limitations under the License.
10.\"
11.\" When distributing Covered Code, include this CDDL HEADER in each
12.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
13.\" If applicable, add the following below this CDDL HEADER, with the
14.\" fields enclosed by brackets "[]" replaced with your own identifying
15.\" information: Portions Copyright [yyyy] [name of copyright owner]
16.\"
17.\" Copyright (c) 2005, Sun Microsystems, Inc.
18.\" Copyright 2025 Oxide Computer Company
19.\"
20.Dd February 10, 2025
21.Dt MODUNLOAD 8
22.Os
23.Sh NAME
24.Nm modunload
25.Nd Unload a module
26.Sh SYNOPSIS
27.Nm
28.Op Fl e Ar exec_file
29.Ar module_name | Fl i Ar module_id
30.Sh DESCRIPTION
31The
32.Nm
33utility unloads a loadable module from the running system.
34The
35.Ar module_name
36or
37.Ar module_id
38are the name or ID, respectively, of the module as shown by
39.Xr modinfo 8 .
40.Pp
41If 0 is specified for
42.Ar module_id ,
43an unload of any autoloaded modules will be attempted.
44Modules loaded by
45.Xr modload 8
46are not affected.
47.Pp
48Either
49.Ar module_name
50or
51.Fl i Ar module_id
52must specified in the arguments.
53.Sh OPTIONS
54The following options are supported:
55.Bl -tag -width Ar
56.It Fl e Ar exec_file
57Specify the name of a shell script or executable image file to be executed
58before the module is unloaded.
59The first argument passed is the module id
60.Pq in decimal .
61The second argument depends on the type of the module:
62.Bl -tag -width Ds
63.It Drivers
64Driver major number
65.It System calls
66System call number
67.It Exec classes
68Index into the
69.Va execsw
70table
71.It Filesystems
72Index into the
73.Va vfssw
74table.
75.It Streams modules
76Index into the
77.Vt fmodsw
78table
79.It Scheduling classes
80Index into the class array
81.It All others
82Value of -1, since the argument does not apply
83.El
84.It Fl i Ar module_id
85Specifies the ID of the module to be unloaded.
86.El
87.Sh OPERANDS
88The following operands are supported:
89.Bl -tag -width Ar
90.It Ar module_name
91Specifies the name of the module to be unloaded.
92.El
93.Sh EXIT STATUS
94.Bl -tag -width Ds
95.It 0
96Successful completion.
97.It >0
98Failure.
99.El
100.Sh EXAMPLES
101.Sy Example 1
102Unloading a module of ID
103.Em 123
104.Bd -literal -offset indent
105# modunload -i 123
106.Ed
107.Pp
108.Sy Example 2
109Unloading a module with name
110.Em some_driver
111.Bd -literal -offset indent
112# modunload some_driver
113.Ed
114.Sh SEE ALSO
115.Xr attributes 7 ,
116.Xr modinfo 8 ,
117.Xr modload 8 ,
118.Xr update_drv 8
119.Sh NOTES
120The
121.Nm
122command is often used on driver modules to force the system to reread the
123associated driver configuration file.
124While this works in the current illumos release, it is not the supported way to
125reread the configuration file and is not guaranteed to work in future releases.
126The supported way for rereading driver configuration file is through the
127.Xr update_drv 8
128command.
129