Manual Pages for Linux CentOS command on man delete_module
MyWebUniversity

Manual Pages for Linux CentOS command on man delete_module

DELETEMODULE(2) Linux Programmer's Manual DELETEMODULE(2)

NAME

deletemodule - unload a kernel module SYNOPSIS int deletemodule(const char *name, int flags); Note: There is no glibc wrapper for this system call; see NOTES. DESCRIPTION The deletemodule() system call attempts to remove the unused loadable module entry identified by name. If the module has an exit function, then that function is executed before unloading the module. The flags 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: 1. If there are other loaded modules that depend on (i.e., refer to symbols defined in) this module, then the call fails. 2. 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. 3. If a module has a nonzero reference count, then the behavior depends on the bits set in flags. In normal usage (see NOTES), the ONONBLOCK flag is always specified, and the OTRUNC flag may addi‐ tionally be specified. The various combinations for flags have the following effect: flags == ONONBLOCK The call returns immediately, with an error. flags == (ONONBLOCK | OTRUNC) The module is unloaded immediately, regardless of whether it has a nonzero reference count. (flags & ONONBLOCK) == 0 If flags does not specify ONONBLOCK, the following steps occur: * The module is marked so that no new references are per‐ mitted. * If the module's reference count is nonzero, the caller is placed in an uninterruptible sleep state (TASKUNINTER‐ RUPTIBLE) until the reference count is zero, at which point the call unblocks. * The module is unloaded in the usual way. The OTRUNC flag has one further effect on the rules described above. By default, if a module has an init function but no exit function, then an attempt to remove the module will fail. However, if OTRUNC was specified, this requirement is bypassed. Using the OTRUNC flag is dangerous! If the kernel was not built with CONFIGMODULEFORCEUNLOAD, this flag is silently ignored. (Normally, CONFIGMODULEFORCEUNLOAD is enabled.) Using this flag taints the kernel (TAINTFORCEDRMMOD). RETURN VALUE

On success, zero is returned. On error, -1 is returned and errno is set appropriately. ERRORS EBUSY The module is not "live" (i.e., it is still being initialized or is already marked for removal); or, the module has an init func‐ tion but has no exit function, and OTRUNC was not specified in flags. EFAULT name refers to a location outside the process's accessible address space. ENOENT No module by that name exists. EPERM The caller was not privileged (did not have the CAPSYSMODULE capability), or module unloading is disabled (see /proc/sys/ker‐ nel/modulesdisabled in proc(5)). EWOULDBLOCK Other modules depend on this module; or, ONONBLOCK was speci‐ fied in flags, but the reference count of this module is nonzero and OTRUNC was not specified in flags. CONFORMING TO

deletemodule() is Linux-specific. NOTES Glibc does not provide a wrapper for this system call; call it using syscall(2). The uninterruptible sleep that may occur if ONONBLOCK is omitted from flags is considered undesirable, because the sleeping process is left in an unkillable state. As at Linux 3.7, specifying ONONBLOCK 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 deletemodule(const char *name);

If name is NULL, all unused modules marked auto-clean are removed. Some further details of differences in the behavior of deletemodule() in Linux 2.4 and earlier are not currently explained in this manual page. SEE ALSO createmodule(2), initmodule(2), querymodule(2), lsmod(8), mod‐ probe(8), rmmod(8) COLOPHON

This page is part of release 3.53 of the Linux man-pages project. A description of the project, and information about reporting bugs, can

be found at http://www.kernel.org/doc/man-pages/.

Linux 2012-11-08 DELETEMODULE(2)




Contact us      |      About us      |      Term of use      |       Copyright © 2000-2019 MyWebUniversity.com ™