From 13282b896864dd0d93120062a1001858cfaf3ed9 Mon Sep 17 00:00:00 2001 From: peter Date: Thu, 28 Sep 2000 22:39:59 +0000 Subject: Add man pages for mod*(2). Shamelessly cut/pasted from the kld*(2) man pages by Chris Costello. --- lib/libc/sys/Makefile.inc | 2 + lib/libc/sys/kldfind.2 | 3 ++ lib/libc/sys/kldfirstmod.2 | 3 ++ lib/libc/sys/kldload.2 | 3 ++ lib/libc/sys/kldnext.2 | 3 ++ lib/libc/sys/kldstat.2 | 3 ++ lib/libc/sys/kldunload.2 | 3 ++ lib/libc/sys/modfind.2 | 79 +++++++++++++++++++++++++++++ lib/libc/sys/modnext.2 | 84 ++++++++++++++++++++++++++++++ lib/libc/sys/modstat.2 | 124 +++++++++++++++++++++++++++++++++++++++++++++ 10 files changed, 307 insertions(+) create mode 100644 lib/libc/sys/modfind.2 create mode 100644 lib/libc/sys/modnext.2 create mode 100644 lib/libc/sys/modstat.2 (limited to 'lib/libc') diff --git a/lib/libc/sys/Makefile.inc b/lib/libc/sys/Makefile.inc index 66a41eb..b6629ec 100644 --- a/lib/libc/sys/Makefile.inc +++ b/lib/libc/sys/Makefile.inc @@ -89,6 +89,7 @@ MAN2+= _exit.2 accept.2 access.2 acct.2 adjtime.2 \ kldfind.2 kldfirstmod.2 kldload.2 kldnext.2 kldstat.2 kldunload.2 \ ktrace.2 kqueue.2 link.2 listen.2 lseek.2 \ madvise.2 mincore.2 minherit.2 mkdir.2 mkfifo.2 mknod.2 mlock.2 mmap.2 \ + modfind.2 modnext.2 modstat.2 \ mount.2 mprotect.2 msync.2 munmap.2 nanosleep.2 \ nfssvc.2 open.2 pathconf.2 pipe.2 poll.2 profil.2 ptrace.2 quotactl.2 \ read.2 readlink.2 reboot.2 recv.2 rename.2 revoke.2 rfork.2 rmdir.2 \ @@ -129,6 +130,7 @@ MLINKS+=intro.2 errno.2 MLINKS+=kqueue.2 kevent.2 MLINKS+=lseek.2 seek.2 MLINKS+=mlock.2 munlock.2 +MLINKS+=modnext.2 modfnext.2 MLINKS+=mount.2 unmount.2 MLINKS+=pathconf.2 fpathconf.2 MLINKS+=read.2 pread.2 read.2 readv.2 diff --git a/lib/libc/sys/kldfind.2 b/lib/libc/sys/kldfind.2 index 84c6168..c9e3d49 100644 --- a/lib/libc/sys/kldfind.2 +++ b/lib/libc/sys/kldfind.2 @@ -68,6 +68,9 @@ The file specified is not loaded in the kernel. .Xr kldnext 2 , .Xr kldstat 2 , .Xr kldunload 2 , +.Xr modfind 2 , +.Xr modnext 2 , +.Xr modstat 2 , .Xr kld 4 .Sh HISTORY The diff --git a/lib/libc/sys/kldfirstmod.2 b/lib/libc/sys/kldfirstmod.2 index 67c1e7f..d24b41f 100644 --- a/lib/libc/sys/kldfirstmod.2 +++ b/lib/libc/sys/kldfirstmod.2 @@ -61,6 +61,9 @@ was not found. .Xr kldnext 2 , .Xr kldstat 2 , .Xr kldunload 2 , +.Xr modfind 2 , +.Xr modnext 2 , +.Xr modstat 2 , .Xr kld 4 .Sh HISTORY The diff --git a/lib/libc/sys/kldload.2 b/lib/libc/sys/kldload.2 index 17ad83c..ba6f13e 100644 --- a/lib/libc/sys/kldload.2 +++ b/lib/libc/sys/kldload.2 @@ -75,6 +75,9 @@ was unrecognized. .Xr kldnext 2 , .Xr kldstat 2 , .Xr kldunload 2 , +.Xr modfind 2 , +.Xr modnext 2 , +.Xr modstat 2 , .Xr kld 4 , .Xr kldload 8 .Sh HISTORY diff --git a/lib/libc/sys/kldnext.2 b/lib/libc/sys/kldnext.2 index 13be49f..20984d2 100644 --- a/lib/libc/sys/kldnext.2 +++ b/lib/libc/sys/kldnext.2 @@ -64,6 +64,9 @@ refers to a kld file that does not exist (isn't loaded). .Xr kldload 2 , .Xr kldstat 2 , .Xr kldunload 2 , +.Xr modfind 2 , +.Xr modnext 2 , +.Xr modstat 2 , .Xr kld 4 .Sh HISTORY The diff --git a/lib/libc/sys/kldstat.2 b/lib/libc/sys/kldstat.2 index 8e9c049..e35a2c0 100644 --- a/lib/libc/sys/kldstat.2 +++ b/lib/libc/sys/kldstat.2 @@ -109,6 +109,9 @@ function. .Xr kldload 2 , .Xr kldnext 2 , .Xr kldunload 2 , +.Xr modfind 2 , +.Xr modnext 2 , +.Xr modstat 2 , .Xr kld 4 , .Xr kldstat 8 .Sh HISTORY diff --git a/lib/libc/sys/kldunload.2 b/lib/libc/sys/kldunload.2 index cade5f3..0e5554b 100644 --- a/lib/libc/sys/kldunload.2 +++ b/lib/libc/sys/kldunload.2 @@ -70,6 +70,9 @@ You attempted to unload a file linked by the kernel. .Xr kldload 2 , .Xr kldnext 2 , .Xr kldstat 2 , +.Xr modfind 2 , +.Xr modnext 2 , +.Xr modstat 2 , .Xr kld 4 , .Xr kldunload 8 .Sh HISTORY diff --git a/lib/libc/sys/modfind.2 b/lib/libc/sys/modfind.2 new file mode 100644 index 0000000..8e83d9a --- /dev/null +++ b/lib/libc/sys/modfind.2 @@ -0,0 +1,79 @@ +.\" +.\" Copyright (c) 1999 Chris Costello +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd September 28, 2000 +.Dt MODFIND 2 +.Os FreeBSD +.Sh NAME +.Nm modfind +.Nd returns the modid of a kernel module +.Sh LIBRARY +.Lb libc +.Sh SYNOPSIS +.Fd #include +.Fd #include +.Ft int +.Fn modfind "const char *modname" +.Sh DESCRIPTION +The function +.Fn modfind +returns the modid of the kernel module referenced by +.Fa modname . +.Sh RETURN VALUES +.Fn modfind +returns the modid of the kernel module referenced by +.Fa file . +Upon error, +.Fn modfind +returns -1 and sets +.Va errno +to indicate the error. +.Sh ERRORS +.Va errno +is set to the following if +.Fn modfind +fails: +.Bl -tag -width Er +.It Bq Er EFAULT +The data required for this operation could not be read from the kernel space. +.It Bq Er ENOENT +The file specified is not loaded in the kernel. +.Sh SEE ALSO +.Xr kldfirstmod 2 , +.Xr kldload 2 , +.Xr kldnext 2 , +.Xr kldstat 2 , +.Xr kldunload 2 , +.Xr modnext 2 , +.Xr modfnext 2 , +.Xr modstat 2 , +.Xr kld 4 +.Sh HISTORY +The +.Nm kld +interface first appeared in +.Fx 3.0 . diff --git a/lib/libc/sys/modnext.2 b/lib/libc/sys/modnext.2 new file mode 100644 index 0000000..2e301f8 --- /dev/null +++ b/lib/libc/sys/modnext.2 @@ -0,0 +1,84 @@ +.\" +.\" Copyright (c) 1999 Chris Costello +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd September 28, 2000 +.Dt MODNEXT 2 +.Os FreeBSD +.Sh NAME +.Nm modnext +.Nd return the modid of the next kernel module +.Sh LIBRARY +.Lb libc +.Sh SYNOPSIS +.Fd #include +.Fd #include +.Ft int +.Fn modnext "int modid" +.Ft int +.Fn modfnext "int modid" +.Sh DESCRIPTION +The function +.Fn modnext +returns the modid of the next kernel module (that is, the one after +.Va modid ) +or 0 if +.Va modid +is the last module in the list. +.Pp +If the +.Va modid +value is 0, then +.Fn modnext +will return the modid of the first module. +.Fn modfnext +must always be given a valid modid. +.Sh RETURN VALUES +.Fn modnext +returns the modid of the next module (see DESCRIPTION) or 0. If an error +occurs, +.Va errno +is set to indicate the error. +.Sh ERRORS +The only error set by +.Fn modnext +is ENOENT, which is set when +.Va modid +refers to a kernel module that does not exist (isn't loaded). +.Sh SEE ALSO +.Xr kldfind 2 , +.Xr kldfirstmod 2 , +.Xr kldload 2 , +.Xr kldstat 2 , +.Xr kldunload 2 , +.Xr modfind 2 , +.Xr modstat 2 , +.Xr kld 4 +.Sh HISTORY +The +.Nm kld +interface first appeared in +.Fx 3.0 . diff --git a/lib/libc/sys/modstat.2 b/lib/libc/sys/modstat.2 new file mode 100644 index 0000000..e02279a --- /dev/null +++ b/lib/libc/sys/modstat.2 @@ -0,0 +1,124 @@ +.\" +.\" Copyright (c) 1999 Chris Costello +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd September 28, 2000 +.Dt MODSTAT 2 +.Os FreeBSD +.Sh NAME +.Nm kldstat +.Nd get status of kernel module +.Sh LIBRARY +.Lb libc +.Sh SYNOPSIS +.Fd #include +.Fd #include +.Ft int +.Fn modstat "int modid" "struct module_stat *stat" +.Sh DESCRIPTION +The +.Fn modstat +function writes the info for the kernel module referred to by +.Fa modid +into +.Fa stat . +.Bd -literal +struct module_stat { + int version; /* set to sizeof(module_stat) */ + char name[MAXPATHLEN]; + int refs; + int id; + modspecific_t data; +}; +typedef union modspecific { + int intval; + u_int u_intval; + long longval; + u_long u_longval; +} modspecific_t; +.Ed +.Pp +.Bl -tag -width XXXaddress +.It version +This field is set to the size of the structure mentioned above by the code +calling +.Fn modstat , +and not +.Fn modstat +itself. +.It name +The name of the module referred to by +.Fa modid . +.It refs +The number of modules referenced by +.Fa modid . +.It id +The id of the module specified in +.Fa modid . +.It data +Module specific data. +.Sh RETURN VALUES +.Fn modstat +seems to always return 0. +.Sh ERRORS +The information for the module referred to by +.Fa modid +is filled into the structure pointed to by +.Fa stat +unless: +.Bl -tag -width Er +.It Bq Er ENOENT +The module was not found (probably not loaded). +.It Bq Er EINVAL +The version specified in the +.Fa version +field of stat is not the proper version. You would need to rebuild world, the +kernel, or your application, if this error occurs, given that you did properly +fill in the +.Fa version +field. +.It Bq Er EFAULT +There was a problem copying one, some, or all of the fields into +.Fa stat +in the +.Fn copyout +function. +.Sh SEE ALSO +.Xr kldfind 2 , +.Xr kldfirstmod 2 , +.Xr kldload 2 , +.Xr kldnext 2 , +.Xr kldunload 2 , +.Xr modnext 2 , +.Xr modfind 2 , +.Xr modfnext 2 , +.Xr kld 4 , +.Xr kldstat 8 +.Sh HISTORY +The +.Nm kld +interface first appeared in +.Fx 3.0 . -- cgit v1.1