2002-11-26 Chris Johns <cjohns@cybertec.com.au>

* Makefile.am: Added sys/linker_set.h
	* kern/Makefile.am: Added kern_mib.c and kern_sysctl.c.
	* kern/uipc_socket.c: OID changed from KERN_SOMAXCONN to KIPC_SOMAXCONN.
	* kern/uipc_socket2.c: OID changed from KERN_MAXSOCKBUF to
	KIPC_MAXSOCKBUF.
	* net/if_ethersubr.c: FreeBSD 2.2.2 does not have a _net_link node
	while 5.0 does.
	* net/if_ppp.c: Removed the TEXT_SET define as these macros are
	now implemented.
	* net/rtsock.c: Enable sysctl support plus fix the bug with the
	lastest FreeBSD sysctl header file.
	* netinet/icmp_var.h: FreeBSD 2.2.2 does not have a _net_inet_icmp
	node while 5.0 does.
	* netinet/if_ether.c: FreeBSD 2.2.2 does not have a _net_link_ether
	node while 5.0 does.
	* netinet/igmp_var.h: FreeBSD 2.2.2 does not have a _net_inet_igmp
	node while 5.0 does.
	* netinet/in_pcb.c: Fixed the arguments to the sysctl call. Add
	inp_gencnt and ipi_count. These are used when listing connections.
	* netinet/in_pcb.h: Added counters to aid the listing of connections.
	* netinet/in_var.h: Provide the _net_inet_ip and _net_inet_raw nodes.
	* netinet/ip_fw.c: Disable the firewall sysctl calls.
	* netinet/tcp_subr.c: Merge tcp_pcblist from the lastest FreeBSD source.
	* netinet/tcp_var.h: Add structures needed by net-snmp to list
	connections.
	* netinet/udp_usrreq.c: Merged udp_pcblist from the lastest FreeBSD
	source.
	* netinet/udp_var.h: Added the sysctl id UDPCTL_PCBLIST. Used by
	net-snmp.
	* rtems_glue.c: Call sysctl_register_all when initialising the
	network stack to register all the sysctl calls. These are in the
	special sections and required an updated linker script.
	* rtems/rtems_syscall.c: Add the sysctl call.
	* sys/kernel.h: Use the lastest FreeBSD method of handling sysctl
	structures.  This now held in the sys/linker_set.h file.
	* sys/queue.h: This is from the lastest FreeBSD code with the circular
	code merged back in as it is not used in the lastest FreeBSD kernel.
	* sys/sysctl.h: The lastest sysctl. This was needed to use with the new
	linker set method. The FreeBSD 2.2.2 version has asm hacks. The lastest
	version of the FreeBSD does not have these hacks. It uses gcc attribute
	directives.
