English pages are provided only to compare translations to original pages,
better looking pages can be browsed
at the Linux man-pages official site.
Linux Programmer's Manual (2)
delete_module - unload a kernel module
int delete_module(const char *name, int flags);
There is no glibc wrapper for this system call; see NOTES.
system call attempts to remove the unused loadable module entry
If the module has an
function, then that function is executed before unloading the module.
argument is used to modify the behavior of the system call,
as described below.
This system call requires privilege.
Module removal is attempted according to the following rules:
If there are other loaded modules that depend on
(i.e., refer to symbols defined in) this module,
then the call fails.
Otherwise, if the reference count for the module
(i.e., the number of processes currently using the module)
is zero, then the module is immediately unloaded.
If a module has a nonzero reference count,
then the behavior depends on the bits set in
In normal usage (see NOTES), the
flag is always specified, and the
flag may additionally be specified.
The various combinations for
have the following effect:
- flags == O_NONBLOCK
The call returns immediately, with an error.
- flags == (O_NONBLOCK | O_TRUNC)
The module is unloaded immediately,
regardless of whether it has a nonzero reference count.
- (flags & O_NONBLOCK) == 0
does not specify
the following steps occur:
The module is marked so that no new references are permitted.
If the module's reference count is nonzero,
the caller is placed in an uninterruptible sleep state
until the reference count is zero, at which point the call unblocks.
The module is unloaded in the usual way.
flag has one further effect on the rules described above.
By default, if a module has an
function but no
function, then an attempt to remove the module will fail.
was specified, this requirement is bypassed.
flag is dangerous!
If the kernel was not built with
this flag is silently ignored.
Using this flag taints the kernel (TAINT_FORCED_RMMOD).
On success, zero is returned.
On error, -1 is returned and
is set appropriately.
The module is not "live"
(i.e., it is still being initialized or is already marked for removal);
or, the module has
function but has no
was not specified in
refers to a location outside the process's accessible address space.
No module by that name exists.
The caller was not privileged
(did not have the
or module unloading is disabled
Other modules depend on this module;
was specified in
but the reference count of this module is nonzero and
was not specified in
Glibc does not provide a wrapper for this system call; call it using
The uninterruptible sleep that may occur if
is omitted from
is considered undesirable, because the sleeping process is left
in an unkillable state.
As at Linux 3.7, specifying
is optional, but in future kernels it is likely to become mandatory.
Linux 2.4 and earlier
In Linux 2.4 and earlier, the system call took only one argument:
int delete_module(const char *name);
is NULL, all unused modules marked auto-clean are removed.
Some further details of differences in the behavior of
in Linux 2.4 and earlier are
currently explained in this manual page.
This page is part of release 3.66 of the Linux
A description of the project,
information about reporting bugs,
and the latest version of this page,
can be found at
- RETURN VALUE
- CONFORMING TO
- Linux 2.4 and earlier
- SEE ALSO
This document was created by
using the manual pages.
Time: 21:42:57 GMT, July 12, 2014