summaryrefslogtreecommitdiff
path: root/share/man
diff options
context:
space:
mode:
authorcvs2svn <cvs2svn@FreeBSD.org>2000-07-26 21:12:35 +0000
committercvs2svn <cvs2svn@FreeBSD.org>2000-07-26 21:12:35 +0000
commita964be6d2c35243e54bf5ce12c15339d331189cb (patch)
tree26495eba10a5d04d8137457f832b376b573dd186 /share/man
parentdc30028e8a31a0604280582224f03e9c70ec1ec0 (diff)
Diffstat (limited to 'share/man')
-rw-r--r--share/man/man4/tap.4217
-rw-r--r--share/man/man5/periodic.conf.5443
-rw-r--r--share/man/man9/accept_filter.9134
-rw-r--r--share/man/man9/sysctl_add_oid.9502
-rw-r--r--share/man/man9/sysctl_ctx_init.9244
5 files changed, 0 insertions, 1540 deletions
diff --git a/share/man/man4/tap.4 b/share/man/man4/tap.4
deleted file mode 100644
index fba5466cd0bd..000000000000
--- a/share/man/man4/tap.4
+++ /dev/null
@@ -1,217 +0,0 @@
-.\" $FreeBSD$
-.\" Based on PR#2411
-.\"
-.Dd July 9, 2000
-.Os
-.Dt TAP 4
-.Sh NAME
-.Nm tap
-.Nd Ethernet tunnel software network interface
-.Sh SYNOPSIS
-.Cd pseudo-device tap
-.Sh DESCRIPTION
-The
-.Nm tap
-interface is a software loopback mechanism that can be loosely
-described as the network interface analog of the
-.Xr pty 4 ,
-that is,
-.Nm tap
-does for network interfaces what the
-.Nm pty
-driver does for terminals.
-.Pp
-The
-.Nm tap
-driver, like the
-.Nm pty
-driver, provides two interfaces: an interface like the usual facility
-it is simulating
-.Po
-an Ethernet network interface in the case of
-.Nm tap ,
-or a terminal for
-.Nm pty
-.Pc ,
-and a character-special device
-.Dq control
-interface.
-.Pp
-The network interfaces are named
-.Sy tap Ns Ar 0 ,
-.Sy tap Ns Ar 1 ,
-etc, as many as were made by
-.Xr MAKEDEV 8 .
-Each one supports the usual Ethernet network-interface
-.Xr ioctl 2 Ns s ,
-such as
-.Dv SIOCSIFADDR
-and
-.Dv SIOCSIFNETMASK ,
-and thus can be used with
-.Xr ifconfig 8
-like any other Ethernet interface. When the system chooses to transmit
-an Ethernet frame on the network interface, the frame can be read from
-the control device
-.Po
-it appears as
-.Dq input
-there
-.Pc ;
-writing an Ethernet frame to the control device generates an input frame on
-the network interface, as if the
-.Pq non-existent
-hardware had just received it.
-.Pp
-The Ethernet tunnel device, normally
-.Pa /dev/tap Ns Sy N ,
-is exclusive-open
-.Po
-it cannot be opened if it is already open
-.Pc
-and is restricted to the super-user.
-A
-.Fn read
-call will return an error
-.Pq Er EHOSTDOWN
-if the interface is not
-.Dq ready .
-Once the interface is ready,
-.Fn read
-will return an Ethernet frame if one is available; if not, it will
-either block until one is or return
-.Er EWOULDBLOCK ,
-depending on whether non-blocking I/O has been enabled. If the frame
-is longer than is allowed for in the buffer passed to
-.Fn read ,
-the extra data will be silently dropped.
-.Pp
-A
-.Xr write 2
-call passes an Ethernet frame in to be
-.Dq received
-on the pseudo-interface. Each
-.Fn write
-call supplies exactly one frame; the frame length is taken from the
-amount of data provided to
-.Fn write .
-Writes will not block; if the frame cannot be accepted
-for a transient reason
-.Pq e.g., no buffer space available ,
-it is silently dropped; if the reason is not transient
-.Pq e.g., frame too large ,
-an error is returned.
-The following
-.Xr ioctl 2
-calls are supported
-.Pq defined in Aq Pa net/if_tap.h Ns :
-.Bl -tag -width VMIO_SIOCSETMACADDR
-.It Dv TAPSDEBUG
-The argument should be a pointer to an
-.Va int ;
-this sets the internal debugging variable to that value. What, if
-anything, this variable controls is not documented here; see the source
-code.
-.It Dv TAPGDEBUG
-The argument should be a pointer to an
-.Va int ;
-this stores the internal debugging variable's value into it.
-.It Dv FIONBIO
-Turn non-blocking I/O for reads off or on, according as the argument
-.Va int Ns 's
-value is or isn't zero
-.Pq Writes are always nonblocking .
-.It Dv FIOASYNC
-Turn asynchronous I/O for reads
-.Po
-i.e., generation of
-.Dv SIGIO
-when data is available to be read
-.Pc
-off or on, according as the argument
-.Va int Ns 's
-value is or isn't zero.
-.It Dv FIONREAD
-If any frames are queued to be read, store the size of the first one into the argument
-.Va int ;
-otherwise, store zero.
-.It Dv TIOCSPGRP
-Set the process group to receive
-.Dv SIGIO
-signals, when asynchronous I/O is enabled, to the argument
-.Va int
-value.
-.It Dv TIOCGPGRP
-Retrieve the process group value for
-.Dv SIGIO
-signals into the argument
-.Va int
-value.
-.It SIOCGIFADDR
-Retrieve the Media Access Control
-.Pq MAC
-address. This command should be executed on descriptor, associated with
-control device
-.Pq Pa /dev/tap Ns Sy N .
-The
-.Va buffer ,
-which is passed as argument, is expected to have enought space to store
-.Pq MAC
-address.
-.It SIOCSIFADDR
-Set the Media Access Control
-.Pq MAC
-address. This command should be executed on a descriptor, associated with
-control device
-.Pq Pa /dev/tap Ns Sy N .
-.El
-.Pp
-The control device also supports
-.Xr select 2
-for read; selecting for write is pointless, and always succeeds, since
-writes are always non-blocking.
-.Pp
-On the last close of the data device, by default, the interface is
-brought down
-.Po
-as if with
-.Dq ifconfig tap Ns Sy N No down
-.Pc .
-All queued frames are thrown away. If the interface is up when the data
-device is not open output frames are always thrown away rather than
-letting them pile up.
-.Pp
-The
-.Nm tap
-device is also can be used with VMware port as a replacement
-of VMnet device driver. The driver uses minor number to select between
-.Nm tap
-and
-.Nm vmnet
-devices. VMnet minor numbering is
-.Va 0x10000
-+
-.Va N .
-Where
-.Va N
-is a VMnet unit number. In this case control device is expected to be
-.Pa /dev/vmnet Ns Sy N ,
-and network interface will be
-.Sy vmnet Ns Ar N .
-Everything else is the same.
-.Pp
-In addition to mentioned above
-.Xr ioctl 2
-there are additional one for VMware port.
-.Bl -tag -width VMIO_SIOCSETMACADDR
-.It VMIO_SIOCSIFFLAGS
-VMware
-.Dv SIOCSIFFLAGS .
-.El
-.Sh SEE ALSO
-.Xr inet 4 ,
-.Xr intro 4
-.\" .Sh BUGS
-.Sh AUTHORS
-This man page has been obtained from
-.Bx Free .
diff --git a/share/man/man5/periodic.conf.5 b/share/man/man5/periodic.conf.5
deleted file mode 100644
index 3acce7892e1d..000000000000
--- a/share/man/man5/periodic.conf.5
+++ /dev/null
@@ -1,443 +0,0 @@
-.\"-
-.\" Copyright (c) 2000 Brian Somers <brian@Awfulhak.org>
-.\" 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 June 22, 2000
-.Dt PERIODIC.CONF 5
-.Os FreeBSD 5.0
-.Sh NAME
-.Nm periodic.conf
-.Nd periodic job configuration information.
-.Sh DESCRIPTION
-The file
-.Nm periodic.conf
-contains a description of how daily, weekly and montly system maintenance
-jobs should run.
-It resides in the
-.Pa /etc/defaults
-directory and parts may be overridden by a file of the same name in
-.Pa /etc ,
-which itself may be overridden by the
-.Pa /etc/periodic.conf.local
-file.
-.Pp
-.Nm
-is actually sourced as a shell script from each of the periodic scripts
-and is intended to simply provide default configuration variables.
-.Pp
-The following list provides a name and short description for each
-variable you can set in the
-.Nm
-file.
-.Bl -tag -offset 4n -width 2n
-.It Ar local_periodic
-(str) List of directories to search for periodic scripts.
-.El
-.B Daily variables
-.Pp
-The following variables are used by the standard scripts that reside in
-.Pa /etc/periodic/daily :
-.Bl -tag -offset 4n -width 2n
-.It Ar daily_clean_disks_enable
-(bool) Set to
-.Dq YES
-if you want to remove all files matching
-.Ar daily_clean_disks_files
-daily.
-.It Ar daily_clean_disks_files
-(str) Set to a list of file names to match.
-Wild cards are permitted.
-.It Ar daily_clean_disks_days
-(int) When
-.Ar daily_clean_disks_enable
-is set to
-.Dq YES ,
-this must also be set to the number of days old that a file's access
-and modification times must be before it's deleted.
-.It Ar daily_clean_disks_verbose
-(bool) Set to
-.Dq YES
-if you want the removed files to be reported in your daily output.
-.It Ar daily_clean_tmps_enable
-(bool) Set to
-.Dq YES
-if you want to clear temporary directories daily.
-.It Ar daily_clean_tmps_dirs
-(str) Set to the list of directories to clear if
-.Ar daily_clean_tmps_enable
-is set to
-.Dq YES .
-.It Ar daily_clean_tmps_days
-(int) When
-.Ar daily_clean_tmps_enable
-is set, this must also be set to the number of days old that a file's access
-and modification times must be before it's deleted.
-.It Ar daily_clean_tmps_ignore
-(str) Set to the list of files that should not be deleted when
-.Ar daily_clean_tmps_enable
-is set to
-.Dq YES .
-Wild card characters are permitted.
-.It Ar daily_clean_tmps_verbose
-(bool) Set to
-.Dq YES
-if you want the removed files to be reported in your daily output.
-.It Ar daily_clean_preserve_enable
-(bool) Set to
-.Dq YES
-if you wish to remove old files from
-.Pa /var/preserve .
-.It Ar daily_clean_preserve_days
-(num) Set to the number of days that files must not have been modified before
-they are deleted.
-.It Ar daily_clean_preserve_verbose
-(bool) Set to
-.Dq YES
-if you want the removed files to be reported in your daily output.
-.It Ar daily_clean_msgs_enable
-(bool) Set to
-.Dq YES
-if you old system messages to be purged.
-.It Ar daily_clean_msgs_days
-(num) Set to the number of days that files must not have been modified before
-they are deleted.
-If this variable is left blank, the
-.Xr msgs 1
-default is used.
-.It Ar daily_clean_rwho_enable
-(bool) Set to
-.Dq YES
-if you wish old files in
-.Pa /var/who
-to be purged.
-.It Ar daily_clean_rwho_days
-(num) Set to the number of days that files must not have been modified before
-they are deleted.
-.It Ar daily_clean_rwho_verbose
-(bool) Set to
-.Dq YES
-if you want the removed files to be reported in your daily output.
-.It Ar daily_clean_hoststat_enable
-(bool) Set to
-.Dq YES
-if you wish old files in
-.Pa /var/spool/.hoststat
-to be purged.
-.It Ar daily_clean_hoststat_days
-(num) Set to the number of days that files must not have been modified before
-they are deleted.
-.It Ar daily_clean_hoststat_verbose
-(bool) Set to
-.Dq YES
-if you want the removed files to be reported in your daily output.
-.It Ar daily_backup_passwd_enable
-(bool) Set to
-.Dq YES
-if you want the
-.Pa /etc/master.passwd
-and
-.Pa /etc/group
-files backed up and reported on.
-Reporting consists of checking both files for modifications and running
-.Xr chkgrp 8
-on the
-.Pa group
-file.
-.It Ar daily_backup_aliases_enable
-(bool) Set to
-.Dq YES
-if you want the
-.Pa /etc/aliases
-file backed up and modifications to be displayed in your daily output.
-.It Ar daily_backup_distfile_enable
-(bool) Set to
-.Dq YES
-if you want the
-.Pa /etc/Distfile
-file backed up and modifications to be displayed in your daily output.
-.It Ar daily_calendar_enable
-(bool) Set to
-.Dq YES
-if you want to run
-.Ic calendar -a
-daily.
-.It Ar daily_accounting_enable
-(bool) Set to
-.Dq YES
-if you want to rotate your daily accounting files.
-No rotations are necessary unless
-.Ar accounting_enable
-is enabled in
-.Xr rc.conf 5 .
-.It Ar daily_accounting_compress
-(bool) Set to
-.Dq YES
-if you want your daily accounting files to be compressed using
-.Xr gzip 1 .
-.It Ar daily_distfile_enable
-(bool) Set to
-.Dq YES
-if you want to run
-.Xr rdist 1
-daily.
-The
-.Pa /etc/Distfile
-file must also exist.
-.It Pa daily_news_expire_enable
-(bool) Set to
-.Dq YES
-if you want to run
-.Pa /etc/news.expire .
-.It Pa daily_uuclean_enable
-(bool) Set to
-.Dq YES
-if you want to run
-.Pa /etc/uuclean.daily .
-.It Ar daily_status_disks_enable
-(bool) Set to
-.Dq YES
-if you want to run
-.Xr df 1
-.Po
-with the arguments supplied in
-.Ar daily_status_disks_df_flags
-.Pc
-and
-.Ic dump W .
-.It Ar daily_status_disks_df_flags
-(str) Set to the arguments for the
-.Xr df 1
-utility when
-.Ar daily_status_disks_enable
-is set to
-.Dq YES .
-.It Ar daily_status_uucp_enable
-(bool) Set to
-.Dq YES
-if you want to run
-.Pa /etc/uuclean.daily .
-.It Ar daily_status_network_enable
-(bool) Set to
-.Dq YES
-if you want to run
-.Ic netstat -i .
-.It Ar daily_status_network_usedns
-(bool) Set to
-.Dq YES
-if you want to run
-.Xr netstat 1
-without the
-.Fl n
-option (to do DNS lookups).
-.It Ar daily_status_rwho_enable
-(bool) Set to
-.Dq YES
-if you want to run
-.Xr uptime 1
-(or
-.Xr ruptime 1
-if
-.Ar rwhod_enable
-is set to
-.Dq YES
-in
-.Pa /etc/rc.conf ).
-.It Ar daily_status_mailq_enable
-(bool) Set to
-.Dq YES
-if you want to run
-.Xr mailq 1 .
-.It Ar daily_status_mailq_shorten
-(bool) Set to
-.Dq YES
-if you want to shorten the
-.Nm mailq
-output when
-.Ar daily_status_mailq_enable
-is set to
-.Dq YES .
-.It Ar daily_status_security_enable
-(bool) Set to
-.Dq YES
-if you want to run
-.Pa /etc/security .
-.It Ar daily_status_security_inline
-(bool) Set to
-.Dq YES
-if you want to run
-.Pa /etc/security
-inline.
-The alternative is to run it as a background job, mailing the output to
-.An root .
-.It Ar daily_status_security_noamd
-(bool) Set to
-.Dq YES
-if you want to ignore
-.Xr amd 8
-mounts when comparing against yesterdays filesystem mounts.
-.It Ar daily_status_security_nomfs
-(bool) Set to
-.Dq YES
-if you want to ignore
-.Xr mfs 8
-mounts when comparing against yesterdays filesystem mounts.
-.It Ar daily_status_mail_rejects_enable
-(bool) Set to
-.Dq YES
-if you want to summarise mail rejections logged to
-.Pa /var/log/maillog
-for the previous day.
-.It Ar daily_status_mail_rejects_logs
-(num) Set to the number of maillog files that should be checked
-for yesterday's mail rejects.
-.It Ar daily_local
-(str) Set to a list of extra scripts that should be run after all other
-daily scripts.
-All scripts must be absolute path names.
-.El
-.Pp
-The following variables are used by the standard scripts that reside in
-.Pa /etc/periodic/weekly :
-.Bl -tag -offset 4n -width 2n
-.It Ar weekly_clean_kvmdb_enable
-(bool) Set to
-.Dq YES
-if you want to purge old
-.Pa /var/db/kvm_*.db
-files.
-The kvm file for the current kernel will not be purged.
-.It Ar weekly_clean_kvmdb_days
-(num) Set to the number of days that the file must not have been accessed
-before being deleted.
-.It Ar weekly_clean_kvmdb_verbose
-(bool) Set to
-.Dq YES
-if you want the removed files to be reported in your daily output.
-.It Ar weekly_uucp_enable
-(bool) Set to
-.Dq YES
-if you want to run
-.Pa /usr/libexec/uucp/clean.weekly .
-.It Ar weekly_locate_enable
-(bool) Set to
-.Dq YES
-if you want to run
-.Pa /usr/libexec/locate.updatedb .
-This script is run using
-.Ic nice -5
-as user
-.An nobody ,
-and generates the table used by the
-.Xr locate 1
-command.
-.It Ar weekly_whatis_enable
-(bool) Set to
-.Dq YES
-if you want to run
-.Pa /usr/libexec/makewhatis.local .
-This script regenerates the database used by the
-.Xr apropos 1
-command.
-.It Ar weekly_catman_enable
-(bool) Set to
-.Dq YES
-if you want to run
-.Pa /usr/libexec/catman.local .
-This script processes all out of date man pages, speeding up the
-.Xr man 1
-command at the expense of disk space.
-.It Ar weekly_noid_enable
-(bool) Set to
-.Dq YES
-if you want to locate orphaned files on the system.
-An orphaned file is one with an invalid owner or group.
-.It Ar weekly_noid_dirs
-(str) A list of directories under which orphaned files are searched for.
-This would usually be set to
-.Pa / .
-.It Ar weekly_status_pkg_dirs
-(bool) Set to
-.Dq YES
-if you want to use
-.Xr pkg_version 1
-to list installed packages which are out of date.
-.It Ar weekly_local
-(str) Set to a list of extra scripts that should be run after all other
-weekly scripts.
-All scripts must be absolute path names.
-.El
-.Pp
-The following variables are used by the standard scripts that reside in
-.Pa /etc/periodic/monthly :
-.Bl -tag -offset 4n -width 2n
-.It Ar monthly_accounting_enable
-(bool) Set to
-.Dq YES
-if you want to do login accounting using the
-.Xr ac 8
-command.
-.It Ar monthly_local
-(str) Set to a list of extra scripts that should be run after all other
-monthly scripts.
-All scripts must be absolute path names.
-.El
-.Sh FILES
-.Bl -tag -width /etc/defaults/periodic.conf
-.It Pa /etc/defaults/periodic.conf
-The default configuration file.
-This file contains all default variables and values.
-.It Pa /etc/periodic.conf
-The usual system specific variable override file.
-.It Pa /etc/periodic.conf.local
-An additional override file, useful when
-.Pa /etc/periodic.conf
-is shared or distributed.
-.El
-.Sh SEE ALSO
-.Xr apropos 1 ,
-.Xr calendar 1 ,
-.Xr df 1 ,
-.Xr gzip 1 ,
-.Xr locate 1 ,
-.Xr man 1 ,
-.Xr msgs 1 ,
-.Xr netstat 1 ,
-.Xr nice 1 ,
-.Xr pkg_version 1 ,
-.Xr rdist 1 ,
-.Xr rc.conf 5 ,
-.Xr ac 8 ,
-.Xr chkgrp 8 ,
-.Xr dump 8 ,
-.Xr mfs 8 .
-.Xr periodic 8 .
-.Sh HISTORY
-The
-.Nm
-file appeared in
-.Fx 5.0 .
-.Sh AUTHORS
-.An Brian Somers Aq brian@Awfulhak.org .
diff --git a/share/man/man9/accept_filter.9 b/share/man/man9/accept_filter.9
deleted file mode 100644
index 94a113cc3886..000000000000
--- a/share/man/man9/accept_filter.9
+++ /dev/null
@@ -1,134 +0,0 @@
-.\"
-.\" Copyright (c) 2000 Alfred Perlstein
-.\"
-.\" 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 DEVELOPERS ``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 DEVELOPERS 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 June 25, 2000
-.Os
-.Dt ACCEPT_FILTER 9
-.Sh NAME
-.Nm accept_filter ,
-.Nm accept_filt_add ,
-.Nm accept_filt_del ,
-.Nm accept_filt_generic_mod_event ,
-.Nm accept_filt_get
-.Nd filter incoming connections
-.Sh SYNOPSIS
-.Fd #include <sys/types.h>
-.Fd #include <sys/socket.h>
-.Fd #include <sys/socketvar.h>
-.Ft int
-.Fn accept_filt_add "struct accept_filter *filt"
-.Ft int
-.Fn accept_filt_del "char *name"
-.Ft int
-.Fn accept_filt_generic_mod_event "module_t mod" "int event" "void *data"
-.Ft struct accept_filter *
-.Fn accept_filt_get "char *name"
-.Sh DESCRIPTION
-Accept filters allow an application to request
-that the kernel pre-process incoming connections.
-An accept filter is requested via the
-.Xr setsockopt 2
-system call, passing in an
-.Fa optname
-of
-.Dv SO_ACCEPTFILTER .
-.Sh IMPLEMENTATION NOTES
-A module that wants to be an accept filter
-must provide a struct accept_filter to the system:
-.Bd -literal
-struct accept_filter {
- char accf_name[16];
- void (*accf_callback)
- __P((struct socket *so, void *arg, int waitflag));
- void * (*accf_create)
- __P((struct socket *so, char *arg));
- void (*accf_destroy)
- __P((struct socket *so));
- SLIST_ENTRY(accept_filter) accf_next; /* next on the list */
-};
-.Ed
-.Pp
-The module should register it with the function
-.Fn accept_filt_add ,
-passing a pointer to a struct accept_filter, allocated with
-.Xr MALLOC 9
-.Pp
-The fields of
-.Fa struct accept_filter
-are as follows:
-.Bl -tag -width accf_callbackXXX
-.It accf_name
-Name of the filter;
-this is how it will be accessed from userland.
-.It accf_callback
-The callback that the kernel will do
-once the connection is established.
-It is the same as a socket upcall
-and will be called when the connection is established
-and whenever new data arrives on the socket,
-unless the callback modifies the socket's flags.
-.It accf_create
-Called whenever a
-.Xr setsockopt 2
-installs the filter onto
-a listening socket.
-.It accf_destroy
-Called whenever the user removes the accept filter on the socket.
-.El
-.Pp
-.Fn accept_filt_del
-passed the same string used in accept_filter.accf_name during registration
-with
-.Fn accept_filt_add ,
-the kernel will then disallow and further userland use of the filter.
-.Pp
-.Fn accept_filt_get
-is used internally to locate which accept filter to use via the
-.Fn setsocketopt
-syscall.
-.Pp
-.Fn accept_filt_generic_mod_event
-provides a simple way to avoid duplicate
-code for accept filters which don't use
-argument field to load and unload
-themselves. It is a function that can be
-put in the load/unload struct
-for the
-.Fn DECLARE_MODULE
-macro.
-.Sh SEE ALSO
-.Xr setsockopt 2 ,
-.Xr malloc 9
-.Sh HISTORY
-The accept filter mechanism was introduced in
-.Fx 4.0 .
-.Sh AUTHORS
-This manual page has been written by
-.An Alfred Perlstein ,
-Sheldon Hearn and Jeroen Ruigrok van der Werven.
-The accept filter concept was pioneered by engineers at Yahoo.com
-and refined to be a loadable module system by Alfred Perlstein.
diff --git a/share/man/man9/sysctl_add_oid.9 b/share/man/man9/sysctl_add_oid.9
deleted file mode 100644
index 3d5769b9b4c0..000000000000
--- a/share/man/man9/sysctl_add_oid.9
+++ /dev/null
@@ -1,502 +0,0 @@
-.\"
-.\" Copyright (c) 2000, Andrzej Bialecki <abial@freebsd.org>
-.\" 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.
-.\" 3. The name of the author may not be used to endorse or promote products
-.\" derived from this software without specific prior written permission.
-.\"
-.\" 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 Jul 15, 2000
-.Dt SYSCTL_ADD_OID 9
-.Os
-.Sh NAME
-.Nm sysctl_add_oid ,
-.Nm sysctl_remove_oid
-.Nd runtime sysctl tree manipulation
-.Sh SYNOPSIS
-.Fd #include <sys/sysctl.h>
-.Ft struct sysctl_oid *
-.Fo sysctl_add_oid
-.Fa "struct sysctl_ctx_list *ctx"
-.Fa "struct sysctl_oid_list *parent"
-.Fa "int number"
-.Fa "char *name"
-.Fa "int kind"
-.Fa "void *arg1"
-.Fa "int arg2"
-.Fa "int (*handler) (SYSCTL_HANDLER_ARGS)"
-.Fa "char *format"
-.Fa "char *descr"
-.Fc
-.Ft int
-.Fo sysctl_remove_oid
-.Fa "struct sysctl_oid *oidp"
-.Fa "int del"
-.Fa "int recurse"
-.Fc
-.Ft struct sysctl_oid_list *
-.Fo SYSCTL_CHILDREN
-.Fa "struct sysctl_oid *oidp"
-.Fc
-.Ft struct sysctl_oid_list *
-.Fo SYSCTL_STATIC_CHILDREN
-.Fa "OID_NAME"
-.Fc
-.Ft struct sysctl_oid *
-.Fo SYSCTL_ADD_OID
-.Fa "struct sysctl_ctx_list *ctx"
-.Fa "struct sysctl_oid_list *parent"
-.Fa "int number"
-.Fa "NAME"
-.Fa "int kind"
-.Fa "void *arg1"
-.Fa "int arg2"
-.Fa "int (*handler) (SYSCTL_HANDLER_ARGS)"
-.Fa "char *format"
-.Fa "char *descr"
-.Fc
-.Ft struct sysctl_oid *
-.Fo SYSCTL_ADD_NODE
-.Fa "struct sysctl_ctx_list *ctx"
-.Fa "struct sysctl_oid_list *parent"
-.Fa "int number"
-.Fa "NAME"
-.Fa "int access"
-.Fa "int (*handler) (SYSCTL_HANDLER_ARGS)"
-.Fa "char *descr"
-.Fc
-.Ft struct sysctl_oid *
-.Fo SYSCTL_ADD_STRING
-.Fa "struct sysctl_ctx_list *ctx"
-.Fa "struct sysctl_oid_list *parent"
-.Fa "int number"
-.Fa "NAME"
-.Fa "int access"
-.Fa "char *arg"
-.Fa "0"
-.Fa "char *descr"
-.Fc
-.Ft struct sysctl_oid *
-.Fo SYSCTL_ADD_INT
-.Fa "struct sysctl_ctx_list *ctx"
-.Fa "struct sysctl_oid_list *parent"
-.Fa "int number"
-.Fa "NAME"
-.Fa "int access"
-.Fa "int *arg"
-.Fa "0"
-.Fa "char *descr"
-.Fc
-.Ft struct sysctl_oid *
-.Fo SYSCTL_ADD_UINT
-.Fa "struct sysctl_ctx_list *ctx"
-.Fa "struct sysctl_oid_list *parent"
-.Fa "int number"
-.Fa "NAME"
-.Fa "int access"
-.Fa "unsigned int *arg"
-.Fa "0"
-.Fa "char *descr"
-.Fc
-.Ft struct sysctl_oid *
-.Fo SYSCTL_ADD_LONG
-.Fa "struct sysctl_ctx_list *ctx"
-.Fa "struct sysctl_oid_list *parent"
-.Fa "int number"
-.Fa "NAME"
-.Fa "int access"
-.Fa "long *arg"
-.Fa "0"
-.Fa "char *descr"
-.Fc
-.Ft struct sysctl_oid *
-.Fo SYSCTL_ADD_ULONG
-.Fa "struct sysctl_ctx_list *ctx"
-.Fa "struct sysctl_oid_list *parent"
-.Fa "int number"
-.Fa "NAME"
-.Fa "int access"
-.Fa "unsigned long *arg"
-.Fa "0"
-.Fa "char *descr"
-.Fc
-.Ft struct sysctl_oid *
-.Fo SYSCTL_ADD_OPAQUE
-.Fa "struct sysctl_ctx_list *ctx"
-.Fa "struct sysctl_oid_list *parent"
-.Fa "int number"
-.Fa "NAME"
-.Fa "int access"
-.Fa "void *arg"
-.Fa "size_t *len"
-.Fa "char *descr"
-.Fc
-.Ft struct sysctl_oid *
-.Fo SYSCTL_ADD_STRUCT
-.Fa "struct sysctl_ctx_list *ctx"
-.Fa "struct sysctl_oid_list *parent"
-.Fa "int number"
-.Fa "NAME"
-.Fa "int access"
-.Fa "struct TYPE *arg"
-.Fa "TYPE"
-.Fa "char *descr"
-.Fc
-.Ft struct sysctl_oid *
-.Fo SYSCTL_ADD_PROC
-.Fa "struct sysctl_ctx_list *ctx"
-.Fa "struct sysctl_oid_list *parent"
-.Fa "int number"
-.Fa "NAME"
-.Fa "int access"
-.Fa "0"
-.Fa "0"
-.Fa "int (*handler) (SYSCTL_HANDLER_ARGS)"
-.Fa "char *format"
-.Fa "char *descr"
-.Fc
-.Sh DESCRIPTION
-These functions and macros provide an interface
-for creating and deleting sysctl oids at runtime
-(e.g. during lifetime of a module).
-The alternative method,
-based on linker sets (see
-.Aq sys/linker_set.h
-and
-.\" XXX Manual pages should avoid referencing source files
-.Pa src/sys/kern/kern_sysctl.c
-for details), only allows creation and deletion
-on module load and unload respectively.
-.Pp
-Dynamic oids of type
-.Dv CTLTYPE_NODE
-are reusable
-so that several code sections can create and delete them,
-but in reality they are allocated and freed
-based on their reference count.
-As a consequence,
-it is possible for two or more code sections
-to create partially overlapping trees that they both can use.
-It is not possible to create overlapping leaves,
-nor to create different child types with the name name and parent.
-.Pp
-Newly created oids are connected to their parent nodes.
-In all these functions and macros
-(with the exception of
-.Fn sysctl_remove_oid ) ,
-one of the required parameters is
-.Fa parent ,
-which points to the head of the parent's list of children.
-.Pp
-Most top level categories are created statically.
-When connecting to existing static oids,
-this pointer can be obtained with the
-.Fn SYSCTL_STATIC_CHILDREN
-macro, where the
-.Fa OID_NAME
-argumwent is name of the parent oid of type
-.Dv CTLTYPE_NODE
-(i.e. the name displayed by
-.Xr sysctl 8 ,
-preceded by underscore, and with all dots replaced with underscores).
-.Pp
-When connecting to an existing dynamic oid, this pointer
-can be obtained with the
-.Fn SYSCTL_CHILDREN
-macro, where the
-.Fa oidp
-argument points to the parent oid of type
-.Dv CTLTYPE_NODE .
-.Pp
-The
-.Fn sysctl_add_oid
-function creates raw oids of any type.
-If the oid is successfuly created,
-the function returns a pointer to it;
-otherwise it returns
-.Dv NULL .
-Many of the arguments for
-.Fn sysctl_add_oid
-are common to the macros.
-The arguments are as follows:
-.Bl -tag -width handler
-.It Fa ctx
-A pointer to an optional sysctl context, or
-.Dv NULL .
-See
-.Xr sysctl_ctx_init 9
-for details.
-Programmers are strongly advised to use contexts
-to organize the dynamic oids which they create,
-unless special creation and deletion sequences are required.
-If
-.Fa ctx
-is not
-.Dv NULL ,
-the newly created oid will be added to this context
-as its first entry.
-.It Fa parent
-A pointer to a
-.Li struct sysctl_oid_list ,
-which is the head of the parent's list of children.
-.It Fa number
-The oid number that will be assigned to this oid.
-In almost all cases this should be set to
-.Dv OID_AUTO ,
-which will result in the assignment of the next available oid number.
-.It Fa name
-The name of the oid.
-The newly created oid will contain a copy of the name.
-.It Fa kind
-The kind of oid,
-specified as a bitmask of the type and access values defined in the
-.Aq sys/sysctl.h
-header file.
-Oids created dynamically always have the
-.Dv CTLTYPE_DYN
-flag set.
-Access flags specify whether this oid is read-only or read-write,
-and whether it may be modified by all users
-or by the supseruser only.
-.It Fa arg1
-A pointer to any data that the oid should reference, or
-.Dv NULL .
-.It Fa arg2
-The size of
-.Fa arg1 ,
-or 0 if
-.Fa arg1
-is
-.Dv NULL .
-.It Fa handler
-A pointer to the function
-that is responsible for handling read and write requests
-to this oid.
-There are several standard handlers
-that support operations on nodes,
-integers, strings and opaque objects.
-It is possible also to define new handlers using the
-.Fn SYSCTL_ADD_PROC
-macro.
-.It Fa format
-A pointer to a string
-which specifies the format of the oid symbolically.
-This format is used as a hint by
-.Xr sysctl 8
-to apply proper data formatting for display purposes.
-Currently used format names are:
-.Dq N
-for node,
-.Dq A
-for
-.Li "char *" ,
-.Dq I
-for
-.Li "int" ,
-.Dq IU
-for
-.Li "unsigned int" ,
-.Dq L
-for
-.Li "long" ,
-.Dq LU
-for
-.Li "unsigned long"
-and
-.Dq S,TYPE
-for
-.Li "struct TYPE"
-structures.
-.It Fa descr
-A pointer to a textual description of the oid.
-.El
-.Pp
-The
-.Fn sysctl_remove_oid
-function removes a dynamically created oid from the tree,
-optionally freeing its resources.
-It takes the following arguments:
-.Bl -tag -width recurse
-.It Fa oidp
-A pointer to the dynamic oid to be removed.
-If the oid is not dynamic, or the pointer is
-.Dv NULL ,
-the function returns
-.Er EINVAL .
-.It Fa del
-If non-zero,
-.Fn sysctl_remove_oid
-will try to free the oid's resources
-when the reference count of the oid becomes zero.
-However, if
-.Fa del
-is set to 0,
-the routine will only deregister the oid from the tree,
-without freeing its resources.
-This behaviour is useful when the caller expects to rollback
-(possibly partially failed)
-deletion of many oids later.
-.It Fa recurse
-If non-zero, attempt to remove the node and all its children.
-If
-.Pa recurse
-is set to 0,
-any attempt to remove a node that contains any children
-will result in a
-.Er ENOTEMPTY
-error.
-.Em "WARNING: use recursive deletion with extreme caution!"
-Normally it should not be needed if contexts are used.
-Contexts take care of tracking inter-dependencies
-between users of the tree.
-However, in some extreme cases it might be necessary
-to remove part of the subtree no matter how it was created,
-in order to free some other resources.
-Be aware, though, that this may result in a system
-.Xr panic 9
-if other code sections continue to use removed subtrees.
-.El
-.Pp
-.\" XXX sheldonh finished up to here
-Again, in most cases the programmer should use contexts,
-as described in
-.Xr sysctl_ctx_init 9 ,
-to keep track of created oids,
-and to delete them later in orderly fashion.
-.Pp
-There is a set of macros defined
-that helps to create oids of given type.
-.Bl -tag -width SYSCTL_ADD_STRINGXX
-They are as follows:
-.It Fn SYSCTL_ADD_OID
-creates a raw oid.
-This macro is functionally equivalent to the
-.Fn sysctl_add_oid
-function.
-.It Fn SYSCTL_ADD_NODE
-creates an oid of type
-.Dv CTLTYPE_NODE ,
-to which child oids may be added.
-.It Fn SYSCTL_ADD_STRING
-creates an oid that handles a zero-terminated character string.
-.It Fn SYSCTL_ADD_INT
-creates an oid that handles an
-.Li int
-variable.
-.It Fn SYSCTL_ADD_UINT
-creates an oid that handles an
-.Li unsigned int
-variable.
-.It Fn SYSCTL_ADD_LONG
-creates an oid that handles a
-.Li long
-variable.
-.It Fn SYSCTL_ADD_ULONG
-creates an oid that handles an
-.Li unsigned long
-variable.
-.It Fn SYSCTL_ADD_OPAQUE
-creates an oid that handles any chunk of opaque data
-of the size specified by the
-.Fa len
-argument,
-which is a pointer to a
-.Li "size_t *" .
-.It Fn SYSCTL_ADD_STRUCT
-creates an oid that handles a
-.Li "struct TYPE"
-structure.
-The
-.Fa format
-parameter will be set to
-.Dq S,TYPE
-to provide proper hints to the
-.Xr sysctl 8
-utlity.
-.It Fn SYSCTL_ADD_PROC
-creates an oid with the specified
-.Pa handler
-function.
-The handler is responsible for handling read and write requests
-to the oid.
-This oid type is especially useful
-if the kernel data is not easily accessible,
-or needs to be processed before exporting.
-.El
-.Sh EXAMPLES
-The following is an example of
-how to create a new top-level category
-and how to hook up another subtree to an existing static node.
-This example does not use contexts,
-which results in tedious management of all intermediate oids,
-as they need to be freed later on:
-.Bd -literal
-#include <sys/sysctl.h>
- ...
-/* Need to preserve pointers to newly created subtrees, to be able
- * to free them later.
- */
-struct sysctl_oid *root1, *root2, *oidp;
-int a_int;
-char *string = "dynamic sysctl";
- ...
-
-root1 = SYSCTL_ADD_NODE( NULL, SYSCTL_STATIC_CHILDREN(/* tree top */),
- OID_AUTO, newtree, CTFLAG_RW, 0, "new top level tree");
-oidp = SYSCTL_ADD_INT( NULL, SYSCTL_CHILDREN(root1),
- OID_AUTO, newint, CTLFLAG_RW, &a_int, 0, "new int leaf");
- ...
-root2 = SYSCTL_ADD_NODE( NULL, SYSCTL_STATIC_CHILDREN(_debug),
- OID_AUTO, newtree, CTFLAG_RW, 0, "new tree under debug");
-oidp = SYSCTL_ADD_STRING( NULL, SYSCTL_CHILDREN(root2),
- OID_AUTO, newstring, CTLFLAG_R, string, 0, "new string leaf");
-.Ed
-.Pp
-This example creates the following subtrees:
-.Bd -literal -offset indent
-debug.newtree.newstring
-newtree.newint
-.Ed
-.Pp
-.Em "Care should be taken to free all oids once they are no longer needed!"
-.Pp
-.Sh SEE ALSO
-.Xr sysctl 8 ,
-.Xr sysctl_ctx_free 9 ,
-.Xr sysctl_ctx_init 9
-.Sh HISTORY
-These functions first appeared in
-.Fx 5.0 .
-.Sh AUTHORS
-.An Andrzej Bialecki Aq abial@FreeBSD.org
-.Sh BUGS
-Sharing nodes between many code sections
-causes interdependencies that sometimes may lock the resources.
-For example,
-if module A hooks up a subtree to an oid created by module B,
-module B will be unable to delete that oid.
-These issues are handled properly by sysctl contexts.
-.Pp
-Many operations on the tree involve traversing linked lists.
-For this reason, oid creation and removal is relatively costly.
diff --git a/share/man/man9/sysctl_ctx_init.9 b/share/man/man9/sysctl_ctx_init.9
deleted file mode 100644
index 9d7a8638940c..000000000000
--- a/share/man/man9/sysctl_ctx_init.9
+++ /dev/null
@@ -1,244 +0,0 @@
-.\"
-.\" Copyright (c) 2000, Andrzej Bialecki <abial@freebsd.org>
-.\" 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.
-.\" 3. The name of the author may not be used to endorse or promote products
-.\" derived from this software without specific prior written permission.
-.\"
-.\" 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 Jul 15, 2000
-.Dt SYSCTL_CTX_INIT 9
-.Os
-.Sh NAME
-.Nm sysctl_ctx_init ,
-.Nm sysctl_ctx_free ,
-.Nm sysctl_ctx_entry_add ,
-.Nm sysctl_ctx_entry_find ,
-.Nm sysctl_ctx_entry_del
-.Nd sysctl context for managing dynamically created sysctl oids.
-.Sh SYNOPSIS
-.Fd #include <sys/sysctl.h>
-.Ft int
-.Fo sysctl_ctx_init
-.Fa "struct sysctl_ctx_list *clist"
-.Fc
-.Ft int
-.Fo sysctl_ctx_free
-.Fa "struct sysctl_ctx_list *clist"
-.Fc
-.Ft struct sysctl_ctx_entry *
-.Fo sysctl_ctx_entry_add
-.Fa "struct sysctl_ctx_list *clist"
-.Fa "struct sysctl_oid *oidp"
-.Fc
-.Ft struct sysctl_ctx_entry *
-.Fo sysctl_ctx_entry_find
-.Fa "struct sysctl_ctx_list *clist"
-.Fa "struct sysctl_oid *oidp"
-.Fc
-.Ft int
-.Fo sysctl_ctx_entry_del
-.Fa "struct sysctl_ctx_list *clist"
-.Fa "struct sysctl_oid *oidp"
-.Fc
-.Sh DESCRIPTION
-These functions provide an interface
-for managing dynamically created oids.
-The sysctl context is responsible for keeping track of created oids,
-as well as their proper removal when needed.
-It adds a simple transactional aspect to oid removal operations;
-i.e. if a removal operation fails part way,
-it is possible to roll back the sysctl tree
-to its previous state.
-.Pp
-The
-.Fn sysctl_ctx_init
-function initializes a sysctl context.
-The
-.Fa clist
-argument must point to an already allocated variable.
-A context
-.Em must
-be initialized before use.
-Once it is initialized,
-a pointer to the context can be passed as an argument to all the
-.Fa SYSCTL_ADD_*
-macros (see
-.Xr sysctl_add_oid 9 ) ,
-and it will be updated with entries pointing to newly created oids.
-.Pp
-Internally, the context is represented as a
-.Xr queue 3
-TAILQ linked list.
-The list consists of
-.Li struct sysctl_ctx_entry
-entries:
-.Bd -literal -offset indent
-struct sysctl_ctx_entry {
- struct sysctl_oid *entry;
- TAILQ_ENTRY(sysctl_ctx_entry) link;
-};
-
-TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry);
-.Ed
-.Pp
-Each context entry points to one dynamic oid that it manages.
-Newly created oids are always inserted in the front of the list.
-.Pp
-The
-.Fn sysctl_ctx_free
-function removes the context and associated oids it manages.
-If the function completes successfuly,
-all managed oids have been unregistered
-(removed from the tree)
-and freed,
-together with all their allocated memory,
-and the entries of the context have been freed as well.
-.Pp
-The removal operation is performed in two steps.
-First, for each context entry, the function
-.Xr sysctl_remove_oid 9
-is executed, with parameter
-.Fa del
-set to 0, which inhibits the freeing of resources.
-If there are no errors during this step,
-.Fn sysctl_ctx_free
-proceeds to the next step.
-If the first step fails,
-all unregistered oids associated with the context are registered again.
-.Pp
-.Em Note :
-in most cases, the programmer specifies
-.Dv OID_AUTO
-as the oid number when creating an oid.
-However, during registration of the oid in the tree,
-this number is changed to the first available number
-greater than 99.
-If the first step of context deletion fails,
-re-registration of the oid does not change the already assigned oid number
-(which is different from OID_AUTO).
-This ensures that re-registered entries
-maintain their original positions in the tree.
-.Pp
-The second step actually performs the deletion of the dynamic oids.
-.Xr sysctl_remove_oid 9
-iterates through the context list,
-starting from beginning (i.e. the newest entries).
-.Em Important :
-this time, the function not only deletes the oids from the tree,
-but also frees their memory (provided that oid_refcnt == 0),
-as well as the memory of all context entries.
-.Pp
-The
-.Fn sysctl_ctx_entry_add
-function allows the addition of an existing dynamic oid to a context.
-.Pp
-The
-.Fn sysctl_ctx_entry_del
-function removes an entry from the context.
-.Em Important :
-in this case, only the corresponding
-.Li struct sysctl_ctx_entry
-is freed, but the
-.Fa oidp
-pointer remains intact.
-Thereafter, the programmer is responsible for managing the resources
-allocated to this oid.
-.Pp
-The
-.Fn sysctl_ctx_entry_find
-function searches for a given
-.Fa oidp
-witin a context list,
-either returning a pointer to the
-.Fa struct sysctl_ctx_entry
-found,
-or
-.Dv NULL .
-.Sh EXAMPLES
-The following is an example of how to create a new top-level category
-and how to hook up another subtree to an existing static node.
-This example uses contexts to keep track of the oids.
-.Bd -literal
-#include <sys/sysctl.h>
- ...
-struct sysctl_ctx_list clist;
-struct sysctl_oid *oidp;
-int a_int;
-char *string = "dynamic sysctl";
- ...
-
-sysctl_ctx_init(&clist);
-oidp = SYSCTL_ADD_NODE( &clist, SYSCTL_STATIC_CHILDREN(/* tree top */),
- OID_AUTO, newtree, CTFLAG_RW, 0, "new top level tree");
-oidp = SYSCTL_ADD_INT( &clist, SYSCTL_CHILDREN(oidp),
- OID_AUTO, newint, CTLFLAG_RW, &a_int, 0, "new int leaf");
- ...
-oidp = SYSCTL_ADD_NODE( &clist, SYSCTL_STATIC_CHILDREN(_debug),
- OID_AUTO, newtree, CTFLAG_RW, 0, "new tree under debug");
-oidp = SYSCTL_ADD_STRING( &clist, SYSCTL_CHILDREN(oidp),
- OID_AUTO, newstring, CTLFLAG_R, string, 0, "new string leaf");
- ...
-/* Now we can free up the oids */
-if(sysctl_ctx_free(&clist)) {
- printf("can't free this context - other oids depend on it");
- return(ENOTEMPTY);
-} else {
- printf("Success!\\n"):
- return(0);
-}
-.Ed
-.Pp
-This example creates the following subtrees:
-.Bd -literal -offset indent
-debug.newtree.newstring
-newtree.newint
-.Ed
-.Pp
-Note that both trees are removed, and their resources freed,
-through one
-.Fn sysctl_ctx_free
-call, which starts by freeing the newest entries (leaves)
-and then proceeds to free the older entries (in this case the nodes).
-.Sh SEE ALSO
-.Xr queue 3 ,
-.Xr sysctl 8 ,
-.Xr sysctl_add_oid 9 ,
-.Xr sysctl_remove_oid 9
-.Sh HISTORY
-These functions first appeared in
-.Fx 5.0 .
-.Sh AUTHORS
-.An Andrzej Bialecki Aq abial@FreeBSD.org
-.Sh BUGS
-The current removal algorithm is somewhat heavy.
-In the worst case,
-all oids need to be unregistered, registered again,
-and then unregistered and deleted.
-However, the algorithm does guarantee transactional properties
-for removal operations.
-.Pp
-All operations on contexts involve linked list traversal.
-For this reason,
-creation and removal of entries is relatively costly.