This commit is contained in:
Joel Sherrill
2003-01-03 18:09:57 +00:00
parent 5bb1a93cdd
commit 36799d4063
26 changed files with 3044 additions and 269 deletions
+44
View File
@@ -1,3 +1,47 @@
2002-11-26 Chris Johns <cjohns@cybertec.com.au>
* Makefile.am: Added sys/linker_set.h
* kern/Makefile.am: Added kern_mib.c and kern_sysctl.c.
* kern/uipc_socket.c: OID changed from KERN_SOMAXCONN to KIPC_SOMAXCONN.
* kern/uipc_socket2.c: OID changed from KERN_MAXSOCKBUF to
KIPC_MAXSOCKBUF.
* net/if_ethersubr.c: FreeBSD 2.2.2 does not have a _net_link node
while 5.0 does.
* net/if_ppp.c: Removed the TEXT_SET define as these macros are
now implemented.
* net/rtsock.c: Enable sysctl support plus fix the bug with the
lastest FreeBSD sysctl header file.
* netinet/icmp_var.h: FreeBSD 2.2.2 does not have a _net_inet_icmp
node while 5.0 does.
* netinet/if_ether.c: FreeBSD 2.2.2 does not have a _net_link_ether
node while 5.0 does.
* netinet/igmp_var.h: FreeBSD 2.2.2 does not have a _net_inet_igmp
node while 5.0 does.
* netinet/in_pcb.c: Fixed the arguments to the sysctl call. Add
inp_gencnt and ipi_count. These are used when listing connections.
* netinet/in_pcb.h: Added counters to aid the listing of connections.
* netinet/in_var.h: Provide the _net_inet_ip and _net_inet_raw nodes.
* netinet/ip_fw.c: Disable the firewall sysctl calls.
* netinet/tcp_subr.c: Merge tcp_pcblist from the lastest FreeBSD source.
* netinet/tcp_var.h: Add structures needed by net-snmp to list
connections.
* netinet/udp_usrreq.c: Merged udp_pcblist from the lastest FreeBSD
source.
* netinet/udp_var.h: Added the sysctl id UDPCTL_PCBLIST. Used by
net-snmp.
* rtems_glue.c: Call sysctl_register_all when initialising the
network stack to register all the sysctl calls. These are in the
special sections and required an updated linker script.
* rtems/rtems_syscall.c: Add the sysctl call.
* sys/kernel.h: Use the lastest FreeBSD method of handling sysctl
structures. This now held in the sys/linker_set.h file.
* sys/queue.h: This is from the lastest FreeBSD code with the circular
code merged back in as it is not used in the lastest FreeBSD kernel.
* sys/sysctl.h: The lastest sysctl. This was needed to use with the new
linker set method. The FreeBSD 2.2.2 version has asm hacks. The lastest
version of the FreeBSD does not have these hacks. It uses gcc attribute
directives.
2002-12-18 Eric Norum <eric.norum@usask.ca>
* Makefile.am: Include netinet sources.
+3 -3
View File
@@ -44,8 +44,8 @@ PREINSTALL_FILES += $(PROJECT_INCLUDE)/arpa \
## kern
kern_C_FILES = kern/kern_subr.c kern/uipc_domain.c kern/uipc_mbuf.c \
kern/uipc_socket.c kern/uipc_socket2.c
kern_C_FILES = kern/kern_mib.c kern/kern_subr.c kern/uipc_domain.c \
kern/uipc_mbuf.c kern/uipc_socket.c kern/uipc_socket2.c
OBJS = $(kern_C_FILES:kern/%.c=$(ARCH)/%.$(OBJEXT))
$(ARCH)/%.$(OBJEXT): kern/%.c
@@ -172,7 +172,7 @@ EXTRA_DIST += $(rtems_C_FILES)
include_sysdir = $(includedir)/sys
include_sys_HEADERS = sys/buf.h sys/callout.h sys/conf.h sys/domain.h \
sys/kernel.h sys/libkern.h sys/malloc.h sys/mbuf.h sys/mount.h \
sys/kernel.h sys/libkern.h sys/linker_set.h sys/malloc.h sys/mbuf.h sys/mount.h \
sys/proc.h sys/protosw.h sys/queue.h sys/reboot.h sys/resourcevar.h \
sys/rtprio.h sys/select.h sys/signalvar.h sys/socket.h sys/socketvar.h \
sys/sysctl.h sys/syslog.h sys/systm.h sys/ttydefaults.h sys/ucred.h \
+382
View File
@@ -0,0 +1,382 @@
/*-
* Copyright (c) 1982, 1986, 1989, 1993
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Mike Karels at Berkeley Software Design, Inc.
*
* Quite extensively rewritten by Poul-Henning Kamp of the FreeBSD
* project, to make these variables more userfriendly.
*
* 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. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
*
* @(#)kern_sysctl.c 8.4 (Berkeley) 4/14/94
* $FreeBSD: src/sys/kern/kern_mib.c,v 1.62 2002/11/07 23:57:17 tmm Exp $
*/
#ifndef __rtems__
#include "opt_posix.h"
#endif
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/systm.h>
#include <sys/sysctl.h>
#include <sys/proc.h>
#ifndef __rtems__
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/jail.h>
#include <sys/smp.h>
#endif
#include <sys/unistd.h>
#ifdef __rtems__
char machine[] = "SET ME";
char osrelease[] = PACKAGE_VERSION;
char ostype[] = "RTEMS";
#endif
SYSCTL_NODE(, 0, sysctl, CTLFLAG_RW, 0,
"Sysctl internal magic");
SYSCTL_NODE(, CTL_KERN, kern, CTLFLAG_RW, 0,
"High kernel, proc, limits &c");
#ifndef __rtems__
SYSCTL_NODE(, CTL_VM, vm, CTLFLAG_RW, 0,
"Virtual memory");
SYSCTL_NODE(, CTL_VFS, vfs, CTLFLAG_RW, 0,
"File system");
#endif
SYSCTL_NODE(, CTL_NET, net, CTLFLAG_RW, 0,
"Network, (see socket.h)");
#ifndef __rtems__
SYSCTL_NODE(, CTL_DEBUG, debug, CTLFLAG_RW, 0,
"Debugging");
SYSCTL_NODE(_debug, OID_AUTO, sizeof, CTLFLAG_RW, 0,
"Sizeof various things");
SYSCTL_NODE(, CTL_HW, hw, CTLFLAG_RW, 0,
"hardware");
SYSCTL_NODE(, CTL_MACHDEP, machdep, CTLFLAG_RW, 0,
"machine dependent");
SYSCTL_NODE(, CTL_USER, user, CTLFLAG_RW, 0,
"user-level");
SYSCTL_NODE(, CTL_P1003_1B, p1003_1b, CTLFLAG_RW, 0,
"p1003_1b, (see p1003_1b.h)");
SYSCTL_NODE(, OID_AUTO, compat, CTLFLAG_RW, 0,
"Compatibility code");
SYSCTL_NODE(, OID_AUTO, security, CTLFLAG_RW, 0,
"Security");
#ifdef REGRESSION
SYSCTL_NODE(, OID_AUTO, regression, CTLFLAG_RW, 0,
"Regression test MIB");
#endif
#endif
SYSCTL_STRING(_kern, KERN_OSRELEASE, osrelease, CTLFLAG_RD,
osrelease, 0, "Operating system release");
SYSCTL_INT(_kern, KERN_OSREV, osrevision, CTLFLAG_RD,
0, BSD, "Operating system revision");
#ifndef __rtems__
SYSCTL_STRING(_kern, KERN_VERSION, version, CTLFLAG_RD,
version, 0, "Kernel version");
#endif
SYSCTL_STRING(_kern, KERN_OSTYPE, ostype, CTLFLAG_RD,
ostype, 0, "Operating system type");
#ifndef __rtems__
extern int osreldate;
SYSCTL_INT(_kern, KERN_OSRELDATE, osreldate, CTLFLAG_RD,
&osreldate, 0, "Operating system release date");
SYSCTL_INT(_kern, KERN_MAXPROC, maxproc, CTLFLAG_RD,
&maxproc, 0, "Maximum number of processes");
SYSCTL_INT(_kern, KERN_MAXPROCPERUID, maxprocperuid, CTLFLAG_RW,
&maxprocperuid, 0, "Maximum processes allowed per userid");
SYSCTL_INT(_kern, OID_AUTO, maxusers, CTLFLAG_RD,
&maxusers, 0, "Hint for kernel tuning");
SYSCTL_INT(_kern, KERN_ARGMAX, argmax, CTLFLAG_RD,
0, ARG_MAX, "Maximum bytes of argument to execve(2)");
SYSCTL_INT(_kern, KERN_POSIX1, posix1version, CTLFLAG_RD,
0, _POSIX_VERSION, "Version of POSIX attempting to comply to");
SYSCTL_INT(_kern, KERN_NGROUPS, ngroups, CTLFLAG_RD,
0, NGROUPS_MAX, "Maximum number of groups a user can belong to");
SYSCTL_INT(_kern, KERN_JOB_CONTROL, job_control, CTLFLAG_RD,
0, 1, "Whether job control is available");
#ifdef _POSIX_SAVED_IDS
SYSCTL_INT(_kern, KERN_SAVED_IDS, saved_ids, CTLFLAG_RD,
0, 1, "Whether saved set-group/user ID is available");
#else
SYSCTL_INT(_kern, KERN_SAVED_IDS, saved_ids, CTLFLAG_RD,
0, 0, "Whether saved set-group/user ID is available");
#endif
char kernelname[MAXPATHLEN] = "/kernel"; /* XXX bloat */
SYSCTL_STRING(_kern, KERN_BOOTFILE, bootfile, CTLFLAG_RW,
kernelname, sizeof kernelname, "Name of kernel file booted");
#ifdef SMP
SYSCTL_INT(_hw, HW_NCPU, ncpu, CTLFLAG_RD,
&mp_ncpus, 0, "Number of active CPUs");
#else
SYSCTL_INT(_hw, HW_NCPU, ncpu, CTLFLAG_RD,
0, 1, "Number of active CPUs");
#endif
SYSCTL_INT(_hw, HW_BYTEORDER, byteorder, CTLFLAG_RD,
0, BYTE_ORDER, "System byte order");
SYSCTL_INT(_hw, HW_PAGESIZE, pagesize, CTLFLAG_RD,
0, PAGE_SIZE, "System memory page size");
static int
sysctl_hw_physmem(SYSCTL_HANDLER_ARGS)
{
u_long val;
val = ctob(physmem);
return (sysctl_handle_long(oidp, &val, 0, req));
}
SYSCTL_PROC(_hw, HW_PHYSMEM, physmem, CTLTYPE_ULONG | CTLFLAG_RD,
0, 0, sysctl_hw_physmem, "LU", "");
static int
sysctl_hw_usermem(SYSCTL_HANDLER_ARGS)
{
u_long val;
val = ctob(physmem - cnt.v_wire_count);
return (sysctl_handle_long(oidp, &val, 0, req));
}
SYSCTL_PROC(_hw, HW_USERMEM, usermem, CTLTYPE_ULONG | CTLFLAG_RD,
0, 0, sysctl_hw_usermem, "LU", "");
SYSCTL_ULONG(_hw, OID_AUTO, availpages, CTLFLAG_RD, &physmem, 0, "");
static char machine_arch[] = MACHINE_ARCH;
SYSCTL_STRING(_hw, HW_MACHINE_ARCH, machine_arch, CTLFLAG_RD,
machine_arch, 0, "System architecture");
char hostname[MAXHOSTNAMELEN];
static int
sysctl_hostname(SYSCTL_HANDLER_ARGS)
{
struct prison *pr;
char tmphostname[MAXHOSTNAMELEN];
int error;
pr = req->td->td_ucred->cr_prison;
if (pr != NULL) {
if (!jail_set_hostname_allowed && req->newptr)
return (EPERM);
/*
* Process is in jail, so make a local copy of jail
* hostname to get/set so we don't have to hold the jail
* mutex during the sysctl copyin/copyout activities.
*/
mtx_lock(&pr->pr_mtx);
bcopy(pr->pr_host, tmphostname, MAXHOSTNAMELEN);
mtx_unlock(&pr->pr_mtx);
error = sysctl_handle_string(oidp, tmphostname,
sizeof pr->pr_host, req);
if (req->newptr != NULL && error == 0) {
/*
* Copy the locally set hostname to the jail, if
* appropriate.
*/
mtx_lock(&pr->pr_mtx);
bcopy(tmphostname, pr->pr_host, MAXHOSTNAMELEN);
mtx_unlock(&pr->pr_mtx);
}
} else
error = sysctl_handle_string(oidp,
hostname, sizeof hostname, req);
return (error);
}
SYSCTL_PROC(_kern, KERN_HOSTNAME, hostname,
CTLTYPE_STRING|CTLFLAG_RW|CTLFLAG_PRISON,
0, 0, sysctl_hostname, "A", "Hostname");
static int regression_securelevel_nonmonotonic = 0;
#ifdef REGRESSION
SYSCTL_INT(_regression, OID_AUTO, securelevel_nonmonotonic, CTLFLAG_RW,
&regression_securelevel_nonmonotonic, 0, "securelevel may be lowered");
#endif
int securelevel = -1;
struct mtx securelevel_mtx;
MTX_SYSINIT(securelevel_lock, &securelevel_mtx, "securelevel mutex lock",
MTX_DEF);
static int
sysctl_kern_securelvl(SYSCTL_HANDLER_ARGS)
{
struct prison *pr;
int error, level;
pr = req->td->td_ucred->cr_prison;
/*
* If the process is in jail, return the maximum of the global and
* local levels; otherwise, return the global level.
*/
if (pr != NULL) {
mtx_lock(&pr->pr_mtx);
level = imax(securelevel, pr->pr_securelevel);
mtx_unlock(&pr->pr_mtx);
} else
level = securelevel;
error = sysctl_handle_int(oidp, &level, 0, req);
if (error || !req->newptr)
return (error);
/*
* Permit update only if the new securelevel exceeds the
* global level, and local level if any.
*/
if (pr != NULL) {
mtx_lock(&pr->pr_mtx);
if (!regression_securelevel_nonmonotonic &&
(level < imax(securelevel, pr->pr_securelevel))) {
mtx_unlock(&pr->pr_mtx);
return (EPERM);
}
pr->pr_securelevel = level;
mtx_unlock(&pr->pr_mtx);
} else {
mtx_lock(&securelevel_mtx);
if (!regression_securelevel_nonmonotonic &&
(level < securelevel)) {
mtx_unlock(&securelevel_mtx);
return (EPERM);
}
securelevel = level;
mtx_unlock(&securelevel_mtx);
}
return (error);
}
SYSCTL_PROC(_kern, KERN_SECURELVL, securelevel,
CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_PRISON, 0, 0, sysctl_kern_securelvl,
"I", "Current secure level");
char domainname[MAXHOSTNAMELEN];
SYSCTL_STRING(_kern, KERN_NISDOMAINNAME, domainname, CTLFLAG_RW,
&domainname, sizeof(domainname), "Name of the current YP/NIS domain");
u_long hostid;
SYSCTL_ULONG(_kern, KERN_HOSTID, hostid, CTLFLAG_RW, &hostid, 0, "Host ID");
/*
* This is really cheating. These actually live in the libc, something
* which I'm not quite sure is a good idea anyway, but in order for
* getnext and friends to actually work, we define dummies here.
*/
SYSCTL_STRING(_user, USER_CS_PATH, cs_path, CTLFLAG_RD,
"", 0, "PATH that finds all the standard utilities");
SYSCTL_INT(_user, USER_BC_BASE_MAX, bc_base_max, CTLFLAG_RD,
0, 0, "Max ibase/obase values in bc(1)");
SYSCTL_INT(_user, USER_BC_DIM_MAX, bc_dim_max, CTLFLAG_RD,
0, 0, "Max array size in bc(1)");
SYSCTL_INT(_user, USER_BC_SCALE_MAX, bc_scale_max, CTLFLAG_RD,
0, 0, "Max scale value in bc(1)");
SYSCTL_INT(_user, USER_BC_STRING_MAX, bc_string_max, CTLFLAG_RD,
0, 0, "Max string length in bc(1)");
SYSCTL_INT(_user, USER_COLL_WEIGHTS_MAX, coll_weights_max, CTLFLAG_RD,
0, 0, "Maximum number of weights assigned to an LC_COLLATE locale entry");
SYSCTL_INT(_user, USER_EXPR_NEST_MAX, expr_nest_max, CTLFLAG_RD, 0, 0, "");
SYSCTL_INT(_user, USER_LINE_MAX, line_max, CTLFLAG_RD,
0, 0, "Max length (bytes) of a text-processing utility's input line");
SYSCTL_INT(_user, USER_RE_DUP_MAX, re_dup_max, CTLFLAG_RD,
0, 0, "Maximum number of repeats of a regexp permitted");
SYSCTL_INT(_user, USER_POSIX2_VERSION, posix2_version, CTLFLAG_RD,
0, 0,
"The version of POSIX 1003.2 with which the system attempts to comply");
SYSCTL_INT(_user, USER_POSIX2_C_BIND, posix2_c_bind, CTLFLAG_RD,
0, 0, "Whether C development supports the C bindings option");
SYSCTL_INT(_user, USER_POSIX2_C_DEV, posix2_c_dev, CTLFLAG_RD,
0, 0, "Whether system supports the C development utilities option");
SYSCTL_INT(_user, USER_POSIX2_CHAR_TERM, posix2_char_term, CTLFLAG_RD,
0, 0, "");
SYSCTL_INT(_user, USER_POSIX2_FORT_DEV, posix2_fort_dev, CTLFLAG_RD,
0, 0, "Whether system supports FORTRAN development utilities");
SYSCTL_INT(_user, USER_POSIX2_FORT_RUN, posix2_fort_run, CTLFLAG_RD,
0, 0, "Whether system supports FORTRAN runtime utilities");
SYSCTL_INT(_user, USER_POSIX2_LOCALEDEF, posix2_localedef, CTLFLAG_RD,
0, 0, "Whether system supports creation of locales");
SYSCTL_INT(_user, USER_POSIX2_SW_DEV, posix2_sw_dev, CTLFLAG_RD,
0, 0, "Whether system supports software development utilities");
SYSCTL_INT(_user, USER_POSIX2_UPE, posix2_upe, CTLFLAG_RD,
0, 0, "Whether system supports the user portability utilities");
SYSCTL_INT(_user, USER_STREAM_MAX, stream_max, CTLFLAG_RD,
0, 0, "Min Maximum number of streams a process may have open at one time");
SYSCTL_INT(_user, USER_TZNAME_MAX, tzname_max, CTLFLAG_RD,
0, 0, "Min Maximum number of types supported for timezone names");
#include <sys/vnode.h>
SYSCTL_INT(_debug_sizeof, OID_AUTO, vnode, CTLFLAG_RD,
0, sizeof(struct vnode), "sizeof(struct vnode)");
SYSCTL_INT(_debug_sizeof, OID_AUTO, proc, CTLFLAG_RD,
0, sizeof(struct proc), "sizeof(struct proc)");
#include <sys/conf.h>
SYSCTL_INT(_debug_sizeof, OID_AUTO, cdev, CTLFLAG_RD,
0, sizeof(struct cdev), "sizeof(struct cdev)");
#include <sys/bio.h>
#include <sys/buf.h>
SYSCTL_INT(_debug_sizeof, OID_AUTO, bio, CTLFLAG_RD,
0, sizeof(struct bio), "sizeof(struct bio)");
SYSCTL_INT(_debug_sizeof, OID_AUTO, buf, CTLFLAG_RD,
0, sizeof(struct buf), "sizeof(struct buf)");
#include <sys/user.h>
SYSCTL_INT(_debug_sizeof, OID_AUTO, kinfo_proc, CTLFLAG_RD,
0, sizeof(struct kinfo_proc), "sizeof(struct kinfo_proc)");
#endif /* __rtems__ */
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -52,7 +52,7 @@
#include <limits.h>
static int somaxconn = SOMAXCONN;
SYSCTL_INT(_kern, KERN_SOMAXCONN, somaxconn, CTLFLAG_RW, &somaxconn, 0, "");
SYSCTL_INT(_kern, KIPC_SOMAXCONN, somaxconn, CTLFLAG_RW, &somaxconn, 0, "");
/*
* Socket operation routines.
+1 -1
View File
@@ -59,7 +59,7 @@
*/
u_long sb_max = SB_MAX; /* XXX should be static */
SYSCTL_INT(_kern, KERN_MAXSOCKBUF, maxsockbuf, CTLFLAG_RW, &sb_max, 0, "")
SYSCTL_INT(_kern, KIPC_MAXSOCKBUF, maxsockbuf, CTLFLAG_RW, &sb_max, 0, "");
static u_long sb_efficiency = 8; /* parameter for sbreserve() */
SYSCTL_INT(_kern, OID_AUTO, sockbuf_waste_factor, CTLFLAG_RW, &sb_efficiency,
+1
View File
@@ -895,6 +895,7 @@ ether_delmulti(ifr, ac)
return (ENETRESET);
}
SYSCTL_DECL(_net_link);
SYSCTL_NODE(_net_link, IFT_ETHER, ether, CTLFLAG_RW, 0, "Ethernet");
int
+2 -1
View File
@@ -179,8 +179,9 @@ struct compressor *ppp_compressors[8] = {
extern struct ifqueue ipintrq;
static struct timeval ppp_time;
#ifndef __rtems__
TEXT_SET(pseudo_set, ppp_rxdaemon);
#endif
static rtems_task ppp_rxdaemon(rtems_task_argument arg)
{
+3 -11
View File
@@ -67,10 +67,8 @@ static struct mbuf *
static int rt_msg2 __P((int,
struct rt_addrinfo *, caddr_t, struct walkarg *));
static int rt_xaddrs __P((caddr_t, caddr_t, struct rt_addrinfo *));
#if !defined(__rtems__)
static int sysctl_dumpentry __P((struct radix_node *rn, void *vw));
static int sysctl_iflist __P((int af, struct walkarg *w));
#endif
static int route_output __P((struct mbuf *, struct socket *));
static int route_usrreq __P((struct socket *,
int, struct mbuf *, struct mbuf *, struct mbuf *));
@@ -677,7 +675,6 @@ rt_newaddrmsg(cmd, ifa, error, rt)
/*
* This is used in dumping the kernel table via sysctl().
*/
#if !defined(__rtems__)
int
sysctl_dumpentry(rn, vw)
struct radix_node *rn;
@@ -710,9 +707,7 @@ sysctl_dumpentry(rn, vw)
}
return (error);
}
#endif
#if !defined(__rtems__)
int
sysctl_iflist(af, w)
int af;
@@ -739,7 +734,7 @@ sysctl_iflist(af, w)
ifm->ifm_flags = (u_short)ifp->if_flags;
ifm->ifm_data = ifp->if_data;
ifm->ifm_addrs = info.rti_addrs;
error =0;
error = SYSCTL_OUT(w->w_req,(caddr_t)ifm, len);
if (error)
return (error);
}
@@ -758,7 +753,7 @@ sysctl_iflist(af, w)
ifam->ifam_flags = ifa->ifa_flags;
ifam->ifam_metric = ifa->ifa_metric;
ifam->ifam_addrs = info.rti_addrs;
error = 0;
error = SYSCTL_OUT(w->w_req, w->w_tmem, len);
if (error)
return (error);
}
@@ -767,11 +762,9 @@ sysctl_iflist(af, w)
}
return (0);
}
#endif
#if !defined(__rtems__)
static int
sysctl_rtsock SYSCTL_HANDLER_ARGS
sysctl_rtsock(SYSCTL_HANDLER_ARGS)
{
int *name = (int *)arg1;
u_int namelen = arg2;
@@ -814,7 +807,6 @@ sysctl_rtsock SYSCTL_HANDLER_ARGS
}
SYSCTL_NODE(_net, PF_ROUTE, routetable, CTLFLAG_RD, sysctl_rtsock,"");
#endif
/*
* Definitions of protocols supported in the ROUTE domain.
+1
View File
@@ -72,6 +72,7 @@ struct icmpstat {
}
#ifdef KERNEL
SYSCTL_DECL(_net_inet_icmp);
extern struct icmpstat icmpstat;
#endif
+1
View File
@@ -62,6 +62,7 @@
#define SIN(s) ((struct sockaddr_in *)s)
#define SDL(s) ((struct sockaddr_dl *)s)
SYSCTL_DECL(_net_link_ether);
SYSCTL_NODE(_net_link_ether, PF_INET, inet, CTLFLAG_RW, 0, "");
/* timer values */
+3
View File
@@ -93,6 +93,9 @@ void igmp_joingroup __P((struct in_multi *));
void igmp_leavegroup __P((struct in_multi *));
void igmp_fasttimo __P((void));
void igmp_slowtimo __P((void));
SYSCTL_DECL(_net_inet_igmp);
#endif
/*
+6 -3
View File
@@ -79,9 +79,8 @@ static int ipport_hilastauto = IPPORT_HILASTAUTO; /* 44999 */
if ((var) < (min)) { (var) = (min); } \
else if ((var) > (max)) { (var) = (max); }
#if 0
static int
sysctl_net_ipport_check SYSCTL_HANDLER_ARGS
sysctl_net_ipport_check(SYSCTL_HANDLER_ARGS)
{
int error = sysctl_handle_int(oidp,
oidp->oid_arg1, oidp->oid_arg2, req);
@@ -95,7 +94,6 @@ sysctl_net_ipport_check SYSCTL_HANDLER_ARGS
}
return error;
}
#endif
#undef RANGECHK
@@ -126,10 +124,12 @@ in_pcballoc(so, pcbinfo)
if (inp == NULL)
return (ENOBUFS);
bzero((caddr_t)inp, sizeof(*inp));
inp->inp_gencnt = ++pcbinfo->ipi_gencnt;
inp->inp_pcbinfo = pcbinfo;
inp->inp_socket = so;
s = splnet();
LIST_INSERT_HEAD(pcbinfo->listhead, inp, inp_list);
pcbinfo->ipi_count++;
in_pcbinshash(inp);
splx(s);
so->so_pcb = (caddr_t)inp;
@@ -445,8 +445,10 @@ in_pcbdetach(inp)
struct inpcb *inp;
{
struct socket *so = inp->inp_socket;
struct inpcbinfo *ipi = inp->inp_pcbinfo;
int s;
inp->inp_gencnt = ++ipi->ipi_gencnt;
so->so_pcb = 0;
sofree(so);
if (inp->inp_options)
@@ -753,5 +755,6 @@ in_pcbrehash(inp)
inp->inp_lport, inp->inp_fport, inp->inp_pcbinfo->hashmask)];
LIST_INSERT_HEAD(head, inp, inp_hash);
inp->inp_pcbinfo->ipi_count--;
splx(s);
}
+33
View File
@@ -48,6 +48,8 @@
*/
LIST_HEAD(inpcbhead, inpcb);
typedef u_int64_t inp_gen_t;
struct inpcb {
LIST_ENTRY(inpcb) inp_list; /* list for all PCBs of this proto */
LIST_ENTRY(inpcb) inp_hash; /* hash list */
@@ -66,11 +68,40 @@ struct inpcb {
u_char inp_ip_p; /* protocol proto */
u_char pad[1]; /* alignment */
struct ip_moptions *inp_moptions; /* IP multicast options */
inp_gen_t inp_gencnt; /* generation count of this instance */
#if 0 /* Someday, perhaps... */
struct ip inp_ip; /* header prototype; should have more */
#endif
};
/*
* Interface exported to userland by various protocols which use
* inpcbs. Hack alert -- only define if struct xsocket is in scope.
*
* ccj - 20 Nov 2002
* Double hack alert. This is taken from the pre 5.0 sources and
* merged into RTEMS. This allows the TCPCTL_PCBLIST code in
* net-snmp to work.
*/
#ifdef _SYS_SOCKETVAR_H_
typedef u_int64_t so_gen_t; /* should be in sys/sockvar.h */
struct xinpcb {
size_t xi_len; /* length of this structure */
struct inpcb xi_inp;
/* struct xsocket xi_socket; ccj removed */
u_int64_t xi_alignment_hack;
};
struct xinpgen {
size_t xig_len; /* length of this structure */
u_int xig_count; /* number of PCBs at this time */
inp_gen_t xig_gen; /* generation count at this time */
so_gen_t xig_sogen; /* socket generation count at this time */
};
#endif /* _SYS_SOCKETVAR_H_ */
struct inpcbinfo {
struct inpcbhead *listhead;
struct inpcbhead *hashbase;
@@ -78,6 +109,8 @@ struct inpcbinfo {
unsigned short lastport;
unsigned short lastlow;
unsigned short lasthi;
u_int ipi_count; /* number of pcbs in this list */
u_int64_t ipi_gencnt; /* current generation count */
};
#define INP_PCBHASH(faddr, lport, fport, mask) \
+6
View File
@@ -161,6 +161,12 @@ struct in_multi {
};
#ifdef KERNEL
#ifdef SYSCTL_DECL
SYSCTL_DECL(_net_inet_ip);
SYSCTL_DECL(_net_inet_raw);
#endif
/*
* Structure used by macros below to remember position when stepping through
* all of the in_multi records.
+5
View File
@@ -60,12 +60,17 @@ static int fw_verbose_limit = 0;
LIST_HEAD (ip_fw_head, ip_fw_chain) ip_fw_chain;
/*
* ccj - No current need for firewall so have provided the MIB.
*/
#if 0
#ifdef SYSCTL_NODE
SYSCTL_NODE(_net_inet_ip, OID_AUTO, fw, CTLFLAG_RW, 0, "Firewall");
SYSCTL_INT(_net_inet_ip_fw, OID_AUTO, debug, CTLFLAG_RW, &fw_debug, 0, "");
SYSCTL_INT(_net_inet_ip_fw, OID_AUTO, verbose, CTLFLAG_RW, &fw_verbose, 0, "");
SYSCTL_INT(_net_inet_ip_fw, OID_AUTO, verbose_limit, CTLFLAG_RW, &fw_verbose_limit, 0, "");
#endif
#endif
#define dprintf(a) if (!fw_debug); else printf a
+124
View File
@@ -457,6 +457,130 @@ tcp_notify(inp, error)
sowwakeup(so);
}
#ifdef __rtems__
#define INP_INFO_RLOCK
#define INP_INFO_RUNLOCK
#define INP_LOCK
#define INP_UNLOCK
#endif
static int
tcp_pcblist(SYSCTL_HANDLER_ARGS)
{
int error, i, n, s;
struct inpcb *inp, **inp_list;
inp_gen_t gencnt;
struct xinpgen xig;
/*
* The process of preparing the TCB list is too time-consuming and
* resource-intensive to repeat twice on every request.
*/
if (req->oldptr == 0) {
n = tcbinfo.ipi_count;
req->oldidx = 2 * (sizeof xig)
+ (n + n/8) * sizeof(struct xtcpcb);
return 0;
}
if (req->newptr != 0)
return EPERM;
/*
* OK, now we're committed to doing something.
*/
s = splnet();
INP_INFO_RLOCK(&tcbinfo);
gencnt = tcbinfo.ipi_gencnt;
n = tcbinfo.ipi_count;
INP_INFO_RUNLOCK(&tcbinfo);
splx(s);
sysctl_wire_old_buffer(req, 2 * (sizeof xig)
+ n * sizeof(struct xtcpcb));
xig.xig_len = sizeof xig;
xig.xig_count = n;
xig.xig_gen = gencnt;
/* xig.xig_sogen = so_gencnt; remove by ccj */
error = SYSCTL_OUT(req, &xig, sizeof xig);
if (error)
return error;
/* ccj add exit if the count is 0 */
if (!n)
return error;
inp_list = malloc(n * sizeof *inp_list, M_TEMP, M_WAITOK);
if (inp_list == 0)
return ENOMEM;
s = splnet();
INP_INFO_RLOCK(&tcbinfo);
for (inp = LIST_FIRST(tcbinfo.listhead), i = 0; inp && i < n;
inp = LIST_NEXT(inp, inp_list)) {
INP_LOCK(inp);
if (inp->inp_gencnt <= gencnt)
#if 0
&&
cr_canseesocket(req->td->td_ucred, inp->inp_socket) == 0)
#endif
inp_list[i++] = inp;
INP_UNLOCK(inp);
}
INP_INFO_RUNLOCK(&tcbinfo);
splx(s);
n = i;
error = 0;
for (i = 0; i < n; i++) {
inp = inp_list[i];
INP_LOCK(inp);
if (inp->inp_gencnt <= gencnt) {
struct xtcpcb xt;
caddr_t inp_ppcb;
xt.xt_len = sizeof xt;
/* XXX should avoid extra copy */
bcopy(inp, &xt.xt_inp, sizeof *inp);
inp_ppcb = inp->inp_ppcb;
if (inp_ppcb != NULL)
bcopy(inp_ppcb, &xt.xt_tp, sizeof xt.xt_tp);
else
bzero((char *) &xt.xt_tp, sizeof xt.xt_tp);
#if 0
if (inp->inp_socket)
sotoxsocket(inp->inp_socket, &xt.xt_socket);
#endif
error = SYSCTL_OUT(req, &xt, sizeof xt);
}
INP_UNLOCK(inp);
}
if (!error) {
/*
* Give the user an updated idea of our state.
* If the generation differs from what we told
* her before, she knows that something happened
* while we were processing this request, and it
* might be necessary to retry.
*/
s = splnet();
INP_INFO_RLOCK(&tcbinfo);
xig.xig_gen = tcbinfo.ipi_gencnt;
#if 0
xig.xig_sogen = so_gencnt;
#endif
xig.xig_count = tcbinfo.ipi_count;
INP_INFO_RUNLOCK(&tcbinfo);
splx(s);
error = SYSCTL_OUT(req, &xig, sizeof xig);
}
free(inp_list, M_TEMP);
return error;
}
SYSCTL_PROC(_net_inet_tcp, TCPCTL_PCBLIST, pcblist, CTLFLAG_RD, 0, 0,
tcp_pcblist, "S,xtcpcb", "List of active TCP connections");
void
tcp_ctlinput(cmd, sa, vip)
int cmd;
+23 -1
View File
@@ -306,6 +306,23 @@ struct tcpstat {
u_long tcps_listendrop; /* listen queue overflows */
};
/*
* TCB structure exported to user-land via sysctl(3).
* Evil hack: declare only if in_pcb.h and sys/socketvar.h have been
* included. Not all of our clients do.
*/
#if defined(_NETINET_IN_PCB_H_) && defined(_SYS_SOCKETVAR_H_)
struct xtcpcb {
size_t xt_len;
struct inpcb xt_inp;
struct tcpcb xt_tp;
#if 0
struct xsocket xt_socket;
u_quad_t xt_alignment_hack;
#endif
};
#endif
/*
* Names for TCP sysctl objects
*/
@@ -319,7 +336,8 @@ struct tcpstat {
#define TCPCTL_SENDSPACE 8 /* send buffer space */
#define TCPCTL_RECVSPACE 9 /* receive buffer space */
#define TCPCTL_KEEPINIT 10 /* receive buffer space */
#define TCPCTL_MAXID 11
#define TCPCTL_PCBLIST 11 /* list of all outstanding PCBs */
#define TCPCTL_MAXID 12
#define TCPCTL_NAMES { \
{ 0, 0 }, \
@@ -336,6 +354,10 @@ struct tcpstat {
}
#ifdef KERNEL
#ifdef SYSCTL_DECL
SYSCTL_DECL(_net_inet_tcp);
#endif
extern struct inpcbhead tcb; /* head of queue of active tcpcb's */
extern struct inpcbinfo tcbinfo;
extern struct tcpstat tcpstat; /* tcp statistics */
+118
View File
@@ -455,6 +455,124 @@ release:
return (error);
}
#ifdef __rtems__
#define INP_INFO_RLOCK
#define INP_INFO_RUNLOCK
#define INP_LOCK
#define INP_UNLOCK
#endif
static int
udp_pcblist(SYSCTL_HANDLER_ARGS)
{
int error, i, n, s;
struct inpcb *inp, **inp_list;
inp_gen_t gencnt;
struct xinpgen xig;
/*
* The process of preparing the TCB list is too time-consuming and
* resource-intensive to repeat twice on every request.
*/
if (req->oldptr == 0) {
n = udbinfo.ipi_count;
req->oldidx = 2 * (sizeof xig)
+ (n + n/8) * sizeof(struct xinpcb);
return 0;
}
if (req->newptr != 0)
return EPERM;
/*
* OK, now we're committed to doing something.
*/
s = splnet();
gencnt = udbinfo.ipi_gencnt;
n = udbinfo.ipi_count;
splx(s);
sysctl_wire_old_buffer(req, 2 * (sizeof xig)
+ n * sizeof(struct xinpcb));
xig.xig_len = sizeof xig;
xig.xig_count = n;
xig.xig_gen = gencnt;
#if 0
xig.xig_sogen = so_gencnt;
#endif
error = SYSCTL_OUT(req, &xig, sizeof xig);
if (error)
return error;
/* ccj add the exit if count is 0 */
if (!n)
return error;
inp_list = malloc(n * sizeof *inp_list, M_TEMP, M_WAITOK);
if (inp_list == 0)
return ENOMEM;
s = splnet();
INP_INFO_RLOCK(&udbinfo);
for (inp = LIST_FIRST(udbinfo.listhead), i = 0; inp && i < n;
inp = LIST_NEXT(inp, inp_list)) {
INP_LOCK(inp);
if (inp->inp_gencnt <= gencnt)
#if 0
&&
cr_canseesocket(req->td->td_ucred, inp->inp_socket) == 0)
#endif
inp_list[i++] = inp;
INP_UNLOCK(inp);
}
INP_INFO_RUNLOCK(&udbinfo);
splx(s);
n = i;
error = 0;
for (i = 0; i < n; i++) {
inp = inp_list[i];
INP_LOCK(inp);
if (inp->inp_gencnt <= gencnt) {
struct xinpcb xi;
xi.xi_len = sizeof xi;
/* XXX should avoid extra copy */
bcopy(inp, &xi.xi_inp, sizeof *inp);
#if 0
if (inp->inp_socket)
sotoxsocket(inp->inp_socket, &xi.xi_socket);
#endif
error = SYSCTL_OUT(req, &xi, sizeof xi);
}
INP_UNLOCK(inp);
}
if (!error) {
/*
* Give the user an updated idea of our state.
* If the generation differs from what we told
* her before, she knows that something happened
* while we were processing this request, and it
* might be necessary to retry.
*/
s = splnet();
INP_INFO_RLOCK(&udbinfo);
xig.xig_gen = udbinfo.ipi_gencnt;
#if 0
xig.xig_sogen = so_gencnt;
#endif
xig.xig_count = udbinfo.ipi_count;
INP_INFO_RUNLOCK(&udbinfo);
splx(s);
error = SYSCTL_OUT(req, &xig, sizeof xig);
}
free(inp_list, M_TEMP);
return error;
}
SYSCTL_PROC(_net_inet_udp, UDPCTL_PCBLIST, pcblist, CTLFLAG_RD, 0, 0,
udp_pcblist, "S,xinpcb", "List of active UDP sockets");
static u_long udp_sendspace = 9216; /* really max datagram size */
/* 40 1K datagrams */
SYSCTL_INT(_net_inet_udp, UDPCTL_MAXDGRAM, maxdgram, CTLFLAG_RW,
+4 -1
View File
@@ -78,7 +78,8 @@ struct udpstat {
#define UDPCTL_STATS 2 /* statistics (read-only) */
#define UDPCTL_MAXDGRAM 3 /* max datagram size */
#define UDPCTL_RECVSPACE 4 /* default receive buffer space */
#define UDPCTL_MAXID 5
#define UDPCTL_PCBLIST 5 /* list of PCBs for UDP sockets */
#define UDPCTL_MAXID 6
#define UDPCTL_NAMES { \
{ 0, 0 }, \
@@ -89,6 +90,8 @@ struct udpstat {
}
#ifdef KERNEL
SYSCTL_DECL(_net_inet_udp);
extern struct inpcbhead udb;
extern struct inpcbinfo udbinfo;
extern struct udpstat udpstat;
+10
View File
@@ -36,6 +36,11 @@
#include <net/netisr.h>
#include <net/route.h>
/*
* Sysctl init all.
*/
void sysctl_register_all(void *arg);
/*
* Memory allocation
*/
@@ -196,6 +201,11 @@ bsd_init (void)
domaininit (NULL);
}
/*
* Setup the sysctl, normally done by a SYSINIT call.
*/
sysctl_register_all(0);
/*
* Set up interfaces
*/
@@ -6,6 +6,7 @@
#include <stdarg.h>
/* #include <stdlib.h> */
#include <stdio.h>
#include <errno.h>
#include <rtems.h>
#include <rtems/libio.h>
@@ -633,6 +634,28 @@ getsockname (int s, struct sockaddr *name, int *namelen)
return getpeersockname (s, name, namelen, 0);
}
int
sysctl(int *name, u_int namelen, void *oldp,
size_t *oldlenp, void *newp, size_t newlen)
{
int error;
size_t j;
rtems_bsdnet_semaphore_obtain ();
error = userland_sysctl (0, name, namelen, oldp, oldlenp, 1, newp, newlen, &j);
rtems_bsdnet_semaphore_release ();
if (oldlenp)
*oldlenp = j;
if (error)
{
errno = error;
return -1;
}
return 0;
}
/*
************************************************************************
* RTEMS I/O HANDLER ROUTINES *
+13
View File
@@ -72,6 +72,7 @@ extern int lbolt; /* once a second sleep address */
extern int tickdelta;
extern long timedelta;
#if FREEBSD_RELENG_2_2_2_BASE
/*
* The following macros are used to declare global sets of objects, which
* are collected by the linker into a `struct linker_set' as defined below.
@@ -86,6 +87,18 @@ extern long timedelta;
#define BSS_SET(set, sym) MAKE_SET(set, sym, 27)
#define ABS_SET(set, sym) MAKE_SET(set, sym, 21)
#else
/*
* RTEMS specific port using the updated sys/linker_set.h
* from the lastest FreeBSD (2002-Nov-15). This is a better
* way.
*
* Chris Johns (ccj@acm.org> 18 Nov 2002.
*/
#include <sys/linker_set.h>
#endif
/*
* Enumerated types for known system startup interfaces.
+93
View File
@@ -0,0 +1,93 @@
/*-
* Copyright (c) 1999 John D. Polstra
* Copyright (c) 1999,2001 Peter Wemm <peter@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.
*
* 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: src/sys/sys/linker_set.h,v 1.13 2002/09/23 06:11:29 peter Exp $
*/
#ifndef _SYS_LINKER_SET_H_
#define _SYS_LINKER_SET_H_
/*
* The following macros are used to declare global sets of objects, which
* are collected by the linker into a `linker_set' as defined below.
* For ELF, this is done by constructing a separate segment for each set.
*/
/*
* Private macros, not to be used outside this header file.
*/
#ifdef __GNUC__
#define __MAKE_SET(set, sym) \
static void const * const __set_##set##_sym_##sym \
__attribute((section("set_" #set))) __unused = &sym
#else /* !__GNUC__ */
#ifndef lint
#error "This file needs to be compiled by GCC or lint"
#endif /* lint */
#define __MAKE_SET(set, sym) extern void const * const (__set_##set##_sym_##sym)
#endif /* __GNUC__ */
/*
* Public macros.
*/
#define TEXT_SET(set, sym) __MAKE_SET(set, sym)
#define DATA_SET(set, sym) __MAKE_SET(set, sym)
#define BSS_SET(set, sym) __MAKE_SET(set, sym)
#define ABS_SET(set, sym) __MAKE_SET(set, sym)
#define SET_ENTRY(set, sym) __MAKE_SET(set, sym)
/*
* Initialize before referring to a give linker set
*/
#define SET_DECLARE(set, ptype) \
extern ptype *__CONCAT(__start_set_,set); \
extern ptype *__CONCAT(__stop_set_,set)
#define SET_BEGIN(set) \
(&__CONCAT(__start_set_,set))
#define SET_LIMIT(set) \
(&__CONCAT(__stop_set_,set))
/*
* Iterate over all the elements of a set.
*
* Sets always contain addresses of things, and "pvar" points to words
* containing those addresses. Thus is must be declared as "type **pvar",
* and the address of each set item is obtained inside the loop by "*pvar".
*/
#define SET_FOREACH(pvar, set) \
for (pvar = SET_BEGIN(set); pvar < SET_LIMIT(set); pvar++)
#define SET_ITEM(set, i) \
((SET_BEGIN(set))[i])
/*
* Provide a count of the items in a set.
*/
#define SET_COUNT(set) \
(SET_LIMIT(set) - SET_BEGIN(set))
#endif /* _SYS_LINKER_SET_H_ */
File diff suppressed because it is too large Load Diff
+289 -58
View File
@@ -34,12 +34,15 @@
* SUCH DAMAGE.
*
* @(#)sysctl.h 8.1 (Berkeley) 6/2/93
* $Id$
* $FreeBSD: src/sys/sys/sysctl.h,v 1.110 2002/10/20 22:48:08 phk Exp $
*/
#ifndef _SYS_SYSCTL_H_
#define _SYS_SYSCTL_H_
#include <sys/queue.h>
struct thread;
/*
* Definitions for sysctl call. The sysctl call uses a hierarchical name
* for objects that can be examined or modified. The name is expressed as
@@ -70,84 +73,205 @@ struct ctlname {
#define CTLTYPE_QUAD 4 /* name describes a 64-bit number */
#define CTLTYPE_OPAQUE 5 /* name describes a structure */
#define CTLTYPE_STRUCT CTLTYPE_OPAQUE /* name describes a structure */
#define CTLTYPE_UINT 6 /* name describes an unsigned integer */
#define CTLTYPE_LONG 7 /* name describes a long */
#define CTLTYPE_ULONG 8 /* name describes an unsigned long */
#define CTLFLAG_RD 0x80000000 /* Allow reads of variable */
#define CTLFLAG_WR 0x40000000 /* Allow writes to the variable */
#define CTLFLAG_RW (CTLFLAG_RD|CTLFLAG_WR)
#define CTLFLAG_NOLOCK 0x20000000 /* XXX Don't Lock */
#define CTLFLAG_ANYBODY 0x10000000 /* All users can set this var */
#define CTLFLAG_SECURE 0x08000000 /* Permit set only if securelevel<=0 */
#define CTLFLAG_PRISON 0x04000000 /* Prisoned roots can fiddle */
#define CTLFLAG_DYN 0x02000000 /* Dynamic oid - can be freed */
#define CTLFLAG_SKIP 0x01000000 /* Skip this sysctl when listing */
/*
* USE THIS instead of a hardwired number from the categories below
* to get dynamically assigned sysctl entries using the linker-set
* technology. This is the way nearly all new sysctl variables should
* be implimented.
* be implemented.
* e.g. SYSCTL_INT(_parent, OID_AUTO, name, CTLFLAG_RW, &variable, 0, "");
*/
#define OID_AUTO (-1)
/*
* The starting number for dynamically-assigned entries. WARNING!
* ALL static sysctl entries should have numbers LESS than this!
*/
#define CTL_AUTO_START 0x100
#ifdef KERNEL
#define SYSCTL_HANDLER_ARGS (struct sysctl_oid *oidp, void *arg1, int arg2, \
struct sysctl_req *req)
#define SYSCTL_HANDLER_ARGS struct sysctl_oid *oidp, void *arg1, int arg2, \
struct sysctl_req *req
/*
* This describes the access space for a sysctl request. This is needed
* so that we can use the interface from the kernel or from user-space.
*/
struct sysctl_req {
struct proc *p;
struct thread *td; /* used for access checking */
int lock;
void *oldptr;
int oldlen;
int oldidx;
int (*oldfunc)(struct sysctl_req *, const void *, int);
size_t oldlen;
size_t oldidx;
int (*oldfunc)(struct sysctl_req *, const void *, size_t);
void *newptr;
int newlen;
int newidx;
int (*newfunc)(struct sysctl_req *, void *, int);
size_t newlen;
size_t newidx;
int (*newfunc)(struct sysctl_req *, void *, size_t);
};
SLIST_HEAD(sysctl_oid_list, sysctl_oid);
/*
* This describes one "oid" in the MIB tree. Potentially more nodes can
* be hidden behind it, expanded by the handler.
*/
struct sysctl_oid {
struct sysctl_oid_list *oid_parent;
SLIST_ENTRY(sysctl_oid) oid_link;
int oid_number;
int oid_kind;
u_int oid_kind;
void *oid_arg1;
int oid_arg2;
const char *oid_name;
int (*oid_handler) SYSCTL_HANDLER_ARGS;
int (*oid_handler)(SYSCTL_HANDLER_ARGS);
const char *oid_fmt;
int oid_refcnt;
const char *descr;
};
#define SYSCTL_IN(r, p, l)
#define SYSCTL_OUT(r, p, l)
#define SYSCTL_IN(r, p, l) (r->newfunc)(r, p, l)
#define SYSCTL_OUT(r, p, l) (r->oldfunc)(r, p, l)
int sysctl_handle_int SYSCTL_HANDLER_ARGS;
int sysctl_handle_string SYSCTL_HANDLER_ARGS;
int sysctl_handle_opaque SYSCTL_HANDLER_ARGS;
int sysctl_handle_int(SYSCTL_HANDLER_ARGS);
int sysctl_handle_long(SYSCTL_HANDLER_ARGS);
int sysctl_handle_intptr(SYSCTL_HANDLER_ARGS);
int sysctl_handle_string(SYSCTL_HANDLER_ARGS);
int sysctl_handle_opaque(SYSCTL_HANDLER_ARGS);
/* This is the "raw" function for a mib-oid */
#define SYSCTL_OID(parent, nbr, name, kind, a1, a2, handler, fmt, descr)
/*
* These functions are used to add/remove an oid from the mib.
*/
void sysctl_register_oid(struct sysctl_oid *oidp);
void sysctl_unregister_oid(struct sysctl_oid *oidp);
/* This makes a node from which other oids can hang */
#define SYSCTL_NODE(parent, nbr, name, access, handler, descr)
/* Declare a static oid to allow child oids to be added to it. */
#define SYSCTL_DECL(name) \
extern struct sysctl_oid_list sysctl_##name##_children
/* This is a string len can be 0 to indicate '\0' termination */
#define SYSCTL_STRING(parent, nbr, name, access, arg, len, descr)
/* Hide these in macros */
#define SYSCTL_CHILDREN(oid_ptr) (struct sysctl_oid_list *) \
(oid_ptr)->oid_arg1
#define SYSCTL_STATIC_CHILDREN(oid_name) \
(&sysctl_##oid_name##_children)
/* This is a integer, if ptr is NULL, val is returned */
#define SYSCTL_INT(parent, nbr, name, access, ptr, val, descr)
/* === Structs and macros related to context handling === */
/* This is anything, specified by a pointer and a lenth */
#define SYSCTL_OPAQUE(parent, nbr, name, access, ptr, len, fmt, descr)
/* All dynamically created sysctls can be tracked in a context list. */
struct sysctl_ctx_entry {
struct sysctl_oid *entry;
TAILQ_ENTRY(sysctl_ctx_entry) link;
};
/* This is a struct, specified by a pointer and type */
#define SYSCTL_STRUCT(parent, nbr, name, access, ptr, type, descr)
TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry);
/* This constructs a "raw" MIB oid. */
#define SYSCTL_OID(parent, nbr, name, kind, a1, a2, handler, fmt, descr) \
static struct sysctl_oid sysctl__##parent##_##name = { \
&sysctl_##parent##_children, { 0 }, \
nbr, kind, a1, a2, #name, handler, fmt, 0, descr }; \
DATA_SET(sysctl_set, sysctl__##parent##_##name)
#define SYSCTL_ADD_OID(ctx, parent, nbr, name, kind, a1, a2, handler, fmt, descr) \
sysctl_add_oid(ctx, parent, nbr, name, kind, a1, a2, handler, fmt, descr)
/* This constructs a node from which other oids can hang. */
#define SYSCTL_NODE(parent, nbr, name, access, handler, descr) \
struct sysctl_oid_list sysctl_##parent##_##name##_children; \
SYSCTL_OID(parent, nbr, name, CTLTYPE_NODE|(access), \
(void*)&sysctl_##parent##_##name##_children, 0, handler, \
"N", descr)
#define SYSCTL_ADD_NODE(ctx, parent, nbr, name, access, handler, descr) \
sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_NODE|(access), \
0, 0, handler, "N", descr)
/* Oid for a string. len can be 0 to indicate '\0' termination. */
#define SYSCTL_STRING(parent, nbr, name, access, arg, len, descr) \
SYSCTL_OID(parent, nbr, name, CTLTYPE_STRING|(access), \
arg, len, sysctl_handle_string, "A", descr)
#define SYSCTL_ADD_STRING(ctx, parent, nbr, name, access, arg, len, descr) \
sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_STRING|(access), \
arg, len, sysctl_handle_string, "A", descr)
/* Oid for an int. If ptr is NULL, val is returned. */
#define SYSCTL_INT(parent, nbr, name, access, ptr, val, descr) \
SYSCTL_OID(parent, nbr, name, CTLTYPE_INT|(access), \
ptr, val, sysctl_handle_int, "I", descr)
#define SYSCTL_ADD_INT(ctx, parent, nbr, name, access, ptr, val, descr) \
sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_INT|(access), \
ptr, val, sysctl_handle_int, "I", descr)
/* Oid for an unsigned int. If ptr is NULL, val is returned. */
#define SYSCTL_UINT(parent, nbr, name, access, ptr, val, descr) \
SYSCTL_OID(parent, nbr, name, CTLTYPE_UINT|(access), \
ptr, val, sysctl_handle_int, "IU", descr)
#define SYSCTL_ADD_UINT(ctx, parent, nbr, name, access, ptr, val, descr) \
sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_UINT|(access), \
ptr, val, sysctl_handle_int, "IU", descr)
/* Oid for a long. The pointer must be non NULL. */
#define SYSCTL_LONG(parent, nbr, name, access, ptr, val, descr) \
SYSCTL_OID(parent, nbr, name, CTLTYPE_LONG|(access), \
ptr, val, sysctl_handle_long, "L", descr)
#define SYSCTL_ADD_LONG(ctx, parent, nbr, name, access, ptr, descr) \
sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_LONG|(access), \
ptr, 0, sysctl_handle_long, "L", descr)
/* Oid for a long. The pointer must be non NULL. */
#define SYSCTL_ULONG(parent, nbr, name, access, ptr, val, descr) \
SYSCTL_OID(parent, nbr, name, CTLTYPE_ULONG|(access), \
ptr, val, sysctl_handle_long, "LU", descr)
#define SYSCTL_ADD_ULONG(ctx, parent, nbr, name, access, ptr, descr) \
sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_ULONG|(access), \
ptr, 0, sysctl_handle_long, "LU", descr)
/* Oid for an opaque object. Specified by a pointer and a length. */
#define SYSCTL_OPAQUE(parent, nbr, name, access, ptr, len, fmt, descr) \
SYSCTL_OID(parent, nbr, name, CTLTYPE_OPAQUE|(access), \
ptr, len, sysctl_handle_opaque, fmt, descr)
#define SYSCTL_ADD_OPAQUE(ctx, parent, nbr, name, access, ptr, len, fmt, descr)\
sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_OPAQUE|(access), \
ptr, len, sysctl_handle_opaque, fmt, descr)
/* Oid for a struct. Specified by a pointer and a type. */
#define SYSCTL_STRUCT(parent, nbr, name, access, ptr, type, descr) \
SYSCTL_OID(parent, nbr, name, CTLTYPE_OPAQUE|(access), \
ptr, sizeof(struct type), sysctl_handle_opaque, \
"S," #type, descr)
#define SYSCTL_ADD_STRUCT(ctx, parent, nbr, name, access, ptr, type, descr) \
sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_OPAQUE|(access), \
ptr, sizeof(struct type), sysctl_handle_opaque, "S," #type, descr)
/* Oid for a procedure. Specified by a pointer and an arg. */
#define SYSCTL_PROC(parent, nbr, name, access, ptr, arg, handler, fmt, descr) \
SYSCTL_OID(parent, nbr, name, (access), \
ptr, arg, handler, fmt, descr)
#define SYSCTL_ADD_PROC(ctx, parent, nbr, name, access, ptr, arg, handler, fmt, descr) \
sysctl_add_oid(ctx, parent, nbr, name, (access), \
ptr, arg, handler, fmt, descr)
/* Needs a proc. Specify by pointer and arg */
#define SYSCTL_PROC(parent, nbr, name, access, ptr, arg, handler, fmt, descr)
#endif /* KERNEL */
/*
@@ -156,13 +280,14 @@ int sysctl_handle_opaque SYSCTL_HANDLER_ARGS;
#define CTL_UNSPEC 0 /* unused */
#define CTL_KERN 1 /* "high kernel": proc, limits */
#define CTL_VM 2 /* virtual memory */
#define CTL_VFS 3 /* file system, mount type is next */
#define CTL_VFS 3 /* filesystem, mount type is next */
#define CTL_NET 4 /* network, see socket.h */
#define CTL_DEBUG 5 /* debugging parameters */
#define CTL_HW 6 /* generic cpu/io */
#define CTL_MACHDEP 7 /* machine dependent */
#define CTL_USER 8 /* user-level */
#define CTL_MAXID 9 /* number of valid top-level ids */
#define CTL_P1003_1B 9 /* POSIX 1003.1B */
#define CTL_MAXID 10 /* number of valid top-level ids */
#define CTL_NAMES { \
{ 0, 0 }, \
@@ -174,6 +299,7 @@ int sysctl_handle_opaque SYSCTL_HANDLER_ARGS;
{ "hw", CTLTYPE_NODE }, \
{ "machdep", CTLTYPE_NODE }, \
{ "user", CTLTYPE_NODE }, \
{ "p1003_1b", CTLTYPE_NODE }, \
}
/*
@@ -208,11 +334,13 @@ int sysctl_handle_opaque SYSCTL_HANDLER_ARGS;
#define KERN_MAXFILESPERPROC 27 /* int: max open files per proc */
#define KERN_MAXPROCPERUID 28 /* int: max processes per uid */
#define KERN_DUMPDEV 29 /* dev_t: device to dump on */
#define KERN_SOMAXCONN 30 /* int: max connections in listen q */
#define KERN_MAXSOCKBUF 31 /* int: max size of a socket buffer */
#define KERN_IPC 30 /* node: anything related to IPC */
#define KERN_DUMMY 31 /* unused */
#define KERN_PS_STRINGS 32 /* int: address of PS_STRINGS */
#define KERN_USRSTACK 33 /* int: address of USRSTACK */
#define KERN_MAXID 34 /* number of valid kern ids */
#define KERN_LOGSIGEXIT 34 /* int: do we log sigexit procs? */
#define KERN_IOV_MAX 35 /* int: value of UIO_MAXIOV */
#define KERN_MAXID 36 /* number of valid kern ids */
#define CTL_KERN_NAMES { \
{ 0, 0 }, \
@@ -226,7 +354,7 @@ int sysctl_handle_opaque SYSCTL_HANDLER_ARGS;
{ "argmax", CTLTYPE_INT }, \
{ "securelevel", CTLTYPE_INT }, \
{ "hostname", CTLTYPE_STRING }, \
{ "hostid", CTLTYPE_INT }, \
{ "hostid", CTLTYPE_UINT }, \
{ "clockrate", CTLTYPE_STRUCT }, \
{ "vnode", CTLTYPE_STRUCT }, \
{ "proc", CTLTYPE_STRUCT }, \
@@ -240,23 +368,21 @@ int sysctl_handle_opaque SYSCTL_HANDLER_ARGS;
{ "nisdomainname", CTLTYPE_STRING }, \
{ "update", CTLTYPE_INT }, \
{ "osreldate", CTLTYPE_INT }, \
{ "ntp_pll", CTLTYPE_NODE }, \
{ "ntp_pll", CTLTYPE_NODE }, \
{ "bootfile", CTLTYPE_STRING }, \
{ "maxfilesperproc", CTLTYPE_INT }, \
{ "maxprocperuid", CTLTYPE_INT }, \
{ "dumpdev", CTLTYPE_STRUCT }, /* we lie; don't print as int */ \
{ "somaxconn", CTLTYPE_INT }, \
{ "maxsockbuf", CTLTYPE_INT }, \
{ "ipc", CTLTYPE_NODE }, \
{ "dummy", CTLTYPE_INT }, \
{ "ps_strings", CTLTYPE_INT }, \
{ "usrstack", CTLTYPE_INT }, \
{ "logsigexit", CTLTYPE_INT }, \
{ "iov_max", CTLTYPE_INT }, \
}
/*
* CTL_VFS identifiers
*/
#define VFS_VFSCONF 0 /* get configured filesystems */
#define VFS_MAXID 1 /* number of items */
#define CTL_VFS_NAMES { \
{ "vfsconf", CTLTYPE_STRUCT }, \
}
@@ -271,6 +397,18 @@ int sysctl_handle_opaque SYSCTL_HANDLER_ARGS;
#define KERN_PROC_TTY 4 /* by controlling tty */
#define KERN_PROC_UID 5 /* by effective uid */
#define KERN_PROC_RUID 6 /* by real uid */
#define KERN_PROC_ARGS 7 /* get/set arguments/proctitle */
/*
* KERN_IPC identifiers
*/
#define KIPC_MAXSOCKBUF 1 /* int: max size of a socket buffer */
#define KIPC_SOCKBUF_WASTE 2 /* int: wastage factor in sockbuf */
#define KIPC_SOMAXCONN 3 /* int: max length of connection q */
#define KIPC_MAX_LINKHDR 4 /* int: max length of link header */
#define KIPC_MAX_PROTOHDR 5 /* int: max length of network header */
#define KIPC_MAX_HDR 6 /* int: max total length of headers */
#define KIPC_MAX_DATALEN 7 /* int: max length of data? */
/*
* CTL_HW identifiers
@@ -294,8 +432,8 @@ int sysctl_handle_opaque SYSCTL_HANDLER_ARGS;
{ "model", CTLTYPE_STRING }, \
{ "ncpu", CTLTYPE_INT }, \
{ "byteorder", CTLTYPE_INT }, \
{ "physmem", CTLTYPE_INT }, \
{ "usermem", CTLTYPE_INT }, \
{ "physmem", CTLTYPE_ULONG }, \
{ "usermem", CTLTYPE_ULONG }, \
{ "pagesize", CTLTYPE_INT }, \
{ "disknames", CTLTYPE_STRUCT }, \
{ "diskstats", CTLTYPE_STRUCT }, \
@@ -351,28 +489,121 @@ int sysctl_handle_opaque SYSCTL_HANDLER_ARGS;
{ "tzname_max", CTLTYPE_INT }, \
}
#define CTL_P1003_1B_ASYNCHRONOUS_IO 1 /* boolean */
#define CTL_P1003_1B_MAPPED_FILES 2 /* boolean */
#define CTL_P1003_1B_MEMLOCK 3 /* boolean */
#define CTL_P1003_1B_MEMLOCK_RANGE 4 /* boolean */
#define CTL_P1003_1B_MEMORY_PROTECTION 5 /* boolean */
#define CTL_P1003_1B_MESSAGE_PASSING 6 /* boolean */
#define CTL_P1003_1B_PRIORITIZED_IO 7 /* boolean */
#define CTL_P1003_1B_PRIORITY_SCHEDULING 8 /* boolean */
#define CTL_P1003_1B_REALTIME_SIGNALS 9 /* boolean */
#define CTL_P1003_1B_SEMAPHORES 10 /* boolean */
#define CTL_P1003_1B_FSYNC 11 /* boolean */
#define CTL_P1003_1B_SHARED_MEMORY_OBJECTS 12 /* boolean */
#define CTL_P1003_1B_SYNCHRONIZED_IO 13 /* boolean */
#define CTL_P1003_1B_TIMERS 14 /* boolean */
#define CTL_P1003_1B_AIO_LISTIO_MAX 15 /* int */
#define CTL_P1003_1B_AIO_MAX 16 /* int */
#define CTL_P1003_1B_AIO_PRIO_DELTA_MAX 17 /* int */
#define CTL_P1003_1B_DELAYTIMER_MAX 18 /* int */
#define CTL_P1003_1B_MQ_OPEN_MAX 19 /* int */
#define CTL_P1003_1B_PAGESIZE 20 /* int */
#define CTL_P1003_1B_RTSIG_MAX 21 /* int */
#define CTL_P1003_1B_SEM_NSEMS_MAX 22 /* int */
#define CTL_P1003_1B_SEM_VALUE_MAX 23 /* int */
#define CTL_P1003_1B_SIGQUEUE_MAX 24 /* int */
#define CTL_P1003_1B_TIMER_MAX 25 /* int */
#define CTL_P1003_1B_MAXID 26
#define CTL_P1003_1B_NAMES { \
{ 0, 0 }, \
{ "asynchronous_io", CTLTYPE_INT }, \
{ "mapped_files", CTLTYPE_INT }, \
{ "memlock", CTLTYPE_INT }, \
{ "memlock_range", CTLTYPE_INT }, \
{ "memory_protection", CTLTYPE_INT }, \
{ "message_passing", CTLTYPE_INT }, \
{ "prioritized_io", CTLTYPE_INT }, \
{ "priority_scheduling", CTLTYPE_INT }, \
{ "realtime_signals", CTLTYPE_INT }, \
{ "semaphores", CTLTYPE_INT }, \
{ "fsync", CTLTYPE_INT }, \
{ "shared_memory_objects", CTLTYPE_INT }, \
{ "synchronized_io", CTLTYPE_INT }, \
{ "timers", CTLTYPE_INT }, \
{ "aio_listio_max", CTLTYPE_INT }, \
{ "aio_max", CTLTYPE_INT }, \
{ "aio_prio_delta_max", CTLTYPE_INT }, \
{ "delaytimer_max", CTLTYPE_INT }, \
{ "mq_open_max", CTLTYPE_INT }, \
{ "pagesize", CTLTYPE_INT }, \
{ "rtsig_max", CTLTYPE_INT }, \
{ "nsems_max", CTLTYPE_INT }, \
{ "sem_value_max", CTLTYPE_INT }, \
{ "sigqueue_max", CTLTYPE_INT }, \
{ "timer_max", CTLTYPE_INT }, \
}
#ifdef KERNEL
extern char cpu_model[];
/*
* Declare some common oids.
*/
extern struct sysctl_oid_list sysctl__children;
SYSCTL_DECL(_kern);
SYSCTL_DECL(_sysctl);
SYSCTL_DECL(_vm);
SYSCTL_DECL(_vfs);
SYSCTL_DECL(_net);
SYSCTL_DECL(_debug);
SYSCTL_DECL(_debug_sizeof);
SYSCTL_DECL(_hw);
SYSCTL_DECL(_machdep);
SYSCTL_DECL(_user);
SYSCTL_DECL(_compat);
extern char machine[];
extern char osrelease[];
extern char ostype[];
int kernel_sysctl(struct proc *p, int *name, u_int namelen, void *old, size_t *oldlenp, void *new, size_t newlen, int *retval);
int userland_sysctl(struct proc *p, int *name, u_int namelen, void *old, size_t *oldlenp, int inkernel, void *new, size_t newlen, int *retval);
/*
int sysctl_clockrate __P((char *, size_t*));
int sysctl_file __P((char *, size_t*));
int sysctl_doproc __P((int *, u_int, char *, size_t*));
int sysctl_doprof __P((int *, u_int, void *, size_t *, void *, size_t));
*/
/* Dynamic oid handling */
struct sysctl_oid *sysctl_add_oid(struct sysctl_ctx_list *clist,
struct sysctl_oid_list *parent, int nbr, const char *name,
int kind, void *arg1, int arg2,
int (*handler) (SYSCTL_HANDLER_ARGS),
const char *fmt, const char *descr);
int sysctl_remove_oid(struct sysctl_oid *oidp, int del, int recurse);
int sysctl_ctx_init(struct sysctl_ctx_list *clist);
int sysctl_ctx_free(struct sysctl_ctx_list *clist);
struct sysctl_ctx_entry *sysctl_ctx_entry_add(struct sysctl_ctx_list *clist,
struct sysctl_oid *oidp);
struct sysctl_ctx_entry *sysctl_ctx_entry_find(struct sysctl_ctx_list *clist,
struct sysctl_oid *oidp);
int sysctl_ctx_entry_del(struct sysctl_ctx_list *clist,
struct sysctl_oid *oidp);
int kernel_sysctl(struct thread *td, int *name, u_int namelen, void *old,
size_t *oldlenp, void *new, size_t newlen,
size_t *retval);
int kernel_sysctlbyname(struct thread *td, char *name,
void *old, size_t *oldlenp, void *new, size_t newlen,
size_t *retval);
int userland_sysctl(struct thread *td, int *name, u_int namelen, void *old,
size_t *oldlenp, int inkernel, void *new, size_t newlen,
size_t *retval);
int sysctl_find_oid(int *name, u_int namelen, struct sysctl_oid **noid,
int *nindx, struct sysctl_req *req);
void sysctl_wire_old_buffer(struct sysctl_req *req, size_t len);
#else /* !KERNEL */
#include <sys/cdefs.h>
__BEGIN_DECLS
int sysctl __P((int *, u_int, void *, size_t *, void *, size_t));
int sysctlbyname __P((const char *, void *, size_t *, void *, size_t));
int sysctl(int *, u_int, void *, size_t *, void *, size_t);
int sysctlbyname(const char *, void *, size_t *, void *, size_t);
int sysctlnametomib(const char *, int *, size_t *);
__END_DECLS
#endif /* KERNEL */