module.9 (132117) | module.9 (140140) |
---|---|
1.\" -*- nroff -*- 2.\" 3.\" Copyright (c) 2000 Alexander Langer 4.\" 5.\" All rights reserved. 6.\" 7.\" This program is free software. 8.\" --- 12 unchanged lines hidden (view full) --- 21.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, 22.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 23.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28.\" | 1.\" -*- nroff -*- 2.\" 3.\" Copyright (c) 2000 Alexander Langer 4.\" 5.\" All rights reserved. 6.\" 7.\" This program is free software. 8.\" --- 12 unchanged lines hidden (view full) --- 21.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, 22.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 23.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28.\" |
29.\" $FreeBSD: head/share/man/man9/module.9 132117 2004-07-13 19:36:59Z phk $ | 29.\" $FreeBSD: head/share/man/man9/module.9 140140 2005-01-12 21:48:25Z ru $ |
30.\" 31.Dd March 1, 2001 32.Dt MODULE 9 33.Os 34.Sh NAME 35.Nm module 36.Nd structure describing a kernel module 37.Sh DESCRIPTION --- 13 unchanged lines hidden (view full) --- 51When the module is loaded, the event handler function is called with 52the 53.Fa what 54argument set to 55.Dv MOD_LOAD . 56.Pp 57On unload it is first called with 58.Fa what | 30.\" 31.Dd March 1, 2001 32.Dt MODULE 9 33.Os 34.Sh NAME 35.Nm module 36.Nd structure describing a kernel module 37.Sh DESCRIPTION --- 13 unchanged lines hidden (view full) --- 51When the module is loaded, the event handler function is called with 52the 53.Fa what 54argument set to 55.Dv MOD_LOAD . 56.Pp 57On unload it is first called with 58.Fa what |
59set to MOD_QUIESCE . | 59set to 60.Dv MOD_QUIESCE . |
60If the unload was not forced, a non-zero return will prevent the 61unload from happening. 62.Pp 63If the unload continues 64.Fa what 65is set to 66.Dv MOD_UNLOAD . 67If the module returns non-zero to this, the unload will not happen. 68.Pp | 61If the unload was not forced, a non-zero return will prevent the 62unload from happening. 63.Pp 64If the unload continues 65.Fa what 66is set to 67.Dv MOD_UNLOAD . 68If the module returns non-zero to this, the unload will not happen. 69.Pp |
69The difference between MOD_QUIESCE and MOD_UNLOAD is that the module 70should fail MOD_QUIESCE if it is currently in use, whereas MOD_UNLOAD | 70The difference between 71.Dv MOD_QUIESCE 72and 73.Dv MOD_UNLOAD 74is that the module should fail 75.Dv MOD_QUIESCE 76if it is currently in use, whereas 77.Dv MOD_UNLOAD |
71should only fail if it is impossible to unload the module, for instance 72because there are memory references to the module which cannot be revoked. 73.Pp 74When the system is shutting down, 75.Fa what 76contains the value of 77.Dv MOD_SHUTDOWN . 78.Pp | 78should only fail if it is impossible to unload the module, for instance 79because there are memory references to the module which cannot be revoked. 80.Pp 81When the system is shutting down, 82.Fa what 83contains the value of 84.Dv MOD_SHUTDOWN . 85.Pp |
79The module should return EOPNOTSUPP for unrecognized values of | 86The module should return 87.Er EOPNOTSUPP 88for unrecognized values of |
80.Fa what . 81.Sh EXAMPLES 82.Bd -literal 83#include <sys/param.h> 84#include <sys/kernel.h> 85#include <sys/module.h> 86 87static int foo_handler(module_t mod, int /*modeventtype_t*/ what, --- 25 unchanged lines hidden --- | 89.Fa what . 90.Sh EXAMPLES 91.Bd -literal 92#include <sys/param.h> 93#include <sys/kernel.h> 94#include <sys/module.h> 95 96static int foo_handler(module_t mod, int /*modeventtype_t*/ what, --- 25 unchanged lines hidden --- |