]> git.ipfire.org Git - thirdparty/man-pages.git/blobdiff - man2/delete_module.2
pipe.2: Note that 'pipefd' is left unchanged in the event of an error
[thirdparty/man-pages.git] / man2 / delete_module.2
index 28d06a27a039c2c44f9e31b68f2dfecf15c00e4d..daa15faa251d09daad6f70ed1c0431f1d8fab146 100644 (file)
@@ -1,5 +1,6 @@
 .\" Copyright (C) 2012 Michael Kerrisk <mtk.manpages@gmail.com>
 .\"
+.\" %%%LICENSE_START(VERBATIM)
 .\" Permission is granted to make and distribute verbatim copies of this
 .\" manual provided the copyright notice and this permission notice are
 .\" preserved on all copies.
 .\"
 .\" Formatted or processed versions of this manual, if unaccompanied by
 .\" the source, must acknowledge the copyright and authors of this work.
+.\" %%%LICENSE_END
 .\"
-.TH DELETE_MODULE 2 2012-10-24 "Linux" "Linux Programmer's Manual"
+.TH DELETE_MODULE 2 2017-09-15 "Linux" "Linux Programmer's Manual"
 .SH NAME
 delete_module \- unload a kernel module
 .SH SYNOPSIS
 .nf
 .BI "int delete_module(const char *" name ", int " flags );
 .fi
-
+.PP
 .IR Note :
-There is no glibc wrapper for this system call; see NOTES.
+No declaration of this system call is provided in glibc headers; see NOTES.
 .SH DESCRIPTION
 The
 .BR delete_module ()
@@ -44,7 +46,7 @@ The
 argument is used to modify the behavior of the system call,
 as described below.
 This system call requires privilege.
-
+.PP
 Module removal is attempted according to the following rules:
 .IP 1. 4
 If there are other loaded modules that depend on
@@ -52,7 +54,7 @@ If there are other loaded modules that depend on
 then the call fails.
 .IP 2.
 Otherwise, if the reference count for the module
-(i.e., the  number  of processes currently using the module)
+(i.e., the number of processes currently using the module)
 is zero, then the module is immediately unloaded.
 .IP 3.
 If a module has a nonzero reference count,
@@ -65,7 +67,7 @@ flag is always specified, and the
 flag may additionally be specified.
 .\"    O_TRUNC == KMOD_REMOVE_FORCE in kmod library
 .\"    O_NONBLOCK == KMOD_REMOVE_NOWAIT in kmod library
-
+.IP
 The various combinations for
 .I flags
 have the following effect:
@@ -100,12 +102,11 @@ The module is unloaded in the usual way.
 The
 .B O_TRUNC
 flag has one further effect on the rules described above.
-By default,
-attempting to remove a module that has an
+By default, if a module has an
 .I init
 function but no
 .I exit
-function fails.
+function, then an attempt to remove the module fails.
 However, if
 .BR O_TRUNC
 was specified, this requirement is bypassed.
@@ -116,11 +117,11 @@ flag is dangerous!
 If the kernel was not built with
 .BR CONFIG_MODULE_FORCE_UNLOAD ,
 this flag is silently ignored.
-(Normally ,
+(Normally,
 .BR CONFIG_MODULE_FORCE_UNLOAD
 is enabled.)
 Using this flag taints the kernel (TAINT_FORCED_RMMOD).
-.SH "RETURN VALUE"
+.SH RETURN VALUE
 On success, zero is returned.
 On error, \-1 is returned and
 .I errno
@@ -139,7 +140,6 @@ function, and
 .B O_TRUNC
 was not specified in
 .IR flags .
-
 .TP
 .B EFAULT
 .I name
@@ -169,13 +169,21 @@ but the reference count of this module is nonzero and
 .B O_TRUNC
 was not specified in
 .IR flags .
-.SH "CONFORMING TO"
+.SH CONFORMING TO
 .BR delete_module ()
 is Linux-specific.
 .SH NOTES
-Glibc does not provide a wrapper for this system call; call it using
+The
+.BR delete_module ()
+system call is not supported by glibc.
+No declaration is provided in glibc headers, but, through a quirk of history,
+glibc versions before 2.23 did export an ABI for this system call.
+Therefore, in order to employ this system call,
+it is (before glibc 2.23) sufficient to
+manually declare the interface in your code;
+alternatively, you can invoke the system call using
 .BR syscall (2).
-
+.PP
 The uninterruptible sleep that may occur if
 .BR O_NONBLOCK
 is omitted from
@@ -187,19 +195,19 @@ As at Linux 3.7, specifying
 is optional, but in future kernels it is likely to become mandatory.
 .SS Linux 2.4 and earlier
 In Linux 2.4 and earlier, the system call took only one argument:
-
+.PP
 .BI "   int delete_module(const char *" name );
-
+.PP
 If
 .I name
 is NULL, all unused modules marked auto-clean are removed.
-
+.PP
 Some further details of differences in the behavior of
 .BR delete_module ()
 in Linux 2.4 and earlier are
 .I not
 currently explained in this manual page.
-.SH "SEE ALSO"
+.SH SEE ALSO
 .BR create_module (2),
 .BR init_module (2),
 .BR query_module (2),