2006-10-03 20:07:12 +04:00
|
|
|
/* $NetBSD: init_sysctl.c,v 1.89 2006/10/03 16:07:12 elad Exp $ */
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
|
|
|
|
/*-
|
|
|
|
* Copyright (c) 2003 The NetBSD Foundation, Inc.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This code is derived from software contributed to The NetBSD Foundation
|
|
|
|
* by Andrew Brown.
|
|
|
|
*
|
|
|
|
* 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 NetBSD
|
|
|
|
* Foundation, Inc. and its contributors.
|
|
|
|
* 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
|
|
|
|
*/
|
|
|
|
|
2003-12-29 01:12:00 +03:00
|
|
|
#include <sys/cdefs.h>
|
2006-10-03 20:07:12 +04:00
|
|
|
__KERNEL_RCSID(0, "$NetBSD: init_sysctl.c,v 1.89 2006/10/03 16:07:12 elad Exp $");
|
2003-12-29 01:12:00 +03:00
|
|
|
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
#include "opt_sysv.h"
|
2003-12-06 05:52:29 +03:00
|
|
|
#include "opt_multiprocessor.h"
|
2003-12-06 23:06:11 +03:00
|
|
|
#include "opt_posix.h"
|
2006-09-08 15:59:52 +04:00
|
|
|
#include "opt_compat_netbsd32.h"
|
2006-09-24 02:01:04 +04:00
|
|
|
#include "opt_ktrace.h"
|
2006-07-26 13:33:57 +04:00
|
|
|
#include "veriexec.h"
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
#include "pty.h"
|
|
|
|
#include "rnd.h"
|
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/sysctl.h>
|
|
|
|
#include <sys/errno.h>
|
|
|
|
#include <sys/systm.h>
|
|
|
|
#include <sys/kernel.h>
|
|
|
|
#include <sys/unistd.h>
|
|
|
|
#include <sys/disklabel.h>
|
|
|
|
#include <sys/rnd.h>
|
|
|
|
#include <sys/vnode.h>
|
|
|
|
#include <sys/mount.h>
|
|
|
|
#include <sys/namei.h>
|
|
|
|
#include <sys/msgbuf.h>
|
|
|
|
#include <dev/cons.h>
|
|
|
|
#include <sys/socketvar.h>
|
|
|
|
#include <sys/file.h>
|
2005-03-09 08:02:17 +03:00
|
|
|
#include <sys/filedesc.h>
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
#include <sys/tty.h>
|
|
|
|
#include <sys/malloc.h>
|
|
|
|
#include <sys/resource.h>
|
|
|
|
#include <sys/resourcevar.h>
|
|
|
|
#include <sys/exec.h>
|
|
|
|
#include <sys/conf.h>
|
|
|
|
#include <sys/device.h>
|
2006-07-24 20:37:28 +04:00
|
|
|
#if NVERIEXEC > 0
|
2005-05-23 02:34:01 +04:00
|
|
|
#define VERIEXEC_NEED_NODE
|
2005-05-20 00:16:19 +04:00
|
|
|
#include <sys/verified_exec.h>
|
2006-07-24 20:37:28 +04:00
|
|
|
#endif /* NVERIEXEC > 0 */
|
2006-02-02 20:48:51 +03:00
|
|
|
#include <sys/stat.h>
|
2006-05-15 01:15:11 +04:00
|
|
|
#include <sys/kauth.h>
|
2006-09-24 02:01:04 +04:00
|
|
|
#ifdef KTRACE
|
|
|
|
#include <sys/ktrace.h>
|
|
|
|
#endif
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
|
|
|
|
#if defined(SYSVMSG) || defined(SYSVSEM) || defined(SYSVSHM)
|
|
|
|
#include <sys/ipc.h>
|
|
|
|
#endif
|
|
|
|
#ifdef SYSVMSG
|
|
|
|
#include <sys/msg.h>
|
|
|
|
#endif
|
|
|
|
#ifdef SYSVSEM
|
|
|
|
#include <sys/sem.h>
|
|
|
|
#endif
|
|
|
|
#ifdef SYSVSHM
|
|
|
|
#include <sys/shm.h>
|
|
|
|
#endif
|
|
|
|
|
2006-09-08 15:59:52 +04:00
|
|
|
#ifdef COMPAT_NETBSD32
|
|
|
|
#include <compat/netbsd32/netbsd32.h>
|
|
|
|
#endif
|
|
|
|
|
2003-12-06 23:06:11 +03:00
|
|
|
#include <machine/cpu.h>
|
|
|
|
|
2005-09-07 20:26:15 +04:00
|
|
|
/* XXX this should not be here */
|
2006-02-02 20:48:51 +03:00
|
|
|
int security_setidcore_dump;
|
|
|
|
char security_setidcore_path[MAXPATHLEN] = "/var/crash/%n.core";
|
|
|
|
uid_t security_setidcore_owner = 0;
|
|
|
|
gid_t security_setidcore_group = 0;
|
|
|
|
mode_t security_setidcore_mode = (S_IRUSR|S_IWUSR);
|
2005-09-07 20:26:15 +04:00
|
|
|
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
/*
|
|
|
|
* try over estimating by 5 procs/lwps
|
|
|
|
*/
|
|
|
|
#define KERN_PROCSLOP (5 * sizeof(struct kinfo_proc))
|
|
|
|
#define KERN_LWPSLOP (5 * sizeof(struct kinfo_lwp))
|
|
|
|
|
2006-09-24 02:01:04 +04:00
|
|
|
#ifdef KTRACE
|
|
|
|
int dcopyout(struct lwp *, const void *, void *, size_t);
|
|
|
|
|
|
|
|
int
|
|
|
|
dcopyout(l, kaddr, uaddr, len)
|
|
|
|
struct lwp *l;
|
|
|
|
const void *kaddr;
|
|
|
|
void *uaddr;
|
|
|
|
size_t len;
|
|
|
|
{
|
|
|
|
int error;
|
|
|
|
|
|
|
|
error = copyout(kaddr, uaddr, len);
|
|
|
|
if (!error && KTRPOINT(l->l_proc, KTR_MIB)) {
|
|
|
|
struct iovec iov;
|
|
|
|
|
|
|
|
iov.iov_base = uaddr;
|
|
|
|
iov.iov_len = len;
|
|
|
|
ktrgenio(l, -1, UIO_READ, &iov, len, 0);
|
|
|
|
}
|
|
|
|
return error;
|
|
|
|
}
|
2006-09-24 09:46:14 +04:00
|
|
|
#else /* !KTRACE */
|
|
|
|
#define dcopyout(l, kaddr, uaddr, len) copyout(kaddr, uaddr, len)
|
2006-09-24 02:01:04 +04:00
|
|
|
#endif /* KTRACE */
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
#ifndef MULTIPROCESSOR
|
2003-12-06 12:36:34 +03:00
|
|
|
#define sysctl_ncpus() (1)
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
#else /* MULTIPROCESSOR */
|
|
|
|
#ifndef CPU_INFO_FOREACH
|
|
|
|
#define CPU_INFO_ITERATOR int
|
|
|
|
#define CPU_INFO_FOREACH(cii, ci) cii = 0, ci = curcpu(); ci != NULL; ci = NULL
|
|
|
|
#endif
|
|
|
|
static int
|
|
|
|
sysctl_ncpus(void)
|
|
|
|
{
|
|
|
|
struct cpu_info *ci;
|
|
|
|
CPU_INFO_ITERATOR cii;
|
|
|
|
|
2005-06-06 23:56:46 +04:00
|
|
|
int ncpus = 0;
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
for (CPU_INFO_FOREACH(cii, ci))
|
2005-06-06 23:56:46 +04:00
|
|
|
ncpus++;
|
|
|
|
return (ncpus);
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
}
|
|
|
|
#endif /* MULTIPROCESSOR */
|
|
|
|
|
2006-03-27 00:07:21 +04:00
|
|
|
#ifdef DIAGNOSTIC
|
|
|
|
static int sysctl_kern_trigger_panic(SYSCTLFN_PROTO);
|
|
|
|
#endif
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
static int sysctl_kern_maxvnodes(SYSCTLFN_PROTO);
|
2003-12-27 02:49:39 +03:00
|
|
|
static int sysctl_kern_rtc_offset(SYSCTLFN_PROTO);
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
static int sysctl_kern_maxproc(SYSCTLFN_PROTO);
|
|
|
|
static int sysctl_kern_hostid(SYSCTLFN_PROTO);
|
2003-12-29 01:19:59 +03:00
|
|
|
static int sysctl_setlen(SYSCTLFN_PROTO);
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
static int sysctl_kern_clockrate(SYSCTLFN_PROTO);
|
|
|
|
static int sysctl_kern_file(SYSCTLFN_PROTO);
|
|
|
|
static int sysctl_kern_autonice(SYSCTLFN_PROTO);
|
|
|
|
static int sysctl_msgbuf(SYSCTLFN_PROTO);
|
|
|
|
static int sysctl_kern_defcorename(SYSCTLFN_PROTO);
|
|
|
|
static int sysctl_kern_cptime(SYSCTLFN_PROTO);
|
|
|
|
#if defined(SYSVMSG) || defined(SYSVSEM) || defined(SYSVSHM)
|
|
|
|
static int sysctl_kern_sysvipc(SYSCTLFN_PROTO);
|
|
|
|
#endif /* defined(SYSVMSG) || defined(SYSVSEM) || defined(SYSVSHM) */
|
2003-12-07 13:31:32 +03:00
|
|
|
#if NPTY > 0
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
static int sysctl_kern_maxptys(SYSCTLFN_PROTO);
|
2003-12-07 13:31:32 +03:00
|
|
|
#endif /* NPTY > 0 */
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
static int sysctl_kern_sbmax(SYSCTLFN_PROTO);
|
|
|
|
static int sysctl_kern_urnd(SYSCTLFN_PROTO);
|
|
|
|
static int sysctl_kern_lwp(SYSCTLFN_PROTO);
|
|
|
|
static int sysctl_kern_forkfsleep(SYSCTLFN_PROTO);
|
|
|
|
static int sysctl_kern_root_partition(SYSCTLFN_PROTO);
|
|
|
|
static int sysctl_kern_drivers(SYSCTLFN_PROTO);
|
2005-03-09 08:02:17 +03:00
|
|
|
static int sysctl_kern_file2(SYSCTLFN_PROTO);
|
2006-07-24 20:37:28 +04:00
|
|
|
#if NVERIEXEC > 0
|
2005-05-20 00:16:19 +04:00
|
|
|
static int sysctl_kern_veriexec(SYSCTLFN_PROTO);
|
2006-07-24 20:37:28 +04:00
|
|
|
#endif /* NVERIEXEC > 0 */
|
2006-02-02 20:48:51 +03:00
|
|
|
static int sysctl_security_setidcore(SYSCTLFN_PROTO);
|
|
|
|
static int sysctl_security_setidcorename(SYSCTLFN_PROTO);
|
2005-06-16 18:55:58 +04:00
|
|
|
static int sysctl_kern_cpid(SYSCTLFN_PROTO);
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
static int sysctl_doeproc(SYSCTLFN_PROTO);
|
|
|
|
static int sysctl_kern_proc_args(SYSCTLFN_PROTO);
|
|
|
|
static int sysctl_hw_usermem(SYSCTLFN_PROTO);
|
|
|
|
static int sysctl_hw_cnmagic(SYSCTLFN_PROTO);
|
2003-12-06 12:36:34 +03:00
|
|
|
static int sysctl_hw_ncpu(SYSCTLFN_PROTO);
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
|
|
|
|
static void fill_kproc2(struct proc *, struct kinfo_proc2 *);
|
|
|
|
static void fill_lwp(struct lwp *l, struct kinfo_lwp *kl);
|
2005-03-09 08:02:17 +03:00
|
|
|
static void fill_file(struct kinfo_file *, const struct file *, struct proc *,
|
|
|
|
int);
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* ********************************************************************
|
|
|
|
* section 1: setup routines
|
|
|
|
* ********************************************************************
|
|
|
|
* these functions are stuffed into a link set for sysctl setup
|
|
|
|
* functions. they're never called or referenced from anywhere else.
|
|
|
|
* ********************************************************************
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* sets up the base nodes...
|
|
|
|
*/
|
|
|
|
SYSCTL_SETUP(sysctl_root_setup, "sysctl base setup")
|
|
|
|
{
|
|
|
|
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_NODE, "kern",
|
|
|
|
SYSCTL_DESCR("High kernel"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
NULL, 0, NULL, 0,
|
|
|
|
CTL_KERN, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_NODE, "vm",
|
|
|
|
SYSCTL_DESCR("Virtual memory"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
NULL, 0, NULL, 0,
|
|
|
|
CTL_VM, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_NODE, "vfs",
|
|
|
|
SYSCTL_DESCR("Filesystem"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
NULL, 0, NULL, 0,
|
|
|
|
CTL_VFS, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_NODE, "net",
|
|
|
|
SYSCTL_DESCR("Networking"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
NULL, 0, NULL, 0,
|
|
|
|
CTL_NET, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_NODE, "debug",
|
|
|
|
SYSCTL_DESCR("Debugging"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
NULL, 0, NULL, 0,
|
|
|
|
CTL_DEBUG, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_NODE, "hw",
|
|
|
|
SYSCTL_DESCR("Generic CPU, I/O"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
NULL, 0, NULL, 0,
|
|
|
|
CTL_HW, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_NODE, "machdep",
|
|
|
|
SYSCTL_DESCR("Machine dependent"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
NULL, 0, NULL, 0,
|
|
|
|
CTL_MACHDEP, CTL_EOL);
|
|
|
|
/*
|
|
|
|
* this node is inserted so that the sysctl nodes in libc can
|
|
|
|
* operate.
|
|
|
|
*/
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_NODE, "user",
|
|
|
|
SYSCTL_DESCR("User-level"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
NULL, 0, NULL, 0,
|
|
|
|
CTL_USER, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_NODE, "ddb",
|
|
|
|
SYSCTL_DESCR("In-kernel debugger"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
NULL, 0, NULL, 0,
|
|
|
|
CTL_DDB, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_NODE, "proc",
|
|
|
|
SYSCTL_DESCR("Per-process"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
NULL, 0, NULL, 0,
|
|
|
|
CTL_PROC, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_NODE, "vendor",
|
|
|
|
SYSCTL_DESCR("Vendor specific"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
NULL, 0, NULL, 0,
|
|
|
|
CTL_VENDOR, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_NODE, "emul",
|
|
|
|
SYSCTL_DESCR("Emulation settings"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
NULL, 0, NULL, 0,
|
|
|
|
CTL_EMUL, CTL_EOL);
|
2005-09-07 20:26:15 +04:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT,
|
|
|
|
CTLTYPE_NODE, "security",
|
|
|
|
SYSCTL_DESCR("Security"),
|
|
|
|
NULL, 0, NULL, 0,
|
|
|
|
CTL_SECURITY, CTL_EOL);
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* this setup routine is a replacement for kern_sysctl()
|
|
|
|
*/
|
|
|
|
SYSCTL_SETUP(sysctl_kern_setup, "sysctl kern subtree setup")
|
|
|
|
{
|
|
|
|
extern int kern_logsigexit; /* defined in kern/kern_sig.c */
|
|
|
|
extern fixpt_t ccpu; /* defined in kern/kern_synch.c */
|
|
|
|
extern int dumponpanic; /* defined in kern/subr_prf.c */
|
2006-07-15 01:55:19 +04:00
|
|
|
const struct sysctlnode *rnode;
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT,
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
CTLTYPE_NODE, "kern", NULL,
|
|
|
|
NULL, 0, NULL, 0,
|
|
|
|
CTL_KERN, CTL_EOL);
|
|
|
|
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_STRING, "ostype",
|
|
|
|
SYSCTL_DESCR("Operating system type"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
NULL, 0, &ostype, 0,
|
|
|
|
CTL_KERN, KERN_OSTYPE, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_STRING, "osrelease",
|
|
|
|
SYSCTL_DESCR("Operating system release"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
NULL, 0, &osrelease, 0,
|
|
|
|
CTL_KERN, KERN_OSRELEASE, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_INT, "osrevision",
|
|
|
|
SYSCTL_DESCR("Operating system revision"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
NULL, __NetBSD_Version__, NULL, 0,
|
|
|
|
CTL_KERN, KERN_OSREV, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_STRING, "version",
|
|
|
|
SYSCTL_DESCR("Kernel version"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
NULL, 0, &version, 0,
|
|
|
|
CTL_KERN, KERN_VERSION, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_INT, "maxvnodes",
|
|
|
|
SYSCTL_DESCR("Maximum number of vnodes"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
sysctl_kern_maxvnodes, 0, NULL, 0,
|
|
|
|
CTL_KERN, KERN_MAXVNODES, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_INT, "maxproc",
|
|
|
|
SYSCTL_DESCR("Maximum number of simultaneous processes"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
sysctl_kern_maxproc, 0, NULL, 0,
|
|
|
|
CTL_KERN, KERN_MAXPROC, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_INT, "maxfiles",
|
|
|
|
SYSCTL_DESCR("Maximum number of open files"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
NULL, 0, &maxfiles, 0,
|
|
|
|
CTL_KERN, KERN_MAXFILES, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_INT, "argmax",
|
|
|
|
SYSCTL_DESCR("Maximum number of bytes of arguments to "
|
|
|
|
"execve(2)"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
NULL, ARG_MAX, NULL, 0,
|
|
|
|
CTL_KERN, KERN_ARGMAX, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_STRING, "hostname",
|
|
|
|
SYSCTL_DESCR("System hostname"),
|
2003-12-29 01:19:59 +03:00
|
|
|
sysctl_setlen, 0, &hostname, MAXHOSTNAMELEN,
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
CTL_KERN, KERN_HOSTNAME, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
2004-04-16 17:25:40 +04:00
|
|
|
CTLFLAG_PERMANENT|CTLFLAG_READWRITE|CTLFLAG_HEX,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_INT, "hostid",
|
|
|
|
SYSCTL_DESCR("System host ID number"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
sysctl_kern_hostid, 0, NULL, 0,
|
|
|
|
CTL_KERN, KERN_HOSTID, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_STRUCT, "clockrate",
|
|
|
|
SYSCTL_DESCR("Kernel clock rates"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
sysctl_kern_clockrate, 0, NULL,
|
|
|
|
sizeof(struct clockinfo),
|
|
|
|
CTL_KERN, KERN_CLOCKRATE, CTL_EOL);
|
2005-09-06 06:36:17 +04:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT,
|
|
|
|
CTLTYPE_INT, "hardclock_ticks",
|
|
|
|
SYSCTL_DESCR("Number of hardclock ticks"),
|
|
|
|
NULL, 0, &hardclock_ticks, sizeof(hardclock_ticks),
|
|
|
|
CTL_KERN, KERN_HARDCLOCK_TICKS, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_STRUCT, "vnode",
|
|
|
|
SYSCTL_DESCR("System vnode table"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
sysctl_kern_vnode, 0, NULL, 0,
|
|
|
|
CTL_KERN, KERN_VNODE, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_STRUCT, "file",
|
|
|
|
SYSCTL_DESCR("System open file table"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
sysctl_kern_file, 0, NULL, 0,
|
|
|
|
CTL_KERN, KERN_FILE, CTL_EOL);
|
|
|
|
#ifndef GPROF
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_NODE, "profiling",
|
|
|
|
SYSCTL_DESCR("Profiling information (not available)"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
sysctl_notavail, 0, NULL, 0,
|
|
|
|
CTL_KERN, KERN_PROF, CTL_EOL);
|
|
|
|
#endif
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_INT, "posix1version",
|
|
|
|
SYSCTL_DESCR("Version of ISO/IEC 9945 (POSIX 1003.1) "
|
|
|
|
"with which the operating system attempts "
|
|
|
|
"to comply"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
NULL, _POSIX_VERSION, NULL, 0,
|
|
|
|
CTL_KERN, KERN_POSIX1, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_INT, "ngroups",
|
|
|
|
SYSCTL_DESCR("Maximum number of supplemental groups"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
NULL, NGROUPS_MAX, NULL, 0,
|
|
|
|
CTL_KERN, KERN_NGROUPS, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_INT, "job_control",
|
|
|
|
SYSCTL_DESCR("Whether job control is available"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
NULL, 1, NULL, 0,
|
|
|
|
CTL_KERN, KERN_JOB_CONTROL, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_INT, "saved_ids",
|
2005-04-18 14:46:39 +04:00
|
|
|
SYSCTL_DESCR("Whether POSIX saved set-group/user ID is "
|
2004-04-08 10:20:29 +04:00
|
|
|
"available"), NULL,
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
#ifdef _POSIX_SAVED_IDS
|
|
|
|
1,
|
|
|
|
#else /* _POSIX_SAVED_IDS */
|
|
|
|
0,
|
|
|
|
#endif /* _POSIX_SAVED_IDS */
|
|
|
|
NULL, 0, CTL_KERN, KERN_SAVED_IDS, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_STRUCT, "boottime",
|
|
|
|
SYSCTL_DESCR("System boot time"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
NULL, 0, &boottime, sizeof(boottime),
|
|
|
|
CTL_KERN, KERN_BOOTTIME, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_STRING, "domainname",
|
|
|
|
SYSCTL_DESCR("YP domain name"),
|
2003-12-29 01:19:59 +03:00
|
|
|
sysctl_setlen, 0, &domainname, MAXHOSTNAMELEN,
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
CTL_KERN, KERN_DOMAINNAME, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_INT, "maxpartitions",
|
|
|
|
SYSCTL_DESCR("Maximum number of partitions allowed per "
|
|
|
|
"disk"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
NULL, MAXPARTITIONS, NULL, 0,
|
|
|
|
CTL_KERN, KERN_MAXPARTITIONS, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_INT, "rawpartition",
|
|
|
|
SYSCTL_DESCR("Raw partition of a disk"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
NULL, RAW_PART, NULL, 0,
|
|
|
|
CTL_KERN, KERN_RAWPARTITION, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT,
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
CTLTYPE_STRUCT, "timex", NULL,
|
|
|
|
sysctl_notavail, 0, NULL, 0,
|
|
|
|
CTL_KERN, KERN_TIMEX, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_INT, "autonicetime",
|
|
|
|
SYSCTL_DESCR("CPU clock seconds before non-root "
|
|
|
|
"process priority is lowered"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
sysctl_kern_autonice, 0, &autonicetime, 0,
|
|
|
|
CTL_KERN, KERN_AUTONICETIME, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_INT, "autoniceval",
|
|
|
|
SYSCTL_DESCR("Automatic reniced non-root process "
|
|
|
|
"priority"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
sysctl_kern_autonice, 0, &autoniceval, 0,
|
|
|
|
CTL_KERN, KERN_AUTONICEVAL, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_INT, "rtc_offset",
|
|
|
|
SYSCTL_DESCR("Offset of real time clock from UTC in "
|
|
|
|
"minutes"),
|
2003-12-27 02:49:39 +03:00
|
|
|
sysctl_kern_rtc_offset, 0, &rtc_offset, 0,
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
CTL_KERN, KERN_RTC_OFFSET, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_STRING, "root_device",
|
|
|
|
SYSCTL_DESCR("Name of the root device"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
sysctl_root_device, 0, NULL, 0,
|
|
|
|
CTL_KERN, KERN_ROOT_DEVICE, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_INT, "msgbufsize",
|
|
|
|
SYSCTL_DESCR("Size of the kernel message buffer"),
|
2004-07-27 16:46:18 +04:00
|
|
|
sysctl_msgbuf, 0, NULL, 0,
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
CTL_KERN, KERN_MSGBUFSIZE, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_INT, "fsync",
|
|
|
|
SYSCTL_DESCR("Whether the POSIX 1003.1b File "
|
|
|
|
"Synchronization Option is available on "
|
|
|
|
"this system"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
NULL, 1, NULL, 0,
|
|
|
|
CTL_KERN, KERN_FSYNC, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_INT, "sysvmsg",
|
|
|
|
SYSCTL_DESCR("System V style message support available"),
|
|
|
|
NULL,
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
#ifdef SYSVMSG
|
|
|
|
1,
|
|
|
|
#else /* SYSVMSG */
|
|
|
|
0,
|
|
|
|
#endif /* SYSVMSG */
|
|
|
|
NULL, 0, CTL_KERN, KERN_SYSVMSG, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_INT, "sysvsem",
|
|
|
|
SYSCTL_DESCR("System V style semaphore support "
|
|
|
|
"available"), NULL,
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
#ifdef SYSVSEM
|
|
|
|
1,
|
|
|
|
#else /* SYSVSEM */
|
|
|
|
0,
|
|
|
|
#endif /* SYSVSEM */
|
|
|
|
NULL, 0, CTL_KERN, KERN_SYSVSEM, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_INT, "sysvshm",
|
|
|
|
SYSCTL_DESCR("System V style shared memory support "
|
|
|
|
"available"), NULL,
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
#ifdef SYSVSHM
|
|
|
|
1,
|
|
|
|
#else /* SYSVSHM */
|
|
|
|
0,
|
|
|
|
#endif /* SYSVSHM */
|
|
|
|
NULL, 0, CTL_KERN, KERN_SYSVSHM, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_INT, "synchronized_io",
|
|
|
|
SYSCTL_DESCR("Whether the POSIX 1003.1b Synchronized "
|
|
|
|
"I/O Option is available on this system"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
NULL, 1, NULL, 0,
|
|
|
|
CTL_KERN, KERN_SYNCHRONIZED_IO, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_INT, "iov_max",
|
|
|
|
SYSCTL_DESCR("Maximum number of iovec structures per "
|
|
|
|
"process"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
NULL, IOV_MAX, NULL, 0,
|
|
|
|
CTL_KERN, KERN_IOV_MAX, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_INT, "mapped_files",
|
|
|
|
SYSCTL_DESCR("Whether the POSIX 1003.1b Memory Mapped "
|
|
|
|
"Files Option is available on this system"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
NULL, 1, NULL, 0,
|
|
|
|
CTL_KERN, KERN_MAPPED_FILES, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_INT, "memlock",
|
|
|
|
SYSCTL_DESCR("Whether the POSIX 1003.1b Process Memory "
|
|
|
|
"Locking Option is available on this "
|
|
|
|
"system"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
NULL, 1, NULL, 0,
|
|
|
|
CTL_KERN, KERN_MEMLOCK, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_INT, "memlock_range",
|
|
|
|
SYSCTL_DESCR("Whether the POSIX 1003.1b Range Memory "
|
|
|
|
"Locking Option is available on this "
|
|
|
|
"system"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
NULL, 1, NULL, 0,
|
|
|
|
CTL_KERN, KERN_MEMLOCK_RANGE, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_INT, "memory_protection",
|
|
|
|
SYSCTL_DESCR("Whether the POSIX 1003.1b Memory "
|
|
|
|
"Protection Option is available on this "
|
|
|
|
"system"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
NULL, 1, NULL, 0,
|
|
|
|
CTL_KERN, KERN_MEMORY_PROTECTION, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_INT, "login_name_max",
|
|
|
|
SYSCTL_DESCR("Maximum login name length"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
NULL, LOGIN_NAME_MAX, NULL, 0,
|
|
|
|
CTL_KERN, KERN_LOGIN_NAME_MAX, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_STRING, "defcorename",
|
|
|
|
SYSCTL_DESCR("Default core file name"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
sysctl_kern_defcorename, 0, defcorename, MAXPATHLEN,
|
|
|
|
CTL_KERN, KERN_DEFCORENAME, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_INT, "logsigexit",
|
|
|
|
SYSCTL_DESCR("Log process exit when caused by signals"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
NULL, 0, &kern_logsigexit, 0,
|
|
|
|
CTL_KERN, KERN_LOGSIGEXIT, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_INT, "fscale",
|
|
|
|
SYSCTL_DESCR("Kernel fixed-point scale factor"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
NULL, FSCALE, NULL, 0,
|
|
|
|
CTL_KERN, KERN_FSCALE, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_INT, "ccpu",
|
|
|
|
SYSCTL_DESCR("Scheduler exponential decay value"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
NULL, 0, &ccpu, 0,
|
|
|
|
CTL_KERN, KERN_CCPU, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_STRUCT, "cp_time",
|
|
|
|
SYSCTL_DESCR("Clock ticks spent in different CPU states"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
sysctl_kern_cptime, 0, NULL, 0,
|
|
|
|
CTL_KERN, KERN_CP_TIME, CTL_EOL);
|
|
|
|
#if defined(SYSVMSG) || defined(SYSVSEM) || defined(SYSVSHM)
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_STRUCT, "sysvipc_info",
|
|
|
|
SYSCTL_DESCR("System V style IPC information"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
sysctl_kern_sysvipc, 0, NULL, 0,
|
|
|
|
CTL_KERN, KERN_SYSVIPC_INFO, CTL_EOL);
|
|
|
|
#endif /* SYSVMSG || SYSVSEM || SYSVSHM */
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_INT, "msgbuf",
|
|
|
|
SYSCTL_DESCR("Kernel message buffer"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
sysctl_msgbuf, 0, NULL, 0,
|
|
|
|
CTL_KERN, KERN_MSGBUF, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_STRUCT, "consdev",
|
|
|
|
SYSCTL_DESCR("Console device"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
sysctl_consdev, 0, NULL, sizeof(dev_t),
|
|
|
|
CTL_KERN, KERN_CONSDEV, CTL_EOL);
|
|
|
|
#if NPTY > 0
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_INT, "maxptys",
|
|
|
|
SYSCTL_DESCR("Maximum number of pseudo-ttys"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
sysctl_kern_maxptys, 0, NULL, 0,
|
|
|
|
CTL_KERN, KERN_MAXPTYS, CTL_EOL);
|
|
|
|
#endif /* NPTY > 0 */
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_INT, "maxphys",
|
|
|
|
SYSCTL_DESCR("Maximum raw I/O transfer size"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
NULL, MAXPHYS, NULL, 0,
|
|
|
|
CTL_KERN, KERN_MAXPHYS, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_INT, "sbmax",
|
|
|
|
SYSCTL_DESCR("Maximum socket buffer size"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
sysctl_kern_sbmax, 0, NULL, 0,
|
|
|
|
CTL_KERN, KERN_SBMAX, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_INT, "monotonic_clock",
|
|
|
|
SYSCTL_DESCR("Implementation version of the POSIX "
|
|
|
|
"1003.1b Monotonic Clock Option"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
/* XXX _POSIX_VERSION */
|
|
|
|
NULL, _POSIX_MONOTONIC_CLOCK, NULL, 0,
|
|
|
|
CTL_KERN, KERN_MONOTONIC_CLOCK, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_INT, "urandom",
|
|
|
|
SYSCTL_DESCR("Random integer value"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
sysctl_kern_urnd, 0, NULL, 0,
|
|
|
|
CTL_KERN, KERN_URND, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_INT, "labelsector",
|
|
|
|
SYSCTL_DESCR("Sector number containing the disklabel"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
NULL, LABELSECTOR, NULL, 0,
|
|
|
|
CTL_KERN, KERN_LABELSECTOR, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_INT, "labeloffset",
|
|
|
|
SYSCTL_DESCR("Offset of the disklabel within the "
|
|
|
|
"sector"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
NULL, LABELOFFSET, NULL, 0,
|
|
|
|
CTL_KERN, KERN_LABELOFFSET, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_NODE, "lwp",
|
|
|
|
SYSCTL_DESCR("System-wide LWP information"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
sysctl_kern_lwp, 0, NULL, 0,
|
|
|
|
CTL_KERN, KERN_LWP, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_INT, "forkfsleep",
|
|
|
|
SYSCTL_DESCR("Milliseconds to sleep on fork failure due "
|
|
|
|
"to process limits"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
sysctl_kern_forkfsleep, 0, NULL, 0,
|
|
|
|
CTL_KERN, KERN_FORKFSLEEP, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_INT, "posix_threads",
|
|
|
|
SYSCTL_DESCR("Version of IEEE Std 1003.1 and its "
|
|
|
|
"Threads option to which the system "
|
|
|
|
"attempts to conform"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
/* XXX _POSIX_VERSION */
|
|
|
|
NULL, _POSIX_THREADS, NULL, 0,
|
|
|
|
CTL_KERN, KERN_POSIX_THREADS, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_INT, "posix_semaphores",
|
|
|
|
SYSCTL_DESCR("Version of IEEE Std 1003.1 and its "
|
|
|
|
"Semaphores option to which the system "
|
|
|
|
"attempts to conform"), NULL,
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
#ifdef P1003_1B_SEMAPHORE
|
|
|
|
200112,
|
|
|
|
#else /* P1003_1B_SEMAPHORE */
|
|
|
|
0,
|
|
|
|
#endif /* P1003_1B_SEMAPHORE */
|
|
|
|
NULL, 0, CTL_KERN, KERN_POSIX_SEMAPHORES, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_INT, "posix_barriers",
|
|
|
|
SYSCTL_DESCR("Version of IEEE Std 1003.1 and its "
|
|
|
|
"Barriers option to which the system "
|
|
|
|
"attempts to conform"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
/* XXX _POSIX_VERSION */
|
|
|
|
NULL, _POSIX_BARRIERS, NULL, 0,
|
|
|
|
CTL_KERN, KERN_POSIX_BARRIERS, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_INT, "posix_timers",
|
|
|
|
SYSCTL_DESCR("Version of IEEE Std 1003.1 and its "
|
|
|
|
"Timers option to which the system "
|
|
|
|
"attempts to conform"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
/* XXX _POSIX_VERSION */
|
|
|
|
NULL, _POSIX_TIMERS, NULL, 0,
|
|
|
|
CTL_KERN, KERN_POSIX_TIMERS, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_INT, "posix_spin_locks",
|
|
|
|
SYSCTL_DESCR("Version of IEEE Std 1003.1 and its Spin "
|
|
|
|
"Locks option to which the system attempts "
|
|
|
|
"to conform"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
/* XXX _POSIX_VERSION */
|
|
|
|
NULL, _POSIX_SPIN_LOCKS, NULL, 0,
|
|
|
|
CTL_KERN, KERN_POSIX_SPIN_LOCKS, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_INT, "posix_reader_writer_locks",
|
|
|
|
SYSCTL_DESCR("Version of IEEE Std 1003.1 and its "
|
|
|
|
"Read-Write Locks option to which the "
|
|
|
|
"system attempts to conform"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
/* XXX _POSIX_VERSION */
|
|
|
|
NULL, _POSIX_READER_WRITER_LOCKS, NULL, 0,
|
|
|
|
CTL_KERN, KERN_POSIX_READER_WRITER_LOCKS, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_INT, "dump_on_panic",
|
|
|
|
SYSCTL_DESCR("Perform a crash dump on system panic"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
NULL, 0, &dumponpanic, 0,
|
|
|
|
CTL_KERN, KERN_DUMP_ON_PANIC, CTL_EOL);
|
2006-03-27 00:07:21 +04:00
|
|
|
#ifdef DIAGNOSTIC
|
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
|
|
|
|
CTLTYPE_INT, "panic_now",
|
|
|
|
SYSCTL_DESCR("Trigger a panic"),
|
|
|
|
sysctl_kern_trigger_panic, 0, NULL, 0,
|
|
|
|
CTL_KERN, CTL_CREATE, CTL_EOL);
|
|
|
|
#endif
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_INT, "root_partition",
|
|
|
|
SYSCTL_DESCR("Root partition on the root device"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
sysctl_kern_root_partition, 0, NULL, 0,
|
|
|
|
CTL_KERN, KERN_ROOT_PARTITION, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_STRUCT, "drivers",
|
|
|
|
SYSCTL_DESCR("List of all drivers with block and "
|
|
|
|
"character device numbers"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
sysctl_kern_drivers, 0, NULL, 0,
|
|
|
|
CTL_KERN, KERN_DRIVERS, CTL_EOL);
|
2005-03-09 08:02:17 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT,
|
2005-03-11 09:16:15 +03:00
|
|
|
CTLTYPE_STRUCT, "file2",
|
2005-03-09 08:02:17 +03:00
|
|
|
SYSCTL_DESCR("System open file table"),
|
|
|
|
sysctl_kern_file2, 0, NULL, 0,
|
|
|
|
CTL_KERN, KERN_FILE2, CTL_EOL);
|
2006-07-24 20:37:28 +04:00
|
|
|
#if NVERIEXEC > 0
|
2005-05-20 00:16:19 +04:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT,
|
|
|
|
CTLTYPE_NODE, "veriexec",
|
|
|
|
SYSCTL_DESCR("Verified Exec"),
|
|
|
|
NULL, 0, NULL, 0,
|
|
|
|
CTL_KERN, KERN_VERIEXEC, CTL_EOL);
|
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
|
|
|
|
CTLTYPE_INT, "verbose",
|
|
|
|
SYSCTL_DESCR("Verified Exec verbose level"),
|
|
|
|
NULL, 0, &veriexec_verbose, 0,
|
|
|
|
CTL_KERN, KERN_VERIEXEC, VERIEXEC_VERBOSE,
|
|
|
|
CTL_EOL);
|
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
|
|
|
|
CTLTYPE_INT, "strict",
|
|
|
|
SYSCTL_DESCR("Verified Exec strict level"),
|
|
|
|
sysctl_kern_veriexec, 0, NULL, 0,
|
|
|
|
CTL_KERN, KERN_VERIEXEC, VERIEXEC_STRICT, CTL_EOL);
|
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT,
|
|
|
|
CTLTYPE_STRING, "algorithms",
|
|
|
|
SYSCTL_DESCR("Verified Exec supported hashing "
|
|
|
|
"algorithms"),
|
|
|
|
sysctl_kern_veriexec, 0, NULL, 0,
|
|
|
|
CTL_KERN, KERN_VERIEXEC, VERIEXEC_ALGORITHMS, CTL_EOL);
|
2005-05-23 02:34:01 +04:00
|
|
|
sysctl_createv(clog, 0, NULL, &veriexec_count_node,
|
|
|
|
CTLFLAG_PERMANENT,
|
|
|
|
CTLTYPE_NODE, "count",
|
|
|
|
SYSCTL_DESCR("Number of fingerprints on device(s)"),
|
|
|
|
NULL, 0, NULL, 0,
|
|
|
|
CTL_KERN, KERN_VERIEXEC, VERIEXEC_COUNT, CTL_EOL);
|
2006-07-24 20:37:28 +04:00
|
|
|
#endif /* NVERIEXEC > 0 */
|
2005-06-16 18:55:58 +04:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT,
|
|
|
|
CTLTYPE_STRUCT, "cp_id",
|
|
|
|
SYSCTL_DESCR("Mapping of CPU number to CPU id"),
|
|
|
|
sysctl_kern_cpid, 0, NULL, 0,
|
|
|
|
CTL_KERN, KERN_CP_ID, CTL_EOL);
|
2006-07-15 01:55:19 +04:00
|
|
|
|
|
|
|
sysctl_createv(clog, 0, NULL, &rnode,
|
|
|
|
CTLFLAG_PERMANENT,
|
|
|
|
CTLTYPE_NODE, "coredump",
|
|
|
|
SYSCTL_DESCR("Coredump settings."),
|
|
|
|
NULL, 0, NULL, 0,
|
|
|
|
CTL_KERN, CTL_CREATE, CTL_EOL);
|
|
|
|
sysctl_createv(clog, 0, &rnode, &rnode,
|
|
|
|
CTLFLAG_PERMANENT,
|
|
|
|
CTLTYPE_NODE, "setid",
|
|
|
|
SYSCTL_DESCR("Set-id processes' coredump settings."),
|
|
|
|
NULL, 0, NULL, 0,
|
|
|
|
CTL_CREATE, CTL_EOL);
|
|
|
|
sysctl_createv(clog, 0, &rnode, NULL,
|
|
|
|
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
|
|
|
|
CTLTYPE_INT, "dump",
|
|
|
|
SYSCTL_DESCR("Allow set-id processes to dump core."),
|
|
|
|
sysctl_security_setidcore, 0, &security_setidcore_dump,
|
|
|
|
sizeof(security_setidcore_dump),
|
|
|
|
CTL_CREATE, CTL_EOL);
|
|
|
|
sysctl_createv(clog, 0, &rnode, NULL,
|
|
|
|
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
|
|
|
|
CTLTYPE_STRING, "path",
|
|
|
|
SYSCTL_DESCR("Path pattern for set-id coredumps."),
|
|
|
|
sysctl_security_setidcorename, 0,
|
|
|
|
&security_setidcore_path,
|
|
|
|
sizeof(security_setidcore_path),
|
|
|
|
CTL_CREATE, CTL_EOL);
|
|
|
|
sysctl_createv(clog, 0, &rnode, NULL,
|
|
|
|
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
|
|
|
|
CTLTYPE_INT, "owner",
|
|
|
|
SYSCTL_DESCR("Owner id for set-id processes' cores."),
|
|
|
|
sysctl_security_setidcore, 0, &security_setidcore_owner,
|
|
|
|
0,
|
|
|
|
CTL_CREATE, CTL_EOL);
|
|
|
|
sysctl_createv(clog, 0, &rnode, NULL,
|
|
|
|
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
|
|
|
|
CTLTYPE_INT, "group",
|
|
|
|
SYSCTL_DESCR("Group id for set-id processes' cores."),
|
|
|
|
sysctl_security_setidcore, 0, &security_setidcore_group,
|
|
|
|
0,
|
|
|
|
CTL_CREATE, CTL_EOL);
|
|
|
|
sysctl_createv(clog, 0, &rnode, NULL,
|
|
|
|
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
|
|
|
|
CTLTYPE_INT, "mode",
|
|
|
|
SYSCTL_DESCR("Mode for set-id processes' cores."),
|
|
|
|
sysctl_security_setidcore, 0, &security_setidcore_mode,
|
|
|
|
0,
|
|
|
|
CTL_CREATE, CTL_EOL);
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
SYSCTL_SETUP(sysctl_kern_proc_setup,
|
|
|
|
"sysctl kern.proc/proc2/proc_args subtree setup")
|
|
|
|
{
|
|
|
|
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT,
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
CTLTYPE_NODE, "kern", NULL,
|
|
|
|
NULL, 0, NULL, 0,
|
|
|
|
CTL_KERN, CTL_EOL);
|
|
|
|
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_NODE, "proc",
|
|
|
|
SYSCTL_DESCR("System-wide process information"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
sysctl_doeproc, 0, NULL, 0,
|
|
|
|
CTL_KERN, KERN_PROC, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_NODE, "proc2",
|
|
|
|
SYSCTL_DESCR("Machine-independent process information"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
sysctl_doeproc, 0, NULL, 0,
|
|
|
|
CTL_KERN, KERN_PROC2, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_NODE, "proc_args",
|
|
|
|
SYSCTL_DESCR("Process argument information"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
sysctl_kern_proc_args, 0, NULL, 0,
|
|
|
|
CTL_KERN, KERN_PROC_ARGS, CTL_EOL);
|
|
|
|
|
|
|
|
/*
|
|
|
|
"nodes" under these:
|
|
|
|
|
|
|
|
KERN_PROC_ALL
|
|
|
|
KERN_PROC_PID pid
|
|
|
|
KERN_PROC_PGRP pgrp
|
|
|
|
KERN_PROC_SESSION sess
|
|
|
|
KERN_PROC_TTY tty
|
|
|
|
KERN_PROC_UID uid
|
|
|
|
KERN_PROC_RUID uid
|
|
|
|
KERN_PROC_GID gid
|
|
|
|
KERN_PROC_RGID gid
|
|
|
|
|
|
|
|
all in all, probably not worth the effort...
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
|
|
|
|
SYSCTL_SETUP(sysctl_hw_setup, "sysctl hw subtree setup")
|
|
|
|
{
|
|
|
|
u_int u;
|
|
|
|
u_quad_t q;
|
|
|
|
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT,
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
CTLTYPE_NODE, "hw", NULL,
|
|
|
|
NULL, 0, NULL, 0,
|
|
|
|
CTL_HW, CTL_EOL);
|
|
|
|
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_STRING, "machine",
|
|
|
|
SYSCTL_DESCR("Machine class"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
NULL, 0, machine, 0,
|
|
|
|
CTL_HW, HW_MACHINE, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_STRING, "model",
|
|
|
|
SYSCTL_DESCR("Machine model"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
NULL, 0, cpu_model, 0,
|
|
|
|
CTL_HW, HW_MODEL, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_INT, "ncpu",
|
|
|
|
SYSCTL_DESCR("Number of active CPUs"),
|
2003-12-06 12:36:34 +03:00
|
|
|
sysctl_hw_ncpu, 0, NULL, 0,
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
CTL_HW, HW_NCPU, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_INT, "byteorder",
|
|
|
|
SYSCTL_DESCR("System byte order"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
NULL, BYTE_ORDER, NULL, 0,
|
|
|
|
CTL_HW, HW_BYTEORDER, CTL_EOL);
|
|
|
|
u = ((u_int)physmem > (UINT_MAX / PAGE_SIZE)) ?
|
|
|
|
UINT_MAX : physmem * PAGE_SIZE;
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_INT, "physmem",
|
|
|
|
SYSCTL_DESCR("Bytes of physical memory"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
NULL, u, NULL, 0,
|
|
|
|
CTL_HW, HW_PHYSMEM, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_INT, "usermem",
|
|
|
|
SYSCTL_DESCR("Bytes of non-kernel memory"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
sysctl_hw_usermem, 0, NULL, 0,
|
|
|
|
CTL_HW, HW_USERMEM, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_INT, "pagesize",
|
|
|
|
SYSCTL_DESCR("Software page size"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
NULL, PAGE_SIZE, NULL, 0,
|
|
|
|
CTL_HW, HW_PAGESIZE, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_STRING, "machine_arch",
|
|
|
|
SYSCTL_DESCR("Machine CPU class"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
NULL, 0, machine_arch, 0,
|
|
|
|
CTL_HW, HW_MACHINE_ARCH, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_INT, "alignbytes",
|
|
|
|
SYSCTL_DESCR("Alignment constraint for all possible "
|
|
|
|
"data types"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
NULL, ALIGNBYTES, NULL, 0,
|
|
|
|
CTL_HW, HW_ALIGNBYTES, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT|CTLFLAG_READWRITE|CTLFLAG_HEX,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_STRING, "cnmagic",
|
|
|
|
SYSCTL_DESCR("Console magic key sequence"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
sysctl_hw_cnmagic, 0, NULL, CNS_LEN,
|
|
|
|
CTL_HW, HW_CNMAGIC, CTL_EOL);
|
|
|
|
q = (u_quad_t)physmem * PAGE_SIZE;
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_QUAD, "physmem64",
|
|
|
|
SYSCTL_DESCR("Bytes of physical memory"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
NULL, q, NULL, 0,
|
|
|
|
CTL_HW, HW_PHYSMEM64, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT,
|
2004-04-08 10:20:29 +04:00
|
|
|
CTLTYPE_QUAD, "usermem64",
|
|
|
|
SYSCTL_DESCR("Bytes of non-kernel memory"),
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
sysctl_hw_usermem, 0, NULL, 0,
|
|
|
|
CTL_HW, HW_USERMEM64, CTL_EOL);
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
/*
|
|
|
|
* Debugging related system variables.
|
|
|
|
*/
|
|
|
|
struct ctldebug /* debug0, */ /* debug1, */ debug2, debug3, debug4;
|
|
|
|
struct ctldebug debug5, debug6, debug7, debug8, debug9;
|
|
|
|
struct ctldebug debug10, debug11, debug12, debug13, debug14;
|
|
|
|
struct ctldebug debug15, debug16, debug17, debug18, debug19;
|
|
|
|
static struct ctldebug *debugvars[CTL_DEBUG_MAXID] = {
|
|
|
|
&debug0, &debug1, &debug2, &debug3, &debug4,
|
|
|
|
&debug5, &debug6, &debug7, &debug8, &debug9,
|
|
|
|
&debug10, &debug11, &debug12, &debug13, &debug14,
|
|
|
|
&debug15, &debug16, &debug17, &debug18, &debug19,
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* this setup routine is a replacement for debug_sysctl()
|
|
|
|
*
|
|
|
|
* note that it creates several nodes per defined debug variable
|
|
|
|
*/
|
|
|
|
SYSCTL_SETUP(sysctl_debug_setup, "sysctl debug subtree setup")
|
|
|
|
{
|
|
|
|
struct ctldebug *cdp;
|
|
|
|
char nodename[20];
|
|
|
|
int i;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* two ways here:
|
|
|
|
*
|
|
|
|
* the "old" way (debug.name -> value) which was emulated by
|
|
|
|
* the sysctl(8) binary
|
|
|
|
*
|
|
|
|
* the new way, which the sysctl(8) binary was actually using
|
|
|
|
|
|
|
|
node debug
|
|
|
|
node debug.0
|
|
|
|
string debug.0.name
|
|
|
|
int debug.0.value
|
|
|
|
int debug.name
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT,
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
CTLTYPE_NODE, "debug", NULL,
|
|
|
|
NULL, 0, NULL, 0,
|
|
|
|
CTL_DEBUG, CTL_EOL);
|
|
|
|
|
|
|
|
for (i = 0; i < CTL_DEBUG_MAXID; i++) {
|
|
|
|
cdp = debugvars[i];
|
|
|
|
if (cdp->debugname == NULL || cdp->debugvar == NULL)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
snprintf(nodename, sizeof(nodename), "debug%d", i);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT|CTLFLAG_HIDDEN,
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
CTLTYPE_NODE, nodename, NULL,
|
|
|
|
NULL, 0, NULL, 0,
|
|
|
|
CTL_DEBUG, i, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT|CTLFLAG_HIDDEN,
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
CTLTYPE_STRING, "name", NULL,
|
2005-05-30 02:24:14 +04:00
|
|
|
/*XXXUNCONST*/
|
|
|
|
NULL, 0, __UNCONST(cdp->debugname), 0,
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
CTL_DEBUG, i, CTL_DEBUG_NAME, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT|CTLFLAG_HIDDEN,
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
CTLTYPE_INT, "value", NULL,
|
|
|
|
NULL, 0, cdp->debugvar, 0,
|
|
|
|
CTL_DEBUG, i, CTL_DEBUG_VALUE, CTL_EOL);
|
2004-03-24 18:34:46 +03:00
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT,
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
CTLTYPE_INT, cdp->debugname, NULL,
|
|
|
|
NULL, 0, cdp->debugvar, 0,
|
|
|
|
CTL_DEBUG, CTL_CREATE, CTL_EOL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif /* DEBUG */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ********************************************************************
|
|
|
|
* section 2: private node-specific helper routines.
|
|
|
|
* ********************************************************************
|
|
|
|
*/
|
|
|
|
|
2006-03-27 00:07:21 +04:00
|
|
|
#ifdef DIAGNOSTIC
|
|
|
|
static int
|
|
|
|
sysctl_kern_trigger_panic(SYSCTLFN_ARGS)
|
|
|
|
{
|
|
|
|
int newtrig, error;
|
|
|
|
struct sysctlnode node;
|
|
|
|
|
|
|
|
newtrig = 0;
|
|
|
|
node = *rnode;
|
|
|
|
node.sysctl_data = &newtrig;
|
|
|
|
error = sysctl_lookup(SYSCTLFN_CALL(&node));
|
|
|
|
if (error || newp == NULL)
|
|
|
|
return (error);
|
|
|
|
|
|
|
|
if (newtrig != 0)
|
|
|
|
panic("Panic triggered");
|
|
|
|
|
|
|
|
return (error);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
/*
|
2003-12-20 10:33:03 +03:00
|
|
|
* sysctl helper routine for kern.maxvnodes. drain vnodes if
|
|
|
|
* new value is lower than desiredvnodes and then calls reinit
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
* routines that needs to adjust to the new value.
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
sysctl_kern_maxvnodes(SYSCTLFN_ARGS)
|
|
|
|
{
|
2003-12-20 10:26:27 +03:00
|
|
|
int error, new_vnodes, old_vnodes;
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
struct sysctlnode node;
|
|
|
|
|
|
|
|
new_vnodes = desiredvnodes;
|
|
|
|
node = *rnode;
|
|
|
|
node.sysctl_data = &new_vnodes;
|
|
|
|
error = sysctl_lookup(SYSCTLFN_CALL(&node));
|
|
|
|
if (error || newp == NULL)
|
|
|
|
return (error);
|
|
|
|
|
2003-12-20 10:26:27 +03:00
|
|
|
old_vnodes = desiredvnodes;
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
desiredvnodes = new_vnodes;
|
2003-12-20 10:26:27 +03:00
|
|
|
if (new_vnodes < old_vnodes) {
|
2005-12-11 15:16:03 +03:00
|
|
|
error = vfs_drainvnodes(new_vnodes, l);
|
2003-12-20 10:26:27 +03:00
|
|
|
if (error) {
|
|
|
|
desiredvnodes = old_vnodes;
|
|
|
|
return (error);
|
|
|
|
}
|
|
|
|
}
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
vfs_reinit();
|
|
|
|
nchreinit();
|
|
|
|
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
2003-12-27 02:49:39 +03:00
|
|
|
/*
|
|
|
|
* sysctl helper routine for rtc_offset - set time after changes
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
sysctl_kern_rtc_offset(SYSCTLFN_ARGS)
|
|
|
|
{
|
2005-12-05 03:16:33 +03:00
|
|
|
struct timespec ts, delta;
|
|
|
|
int error, new_rtc_offset;
|
2003-12-27 02:49:39 +03:00
|
|
|
struct sysctlnode node;
|
|
|
|
|
|
|
|
new_rtc_offset = rtc_offset;
|
|
|
|
node = *rnode;
|
|
|
|
node.sysctl_data = &new_rtc_offset;
|
|
|
|
error = sysctl_lookup(SYSCTLFN_CALL(&node));
|
|
|
|
if (error || newp == NULL)
|
|
|
|
return (error);
|
|
|
|
|
First take at security model abstraction.
- Add a few scopes to the kernel: system, network, and machdep.
- Add a few more actions/sub-actions (requests), and start using them as
opposed to the KAUTH_GENERIC_ISSUSER place-holders.
- Introduce a basic set of listeners that implement our "traditional"
security model, called "bsd44". This is the default (and only) model we
have at the moment.
- Update all relevant documentation.
- Add some code and docs to help folks who want to actually use this stuff:
* There's a sample overlay model, sitting on-top of "bsd44", for
fast experimenting with tweaking just a subset of an existing model.
This is pretty cool because it's *really* straightforward to do stuff
you had to use ugly hacks for until now...
* And of course, documentation describing how to do the above for quick
reference, including code samples.
All of these changes were tested for regressions using a Python-based
testsuite that will be (I hope) available soon via pkgsrc. Information
about the tests, and how to write new ones, can be found on:
http://kauth.linbsd.org/kauthwiki
NOTE FOR DEVELOPERS: *PLEASE* don't add any code that does any of the
following:
- Uses a KAUTH_GENERIC_ISSUSER kauth(9) request,
- Checks 'securelevel' directly,
- Checks a uid/gid directly.
(or if you feel you have to, contact me first)
This is still work in progress; It's far from being done, but now it'll
be a lot easier.
Relevant mailing list threads:
http://mail-index.netbsd.org/tech-security/2006/01/25/0011.html
http://mail-index.netbsd.org/tech-security/2006/03/24/0001.html
http://mail-index.netbsd.org/tech-security/2006/04/18/0000.html
http://mail-index.netbsd.org/tech-security/2006/05/15/0000.html
http://mail-index.netbsd.org/tech-security/2006/08/01/0000.html
http://mail-index.netbsd.org/tech-security/2006/08/25/0000.html
Many thanks to YAMAMOTO Takashi, Matt Thomas, and Christos Zoulas for help
stablizing kauth(9).
Full credit for the regression tests, making sure these changes didn't break
anything, goes to Matt Fleming and Jaime Fournier.
Happy birthday Randi! :)
2006-09-09 00:58:56 +04:00
|
|
|
if (kauth_authorize_system(l->l_cred, KAUTH_SYSTEM_TIME,
|
|
|
|
KAUTH_REQ_SYSTEM_TIME_RTCOFFSET,
|
2006-09-13 14:07:42 +04:00
|
|
|
(void *)(u_long)new_rtc_offset, NULL, NULL))
|
2003-12-27 02:49:39 +03:00
|
|
|
return (EPERM);
|
|
|
|
if (rtc_offset == new_rtc_offset)
|
|
|
|
return (0);
|
|
|
|
|
|
|
|
/* if we change the offset, adjust the time */
|
2005-12-05 03:16:33 +03:00
|
|
|
nanotime(&ts);
|
|
|
|
delta.tv_sec = 60 * (new_rtc_offset - rtc_offset);
|
|
|
|
delta.tv_nsec = 0;
|
|
|
|
timespecadd(&ts, &delta, &ts);
|
2003-12-27 02:49:39 +03:00
|
|
|
rtc_offset = new_rtc_offset;
|
2005-12-05 03:16:33 +03:00
|
|
|
settime(l->l_proc, &ts);
|
2003-12-27 02:49:39 +03:00
|
|
|
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
/*
|
2005-08-24 20:00:54 +04:00
|
|
|
* sysctl helper routine for kern.maxproc. ensures that the new
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
* values are not too low or too high.
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
sysctl_kern_maxproc(SYSCTLFN_ARGS)
|
|
|
|
{
|
|
|
|
int error, nmaxproc;
|
|
|
|
struct sysctlnode node;
|
|
|
|
|
|
|
|
nmaxproc = maxproc;
|
|
|
|
node = *rnode;
|
|
|
|
node.sysctl_data = &nmaxproc;
|
|
|
|
error = sysctl_lookup(SYSCTLFN_CALL(&node));
|
|
|
|
if (error || newp == NULL)
|
|
|
|
return (error);
|
|
|
|
|
|
|
|
if (nmaxproc < 0 || nmaxproc >= PID_MAX)
|
|
|
|
return (EINVAL);
|
|
|
|
#ifdef __HAVE_CPU_MAXPROC
|
|
|
|
if (nmaxproc > cpu_maxproc())
|
|
|
|
return (EINVAL);
|
|
|
|
#endif
|
|
|
|
maxproc = nmaxproc;
|
|
|
|
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* sysctl helper function for kern.hostid. the hostid is a long, but
|
|
|
|
* we export it as an int, so we need to give it a little help.
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
sysctl_kern_hostid(SYSCTLFN_ARGS)
|
|
|
|
{
|
|
|
|
int error, inthostid;
|
|
|
|
struct sysctlnode node;
|
|
|
|
|
2004-05-03 17:39:50 +04:00
|
|
|
inthostid = hostid; /* XXX assumes sizeof int <= sizeof long */
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
node = *rnode;
|
|
|
|
node.sysctl_data = &inthostid;
|
|
|
|
error = sysctl_lookup(SYSCTLFN_CALL(&node));
|
|
|
|
if (error || newp == NULL)
|
|
|
|
return (error);
|
|
|
|
|
2004-04-16 17:25:40 +04:00
|
|
|
hostid = (unsigned)inthostid;
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
2003-12-28 17:39:36 +03:00
|
|
|
/*
|
2003-12-29 01:19:59 +03:00
|
|
|
* sysctl helper function for kern.hostname and kern.domainnname.
|
|
|
|
* resets the relevant recorded length when the underlying name is
|
|
|
|
* changed.
|
2003-12-28 17:39:36 +03:00
|
|
|
*/
|
|
|
|
static int
|
2003-12-29 01:19:59 +03:00
|
|
|
sysctl_setlen(SYSCTLFN_ARGS)
|
2003-12-28 17:39:36 +03:00
|
|
|
{
|
|
|
|
int error;
|
|
|
|
|
2005-06-09 06:19:59 +04:00
|
|
|
error = sysctl_lookup(SYSCTLFN_CALL(rnode));
|
2003-12-28 17:39:36 +03:00
|
|
|
if (error || newp == NULL)
|
|
|
|
return (error);
|
|
|
|
|
2003-12-29 01:19:59 +03:00
|
|
|
switch (rnode->sysctl_num) {
|
|
|
|
case KERN_HOSTNAME:
|
|
|
|
hostnamelen = strlen((const char*)rnode->sysctl_data);
|
|
|
|
break;
|
|
|
|
case KERN_DOMAINNAME:
|
|
|
|
domainnamelen = strlen((const char*)rnode->sysctl_data);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2003-12-28 17:39:36 +03:00
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
/*
|
|
|
|
* sysctl helper routine for kern.clockrate. assembles a struct on
|
|
|
|
* the fly to be returned to the caller.
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
sysctl_kern_clockrate(SYSCTLFN_ARGS)
|
|
|
|
{
|
|
|
|
struct clockinfo clkinfo;
|
|
|
|
struct sysctlnode node;
|
|
|
|
|
|
|
|
clkinfo.tick = tick;
|
|
|
|
clkinfo.tickadj = tickadj;
|
|
|
|
clkinfo.hz = hz;
|
|
|
|
clkinfo.profhz = profhz;
|
|
|
|
clkinfo.stathz = stathz ? stathz : hz;
|
|
|
|
|
|
|
|
node = *rnode;
|
|
|
|
node.sysctl_data = &clkinfo;
|
|
|
|
return (sysctl_lookup(SYSCTLFN_CALL(&node)));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* sysctl helper routine for kern.file pseudo-subtree.
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
sysctl_kern_file(SYSCTLFN_ARGS)
|
|
|
|
{
|
|
|
|
int error;
|
|
|
|
size_t buflen;
|
|
|
|
struct file *fp;
|
|
|
|
char *start, *where;
|
|
|
|
|
|
|
|
start = where = oldp;
|
|
|
|
buflen = *oldlenp;
|
|
|
|
if (where == NULL) {
|
|
|
|
/*
|
|
|
|
* overestimate by 10 files
|
|
|
|
*/
|
|
|
|
*oldlenp = sizeof(filehead) + (nfiles + 10) * sizeof(struct file);
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2006-09-24 02:01:04 +04:00
|
|
|
* first dcopyout filehead
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
*/
|
|
|
|
if (buflen < sizeof(filehead)) {
|
|
|
|
*oldlenp = 0;
|
|
|
|
return (0);
|
|
|
|
}
|
2006-09-24 02:01:04 +04:00
|
|
|
error = dcopyout(l, &filehead, where, sizeof(filehead));
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
if (error)
|
|
|
|
return (error);
|
|
|
|
buflen -= sizeof(filehead);
|
|
|
|
where += sizeof(filehead);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* followed by an array of file structures
|
|
|
|
*/
|
|
|
|
LIST_FOREACH(fp, &filehead, f_list) {
|
2006-07-24 02:06:03 +04:00
|
|
|
if (kauth_authorize_generic(l->l_cred,
|
2006-07-17 00:21:42 +04:00
|
|
|
KAUTH_GENERIC_CANSEE, fp->f_cred) != 0)
|
2005-09-07 21:30:07 +04:00
|
|
|
continue;
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
if (buflen < sizeof(struct file)) {
|
|
|
|
*oldlenp = where - start;
|
|
|
|
return (ENOMEM);
|
|
|
|
}
|
2006-09-24 02:01:04 +04:00
|
|
|
error = dcopyout(l, fp, where, sizeof(struct file));
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
if (error)
|
|
|
|
return (error);
|
|
|
|
buflen -= sizeof(struct file);
|
|
|
|
where += sizeof(struct file);
|
|
|
|
}
|
|
|
|
*oldlenp = where - start;
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* sysctl helper routine for kern.autonicetime and kern.autoniceval.
|
|
|
|
* asserts that the assigned value is in the correct range.
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
sysctl_kern_autonice(SYSCTLFN_ARGS)
|
|
|
|
{
|
|
|
|
int error, t = 0;
|
|
|
|
struct sysctlnode node;
|
|
|
|
|
|
|
|
node = *rnode;
|
|
|
|
t = *(int*)node.sysctl_data;
|
|
|
|
node.sysctl_data = &t;
|
|
|
|
error = sysctl_lookup(SYSCTLFN_CALL(&node));
|
|
|
|
if (error || newp == NULL)
|
|
|
|
return (error);
|
|
|
|
|
|
|
|
switch (node.sysctl_num) {
|
|
|
|
case KERN_AUTONICETIME:
|
|
|
|
if (t >= 0)
|
|
|
|
autonicetime = t;
|
|
|
|
break;
|
|
|
|
case KERN_AUTONICEVAL:
|
|
|
|
if (t < PRIO_MIN)
|
|
|
|
t = PRIO_MIN;
|
|
|
|
else if (t > PRIO_MAX)
|
|
|
|
t = PRIO_MAX;
|
|
|
|
autoniceval = t;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* sysctl helper routine for kern.msgbufsize and kern.msgbuf. for the
|
2004-04-23 06:58:27 +04:00
|
|
|
* former it merely checks the message buffer is set up. for the latter,
|
|
|
|
* it also copies out the data if necessary.
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
*/
|
|
|
|
static int
|
|
|
|
sysctl_msgbuf(SYSCTLFN_ARGS)
|
|
|
|
{
|
|
|
|
char *where = oldp;
|
|
|
|
size_t len, maxlen;
|
|
|
|
long beg, end;
|
|
|
|
int error;
|
|
|
|
|
|
|
|
if (!msgbufenabled || msgbufp->msg_magic != MSG_MAGIC) {
|
|
|
|
msgbufenabled = 0;
|
|
|
|
return (ENXIO);
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (rnode->sysctl_num) {
|
2004-07-27 16:46:18 +04:00
|
|
|
case KERN_MSGBUFSIZE: {
|
|
|
|
struct sysctlnode node = *rnode;
|
|
|
|
int msg_bufs = (int)msgbufp->msg_bufs;
|
|
|
|
node.sysctl_data = &msg_bufs;
|
|
|
|
return (sysctl_lookup(SYSCTLFN_CALL(&node)));
|
|
|
|
}
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
case KERN_MSGBUF:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return (EOPNOTSUPP);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (newp != NULL)
|
|
|
|
return (EPERM);
|
|
|
|
|
|
|
|
if (oldp == NULL) {
|
|
|
|
/* always return full buffer size */
|
|
|
|
*oldlenp = msgbufp->msg_bufs;
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
error = 0;
|
|
|
|
maxlen = MIN(msgbufp->msg_bufs, *oldlenp);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* First, copy from the write pointer to the end of
|
|
|
|
* message buffer.
|
|
|
|
*/
|
|
|
|
beg = msgbufp->msg_bufx;
|
|
|
|
end = msgbufp->msg_bufs;
|
|
|
|
while (maxlen > 0) {
|
|
|
|
len = MIN(end - beg, maxlen);
|
|
|
|
if (len == 0)
|
|
|
|
break;
|
2006-09-24 02:01:04 +04:00
|
|
|
error = dcopyout(l, &msgbufp->msg_bufc[beg], where, len);
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
if (error)
|
|
|
|
break;
|
|
|
|
where += len;
|
|
|
|
maxlen -= len;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ... then, copy from the beginning of message buffer to
|
|
|
|
* the write pointer.
|
|
|
|
*/
|
|
|
|
beg = 0;
|
|
|
|
end = msgbufp->msg_bufx;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (error);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* sysctl helper routine for kern.defcorename. in the case of a new
|
|
|
|
* string being assigned, check that it's not a zero-length string.
|
|
|
|
* (XXX the check in -current doesn't work, but do we really care?)
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
sysctl_kern_defcorename(SYSCTLFN_ARGS)
|
|
|
|
{
|
|
|
|
int error;
|
2006-02-04 15:09:50 +03:00
|
|
|
char *newcorename;
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
struct sysctlnode node;
|
|
|
|
|
2006-02-04 15:09:50 +03:00
|
|
|
newcorename = PNBUF_GET();
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
node = *rnode;
|
|
|
|
node.sysctl_data = &newcorename[0];
|
|
|
|
memcpy(node.sysctl_data, rnode->sysctl_data, MAXPATHLEN);
|
|
|
|
error = sysctl_lookup(SYSCTLFN_CALL(&node));
|
2006-02-04 15:09:50 +03:00
|
|
|
if (error || newp == NULL) {
|
|
|
|
goto done;
|
|
|
|
}
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* when sysctl_lookup() deals with a string, it's guaranteed
|
|
|
|
* to come back nul terminated. so there. :)
|
|
|
|
*/
|
2006-02-04 15:09:50 +03:00
|
|
|
if (strlen(newcorename) == 0) {
|
|
|
|
error = EINVAL;
|
|
|
|
} else {
|
|
|
|
memcpy(rnode->sysctl_data, node.sysctl_data, MAXPATHLEN);
|
|
|
|
error = 0;
|
|
|
|
}
|
|
|
|
done:
|
|
|
|
PNBUF_PUT(newcorename);
|
|
|
|
return error;
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* sysctl helper routine for kern.cp_time node. adds up cpu time
|
|
|
|
* across all cpus.
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
sysctl_kern_cptime(SYSCTLFN_ARGS)
|
|
|
|
{
|
|
|
|
struct sysctlnode node = *rnode;
|
|
|
|
|
2003-12-07 00:33:51 +03:00
|
|
|
#ifndef MULTIPROCESSOR
|
|
|
|
|
2003-12-29 01:24:12 +03:00
|
|
|
if (namelen == 1) {
|
|
|
|
if (name[0] != 0)
|
|
|
|
return (ENOENT);
|
2003-12-07 00:33:51 +03:00
|
|
|
/*
|
|
|
|
* you're allowed to ask for the zero'th processor
|
|
|
|
*/
|
|
|
|
name++;
|
|
|
|
namelen--;
|
|
|
|
}
|
|
|
|
node.sysctl_data = curcpu()->ci_schedstate.spc_cp_time;
|
|
|
|
node.sysctl_size = sizeof(curcpu()->ci_schedstate.spc_cp_time);
|
|
|
|
return (sysctl_lookup(SYSCTLFN_CALL(&node)));
|
|
|
|
|
|
|
|
#else /* MULTIPROCESSOR */
|
|
|
|
|
2005-12-26 21:41:36 +03:00
|
|
|
uint64_t *cp_time = NULL;
|
2003-12-07 00:33:51 +03:00
|
|
|
int error, n = sysctl_ncpus(), i;
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
struct cpu_info *ci;
|
|
|
|
CPU_INFO_ITERATOR cii;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* if you specifically pass a buffer that is the size of the
|
|
|
|
* sum, or if you are probing for the size, you get the "sum"
|
|
|
|
* of cp_time (and the size thereof) across all processors.
|
|
|
|
*
|
|
|
|
* alternately, you can pass an additional mib number and get
|
|
|
|
* cp_time for that particular processor.
|
|
|
|
*/
|
|
|
|
switch (namelen) {
|
|
|
|
case 0:
|
2005-12-26 21:41:36 +03:00
|
|
|
if (*oldlenp == sizeof(uint64_t) * CPUSTATES || oldp == NULL) {
|
|
|
|
node.sysctl_size = sizeof(uint64_t) * CPUSTATES;
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
n = -1; /* SUM */
|
|
|
|
}
|
|
|
|
else {
|
2005-12-26 21:41:36 +03:00
|
|
|
node.sysctl_size = n * sizeof(uint64_t) * CPUSTATES;
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
n = -2; /* ALL */
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
if (name[0] < 0 || name[0] >= n)
|
2003-12-29 01:24:12 +03:00
|
|
|
return (ENOENT); /* ENOSUCHPROCESSOR */
|
2005-12-26 21:41:36 +03:00
|
|
|
node.sysctl_size = sizeof(uint64_t) * CPUSTATES;
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
n = name[0];
|
|
|
|
/*
|
|
|
|
* adjust these so that sysctl_lookup() will be happy
|
|
|
|
*/
|
|
|
|
name++;
|
|
|
|
namelen--;
|
2003-12-07 13:33:03 +03:00
|
|
|
break;
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
default:
|
|
|
|
return (EINVAL);
|
|
|
|
}
|
|
|
|
|
2003-12-07 00:33:51 +03:00
|
|
|
cp_time = malloc(node.sysctl_size, M_TEMP, M_WAITOK|M_CANFAIL);
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
if (cp_time == NULL)
|
|
|
|
return (ENOMEM);
|
|
|
|
node.sysctl_data = cp_time;
|
|
|
|
memset(cp_time, 0, node.sysctl_size);
|
|
|
|
|
|
|
|
for (CPU_INFO_FOREACH(cii, ci)) {
|
2003-12-07 00:33:51 +03:00
|
|
|
if (n <= 0)
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
for (i = 0; i < CPUSTATES; i++)
|
|
|
|
cp_time[i] += ci->ci_schedstate.spc_cp_time[i];
|
|
|
|
/*
|
|
|
|
* if a specific processor was requested and we just
|
|
|
|
* did it, we're done here
|
|
|
|
*/
|
|
|
|
if (n == 0)
|
|
|
|
break;
|
|
|
|
/*
|
|
|
|
* if doing "all", skip to next cp_time set for next processor
|
|
|
|
*/
|
|
|
|
if (n == -2)
|
|
|
|
cp_time += CPUSTATES;
|
|
|
|
/*
|
|
|
|
* if we're doing a specific processor, we're one
|
|
|
|
* processor closer
|
|
|
|
*/
|
|
|
|
if (n > 0)
|
|
|
|
n--;
|
|
|
|
}
|
|
|
|
|
|
|
|
error = sysctl_lookup(SYSCTLFN_CALL(&node));
|
2003-12-07 00:33:51 +03:00
|
|
|
free(node.sysctl_data, M_TEMP);
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
return (error);
|
2003-12-07 00:33:51 +03:00
|
|
|
|
|
|
|
#endif /* MULTIPROCESSOR */
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
#if defined(SYSVMSG) || defined(SYSVSEM) || defined(SYSVSHM)
|
|
|
|
/*
|
|
|
|
* sysctl helper routine for kern.sysvipc_info subtree.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define FILL_PERM(src, dst) do { \
|
|
|
|
(dst)._key = (src)._key; \
|
|
|
|
(dst).uid = (src).uid; \
|
|
|
|
(dst).gid = (src).gid; \
|
|
|
|
(dst).cuid = (src).cuid; \
|
|
|
|
(dst).cgid = (src).cgid; \
|
|
|
|
(dst).mode = (src).mode; \
|
|
|
|
(dst)._seq = (src)._seq; \
|
|
|
|
} while (/*CONSTCOND*/ 0);
|
|
|
|
#define FILL_MSG(src, dst) do { \
|
|
|
|
FILL_PERM((src).msg_perm, (dst).msg_perm); \
|
|
|
|
(dst).msg_qnum = (src).msg_qnum; \
|
|
|
|
(dst).msg_qbytes = (src).msg_qbytes; \
|
|
|
|
(dst)._msg_cbytes = (src)._msg_cbytes; \
|
|
|
|
(dst).msg_lspid = (src).msg_lspid; \
|
|
|
|
(dst).msg_lrpid = (src).msg_lrpid; \
|
|
|
|
(dst).msg_stime = (src).msg_stime; \
|
|
|
|
(dst).msg_rtime = (src).msg_rtime; \
|
|
|
|
(dst).msg_ctime = (src).msg_ctime; \
|
|
|
|
} while (/*CONSTCOND*/ 0)
|
|
|
|
#define FILL_SEM(src, dst) do { \
|
|
|
|
FILL_PERM((src).sem_perm, (dst).sem_perm); \
|
|
|
|
(dst).sem_nsems = (src).sem_nsems; \
|
|
|
|
(dst).sem_otime = (src).sem_otime; \
|
|
|
|
(dst).sem_ctime = (src).sem_ctime; \
|
|
|
|
} while (/*CONSTCOND*/ 0)
|
|
|
|
#define FILL_SHM(src, dst) do { \
|
|
|
|
FILL_PERM((src).shm_perm, (dst).shm_perm); \
|
|
|
|
(dst).shm_segsz = (src).shm_segsz; \
|
|
|
|
(dst).shm_lpid = (src).shm_lpid; \
|
|
|
|
(dst).shm_cpid = (src).shm_cpid; \
|
|
|
|
(dst).shm_atime = (src).shm_atime; \
|
|
|
|
(dst).shm_dtime = (src).shm_dtime; \
|
|
|
|
(dst).shm_ctime = (src).shm_ctime; \
|
|
|
|
(dst).shm_nattch = (src).shm_nattch; \
|
|
|
|
} while (/*CONSTCOND*/ 0)
|
|
|
|
|
|
|
|
static int
|
|
|
|
sysctl_kern_sysvipc(SYSCTLFN_ARGS)
|
|
|
|
{
|
|
|
|
void *where = oldp;
|
|
|
|
size_t *sizep = oldlenp;
|
|
|
|
#ifdef SYSVMSG
|
|
|
|
struct msg_sysctl_info *msgsi = NULL;
|
|
|
|
#endif
|
|
|
|
#ifdef SYSVSEM
|
|
|
|
struct sem_sysctl_info *semsi = NULL;
|
|
|
|
#endif
|
|
|
|
#ifdef SYSVSHM
|
|
|
|
struct shm_sysctl_info *shmsi = NULL;
|
|
|
|
#endif
|
|
|
|
size_t infosize, dssize, tsize, buflen;
|
2005-05-30 02:24:14 +04:00
|
|
|
void *bf = NULL;
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
char *start;
|
|
|
|
int32_t nds;
|
|
|
|
int i, error, ret;
|
|
|
|
|
|
|
|
if (namelen != 1)
|
|
|
|
return (EINVAL);
|
|
|
|
|
|
|
|
start = where;
|
|
|
|
buflen = *sizep;
|
|
|
|
|
|
|
|
switch (*name) {
|
|
|
|
case KERN_SYSVIPC_MSG_INFO:
|
|
|
|
#ifdef SYSVMSG
|
|
|
|
infosize = sizeof(msgsi->msginfo);
|
|
|
|
nds = msginfo.msgmni;
|
|
|
|
dssize = sizeof(msgsi->msgids[0]);
|
|
|
|
break;
|
|
|
|
#else
|
|
|
|
return (EINVAL);
|
|
|
|
#endif
|
|
|
|
case KERN_SYSVIPC_SEM_INFO:
|
|
|
|
#ifdef SYSVSEM
|
|
|
|
infosize = sizeof(semsi->seminfo);
|
|
|
|
nds = seminfo.semmni;
|
|
|
|
dssize = sizeof(semsi->semids[0]);
|
|
|
|
break;
|
|
|
|
#else
|
|
|
|
return (EINVAL);
|
|
|
|
#endif
|
|
|
|
case KERN_SYSVIPC_SHM_INFO:
|
|
|
|
#ifdef SYSVSHM
|
|
|
|
infosize = sizeof(shmsi->shminfo);
|
|
|
|
nds = shminfo.shmmni;
|
|
|
|
dssize = sizeof(shmsi->shmids[0]);
|
|
|
|
break;
|
|
|
|
#else
|
|
|
|
return (EINVAL);
|
|
|
|
#endif
|
|
|
|
default:
|
|
|
|
return (EINVAL);
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
* Round infosize to 64 bit boundary if requesting more than just
|
|
|
|
* the info structure or getting the total data size.
|
|
|
|
*/
|
|
|
|
if (where == NULL || *sizep > infosize)
|
|
|
|
infosize = ((infosize + 7) / 8) * 8;
|
|
|
|
tsize = infosize + nds * dssize;
|
|
|
|
|
|
|
|
/* Return just the total size required. */
|
|
|
|
if (where == NULL) {
|
|
|
|
*sizep = tsize;
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Not enough room for even the info struct. */
|
|
|
|
if (buflen < infosize) {
|
|
|
|
*sizep = 0;
|
|
|
|
return (ENOMEM);
|
|
|
|
}
|
2005-05-30 02:24:14 +04:00
|
|
|
bf = malloc(min(tsize, buflen), M_TEMP, M_WAITOK);
|
|
|
|
memset(bf, 0, min(tsize, buflen));
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
|
|
|
|
switch (*name) {
|
|
|
|
#ifdef SYSVMSG
|
|
|
|
case KERN_SYSVIPC_MSG_INFO:
|
2005-05-30 02:24:14 +04:00
|
|
|
msgsi = (struct msg_sysctl_info *)bf;
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
msgsi->msginfo = msginfo;
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
#ifdef SYSVSEM
|
|
|
|
case KERN_SYSVIPC_SEM_INFO:
|
2005-05-30 02:24:14 +04:00
|
|
|
semsi = (struct sem_sysctl_info *)bf;
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
semsi->seminfo = seminfo;
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
#ifdef SYSVSHM
|
|
|
|
case KERN_SYSVIPC_SHM_INFO:
|
2005-05-30 02:24:14 +04:00
|
|
|
shmsi = (struct shm_sysctl_info *)bf;
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
shmsi->shminfo = shminfo;
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
buflen -= infosize;
|
|
|
|
|
|
|
|
ret = 0;
|
|
|
|
if (buflen > 0) {
|
|
|
|
/* Fill in the IPC data structures. */
|
|
|
|
for (i = 0; i < nds; i++) {
|
|
|
|
if (buflen < dssize) {
|
|
|
|
ret = ENOMEM;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
switch (*name) {
|
|
|
|
#ifdef SYSVMSG
|
|
|
|
case KERN_SYSVIPC_MSG_INFO:
|
|
|
|
FILL_MSG(msqids[i], msgsi->msgids[i]);
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
#ifdef SYSVSEM
|
|
|
|
case KERN_SYSVIPC_SEM_INFO:
|
|
|
|
FILL_SEM(sema[i], semsi->semids[i]);
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
#ifdef SYSVSHM
|
|
|
|
case KERN_SYSVIPC_SHM_INFO:
|
|
|
|
FILL_SHM(shmsegs[i], shmsi->shmids[i]);
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
buflen -= dssize;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*sizep -= buflen;
|
2006-09-24 02:01:04 +04:00
|
|
|
error = dcopyout(l, bf, start, *sizep);
|
|
|
|
/* If dcopyout succeeded, use return code set earlier. */
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
if (error == 0)
|
|
|
|
error = ret;
|
2005-05-30 02:24:14 +04:00
|
|
|
if (bf)
|
|
|
|
free(bf, M_TEMP);
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
return (error);
|
|
|
|
}
|
|
|
|
|
|
|
|
#undef FILL_PERM
|
|
|
|
#undef FILL_MSG
|
|
|
|
#undef FILL_SEM
|
|
|
|
#undef FILL_SHM
|
|
|
|
|
|
|
|
#endif /* defined(SYSVMSG) || defined(SYSVSEM) || defined(SYSVSHM) */
|
|
|
|
|
|
|
|
#if NPTY > 0
|
|
|
|
/*
|
|
|
|
* sysctl helper routine for kern.maxptys. ensures that any new value
|
|
|
|
* is acceptable to the pty subsystem.
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
sysctl_kern_maxptys(SYSCTLFN_ARGS)
|
|
|
|
{
|
|
|
|
int pty_maxptys(int, int); /* defined in kern/tty_pty.c */
|
2005-05-30 02:24:14 +04:00
|
|
|
int error, xmax;
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
struct sysctlnode node;
|
|
|
|
|
|
|
|
/* get current value of maxptys */
|
2005-05-30 02:24:14 +04:00
|
|
|
xmax = pty_maxptys(0, 0);
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
|
|
|
|
node = *rnode;
|
2005-05-30 02:24:14 +04:00
|
|
|
node.sysctl_data = &xmax;
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
error = sysctl_lookup(SYSCTLFN_CALL(&node));
|
|
|
|
if (error || newp == NULL)
|
|
|
|
return (error);
|
2005-02-27 00:34:55 +03:00
|
|
|
|
2005-05-30 02:24:14 +04:00
|
|
|
if (xmax != pty_maxptys(xmax, 1))
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
return (EINVAL);
|
|
|
|
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
#endif /* NPTY > 0 */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* sysctl helper routine for kern.sbmax. basically just ensures that
|
|
|
|
* any new value is not too small.
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
sysctl_kern_sbmax(SYSCTLFN_ARGS)
|
|
|
|
{
|
|
|
|
int error, new_sbmax;
|
|
|
|
struct sysctlnode node;
|
|
|
|
|
|
|
|
new_sbmax = sb_max;
|
|
|
|
node = *rnode;
|
|
|
|
node.sysctl_data = &new_sbmax;
|
|
|
|
error = sysctl_lookup(SYSCTLFN_CALL(&node));
|
|
|
|
if (error || newp == NULL)
|
|
|
|
return (error);
|
|
|
|
|
|
|
|
error = sb_max_set(new_sbmax);
|
|
|
|
|
|
|
|
return (error);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* sysctl helper routine for kern.urandom node. picks a random number
|
|
|
|
* for you.
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
sysctl_kern_urnd(SYSCTLFN_ARGS)
|
|
|
|
{
|
|
|
|
#if NRND > 0
|
|
|
|
int v;
|
|
|
|
|
|
|
|
if (rnd_extract_data(&v, sizeof(v), RND_EXTRACT_ANY) == sizeof(v)) {
|
|
|
|
struct sysctlnode node = *rnode;
|
|
|
|
node.sysctl_data = &v;
|
|
|
|
return (sysctl_lookup(SYSCTLFN_CALL(&node)));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return (EIO); /*XXX*/
|
|
|
|
#else
|
|
|
|
return (EOPNOTSUPP);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* sysctl helper routine to do kern.lwp.* work.
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
sysctl_kern_lwp(SYSCTLFN_ARGS)
|
|
|
|
{
|
|
|
|
struct kinfo_lwp klwp;
|
|
|
|
struct proc *p;
|
|
|
|
struct lwp *l2;
|
|
|
|
char *where, *dp;
|
|
|
|
int pid, elem_size, elem_count;
|
|
|
|
int buflen, needed, error;
|
|
|
|
|
2003-12-29 01:36:37 +03:00
|
|
|
if (namelen == 1 && name[0] == CTL_QUERY)
|
2005-06-09 06:19:59 +04:00
|
|
|
return (sysctl_query(SYSCTLFN_CALL(rnode)));
|
2003-12-29 01:36:37 +03:00
|
|
|
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
dp = where = oldp;
|
|
|
|
buflen = where != NULL ? *oldlenp : 0;
|
|
|
|
error = needed = 0;
|
|
|
|
|
2003-12-13 02:21:44 +03:00
|
|
|
if (newp != NULL || namelen != 3)
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
return (EINVAL);
|
2003-12-13 02:21:44 +03:00
|
|
|
pid = name[0];
|
|
|
|
elem_size = name[1];
|
|
|
|
elem_count = name[2];
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
|
|
|
|
p = pfind(pid);
|
|
|
|
if (p == NULL)
|
|
|
|
return (ESRCH);
|
|
|
|
LIST_FOREACH(l2, &p->p_lwps, l_sibling) {
|
|
|
|
if (buflen >= elem_size && elem_count > 0) {
|
|
|
|
fill_lwp(l2, &klwp);
|
|
|
|
/*
|
|
|
|
* Copy out elem_size, but not larger than
|
|
|
|
* the size of a struct kinfo_proc2.
|
|
|
|
*/
|
2006-09-24 02:01:04 +04:00
|
|
|
error = dcopyout(l, &klwp, dp,
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
min(sizeof(klwp), elem_size));
|
|
|
|
if (error)
|
|
|
|
goto cleanup;
|
|
|
|
dp += elem_size;
|
|
|
|
buflen -= elem_size;
|
|
|
|
elem_count--;
|
|
|
|
}
|
|
|
|
needed += elem_size;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (where != NULL) {
|
|
|
|
*oldlenp = dp - where;
|
|
|
|
if (needed > *oldlenp)
|
|
|
|
return (ENOMEM);
|
|
|
|
} else {
|
2004-02-21 06:27:57 +03:00
|
|
|
needed += KERN_LWPSLOP;
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
*oldlenp = needed;
|
|
|
|
}
|
|
|
|
return (0);
|
|
|
|
cleanup:
|
|
|
|
return (error);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* sysctl helper routine for kern.forkfsleep node. ensures that the
|
|
|
|
* given value is not too large or two small, and is at least one
|
|
|
|
* timer tick if not zero.
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
sysctl_kern_forkfsleep(SYSCTLFN_ARGS)
|
|
|
|
{
|
|
|
|
/* userland sees value in ms, internally is in ticks */
|
|
|
|
extern int forkfsleep; /* defined in kern/kern_fork.c */
|
|
|
|
int error, timo, lsleep;
|
|
|
|
struct sysctlnode node;
|
|
|
|
|
|
|
|
lsleep = forkfsleep * 1000 / hz;
|
|
|
|
node = *rnode;
|
|
|
|
node.sysctl_data = &lsleep;
|
|
|
|
error = sysctl_lookup(SYSCTLFN_CALL(&node));
|
|
|
|
if (error || newp == NULL)
|
|
|
|
return (error);
|
|
|
|
|
|
|
|
/* refuse negative values, and overly 'long time' */
|
|
|
|
if (lsleep < 0 || lsleep > MAXSLP * 1000)
|
|
|
|
return (EINVAL);
|
|
|
|
|
|
|
|
timo = mstohz(lsleep);
|
|
|
|
|
|
|
|
/* if the interval is >0 ms && <1 tick, use 1 tick */
|
|
|
|
if (lsleep != 0 && timo == 0)
|
|
|
|
forkfsleep = 1;
|
|
|
|
else
|
|
|
|
forkfsleep = timo;
|
|
|
|
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* sysctl helper routine for kern.root_partition
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
sysctl_kern_root_partition(SYSCTLFN_ARGS)
|
|
|
|
{
|
|
|
|
int rootpart = DISKPART(rootdev);
|
|
|
|
struct sysctlnode node = *rnode;
|
|
|
|
|
|
|
|
node.sysctl_data = &rootpart;
|
|
|
|
return (sysctl_lookup(SYSCTLFN_CALL(&node)));
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* sysctl helper function for kern.drivers
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
sysctl_kern_drivers(SYSCTLFN_ARGS)
|
|
|
|
{
|
|
|
|
int error;
|
|
|
|
size_t buflen;
|
|
|
|
struct kinfo_drivers kd;
|
|
|
|
char *start, *where;
|
|
|
|
const char *dname;
|
|
|
|
int i;
|
|
|
|
extern struct devsw_conv *devsw_conv;
|
|
|
|
extern int max_devsw_convs;
|
|
|
|
|
|
|
|
if (newp != NULL || namelen != 0)
|
|
|
|
return (EINVAL);
|
|
|
|
|
|
|
|
start = where = oldp;
|
|
|
|
buflen = *oldlenp;
|
|
|
|
if (where == NULL) {
|
|
|
|
*oldlenp = max_devsw_convs * sizeof kd;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* An array of kinfo_drivers structures
|
|
|
|
*/
|
|
|
|
error = 0;
|
|
|
|
for (i = 0; i < max_devsw_convs; i++) {
|
|
|
|
dname = devsw_conv[i].d_name;
|
|
|
|
if (dname == NULL)
|
|
|
|
continue;
|
|
|
|
if (buflen < sizeof kd) {
|
|
|
|
error = ENOMEM;
|
|
|
|
break;
|
|
|
|
}
|
2004-04-08 07:35:10 +04:00
|
|
|
memset(&kd, 0, sizeof(kd));
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
kd.d_bmajor = devsw_conv[i].d_bmajor;
|
|
|
|
kd.d_cmajor = devsw_conv[i].d_cmajor;
|
|
|
|
strlcpy(kd.d_name, dname, sizeof kd.d_name);
|
2006-09-24 02:01:04 +04:00
|
|
|
error = dcopyout(l, &kd, where, sizeof kd);
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
if (error != 0)
|
|
|
|
break;
|
|
|
|
buflen -= sizeof kd;
|
|
|
|
where += sizeof kd;
|
|
|
|
}
|
|
|
|
*oldlenp = where - start;
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
2005-03-09 08:02:17 +03:00
|
|
|
/*
|
|
|
|
* sysctl helper function for kern.file2
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
sysctl_kern_file2(SYSCTLFN_ARGS)
|
|
|
|
{
|
|
|
|
struct proc *p;
|
|
|
|
struct file *fp;
|
|
|
|
struct filedesc *fd;
|
|
|
|
struct kinfo_file kf;
|
|
|
|
char *dp;
|
|
|
|
u_int i, op;
|
|
|
|
size_t len, needed, elem_size, out_size;
|
|
|
|
int error, arg, elem_count;
|
|
|
|
|
|
|
|
if (namelen == 1 && name[0] == CTL_QUERY)
|
2005-06-09 06:19:59 +04:00
|
|
|
return (sysctl_query(SYSCTLFN_CALL(rnode)));
|
2005-03-09 08:02:17 +03:00
|
|
|
|
|
|
|
if (namelen != 4)
|
|
|
|
return (EINVAL);
|
|
|
|
|
|
|
|
error = 0;
|
|
|
|
dp = oldp;
|
|
|
|
len = (oldp != NULL) ? *oldlenp : 0;
|
|
|
|
op = name[0];
|
|
|
|
arg = name[1];
|
|
|
|
elem_size = name[2];
|
|
|
|
elem_count = name[3];
|
|
|
|
out_size = MIN(sizeof(kf), elem_size);
|
|
|
|
needed = 0;
|
|
|
|
|
|
|
|
if (elem_size < 1 || elem_count < 0)
|
|
|
|
return (EINVAL);
|
|
|
|
|
|
|
|
switch (op) {
|
|
|
|
case KERN_FILE_BYFILE:
|
|
|
|
/*
|
|
|
|
* doesn't use arg so it must be zero
|
|
|
|
*/
|
|
|
|
if (arg != 0)
|
|
|
|
return (EINVAL);
|
|
|
|
LIST_FOREACH(fp, &filehead, f_list) {
|
2006-07-24 02:06:03 +04:00
|
|
|
if (kauth_authorize_generic(l->l_cred,
|
2006-07-17 00:21:42 +04:00
|
|
|
KAUTH_GENERIC_CANSEE, fp->f_cred) != 0)
|
2005-09-07 21:30:07 +04:00
|
|
|
continue;
|
2005-03-09 08:02:17 +03:00
|
|
|
if (len >= elem_size && elem_count > 0) {
|
|
|
|
fill_file(&kf, fp, NULL, 0);
|
2006-09-24 02:01:04 +04:00
|
|
|
error = dcopyout(l, &kf, dp, out_size);
|
2005-03-09 08:02:17 +03:00
|
|
|
if (error)
|
|
|
|
break;
|
|
|
|
dp += elem_size;
|
|
|
|
len -= elem_size;
|
|
|
|
}
|
|
|
|
if (elem_count > 0) {
|
|
|
|
needed += elem_size;
|
|
|
|
if (elem_count != INT_MAX)
|
|
|
|
elem_count--;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2006-06-13 17:23:03 +04:00
|
|
|
case KERN_FILE_BYPID:
|
2005-03-09 08:02:17 +03:00
|
|
|
if (arg < -1)
|
|
|
|
/* -1 means all processes */
|
|
|
|
return (EINVAL);
|
|
|
|
proclist_lock_read();
|
|
|
|
PROCLIST_FOREACH(p, &allproc) {
|
|
|
|
if (p->p_stat == SIDL)
|
|
|
|
/* skip embryonic processes */
|
|
|
|
continue;
|
2006-07-24 02:06:03 +04:00
|
|
|
if (kauth_authorize_process(l->l_cred,
|
2006-06-13 17:56:50 +04:00
|
|
|
KAUTH_PROCESS_CANSEE, p, NULL, NULL, NULL) != 0)
|
2005-09-07 21:30:07 +04:00
|
|
|
continue;
|
2005-03-09 08:02:17 +03:00
|
|
|
if (arg > 0 && p->p_pid != arg)
|
|
|
|
/* pick only the one we want */
|
|
|
|
/* XXX want 0 to mean "kernel files" */
|
|
|
|
continue;
|
|
|
|
fd = p->p_fd;
|
|
|
|
for (i = 0; i < fd->fd_nfiles; i++) {
|
|
|
|
fp = fd->fd_ofiles[i];
|
|
|
|
if (fp == NULL || !FILE_IS_USABLE(fp))
|
|
|
|
continue;
|
|
|
|
if (len >= elem_size && elem_count > 0) {
|
|
|
|
fill_file(&kf, fd->fd_ofiles[i],
|
|
|
|
p, i);
|
2006-09-24 02:01:04 +04:00
|
|
|
error = dcopyout(l, &kf, dp, out_size);
|
2005-03-09 08:02:17 +03:00
|
|
|
if (error)
|
|
|
|
break;
|
|
|
|
dp += elem_size;
|
|
|
|
len -= elem_size;
|
|
|
|
}
|
|
|
|
if (elem_count > 0) {
|
|
|
|
needed += elem_size;
|
|
|
|
if (elem_count != INT_MAX)
|
|
|
|
elem_count--;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
proclist_unlock_read();
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return (EINVAL);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (oldp == NULL)
|
|
|
|
needed += KERN_FILESLOP * elem_size;
|
|
|
|
*oldlenp = needed;
|
|
|
|
|
|
|
|
return (error);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
fill_file(struct kinfo_file *kp, const struct file *fp, struct proc *p, int i)
|
|
|
|
{
|
|
|
|
|
|
|
|
memset(kp, 0, sizeof(*kp));
|
|
|
|
|
|
|
|
kp->ki_fileaddr = PTRTOUINT64(fp);
|
|
|
|
kp->ki_flag = fp->f_flag;
|
|
|
|
kp->ki_iflags = fp->f_iflags;
|
|
|
|
kp->ki_ftype = fp->f_type;
|
|
|
|
kp->ki_count = fp->f_count;
|
|
|
|
kp->ki_msgcount = fp->f_msgcount;
|
|
|
|
kp->ki_usecount = fp->f_usecount;
|
|
|
|
kp->ki_fucred = PTRTOUINT64(fp->f_cred);
|
2006-05-15 01:15:11 +04:00
|
|
|
kp->ki_fuid = kauth_cred_geteuid(fp->f_cred);
|
|
|
|
kp->ki_fgid = kauth_cred_getegid(fp->f_cred);
|
2005-03-09 08:02:17 +03:00
|
|
|
kp->ki_fops = PTRTOUINT64(fp->f_ops);
|
|
|
|
kp->ki_foffset = fp->f_offset;
|
|
|
|
kp->ki_fdata = PTRTOUINT64(fp->f_data);
|
|
|
|
|
|
|
|
/* vnode information to glue this file to something */
|
|
|
|
if (fp->f_type == DTYPE_VNODE) {
|
|
|
|
struct vnode *vp = (struct vnode *)fp->f_data;
|
|
|
|
|
|
|
|
kp->ki_vun = PTRTOUINT64(vp->v_un.vu_socket);
|
|
|
|
kp->ki_vsize = vp->v_size;
|
|
|
|
kp->ki_vtype = vp->v_type;
|
|
|
|
kp->ki_vtag = vp->v_tag;
|
|
|
|
kp->ki_vdata = PTRTOUINT64(vp->v_data);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* process information when retrieved via KERN_FILE_BYPID */
|
|
|
|
if (p) {
|
|
|
|
kp->ki_pid = p->p_pid;
|
|
|
|
kp->ki_fd = i;
|
|
|
|
kp->ki_ofileflags = p->p_fd->fd_ofileflags[i];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
static int
|
|
|
|
sysctl_doeproc(SYSCTLFN_ARGS)
|
|
|
|
{
|
2006-06-20 07:20:44 +04:00
|
|
|
struct eproc *eproc;
|
|
|
|
struct kinfo_proc2 *kproc2;
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
struct kinfo_proc *dp;
|
|
|
|
struct proc *p;
|
|
|
|
const struct proclist_desc *pd;
|
|
|
|
char *where, *dp2;
|
|
|
|
int type, op, arg;
|
|
|
|
u_int elem_size, elem_count;
|
|
|
|
size_t buflen, needed;
|
|
|
|
int error;
|
|
|
|
|
2003-12-29 01:36:37 +03:00
|
|
|
if (namelen == 1 && name[0] == CTL_QUERY)
|
2005-06-09 06:19:59 +04:00
|
|
|
return (sysctl_query(SYSCTLFN_CALL(rnode)));
|
2003-12-29 01:36:37 +03:00
|
|
|
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
dp = oldp;
|
|
|
|
dp2 = where = oldp;
|
|
|
|
buflen = where != NULL ? *oldlenp : 0;
|
|
|
|
error = 0;
|
|
|
|
needed = 0;
|
|
|
|
type = rnode->sysctl_num;
|
|
|
|
|
|
|
|
if (type == KERN_PROC) {
|
|
|
|
if (namelen != 2 && !(namelen == 1 && name[0] == KERN_PROC_ALL))
|
|
|
|
return (EINVAL);
|
|
|
|
op = name[0];
|
|
|
|
if (op != KERN_PROC_ALL)
|
|
|
|
arg = name[1];
|
|
|
|
else
|
|
|
|
arg = 0; /* Quell compiler warning */
|
|
|
|
elem_size = elem_count = 0; /* Ditto */
|
|
|
|
} else {
|
|
|
|
if (namelen != 4)
|
|
|
|
return (EINVAL);
|
|
|
|
op = name[0];
|
|
|
|
arg = name[1];
|
|
|
|
elem_size = name[2];
|
|
|
|
elem_count = name[3];
|
|
|
|
}
|
|
|
|
|
2006-06-21 17:46:17 +04:00
|
|
|
if (type == KERN_PROC) {
|
|
|
|
eproc = malloc(sizeof(*eproc), M_TEMP, M_WAITOK);
|
|
|
|
kproc2 = NULL;
|
|
|
|
} else {
|
|
|
|
eproc = NULL;
|
|
|
|
kproc2 = malloc(sizeof(*kproc2), M_TEMP, M_WAITOK);
|
|
|
|
}
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
proclist_lock_read();
|
|
|
|
|
|
|
|
pd = proclists;
|
|
|
|
again:
|
2004-10-01 20:30:52 +04:00
|
|
|
PROCLIST_FOREACH(p, pd->pd_list) {
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
/*
|
|
|
|
* Skip embryonic processes.
|
|
|
|
*/
|
|
|
|
if (p->p_stat == SIDL)
|
|
|
|
continue;
|
2005-09-07 21:30:07 +04:00
|
|
|
|
2006-07-24 02:06:03 +04:00
|
|
|
if (kauth_authorize_process(l->l_cred,
|
2006-06-13 17:56:50 +04:00
|
|
|
KAUTH_PROCESS_CANSEE, p, NULL, NULL, NULL) != 0)
|
2005-09-07 21:30:07 +04:00
|
|
|
continue;
|
|
|
|
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
/*
|
|
|
|
* TODO - make more efficient (see notes below).
|
|
|
|
* do by session.
|
|
|
|
*/
|
|
|
|
switch (op) {
|
|
|
|
|
|
|
|
case KERN_PROC_PID:
|
|
|
|
/* could do this with just a lookup */
|
|
|
|
if (p->p_pid != (pid_t)arg)
|
|
|
|
continue;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case KERN_PROC_PGRP:
|
|
|
|
/* could do this by traversing pgrp */
|
|
|
|
if (p->p_pgrp->pg_id != (pid_t)arg)
|
|
|
|
continue;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case KERN_PROC_SESSION:
|
|
|
|
if (p->p_session->s_sid != (pid_t)arg)
|
|
|
|
continue;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case KERN_PROC_TTY:
|
|
|
|
if (arg == (int) KERN_PROC_TTY_REVOKE) {
|
|
|
|
if ((p->p_flag & P_CONTROLT) == 0 ||
|
|
|
|
p->p_session->s_ttyp == NULL ||
|
|
|
|
p->p_session->s_ttyvp != NULL)
|
|
|
|
continue;
|
|
|
|
} else if ((p->p_flag & P_CONTROLT) == 0 ||
|
|
|
|
p->p_session->s_ttyp == NULL) {
|
|
|
|
if ((dev_t)arg != KERN_PROC_TTY_NODEV)
|
|
|
|
continue;
|
|
|
|
} else if (p->p_session->s_ttyp->t_dev != (dev_t)arg)
|
|
|
|
continue;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case KERN_PROC_UID:
|
2006-05-15 01:15:11 +04:00
|
|
|
if (kauth_cred_geteuid(p->p_cred) != (uid_t)arg)
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
continue;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case KERN_PROC_RUID:
|
2006-05-15 01:15:11 +04:00
|
|
|
if (kauth_cred_getuid(p->p_cred) != (uid_t)arg)
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
continue;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case KERN_PROC_GID:
|
2006-05-15 01:15:11 +04:00
|
|
|
if (kauth_cred_getegid(p->p_cred) != (uid_t)arg)
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
continue;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case KERN_PROC_RGID:
|
2006-05-15 01:15:11 +04:00
|
|
|
if (kauth_cred_getgid(p->p_cred) != (uid_t)arg)
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
continue;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case KERN_PROC_ALL:
|
|
|
|
/* allow everything */
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
error = EINVAL;
|
|
|
|
goto cleanup;
|
|
|
|
}
|
|
|
|
if (type == KERN_PROC) {
|
|
|
|
if (buflen >= sizeof(struct kinfo_proc)) {
|
2006-06-20 07:20:44 +04:00
|
|
|
fill_eproc(p, eproc);
|
2006-09-24 02:01:04 +04:00
|
|
|
error = dcopyout(l, p, &dp->kp_proc,
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
sizeof(struct proc));
|
|
|
|
if (error)
|
|
|
|
goto cleanup;
|
2006-09-24 02:01:04 +04:00
|
|
|
error = dcopyout(l, eproc, &dp->kp_eproc,
|
2006-06-20 07:20:44 +04:00
|
|
|
sizeof(*eproc));
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
if (error)
|
|
|
|
goto cleanup;
|
|
|
|
dp++;
|
|
|
|
buflen -= sizeof(struct kinfo_proc);
|
|
|
|
}
|
|
|
|
needed += sizeof(struct kinfo_proc);
|
|
|
|
} else { /* KERN_PROC2 */
|
|
|
|
if (buflen >= elem_size && elem_count > 0) {
|
2006-06-20 07:20:44 +04:00
|
|
|
fill_kproc2(p, kproc2);
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
/*
|
|
|
|
* Copy out elem_size, but not larger than
|
|
|
|
* the size of a struct kinfo_proc2.
|
|
|
|
*/
|
2006-09-24 02:01:04 +04:00
|
|
|
error = dcopyout(l, kproc2, dp2,
|
2006-06-20 07:20:44 +04:00
|
|
|
min(sizeof(*kproc2), elem_size));
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
if (error)
|
|
|
|
goto cleanup;
|
|
|
|
dp2 += elem_size;
|
|
|
|
buflen -= elem_size;
|
|
|
|
elem_count--;
|
|
|
|
}
|
|
|
|
needed += elem_size;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
pd++;
|
|
|
|
if (pd->pd_list != NULL)
|
|
|
|
goto again;
|
|
|
|
proclist_unlock_read();
|
|
|
|
|
|
|
|
if (where != NULL) {
|
|
|
|
if (type == KERN_PROC)
|
|
|
|
*oldlenp = (char *)dp - where;
|
|
|
|
else
|
|
|
|
*oldlenp = dp2 - where;
|
2006-06-20 07:20:44 +04:00
|
|
|
if (needed > *oldlenp) {
|
|
|
|
error = ENOMEM;
|
|
|
|
goto out;
|
|
|
|
}
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
} else {
|
2004-02-21 06:27:57 +03:00
|
|
|
needed += KERN_PROCSLOP;
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
*oldlenp = needed;
|
|
|
|
}
|
2006-06-21 17:46:17 +04:00
|
|
|
if (kproc2)
|
|
|
|
free(kproc2, M_TEMP);
|
|
|
|
if (eproc)
|
|
|
|
free(eproc, M_TEMP);
|
|
|
|
return 0;
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
cleanup:
|
|
|
|
proclist_unlock_read();
|
2006-06-20 07:20:44 +04:00
|
|
|
out:
|
2006-06-21 17:46:17 +04:00
|
|
|
if (kproc2)
|
|
|
|
free(kproc2, M_TEMP);
|
|
|
|
if (eproc)
|
|
|
|
free(eproc, M_TEMP);
|
|
|
|
return error;
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* sysctl helper routine for kern.proc_args pseudo-subtree.
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
sysctl_kern_proc_args(SYSCTLFN_ARGS)
|
|
|
|
{
|
|
|
|
struct ps_strings pss;
|
2006-07-24 02:06:03 +04:00
|
|
|
struct proc *p;
|
2006-09-10 09:46:02 +04:00
|
|
|
size_t len, i;
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
struct uio auio;
|
|
|
|
struct iovec aiov;
|
|
|
|
pid_t pid;
|
|
|
|
int nargv, type, error;
|
|
|
|
char *arg;
|
2006-09-10 09:46:02 +04:00
|
|
|
char **argv = NULL;
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
char *tmp;
|
2005-10-08 10:35:56 +04:00
|
|
|
struct vmspace *vmspace;
|
|
|
|
vaddr_t psstr_addr;
|
|
|
|
vaddr_t offsetn;
|
|
|
|
vaddr_t offsetv;
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
|
2003-12-29 01:36:37 +03:00
|
|
|
if (namelen == 1 && name[0] == CTL_QUERY)
|
2005-06-09 06:19:59 +04:00
|
|
|
return (sysctl_query(SYSCTLFN_CALL(rnode)));
|
2003-12-29 01:36:37 +03:00
|
|
|
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
if (newp != NULL || namelen != 2)
|
|
|
|
return (EINVAL);
|
|
|
|
pid = name[0];
|
|
|
|
type = name[1];
|
|
|
|
|
|
|
|
switch (type) {
|
|
|
|
case KERN_PROC_ARGV:
|
|
|
|
case KERN_PROC_NARGV:
|
|
|
|
case KERN_PROC_ENV:
|
|
|
|
case KERN_PROC_NENV:
|
|
|
|
/* ok */
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return (EINVAL);
|
|
|
|
}
|
|
|
|
|
2005-10-08 10:35:56 +04:00
|
|
|
proclist_lock_read();
|
|
|
|
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
/* check pid */
|
2005-10-08 10:35:56 +04:00
|
|
|
if ((p = p_find(pid, PFIND_LOCKED)) == NULL) {
|
|
|
|
error = EINVAL;
|
|
|
|
goto out_locked;
|
|
|
|
}
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
|
2006-07-24 02:06:03 +04:00
|
|
|
error = kauth_authorize_process(l->l_cred,
|
2006-06-13 17:56:50 +04:00
|
|
|
KAUTH_PROCESS_CANSEE, p, NULL, NULL, NULL);
|
|
|
|
if (error) {
|
2005-10-08 10:35:56 +04:00
|
|
|
goto out_locked;
|
|
|
|
}
|
2005-09-07 21:30:07 +04:00
|
|
|
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
/* only root or same user change look at the environment */
|
|
|
|
if (type == KERN_PROC_ENV || type == KERN_PROC_NENV) {
|
First take at security model abstraction.
- Add a few scopes to the kernel: system, network, and machdep.
- Add a few more actions/sub-actions (requests), and start using them as
opposed to the KAUTH_GENERIC_ISSUSER place-holders.
- Introduce a basic set of listeners that implement our "traditional"
security model, called "bsd44". This is the default (and only) model we
have at the moment.
- Update all relevant documentation.
- Add some code and docs to help folks who want to actually use this stuff:
* There's a sample overlay model, sitting on-top of "bsd44", for
fast experimenting with tweaking just a subset of an existing model.
This is pretty cool because it's *really* straightforward to do stuff
you had to use ugly hacks for until now...
* And of course, documentation describing how to do the above for quick
reference, including code samples.
All of these changes were tested for regressions using a Python-based
testsuite that will be (I hope) available soon via pkgsrc. Information
about the tests, and how to write new ones, can be found on:
http://kauth.linbsd.org/kauthwiki
NOTE FOR DEVELOPERS: *PLEASE* don't add any code that does any of the
following:
- Uses a KAUTH_GENERIC_ISSUSER kauth(9) request,
- Checks 'securelevel' directly,
- Checks a uid/gid directly.
(or if you feel you have to, contact me first)
This is still work in progress; It's far from being done, but now it'll
be a lot easier.
Relevant mailing list threads:
http://mail-index.netbsd.org/tech-security/2006/01/25/0011.html
http://mail-index.netbsd.org/tech-security/2006/03/24/0001.html
http://mail-index.netbsd.org/tech-security/2006/04/18/0000.html
http://mail-index.netbsd.org/tech-security/2006/05/15/0000.html
http://mail-index.netbsd.org/tech-security/2006/08/01/0000.html
http://mail-index.netbsd.org/tech-security/2006/08/25/0000.html
Many thanks to YAMAMOTO Takashi, Matt Thomas, and Christos Zoulas for help
stablizing kauth(9).
Full credit for the regression tests, making sure these changes didn't break
anything, goes to Matt Fleming and Jaime Fournier.
Happy birthday Randi! :)
2006-09-09 00:58:56 +04:00
|
|
|
if (kauth_authorize_process(l->l_cred, KAUTH_PROCESS_CANSEE,
|
2006-09-13 14:07:42 +04:00
|
|
|
p, NULL, NULL, NULL)) {
|
2005-10-08 10:35:56 +04:00
|
|
|
error = EPERM;
|
|
|
|
goto out_locked;
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (oldp == NULL) {
|
|
|
|
if (type == KERN_PROC_NARGV || type == KERN_PROC_NENV)
|
|
|
|
*oldlenp = sizeof (int);
|
|
|
|
else
|
|
|
|
*oldlenp = ARG_MAX; /* XXX XXX XXX */
|
2005-10-08 10:35:56 +04:00
|
|
|
error = 0;
|
|
|
|
goto out_locked;
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Zombies don't have a stack, so we can't read their psstrings.
|
|
|
|
* System processes also don't have a user stack.
|
|
|
|
*/
|
2005-10-08 10:35:56 +04:00
|
|
|
if (P_ZOMBIE(p) || (p->p_flag & P_SYSTEM) != 0) {
|
|
|
|
error = EINVAL;
|
|
|
|
goto out_locked;
|
|
|
|
}
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Lock the process down in memory.
|
|
|
|
*/
|
|
|
|
/* XXXCDC: how should locking work here? */
|
2005-10-08 10:35:56 +04:00
|
|
|
if ((p->p_flag & P_WEXIT) || (p->p_vmspace->vm_refcnt < 1)) {
|
|
|
|
error = EFAULT;
|
|
|
|
goto out_locked;
|
|
|
|
}
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
|
2005-10-08 10:35:56 +04:00
|
|
|
psstr_addr = (vaddr_t)p->p_psstr;
|
|
|
|
if (type == KERN_PROC_ARGV || type == KERN_PROC_NARGV) {
|
|
|
|
offsetn = p->p_psnargv;
|
|
|
|
offsetv = p->p_psargv;
|
|
|
|
} else {
|
|
|
|
offsetn = p->p_psnenv;
|
|
|
|
offsetv = p->p_psenv;
|
|
|
|
}
|
|
|
|
vmspace = p->p_vmspace;
|
|
|
|
vmspace->vm_refcnt++; /* XXX */
|
|
|
|
|
|
|
|
proclist_unlock_read();
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Allocate a temporary buffer to hold the arguments.
|
|
|
|
*/
|
|
|
|
arg = malloc(PAGE_SIZE, M_TEMP, M_WAITOK);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Read in the ps_strings structure.
|
|
|
|
*/
|
|
|
|
aiov.iov_base = &pss;
|
|
|
|
aiov.iov_len = sizeof(pss);
|
|
|
|
auio.uio_iov = &aiov;
|
|
|
|
auio.uio_iovcnt = 1;
|
2005-10-08 10:35:56 +04:00
|
|
|
auio.uio_offset = psstr_addr;
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
auio.uio_resid = sizeof(pss);
|
|
|
|
auio.uio_rw = UIO_READ;
|
2006-03-01 15:38:10 +03:00
|
|
|
UIO_SETUP_SYSSPACE(&auio);
|
2005-10-08 10:35:56 +04:00
|
|
|
error = uvm_io(&vmspace->vm_map, &auio);
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
if (error)
|
|
|
|
goto done;
|
|
|
|
|
2005-10-08 10:35:56 +04:00
|
|
|
memcpy(&nargv, (char *)&pss + offsetn, sizeof(nargv));
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
if (type == KERN_PROC_NARGV || type == KERN_PROC_NENV) {
|
2006-09-24 02:01:04 +04:00
|
|
|
error = dcopyout(l, &nargv, oldp, sizeof(nargv));
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
*oldlenp = sizeof(nargv);
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
* Now read the address of the argument vector.
|
|
|
|
*/
|
|
|
|
switch (type) {
|
|
|
|
case KERN_PROC_ARGV:
|
2005-10-08 10:35:56 +04:00
|
|
|
/* FALLTHROUGH */
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
case KERN_PROC_ENV:
|
2005-10-08 10:35:56 +04:00
|
|
|
memcpy(&tmp, (char *)&pss + offsetv, sizeof(tmp));
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return (EINVAL);
|
|
|
|
}
|
2006-09-08 15:59:52 +04:00
|
|
|
|
2006-09-10 09:46:02 +04:00
|
|
|
#ifdef COMPAT_NETBSD32
|
|
|
|
if (p->p_flag & P_32)
|
|
|
|
len = sizeof(netbsd32_charp) * nargv;
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
len = sizeof(char *) * nargv;
|
|
|
|
|
|
|
|
argv = malloc(len, M_TEMP, M_WAITOK);
|
|
|
|
|
|
|
|
aiov.iov_base = argv;
|
|
|
|
aiov.iov_len = len;
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
auio.uio_iov = &aiov;
|
|
|
|
auio.uio_iovcnt = 1;
|
2006-09-10 09:46:02 +04:00
|
|
|
auio.uio_offset = (off_t)(unsigned long)tmp;
|
|
|
|
auio.uio_resid = len;
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
auio.uio_rw = UIO_READ;
|
2006-03-01 15:38:10 +03:00
|
|
|
UIO_SETUP_SYSSPACE(&auio);
|
2005-10-08 10:35:56 +04:00
|
|
|
error = uvm_io(&vmspace->vm_map, &auio);
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
if (error)
|
|
|
|
goto done;
|
|
|
|
|
2006-09-10 09:46:02 +04:00
|
|
|
/*
|
|
|
|
* Now copy each string.
|
2006-09-08 15:59:52 +04:00
|
|
|
*/
|
2006-09-10 09:46:02 +04:00
|
|
|
len = 0; /* bytes written to user buffer */
|
|
|
|
for (i = 0; i < nargv; i++) {
|
|
|
|
int finished = 0;
|
|
|
|
vaddr_t base;
|
|
|
|
size_t xlen;
|
|
|
|
int j;
|
2006-09-08 15:59:52 +04:00
|
|
|
|
2006-09-10 09:46:02 +04:00
|
|
|
#ifdef COMPAT_NETBSD32
|
|
|
|
if (p->p_flag & P_32) {
|
|
|
|
netbsd32_charp *argv32;
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
|
2006-09-10 09:46:02 +04:00
|
|
|
argv32 = (netbsd32_charp *)argv;
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
|
2006-09-10 09:46:02 +04:00
|
|
|
base = (vaddr_t)NETBSD32PTR64(argv32[i]);
|
|
|
|
} else
|
|
|
|
#endif
|
|
|
|
base = (vaddr_t)argv[i];
|
|
|
|
|
|
|
|
while (!finished) {
|
|
|
|
xlen = PAGE_SIZE - (base & PAGE_MASK);
|
|
|
|
|
|
|
|
aiov.iov_base = arg;
|
|
|
|
aiov.iov_len = PAGE_SIZE;
|
|
|
|
auio.uio_iov = &aiov;
|
|
|
|
auio.uio_iovcnt = 1;
|
|
|
|
auio.uio_offset = base;
|
|
|
|
auio.uio_resid = xlen;
|
|
|
|
auio.uio_rw = UIO_READ;
|
|
|
|
UIO_SETUP_SYSSPACE(&auio);
|
|
|
|
error = uvm_io(&vmspace->vm_map, &auio);
|
|
|
|
if (error)
|
|
|
|
goto done;
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
|
2006-09-10 09:46:02 +04:00
|
|
|
/* Look for the end of the string */
|
|
|
|
for (j = 0; j < xlen; j++) {
|
|
|
|
if (arg[j] == '\0') {
|
|
|
|
xlen = j + 1;
|
|
|
|
finished = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
|
2006-09-10 09:46:02 +04:00
|
|
|
/* Check for user buffer overflow */
|
|
|
|
if (len + xlen > *oldlenp) {
|
|
|
|
finished = 1;
|
|
|
|
if (len > *oldlenp)
|
|
|
|
xlen = 0;
|
|
|
|
else
|
|
|
|
xlen = *oldlenp - len;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Copyout the page */
|
2006-09-24 02:01:04 +04:00
|
|
|
error = dcopyout(l, arg, (char *)oldp + len, xlen);
|
2006-09-10 09:46:02 +04:00
|
|
|
if (error)
|
|
|
|
goto done;
|
|
|
|
|
|
|
|
len += xlen;
|
|
|
|
base += xlen;
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
*oldlenp = len;
|
|
|
|
|
|
|
|
done:
|
2006-09-10 09:46:02 +04:00
|
|
|
if (argv != NULL)
|
|
|
|
free(argv, M_TEMP);
|
|
|
|
|
2005-10-08 10:35:56 +04:00
|
|
|
uvmspace_free(vmspace);
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
|
|
|
|
free(arg, M_TEMP);
|
2005-10-08 10:35:56 +04:00
|
|
|
return error;
|
|
|
|
|
|
|
|
out_locked:
|
|
|
|
proclist_unlock_read();
|
|
|
|
return error;
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
}
|
|
|
|
|
2005-05-20 00:16:19 +04:00
|
|
|
/*
|
|
|
|
* Sysctl helper routine for Verified Exec.
|
|
|
|
*/
|
2006-07-24 20:37:28 +04:00
|
|
|
#if NVERIEXEC > 0
|
2005-05-20 00:16:19 +04:00
|
|
|
static int
|
|
|
|
sysctl_kern_veriexec(SYSCTLFN_ARGS)
|
|
|
|
{
|
|
|
|
int newval, error;
|
|
|
|
int *var = NULL, raise_only = 0;
|
|
|
|
struct sysctlnode node;
|
|
|
|
|
|
|
|
node = *rnode;
|
|
|
|
|
|
|
|
switch (rnode->sysctl_num) {
|
|
|
|
case VERIEXEC_STRICT:
|
|
|
|
raise_only = 1;
|
|
|
|
var = &veriexec_strict;
|
|
|
|
break;
|
|
|
|
case VERIEXEC_ALGORITHMS:
|
|
|
|
node.sysctl_data = veriexec_fp_names;
|
|
|
|
node.sysctl_size = strlen(veriexec_fp_names) + 1;
|
|
|
|
return (sysctl_lookup(SYSCTLFN_CALL(&node)));
|
|
|
|
default:
|
|
|
|
return (EINVAL);
|
|
|
|
}
|
|
|
|
|
|
|
|
newval = *var;
|
|
|
|
|
|
|
|
node.sysctl_data = &newval;
|
|
|
|
error = sysctl_lookup(SYSCTLFN_CALL(&node));
|
|
|
|
if (error || newp == NULL) {
|
|
|
|
return (error);
|
|
|
|
}
|
|
|
|
|
2005-06-15 20:58:31 +04:00
|
|
|
if (raise_only && (newval < *var))
|
|
|
|
return (EPERM);
|
|
|
|
|
2005-05-20 00:16:19 +04:00
|
|
|
*var = newval;
|
|
|
|
|
|
|
|
return (error);
|
|
|
|
}
|
2006-07-24 20:37:28 +04:00
|
|
|
#endif /* NVERIEXEC > 0 */
|
2005-05-20 00:16:19 +04:00
|
|
|
|
2006-02-02 20:48:51 +03:00
|
|
|
static int
|
|
|
|
sysctl_security_setidcore(SYSCTLFN_ARGS)
|
|
|
|
{
|
|
|
|
int newsize, error;
|
|
|
|
struct sysctlnode node;
|
|
|
|
|
|
|
|
node = *rnode;
|
|
|
|
node.sysctl_data = &newsize;
|
|
|
|
newsize = *(int *)rnode->sysctl_data;
|
|
|
|
error = sysctl_lookup(SYSCTLFN_CALL(&node));
|
|
|
|
if (error || newp == NULL)
|
|
|
|
return error;
|
|
|
|
|
First take at security model abstraction.
- Add a few scopes to the kernel: system, network, and machdep.
- Add a few more actions/sub-actions (requests), and start using them as
opposed to the KAUTH_GENERIC_ISSUSER place-holders.
- Introduce a basic set of listeners that implement our "traditional"
security model, called "bsd44". This is the default (and only) model we
have at the moment.
- Update all relevant documentation.
- Add some code and docs to help folks who want to actually use this stuff:
* There's a sample overlay model, sitting on-top of "bsd44", for
fast experimenting with tweaking just a subset of an existing model.
This is pretty cool because it's *really* straightforward to do stuff
you had to use ugly hacks for until now...
* And of course, documentation describing how to do the above for quick
reference, including code samples.
All of these changes were tested for regressions using a Python-based
testsuite that will be (I hope) available soon via pkgsrc. Information
about the tests, and how to write new ones, can be found on:
http://kauth.linbsd.org/kauthwiki
NOTE FOR DEVELOPERS: *PLEASE* don't add any code that does any of the
following:
- Uses a KAUTH_GENERIC_ISSUSER kauth(9) request,
- Checks 'securelevel' directly,
- Checks a uid/gid directly.
(or if you feel you have to, contact me first)
This is still work in progress; It's far from being done, but now it'll
be a lot easier.
Relevant mailing list threads:
http://mail-index.netbsd.org/tech-security/2006/01/25/0011.html
http://mail-index.netbsd.org/tech-security/2006/03/24/0001.html
http://mail-index.netbsd.org/tech-security/2006/04/18/0000.html
http://mail-index.netbsd.org/tech-security/2006/05/15/0000.html
http://mail-index.netbsd.org/tech-security/2006/08/01/0000.html
http://mail-index.netbsd.org/tech-security/2006/08/25/0000.html
Many thanks to YAMAMOTO Takashi, Matt Thomas, and Christos Zoulas for help
stablizing kauth(9).
Full credit for the regression tests, making sure these changes didn't break
anything, goes to Matt Fleming and Jaime Fournier.
Happy birthday Randi! :)
2006-09-09 00:58:56 +04:00
|
|
|
if (kauth_authorize_system(l->l_cred, KAUTH_SYSTEM_SETIDCORE,
|
2006-09-13 14:07:42 +04:00
|
|
|
0, NULL, NULL, NULL))
|
2006-02-02 20:48:51 +03:00
|
|
|
return (EPERM);
|
|
|
|
|
|
|
|
*(int *)rnode->sysctl_data = newsize;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
sysctl_security_setidcorename(SYSCTLFN_ARGS)
|
|
|
|
{
|
|
|
|
int error;
|
2006-06-17 10:54:58 +04:00
|
|
|
char *newsetidcorename;
|
2006-02-02 20:48:51 +03:00
|
|
|
struct sysctlnode node;
|
|
|
|
|
2006-06-17 10:54:58 +04:00
|
|
|
newsetidcorename = PNBUF_GET();
|
2006-02-02 20:48:51 +03:00
|
|
|
node = *rnode;
|
2006-06-17 10:54:58 +04:00
|
|
|
node.sysctl_data = newsetidcorename;
|
2006-02-02 20:48:51 +03:00
|
|
|
memcpy(node.sysctl_data, rnode->sysctl_data, MAXPATHLEN);
|
|
|
|
error = sysctl_lookup(SYSCTLFN_CALL(&node));
|
2006-06-17 10:54:58 +04:00
|
|
|
if (error || newp == NULL) {
|
|
|
|
goto out;
|
|
|
|
}
|
First take at security model abstraction.
- Add a few scopes to the kernel: system, network, and machdep.
- Add a few more actions/sub-actions (requests), and start using them as
opposed to the KAUTH_GENERIC_ISSUSER place-holders.
- Introduce a basic set of listeners that implement our "traditional"
security model, called "bsd44". This is the default (and only) model we
have at the moment.
- Update all relevant documentation.
- Add some code and docs to help folks who want to actually use this stuff:
* There's a sample overlay model, sitting on-top of "bsd44", for
fast experimenting with tweaking just a subset of an existing model.
This is pretty cool because it's *really* straightforward to do stuff
you had to use ugly hacks for until now...
* And of course, documentation describing how to do the above for quick
reference, including code samples.
All of these changes were tested for regressions using a Python-based
testsuite that will be (I hope) available soon via pkgsrc. Information
about the tests, and how to write new ones, can be found on:
http://kauth.linbsd.org/kauthwiki
NOTE FOR DEVELOPERS: *PLEASE* don't add any code that does any of the
following:
- Uses a KAUTH_GENERIC_ISSUSER kauth(9) request,
- Checks 'securelevel' directly,
- Checks a uid/gid directly.
(or if you feel you have to, contact me first)
This is still work in progress; It's far from being done, but now it'll
be a lot easier.
Relevant mailing list threads:
http://mail-index.netbsd.org/tech-security/2006/01/25/0011.html
http://mail-index.netbsd.org/tech-security/2006/03/24/0001.html
http://mail-index.netbsd.org/tech-security/2006/04/18/0000.html
http://mail-index.netbsd.org/tech-security/2006/05/15/0000.html
http://mail-index.netbsd.org/tech-security/2006/08/01/0000.html
http://mail-index.netbsd.org/tech-security/2006/08/25/0000.html
Many thanks to YAMAMOTO Takashi, Matt Thomas, and Christos Zoulas for help
stablizing kauth(9).
Full credit for the regression tests, making sure these changes didn't break
anything, goes to Matt Fleming and Jaime Fournier.
Happy birthday Randi! :)
2006-09-09 00:58:56 +04:00
|
|
|
if (kauth_authorize_system(l->l_cred, KAUTH_SYSTEM_SETIDCORE,
|
2006-09-13 14:07:42 +04:00
|
|
|
0, NULL, NULL, NULL)) {
|
2006-06-17 10:54:58 +04:00
|
|
|
error = EPERM;
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
if (strlen(newsetidcorename) == 0) {
|
|
|
|
error = EINVAL;
|
|
|
|
goto out;
|
|
|
|
}
|
2006-02-02 20:48:51 +03:00
|
|
|
memcpy(rnode->sysctl_data, node.sysctl_data, MAXPATHLEN);
|
2006-06-17 10:54:58 +04:00
|
|
|
out:
|
|
|
|
PNBUF_PUT(newsetidcorename);
|
|
|
|
return error;
|
2006-02-02 20:48:51 +03:00
|
|
|
}
|
|
|
|
|
2005-06-16 18:55:58 +04:00
|
|
|
/*
|
|
|
|
* sysctl helper routine for kern.cp_id node. maps cpus to their
|
|
|
|
* cpuids.
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
sysctl_kern_cpid(SYSCTLFN_ARGS)
|
|
|
|
{
|
|
|
|
struct sysctlnode node = *rnode;
|
|
|
|
|
|
|
|
#ifndef MULTIPROCESSOR
|
2005-12-26 21:41:36 +03:00
|
|
|
uint64_t id;
|
2005-06-16 18:55:58 +04:00
|
|
|
|
|
|
|
if (namelen == 1) {
|
|
|
|
if (name[0] != 0)
|
|
|
|
return (ENOENT);
|
|
|
|
/*
|
|
|
|
* you're allowed to ask for the zero'th processor
|
|
|
|
*/
|
|
|
|
name++;
|
|
|
|
namelen--;
|
|
|
|
}
|
|
|
|
node.sysctl_data = &id;
|
|
|
|
node.sysctl_size = sizeof(id);
|
|
|
|
id = cpu_number();
|
|
|
|
return (sysctl_lookup(SYSCTLFN_CALL(&node)));
|
|
|
|
|
|
|
|
#else /* MULTIPROCESSOR */
|
2005-12-26 21:41:36 +03:00
|
|
|
uint64_t *cp_id = NULL;
|
2005-06-16 18:55:58 +04:00
|
|
|
int error, n = sysctl_ncpus();
|
|
|
|
struct cpu_info *ci;
|
|
|
|
CPU_INFO_ITERATOR cii;
|
|
|
|
|
|
|
|
/*
|
2005-06-18 03:53:21 +04:00
|
|
|
* here you may either retrieve a single cpu id or the whole
|
|
|
|
* set. the size you get back when probing depends on what
|
|
|
|
* you ask for.
|
2005-06-16 18:55:58 +04:00
|
|
|
*/
|
|
|
|
switch (namelen) {
|
|
|
|
case 0:
|
2005-12-26 21:41:36 +03:00
|
|
|
node.sysctl_size = n * sizeof(uint64_t);
|
2005-06-16 18:55:58 +04:00
|
|
|
n = -2; /* ALL */
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
if (name[0] < 0 || name[0] >= n)
|
|
|
|
return (ENOENT); /* ENOSUCHPROCESSOR */
|
2005-12-26 21:41:36 +03:00
|
|
|
node.sysctl_size = sizeof(uint64_t);
|
2005-06-16 18:55:58 +04:00
|
|
|
n = name[0];
|
|
|
|
/*
|
|
|
|
* adjust these so that sysctl_lookup() will be happy
|
|
|
|
*/
|
|
|
|
name++;
|
|
|
|
namelen--;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return (EINVAL);
|
|
|
|
}
|
|
|
|
|
|
|
|
cp_id = malloc(node.sysctl_size, M_TEMP, M_WAITOK|M_CANFAIL);
|
|
|
|
if (cp_id == NULL)
|
|
|
|
return (ENOMEM);
|
|
|
|
node.sysctl_data = cp_id;
|
|
|
|
memset(cp_id, 0, node.sysctl_size);
|
|
|
|
|
|
|
|
for (CPU_INFO_FOREACH(cii, ci)) {
|
|
|
|
if (n <= 0)
|
|
|
|
cp_id[0] = ci->ci_cpuid;
|
|
|
|
/*
|
|
|
|
* if a specific processor was requested and we just
|
|
|
|
* did it, we're done here
|
|
|
|
*/
|
|
|
|
if (n == 0)
|
|
|
|
break;
|
|
|
|
/*
|
|
|
|
* if doing "all", skip to next cp_id slot for next processor
|
|
|
|
*/
|
|
|
|
if (n == -2)
|
|
|
|
cp_id++;
|
|
|
|
/*
|
|
|
|
* if we're doing a specific processor, we're one
|
|
|
|
* processor closer
|
|
|
|
*/
|
|
|
|
if (n > 0)
|
|
|
|
n--;
|
|
|
|
}
|
|
|
|
|
|
|
|
error = sysctl_lookup(SYSCTLFN_CALL(&node));
|
|
|
|
free(node.sysctl_data, M_TEMP);
|
|
|
|
return (error);
|
|
|
|
|
|
|
|
#endif /* MULTIPROCESSOR */
|
|
|
|
}
|
|
|
|
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
/*
|
|
|
|
* sysctl helper routine for hw.usermem and hw.usermem64. values are
|
|
|
|
* calculate on the fly taking into account integer overflow and the
|
|
|
|
* current wired count.
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
sysctl_hw_usermem(SYSCTLFN_ARGS)
|
|
|
|
{
|
|
|
|
u_int ui;
|
|
|
|
u_quad_t uq;
|
|
|
|
struct sysctlnode node;
|
|
|
|
|
|
|
|
node = *rnode;
|
|
|
|
switch (rnode->sysctl_num) {
|
|
|
|
case HW_USERMEM:
|
|
|
|
if ((ui = physmem - uvmexp.wired) > (UINT_MAX / PAGE_SIZE))
|
|
|
|
ui = UINT_MAX;
|
|
|
|
else
|
|
|
|
ui *= PAGE_SIZE;
|
|
|
|
node.sysctl_data = &ui;
|
|
|
|
break;
|
|
|
|
case HW_USERMEM64:
|
|
|
|
uq = (u_quad_t)(physmem - uvmexp.wired) * PAGE_SIZE;
|
|
|
|
node.sysctl_data = &uq;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return (EINVAL);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (sysctl_lookup(SYSCTLFN_CALL(&node)));
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* sysctl helper routine for kern.cnmagic node. pulls the old value
|
|
|
|
* out, encoded, and stuffs the new value in for decoding.
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
sysctl_hw_cnmagic(SYSCTLFN_ARGS)
|
|
|
|
{
|
|
|
|
char magic[CNS_LEN];
|
|
|
|
int error;
|
|
|
|
struct sysctlnode node;
|
|
|
|
|
|
|
|
if (oldp)
|
|
|
|
cn_get_magic(magic, CNS_LEN);
|
|
|
|
node = *rnode;
|
|
|
|
node.sysctl_data = &magic[0];
|
|
|
|
error = sysctl_lookup(SYSCTLFN_CALL(&node));
|
|
|
|
if (error || newp == NULL)
|
|
|
|
return (error);
|
2005-02-27 00:34:55 +03:00
|
|
|
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
return (cn_set_magic(magic));
|
|
|
|
}
|
|
|
|
|
2003-12-06 12:36:34 +03:00
|
|
|
static int
|
|
|
|
sysctl_hw_ncpu(SYSCTLFN_ARGS)
|
|
|
|
{
|
|
|
|
int ncpu;
|
|
|
|
struct sysctlnode node;
|
|
|
|
|
|
|
|
ncpu = sysctl_ncpus();
|
|
|
|
node = *rnode;
|
|
|
|
node.sysctl_data = &ncpu;
|
2005-02-27 00:34:55 +03:00
|
|
|
|
2003-12-06 12:36:34 +03:00
|
|
|
return (sysctl_lookup(SYSCTLFN_CALL(&node)));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
/*
|
|
|
|
* ********************************************************************
|
|
|
|
* section 3: public helper routines that are used for more than one
|
|
|
|
* node
|
|
|
|
* ********************************************************************
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* sysctl helper routine for the kern.root_device node and some ports'
|
|
|
|
* machdep.root_device nodes.
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
sysctl_root_device(SYSCTLFN_ARGS)
|
|
|
|
{
|
|
|
|
struct sysctlnode node;
|
|
|
|
|
|
|
|
node = *rnode;
|
|
|
|
node.sysctl_data = root_device->dv_xname;
|
|
|
|
node.sysctl_size = strlen(root_device->dv_xname) + 1;
|
|
|
|
return (sysctl_lookup(SYSCTLFN_CALL(&node)));
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* sysctl helper routine for kern.consdev, dependent on the current
|
|
|
|
* state of the console. also used for machdep.console_device on some
|
|
|
|
* ports.
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
sysctl_consdev(SYSCTLFN_ARGS)
|
|
|
|
{
|
|
|
|
dev_t consdev;
|
|
|
|
struct sysctlnode node;
|
|
|
|
|
|
|
|
if (cn_tab != NULL)
|
|
|
|
consdev = cn_tab->cn_dev;
|
|
|
|
else
|
|
|
|
consdev = NODEV;
|
|
|
|
node = *rnode;
|
|
|
|
node.sysctl_data = &consdev;
|
|
|
|
node.sysctl_size = sizeof(consdev);
|
|
|
|
return (sysctl_lookup(SYSCTLFN_CALL(&node)));
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ********************************************************************
|
|
|
|
* section 4: support for some helpers
|
|
|
|
* ********************************************************************
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Fill in a kinfo_proc2 structure for the specified process.
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
fill_kproc2(struct proc *p, struct kinfo_proc2 *ki)
|
|
|
|
{
|
|
|
|
struct tty *tp;
|
|
|
|
struct lwp *l;
|
|
|
|
struct timeval ut, st;
|
|
|
|
|
|
|
|
memset(ki, 0, sizeof(*ki));
|
|
|
|
|
2004-02-19 06:57:56 +03:00
|
|
|
ki->p_paddr = PTRTOUINT64(p);
|
|
|
|
ki->p_fd = PTRTOUINT64(p->p_fd);
|
|
|
|
ki->p_cwdi = PTRTOUINT64(p->p_cwdi);
|
|
|
|
ki->p_stats = PTRTOUINT64(p->p_stats);
|
|
|
|
ki->p_limit = PTRTOUINT64(p->p_limit);
|
|
|
|
ki->p_vmspace = PTRTOUINT64(p->p_vmspace);
|
|
|
|
ki->p_sigacts = PTRTOUINT64(p->p_sigacts);
|
|
|
|
ki->p_sess = PTRTOUINT64(p->p_session);
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
ki->p_tsess = 0; /* may be changed if controlling tty below */
|
2004-02-19 06:57:56 +03:00
|
|
|
ki->p_ru = PTRTOUINT64(p->p_ru);
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
|
|
|
|
ki->p_eflag = 0;
|
|
|
|
ki->p_exitsig = p->p_exitsig;
|
|
|
|
ki->p_flag = p->p_flag;
|
|
|
|
|
|
|
|
ki->p_pid = p->p_pid;
|
|
|
|
if (p->p_pptr)
|
|
|
|
ki->p_ppid = p->p_pptr->p_pid;
|
|
|
|
else
|
|
|
|
ki->p_ppid = 0;
|
|
|
|
ki->p_sid = p->p_session->s_sid;
|
|
|
|
ki->p__pgid = p->p_pgrp->pg_id;
|
|
|
|
|
|
|
|
ki->p_tpgid = NO_PGID; /* may be changed if controlling tty below */
|
|
|
|
|
2006-05-15 01:15:11 +04:00
|
|
|
ki->p_uid = kauth_cred_geteuid(p->p_cred);
|
|
|
|
ki->p_ruid = kauth_cred_getuid(p->p_cred);
|
|
|
|
ki->p_gid = kauth_cred_getegid(p->p_cred);
|
|
|
|
ki->p_rgid = kauth_cred_getgid(p->p_cred);
|
|
|
|
ki->p_svuid = kauth_cred_getsvuid(p->p_cred);
|
|
|
|
ki->p_svgid = kauth_cred_getsvgid(p->p_cred);
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
|
2006-05-15 01:15:11 +04:00
|
|
|
ki->p_ngroups = kauth_cred_ngroups(p->p_cred);
|
|
|
|
kauth_cred_getgroups(p->p_cred, ki->p_groups,
|
|
|
|
min(ki->p_ngroups, sizeof(ki->p_groups) / sizeof(ki->p_groups[0])));
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
|
|
|
|
ki->p_jobc = p->p_pgrp->pg_jobc;
|
|
|
|
if ((p->p_flag & P_CONTROLT) && (tp = p->p_session->s_ttyp)) {
|
|
|
|
ki->p_tdev = tp->t_dev;
|
|
|
|
ki->p_tpgid = tp->t_pgrp ? tp->t_pgrp->pg_id : NO_PGID;
|
2004-02-19 06:57:56 +03:00
|
|
|
ki->p_tsess = PTRTOUINT64(tp->t_session);
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
} else {
|
|
|
|
ki->p_tdev = NODEV;
|
|
|
|
}
|
|
|
|
|
|
|
|
ki->p_estcpu = p->p_estcpu;
|
|
|
|
ki->p_rtime_sec = p->p_rtime.tv_sec;
|
|
|
|
ki->p_rtime_usec = p->p_rtime.tv_usec;
|
|
|
|
ki->p_cpticks = p->p_cpticks;
|
|
|
|
ki->p_pctcpu = p->p_pctcpu;
|
|
|
|
|
|
|
|
ki->p_uticks = p->p_uticks;
|
|
|
|
ki->p_sticks = p->p_sticks;
|
|
|
|
ki->p_iticks = p->p_iticks;
|
|
|
|
|
2004-02-19 06:57:56 +03:00
|
|
|
ki->p_tracep = PTRTOUINT64(p->p_tracep);
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
ki->p_traceflag = p->p_traceflag;
|
|
|
|
|
|
|
|
|
|
|
|
memcpy(&ki->p_siglist, &p->p_sigctx.ps_siglist, sizeof(ki_sigset_t));
|
|
|
|
memcpy(&ki->p_sigmask, &p->p_sigctx.ps_sigmask, sizeof(ki_sigset_t));
|
|
|
|
memcpy(&ki->p_sigignore, &p->p_sigctx.ps_sigignore,sizeof(ki_sigset_t));
|
|
|
|
memcpy(&ki->p_sigcatch, &p->p_sigctx.ps_sigcatch, sizeof(ki_sigset_t));
|
|
|
|
|
|
|
|
ki->p_stat = p->p_stat; /* Will likely be overridden by LWP status */
|
|
|
|
ki->p_realstat = p->p_stat;
|
|
|
|
ki->p_nice = p->p_nice;
|
|
|
|
|
|
|
|
ki->p_xstat = p->p_xstat;
|
|
|
|
ki->p_acflag = p->p_acflag;
|
|
|
|
|
|
|
|
strncpy(ki->p_comm, p->p_comm,
|
|
|
|
min(sizeof(ki->p_comm), sizeof(p->p_comm)));
|
|
|
|
|
|
|
|
strncpy(ki->p_login, p->p_session->s_login,
|
|
|
|
min(sizeof ki->p_login - 1, sizeof p->p_session->s_login));
|
|
|
|
|
|
|
|
ki->p_nlwps = p->p_nlwps;
|
|
|
|
ki->p_nrlwps = p->p_nrlwps;
|
|
|
|
ki->p_realflag = p->p_flag;
|
|
|
|
|
|
|
|
if (p->p_stat == SIDL || P_ZOMBIE(p)) {
|
|
|
|
ki->p_vm_rssize = 0;
|
|
|
|
ki->p_vm_tsize = 0;
|
|
|
|
ki->p_vm_dsize = 0;
|
|
|
|
ki->p_vm_ssize = 0;
|
|
|
|
l = NULL;
|
|
|
|
} else {
|
|
|
|
struct vmspace *vm = p->p_vmspace;
|
|
|
|
|
|
|
|
ki->p_vm_rssize = vm_resident_count(vm);
|
|
|
|
ki->p_vm_tsize = vm->vm_tsize;
|
|
|
|
ki->p_vm_dsize = vm->vm_dsize;
|
|
|
|
ki->p_vm_ssize = vm->vm_ssize;
|
|
|
|
|
|
|
|
/* Pick a "representative" LWP */
|
|
|
|
l = proc_representative_lwp(p);
|
2004-02-19 06:57:56 +03:00
|
|
|
ki->p_forw = PTRTOUINT64(l->l_forw);
|
|
|
|
ki->p_back = PTRTOUINT64(l->l_back);
|
|
|
|
ki->p_addr = PTRTOUINT64(l->l_addr);
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
ki->p_stat = l->l_stat;
|
2006-04-01 04:57:34 +04:00
|
|
|
ki->p_flag |= l->l_flag & P_SHARED;
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
ki->p_swtime = l->l_swtime;
|
|
|
|
ki->p_slptime = l->l_slptime;
|
|
|
|
if (l->l_stat == LSONPROC) {
|
|
|
|
KDASSERT(l->l_cpu != NULL);
|
|
|
|
ki->p_schedflags = l->l_cpu->ci_schedstate.spc_flags;
|
|
|
|
} else
|
|
|
|
ki->p_schedflags = 0;
|
|
|
|
ki->p_holdcnt = l->l_holdcnt;
|
|
|
|
ki->p_priority = l->l_priority;
|
|
|
|
ki->p_usrpri = l->l_usrpri;
|
|
|
|
if (l->l_wmesg)
|
|
|
|
strncpy(ki->p_wmesg, l->l_wmesg, sizeof(ki->p_wmesg));
|
2004-02-19 06:57:56 +03:00
|
|
|
ki->p_wchan = PTRTOUINT64(l->l_wchan);
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (p->p_session->s_ttyvp)
|
|
|
|
ki->p_eflag |= EPROC_CTTY;
|
|
|
|
if (SESS_LEADER(p))
|
|
|
|
ki->p_eflag |= EPROC_SLEADER;
|
|
|
|
|
|
|
|
/* XXX Is this double check necessary? */
|
|
|
|
if (P_ZOMBIE(p)) {
|
|
|
|
ki->p_uvalid = 0;
|
|
|
|
} else {
|
|
|
|
ki->p_uvalid = 1;
|
|
|
|
|
|
|
|
ki->p_ustart_sec = p->p_stats->p_start.tv_sec;
|
|
|
|
ki->p_ustart_usec = p->p_stats->p_start.tv_usec;
|
|
|
|
|
|
|
|
calcru(p, &ut, &st, 0);
|
|
|
|
ki->p_uutime_sec = ut.tv_sec;
|
|
|
|
ki->p_uutime_usec = ut.tv_usec;
|
|
|
|
ki->p_ustime_sec = st.tv_sec;
|
|
|
|
ki->p_ustime_usec = st.tv_usec;
|
|
|
|
|
|
|
|
ki->p_uru_maxrss = p->p_stats->p_ru.ru_maxrss;
|
|
|
|
ki->p_uru_ixrss = p->p_stats->p_ru.ru_ixrss;
|
|
|
|
ki->p_uru_idrss = p->p_stats->p_ru.ru_idrss;
|
|
|
|
ki->p_uru_isrss = p->p_stats->p_ru.ru_isrss;
|
|
|
|
ki->p_uru_minflt = p->p_stats->p_ru.ru_minflt;
|
|
|
|
ki->p_uru_majflt = p->p_stats->p_ru.ru_majflt;
|
|
|
|
ki->p_uru_nswap = p->p_stats->p_ru.ru_nswap;
|
|
|
|
ki->p_uru_inblock = p->p_stats->p_ru.ru_inblock;
|
|
|
|
ki->p_uru_oublock = p->p_stats->p_ru.ru_oublock;
|
|
|
|
ki->p_uru_msgsnd = p->p_stats->p_ru.ru_msgsnd;
|
|
|
|
ki->p_uru_msgrcv = p->p_stats->p_ru.ru_msgrcv;
|
|
|
|
ki->p_uru_nsignals = p->p_stats->p_ru.ru_nsignals;
|
|
|
|
ki->p_uru_nvcsw = p->p_stats->p_ru.ru_nvcsw;
|
|
|
|
ki->p_uru_nivcsw = p->p_stats->p_ru.ru_nivcsw;
|
|
|
|
|
|
|
|
timeradd(&p->p_stats->p_cru.ru_utime,
|
|
|
|
&p->p_stats->p_cru.ru_stime, &ut);
|
|
|
|
ki->p_uctime_sec = ut.tv_sec;
|
|
|
|
ki->p_uctime_usec = ut.tv_usec;
|
|
|
|
}
|
|
|
|
#ifdef MULTIPROCESSOR
|
|
|
|
if (l && l->l_cpu != NULL)
|
|
|
|
ki->p_cpuid = l->l_cpu->ci_cpuid;
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
ki->p_cpuid = KI_NOCPU;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Fill in a kinfo_lwp structure for the specified lwp.
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
fill_lwp(struct lwp *l, struct kinfo_lwp *kl)
|
|
|
|
{
|
|
|
|
|
2004-02-19 06:57:56 +03:00
|
|
|
kl->l_forw = PTRTOUINT64(l->l_forw);
|
|
|
|
kl->l_back = PTRTOUINT64(l->l_back);
|
|
|
|
kl->l_laddr = PTRTOUINT64(l);
|
|
|
|
kl->l_addr = PTRTOUINT64(l->l_addr);
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
kl->l_stat = l->l_stat;
|
|
|
|
kl->l_lid = l->l_lid;
|
|
|
|
kl->l_flag = l->l_flag;
|
|
|
|
|
|
|
|
kl->l_swtime = l->l_swtime;
|
|
|
|
kl->l_slptime = l->l_slptime;
|
|
|
|
if (l->l_stat == LSONPROC) {
|
|
|
|
KDASSERT(l->l_cpu != NULL);
|
|
|
|
kl->l_schedflags = l->l_cpu->ci_schedstate.spc_flags;
|
|
|
|
} else
|
|
|
|
kl->l_schedflags = 0;
|
|
|
|
kl->l_holdcnt = l->l_holdcnt;
|
|
|
|
kl->l_priority = l->l_priority;
|
|
|
|
kl->l_usrpri = l->l_usrpri;
|
|
|
|
if (l->l_wmesg)
|
|
|
|
strncpy(kl->l_wmesg, l->l_wmesg, sizeof(kl->l_wmesg));
|
2004-02-19 06:57:56 +03:00
|
|
|
kl->l_wchan = PTRTOUINT64(l->l_wchan);
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
#ifdef MULTIPROCESSOR
|
|
|
|
if (l->l_cpu != NULL)
|
|
|
|
kl->l_cpuid = l->l_cpu->ci_cpuid;
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
kl->l_cpuid = KI_NOCPU;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Fill in an eproc structure for the specified process.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
fill_eproc(struct proc *p, struct eproc *ep)
|
|
|
|
{
|
|
|
|
struct tty *tp;
|
|
|
|
struct lwp *l;
|
|
|
|
|
|
|
|
ep->e_paddr = p;
|
|
|
|
ep->e_sess = p->p_session;
|
2006-07-17 18:47:02 +04:00
|
|
|
kauth_cred_topcred(p->p_cred, &ep->e_pcred);
|
|
|
|
kauth_cred_toucred(p->p_cred, &ep->e_ucred);
|
Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.
Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.
All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.
PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 22:38:21 +03:00
|
|
|
if (p->p_stat == SIDL || P_ZOMBIE(p)) {
|
|
|
|
ep->e_vm.vm_rssize = 0;
|
|
|
|
ep->e_vm.vm_tsize = 0;
|
|
|
|
ep->e_vm.vm_dsize = 0;
|
|
|
|
ep->e_vm.vm_ssize = 0;
|
|
|
|
/* ep->e_vm.vm_pmap = XXX; */
|
|
|
|
} else {
|
|
|
|
struct vmspace *vm = p->p_vmspace;
|
|
|
|
|
|
|
|
ep->e_vm.vm_rssize = vm_resident_count(vm);
|
|
|
|
ep->e_vm.vm_tsize = vm->vm_tsize;
|
|
|
|
ep->e_vm.vm_dsize = vm->vm_dsize;
|
|
|
|
ep->e_vm.vm_ssize = vm->vm_ssize;
|
|
|
|
|
|
|
|
/* Pick a "representative" LWP */
|
|
|
|
l = proc_representative_lwp(p);
|
|
|
|
|
|
|
|
if (l->l_wmesg)
|
|
|
|
strncpy(ep->e_wmesg, l->l_wmesg, WMESGLEN);
|
|
|
|
}
|
|
|
|
if (p->p_pptr)
|
|
|
|
ep->e_ppid = p->p_pptr->p_pid;
|
|
|
|
else
|
|
|
|
ep->e_ppid = 0;
|
|
|
|
ep->e_pgid = p->p_pgrp->pg_id;
|
|
|
|
ep->e_sid = ep->e_sess->s_sid;
|
|
|
|
ep->e_jobc = p->p_pgrp->pg_jobc;
|
|
|
|
if ((p->p_flag & P_CONTROLT) &&
|
|
|
|
(tp = ep->e_sess->s_ttyp)) {
|
|
|
|
ep->e_tdev = tp->t_dev;
|
|
|
|
ep->e_tpgid = tp->t_pgrp ? tp->t_pgrp->pg_id : NO_PGID;
|
|
|
|
ep->e_tsess = tp->t_session;
|
|
|
|
} else
|
|
|
|
ep->e_tdev = NODEV;
|
|
|
|
|
|
|
|
ep->e_xsize = ep->e_xrssize = 0;
|
|
|
|
ep->e_xccount = ep->e_xswrss = 0;
|
|
|
|
ep->e_flag = ep->e_sess->s_ttyvp ? EPROC_CTTY : 0;
|
|
|
|
if (SESS_LEADER(p))
|
|
|
|
ep->e_flag |= EPROC_SLEADER;
|
|
|
|
strncpy(ep->e_login, ep->e_sess->s_login, MAXLOGNAME);
|
|
|
|
}
|