mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-15 10:17:20 +00:00
Sorry, the last commit screwed up for me, this is the right one (I hope!)
Please refer to the previous commit message about sysctl variables.
This commit is contained in:
parent
cdf14730ab
commit
3a34a5c3b8
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=11865
@ -32,7 +32,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)npx.c 7.2 (Berkeley) 5/12/91
|
||||
* $Id: npx.c,v 1.23 1995/05/30 08:02:51 rgrimes Exp $
|
||||
* $Id: npx.c,v 1.24 1995/09/19 18:55:14 bde Exp $
|
||||
*/
|
||||
|
||||
#include "npx.h"
|
||||
@ -40,6 +40,8 @@
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/conf.h>
|
||||
#include <sys/file.h>
|
||||
#include <sys/proc.h>
|
||||
@ -104,6 +106,11 @@ struct isa_driver npxdriver = {
|
||||
};
|
||||
|
||||
int hw_float; /* XXX currently just alias for npx_exists */
|
||||
|
||||
SYSCTL_INT(_hw,HW_FLOATINGPT, floatingpoint,
|
||||
CTLFLAG_RD, &hw_float, 0,
|
||||
"Floatingpoint instructions executed in hardware");
|
||||
|
||||
u_int npx0_imask = SWI_CLOCK_MASK;
|
||||
struct proc *npxproc;
|
||||
|
||||
|
@ -32,7 +32,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)npx.c 7.2 (Berkeley) 5/12/91
|
||||
* $Id: npx.c,v 1.23 1995/05/30 08:02:51 rgrimes Exp $
|
||||
* $Id: npx.c,v 1.24 1995/09/19 18:55:14 bde Exp $
|
||||
*/
|
||||
|
||||
#include "npx.h"
|
||||
@ -40,6 +40,8 @@
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/conf.h>
|
||||
#include <sys/file.h>
|
||||
#include <sys/proc.h>
|
||||
@ -104,6 +106,11 @@ struct isa_driver npxdriver = {
|
||||
};
|
||||
|
||||
int hw_float; /* XXX currently just alias for npx_exists */
|
||||
|
||||
SYSCTL_INT(_hw,HW_FLOATINGPT, floatingpoint,
|
||||
CTLFLAG_RD, &hw_float, 0,
|
||||
"Floatingpoint instructions executed in hardware");
|
||||
|
||||
u_int npx0_imask = SWI_CLOCK_MASK;
|
||||
struct proc *npxproc;
|
||||
|
||||
|
@ -51,6 +51,7 @@
|
||||
#define SETNAME 56
|
||||
#define SI86_MEM 65
|
||||
|
||||
extern int hw_float;
|
||||
|
||||
int
|
||||
ibcs2_sysi86(struct proc *p, struct ibcs2_sysi86_args *args, int *retval)
|
||||
|
@ -32,7 +32,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)npx.c 7.2 (Berkeley) 5/12/91
|
||||
* $Id: npx.c,v 1.23 1995/05/30 08:02:51 rgrimes Exp $
|
||||
* $Id: npx.c,v 1.24 1995/09/19 18:55:14 bde Exp $
|
||||
*/
|
||||
|
||||
#include "npx.h"
|
||||
@ -40,6 +40,8 @@
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/conf.h>
|
||||
#include <sys/file.h>
|
||||
#include <sys/proc.h>
|
||||
@ -104,6 +106,11 @@ struct isa_driver npxdriver = {
|
||||
};
|
||||
|
||||
int hw_float; /* XXX currently just alias for npx_exists */
|
||||
|
||||
SYSCTL_INT(_hw,HW_FLOATINGPT, floatingpoint,
|
||||
CTLFLAG_RD, &hw_float, 0,
|
||||
"Floatingpoint instructions executed in hardware");
|
||||
|
||||
u_int npx0_imask = SWI_CLOCK_MASK;
|
||||
struct proc *npxproc;
|
||||
|
||||
|
@ -55,124 +55,112 @@
|
||||
#include <sys/conf.h>
|
||||
#include <vm/vm.h>
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
#ifdef DEBUG
|
||||
static sysctlfn debug_sysctl;
|
||||
#endif
|
||||
#include <sys/user.h>
|
||||
|
||||
/* BEGIN_MIB */
|
||||
SYSCTL_NODE(,CTL_KERN, kern, 0, "High kernel, proc, limits &c");
|
||||
SYSCTL_NODE(,CTL_VM, vm, 0, "Virtual memory");
|
||||
SYSCTL_NODE(,CTL_FS, fs, 0, "File system");
|
||||
SYSCTL_NODE(,CTL_NET, net, 0, "Network, (see socket.h)");
|
||||
SYSCTL_NODE(,CTL_DEBUG, debug, 0, "Debugging");
|
||||
SYSCTL_NODE(,CTL_HW, hw, 0, "hardware");
|
||||
SYSCTL_NODE(,CTL_KERN, kern, 0, "High kernel, proc, limits &c");
|
||||
SYSCTL_NODE(,CTL_VM, vm, 0, "Virtual memory");
|
||||
SYSCTL_NODE(,CTL_FS, fs, 0, "File system");
|
||||
SYSCTL_NODE(,CTL_NET, net, 0, "Network, (see socket.h)");
|
||||
SYSCTL_NODE(,CTL_DEBUG, debug, 0, "Debugging");
|
||||
SYSCTL_NODE(,CTL_HW, hw, 0, "hardware");
|
||||
SYSCTL_NODE(,CTL_MACHDEP, machdep,0, "machine dependent");
|
||||
SYSCTL_NODE(,CTL_USER, user, 0, "user-level");
|
||||
SYSCTL_NODE(,CTL_USER, user, 0, "user-level");
|
||||
|
||||
SYSCTL_STRING(_kern,KERN_OSTYPE, ostype,
|
||||
CTLFLAG_RD, ostype, 0, 0, "");
|
||||
CTLFLAG_RD, ostype, 0, "");
|
||||
|
||||
SYSCTL_STRING(_kern,KERN_OSRELEASE, osrelease,
|
||||
CTLFLAG_RD, osrelease, 0, 0, "");
|
||||
CTLFLAG_RD, osrelease, 0, "");
|
||||
|
||||
SYSCTL_INT(_kern,KERN_OSREV, osrevision,
|
||||
CTLFLAG_RD, 0, BSD, 0, "");
|
||||
CTLFLAG_RD, 0, BSD, "");
|
||||
|
||||
SYSCTL_STRING(_kern,KERN_VERSION, version,
|
||||
CTLFLAG_RD, version, 0, 0, "");
|
||||
CTLFLAG_RD, version, 0, "");
|
||||
|
||||
extern int osreldate;
|
||||
SYSCTL_INT(_kern,KERN_OSRELDATE, osreldate,
|
||||
CTLFLAG_RD, &osreldate, 0, 0, "");
|
||||
CTLFLAG_RD, &osreldate, 0, "");
|
||||
|
||||
SYSCTL_INT(_kern,KERN_MAXVNODES, maxvnodes,
|
||||
CTLFLAG_RD, &desiredvnodes, 0, 0, "");
|
||||
CTLFLAG_RD, &desiredvnodes, 0, "");
|
||||
|
||||
SYSCTL_INT(_kern,KERN_MAXPROC, maxproc,
|
||||
CTLFLAG_RD, &maxproc, 0, 0, "");
|
||||
CTLFLAG_RD, &maxproc, 0, "");
|
||||
|
||||
SYSCTL_INT(_kern,KERN_MAXPROCPERUID,maxprocperuid,
|
||||
CTLFLAG_RD, &maxprocperuid, 0, 0, "");
|
||||
CTLFLAG_RD, &maxprocperuid, 0, "");
|
||||
|
||||
SYSCTL_INT(_kern,KERN_MAXFILESPERPROC, maxfilesperproc,
|
||||
CTLFLAG_RD, &maxfilesperproc, 0, 0, "");
|
||||
CTLFLAG_RD, &maxfilesperproc, 0, "");
|
||||
|
||||
SYSCTL_INT(_kern,KERN_ARGMAX, argmax,
|
||||
CTLFLAG_RD, 0, ARG_MAX, 0, "");
|
||||
CTLFLAG_RD, 0, ARG_MAX, "");
|
||||
|
||||
SYSCTL_INT(_kern,KERN_POSIX1, posix1version,
|
||||
CTLFLAG_RD, 0, _POSIX_VERSION, 0, "");
|
||||
CTLFLAG_RD, 0, _POSIX_VERSION, "");
|
||||
|
||||
SYSCTL_INT(_kern,KERN_NGROUPS, ngroups,
|
||||
CTLFLAG_RD, 0, NGROUPS_MAX, 0, "");
|
||||
CTLFLAG_RD, 0, NGROUPS_MAX, "");
|
||||
|
||||
SYSCTL_INT(_kern,KERN_JOB_CONTROL, job_control,
|
||||
CTLFLAG_RD, 0, 1, 0, "");
|
||||
CTLFLAG_RD, 0, 1, "");
|
||||
|
||||
SYSCTL_INT(_kern,KERN_MAXFILES, maxfiles,
|
||||
CTLFLAG_RW, &maxfiles, 0, 0, "");
|
||||
CTLFLAG_RW, &maxfiles, 0, "");
|
||||
|
||||
#ifdef _POSIX_SAVED_IDS
|
||||
SYSCTL_INT(_kern,KERN_SAVED_IDS, saved_ids,
|
||||
CTLFLAG_RD, 0, 1, 0, "");
|
||||
CTLFLAG_RD, 0, 1, "");
|
||||
#else
|
||||
SYSCTL_INT(_kern,KERN_SAVED_IDS, saved_ids,
|
||||
CTLFLAG_RD, 0, 0, 0, "");
|
||||
CTLFLAG_RD, 0, 0, "");
|
||||
#endif
|
||||
|
||||
char kernelname[MAXPATHLEN] = "/kernel"; /* XXX bloat */
|
||||
|
||||
SYSCTL_STRING(_kern,KERN_BOOTFILE, bootfile,
|
||||
CTLFLAG_RW, kernelname, sizeof kernelname, 0, "");
|
||||
CTLFLAG_RW, kernelname, sizeof kernelname, "");
|
||||
|
||||
SYSCTL_STRUCT(_kern,KERN_BOOTTIME, boottime,
|
||||
CTLFLAG_RW, &boottime, timeval, 0, "");
|
||||
CTLFLAG_RW, &boottime, timeval, "");
|
||||
|
||||
SYSCTL_STRING(_hw,HW_MACHINE, machine,
|
||||
CTLFLAG_RD, machine, 0, 0, "");
|
||||
CTLFLAG_RD, machine, 0, "");
|
||||
|
||||
SYSCTL_STRING(_hw,HW_MACHINE, model,
|
||||
CTLFLAG_RD, cpu_model, 0, 0, "");
|
||||
CTLFLAG_RD, cpu_model, 0, "");
|
||||
|
||||
SYSCTL_INT(_hw,HW_NCPU, ncpu,
|
||||
CTLFLAG_RD, 0, 1, 0, "");
|
||||
CTLFLAG_RD, 0, 1, "");
|
||||
|
||||
SYSCTL_INT(_hw,HW_BYTEORDER, byteorder,
|
||||
CTLFLAG_RD, 0, BYTE_ORDER, 0, "");
|
||||
CTLFLAG_RD, 0, BYTE_ORDER, "");
|
||||
|
||||
SYSCTL_INT(_hw,HW_PAGESIZE, pagesize,
|
||||
CTLFLAG_RD, 0, PAGE_SIZE, 0, "");
|
||||
|
||||
SYSCTL_INT(_hw,HW_FLOATINGPT, floatingpoint,
|
||||
CTLFLAG_RD, &hw_float, 0, 0, "");
|
||||
CTLFLAG_RD, 0, PAGE_SIZE, "");
|
||||
|
||||
/* END_MIB */
|
||||
|
||||
extern int vfs_update_wakeup;
|
||||
extern int vfs_update_interval;
|
||||
static int
|
||||
sysctl_kern_updateinterval(oidp, when, error)
|
||||
struct sysctl_oid *oidp;
|
||||
int when;
|
||||
int error;
|
||||
sysctl_kern_updateinterval SYSCTL_HANDLER_ARGS
|
||||
{
|
||||
if (when == CTLAFTER && !error)
|
||||
int error = sysctl_handle_int(oidp,
|
||||
oidp->oid_arg1,oidp->oid_arg2,
|
||||
oldp,oldlenp,newp,newlen);
|
||||
if (!error)
|
||||
wakeup(&vfs_update_wakeup);
|
||||
return 0;
|
||||
return error;
|
||||
}
|
||||
|
||||
SYSCTL_INT(_kern,KERN_UPDATEINTERVAL, update,
|
||||
CTLFLAG_RD, &vfs_update_interval, 0, sysctl_kern_updateinterval,"");
|
||||
SYSCTL_PROC(_kern,KERN_UPDATEINTERVAL, update, CTLTYPE_INT|CTLFLAG_RD,
|
||||
&vfs_update_interval, 0, sysctl_kern_updateinterval,"");
|
||||
|
||||
|
||||
static int
|
||||
do_int(oidp, oldp, oldlenp, newp, newlen)
|
||||
struct sysctl_oid *oidp;
|
||||
void *oldp;
|
||||
size_t *oldlenp;
|
||||
void *newp;
|
||||
size_t newlen;
|
||||
int
|
||||
sysctl_handle_int SYSCTL_HANDLER_ARGS
|
||||
{
|
||||
int error = 0;
|
||||
|
||||
@ -181,7 +169,7 @@ do_int(oidp, oldp, oldlenp, newp, newlen)
|
||||
return (ENOMEM);
|
||||
|
||||
/* If it is a constant, don't write */
|
||||
if (newp && !oidp->oid_arg1)
|
||||
if (newp && !arg1)
|
||||
return (EPERM);
|
||||
|
||||
/* If we get more than an int */
|
||||
@ -189,26 +177,20 @@ do_int(oidp, oldp, oldlenp, newp, newlen)
|
||||
return (EINVAL);
|
||||
|
||||
*oldlenp = sizeof(int);
|
||||
if (oldp && oidp->oid_arg1 )
|
||||
error = copyout(oidp->oid_arg1, oldp, sizeof(int));
|
||||
if (oldp && arg1 )
|
||||
error = copyout(arg1, oldp, sizeof(int));
|
||||
else if (oldp)
|
||||
error = copyout(&oidp->oid_arg2, oldp, sizeof(int));
|
||||
error = copyout(&arg2, oldp, sizeof(int));
|
||||
if (error == 0 && newp)
|
||||
error = copyin(newp, oidp->oid_arg1, sizeof(int));
|
||||
error = copyin(newp, arg1, sizeof(int));
|
||||
return (error);
|
||||
}
|
||||
|
||||
static int
|
||||
do_string(oidp, oldp, oldlenp, newp, newlen)
|
||||
struct sysctl_oid *oidp;
|
||||
void *oldp;
|
||||
size_t *oldlenp;
|
||||
void *newp;
|
||||
size_t newlen;
|
||||
int
|
||||
sysctl_handle_string SYSCTL_HANDLER_ARGS
|
||||
{
|
||||
int len, error = 0, rval = 0;
|
||||
int maxlen = oidp->oid_arg2;
|
||||
char *str = (char *)(oidp->oid_arg1);
|
||||
char *str = (char *)arg1;
|
||||
|
||||
len = strlen(str) + 1;
|
||||
|
||||
@ -217,7 +199,7 @@ do_string(oidp, oldp, oldlenp, newp, newlen)
|
||||
rval = ENOMEM;
|
||||
}
|
||||
|
||||
if (newp && newlen >= maxlen)
|
||||
if (newp && newlen >= arg2)
|
||||
return (EINVAL);
|
||||
|
||||
if (oldp) {
|
||||
@ -235,40 +217,35 @@ do_string(oidp, oldp, oldlenp, newp, newlen)
|
||||
return (rval);
|
||||
}
|
||||
|
||||
static int
|
||||
do_opaque(oidp, oldp, oldlenp, newp, newlen)
|
||||
struct sysctl_oid *oidp;
|
||||
void *oldp;
|
||||
size_t *oldlenp;
|
||||
void *newp;
|
||||
size_t newlen;
|
||||
int
|
||||
sysctl_handle_opaque SYSCTL_HANDLER_ARGS
|
||||
{
|
||||
int error = 0, rval = 0;
|
||||
char *str = (char *)(oidp->oid_arg1);
|
||||
int len = oidp->oid_arg2;
|
||||
|
||||
if (oldp && *oldlenp < len) {
|
||||
if (oldp && *oldlenp < arg2) {
|
||||
return (ENOMEM);
|
||||
}
|
||||
|
||||
if (newp && newlen != len)
|
||||
if (newp && newlen != arg2)
|
||||
return (EINVAL);
|
||||
|
||||
if (oldp) {
|
||||
*oldlenp = len;
|
||||
error = copyout(str, oldp, len);
|
||||
*oldlenp = arg2;
|
||||
error = copyout(arg1, oldp, arg2);
|
||||
if (error)
|
||||
rval = error;
|
||||
}
|
||||
if ((error == 0 || error == ENOMEM) && newp) {
|
||||
error = copyin(newp, str, len);
|
||||
error = copyin(newp, arg1, arg2);
|
||||
if (error)
|
||||
rval = error;
|
||||
str[newlen] = 0;
|
||||
}
|
||||
return (rval);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
static sysctlfn debug_sysctl;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Locking and stats
|
||||
@ -346,11 +323,6 @@ __sysctl(p, uap, retval)
|
||||
(*oidp)->oid_name, (*oidp)->oid_kind, (*oidp)->oid_arg1);
|
||||
#endif
|
||||
|
||||
if ((*oidp)->oid_handler) {
|
||||
i = ((*oidp)->oid_handler) (*oidp,CTLBEFORE,0);
|
||||
if (i)
|
||||
return i;
|
||||
}
|
||||
if ((*oidp)->oid_kind & CTLFLAG_NOLOCK)
|
||||
dolock = 0;
|
||||
|
||||
@ -376,33 +348,14 @@ __sysctl(p, uap, retval)
|
||||
if (uap->new && !((*oidp)->oid_kind & CTLFLAG_WR))
|
||||
return (EPERM);
|
||||
|
||||
switch ((*oidp)->oid_kind & CTLTYPE) {
|
||||
case CTLTYPE_INT:
|
||||
error = do_int(*oidp,
|
||||
uap->old, &oldlen,
|
||||
uap->new, uap->newlen);
|
||||
break;
|
||||
case CTLTYPE_STRING:
|
||||
error = do_string(*oidp,
|
||||
uap->old, &oldlen,
|
||||
uap->new, uap->newlen);
|
||||
break;
|
||||
case CTLTYPE_OPAQUE:
|
||||
error = do_opaque(*oidp,
|
||||
uap->old, &oldlen,
|
||||
uap->new, uap->newlen);
|
||||
break;
|
||||
default:
|
||||
printf("sysctl not handled\n");
|
||||
error = EINVAL;
|
||||
break;
|
||||
}
|
||||
|
||||
if ((*oidp)->oid_handler) {
|
||||
i = ((*oidp)->oid_handler) (*oidp,CTLAFTER,error);
|
||||
i = ((*oidp)->oid_handler) (*oidp,
|
||||
(*oidp)->oid_arg1, (*oidp)->oid_arg2,
|
||||
uap->old,&oldlen,uap->new,uap->newlen);
|
||||
if (i)
|
||||
error = i;
|
||||
}
|
||||
} else
|
||||
return EINVAL;
|
||||
goto over_and_out;
|
||||
|
||||
old:
|
||||
|
@ -40,17 +40,6 @@
|
||||
#ifndef _SYS_SYSCTL_H_
|
||||
#define _SYS_SYSCTL_H_
|
||||
|
||||
|
||||
/*
|
||||
* These are for the eproc structure defined below.
|
||||
*/
|
||||
#ifndef KERNEL
|
||||
#include <sys/time.h>
|
||||
#include <sys/ucred.h>
|
||||
#include <sys/proc.h>
|
||||
#include <vm/vm.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Definitions for sysctl call. The sysctl call uses a hierarchical name
|
||||
* for objects that can be examined or modified. The name is expressed as
|
||||
@ -74,7 +63,7 @@ struct ctlname {
|
||||
int ctl_type; /* type of name */
|
||||
};
|
||||
|
||||
#define CTLTYPE 0xf /* Mask */
|
||||
#define CTLTYPE 0xf /* Mask for the type */
|
||||
#define CTLTYPE_NODE 1 /* name is a node */
|
||||
#define CTLTYPE_INT 2 /* name describes an integer */
|
||||
#define CTLTYPE_STRING 3 /* name describes a string */
|
||||
@ -85,12 +74,11 @@ struct ctlname {
|
||||
#define CTLFLAG_RD 0x80000000 /* Allow reads of variable */
|
||||
#define CTLFLAG_WR 0x40000000 /* Allow writes to the variable */
|
||||
#define CTLFLAG_RW (CTLFLAG_RD|CTLFLAG_WR)
|
||||
#define CTLFLAG_XLT 0x20000000 /* Variable is xlated by function */
|
||||
#define CTLFLAG_NOLOCK 0x10000000 /* XXX Don't Lock */
|
||||
|
||||
#define CTLBEFORE 0
|
||||
#define CTLAFTER 1
|
||||
#define CTLFLAG_NOLOCK 0x20000000 /* XXX Don't Lock */
|
||||
|
||||
#ifdef KERNEL
|
||||
#define SYSCTL_HANDLER_ARGS (struct sysctl_oid *oidp, void *arg1, int arg2,\
|
||||
void *oldp, size_t *oldlenp, void *newp, size_t newlen )
|
||||
|
||||
struct sysctl_oid {
|
||||
int oid_number;
|
||||
@ -98,9 +86,12 @@ struct sysctl_oid {
|
||||
void *oid_arg1;
|
||||
int oid_arg2;
|
||||
char *oid_name;
|
||||
int (*oid_handler)(struct sysctl_oid *, int, int);
|
||||
int (*oid_handler) SYSCTL_HANDLER_ARGS;
|
||||
};
|
||||
typedef int (*sysctl_handler)(struct sysctl_oid *, int, int);
|
||||
|
||||
int sysctl_handle_int SYSCTL_HANDLER_ARGS;
|
||||
int sysctl_handle_string SYSCTL_HANDLER_ARGS;
|
||||
int sysctl_handle_opaque SYSCTL_HANDLER_ARGS;
|
||||
|
||||
/* This is the "raw" function for a mib-oid */
|
||||
#define SYSCTL_OID(parent,number,name,kind,arg1,arg2,handler,descr) \
|
||||
@ -116,29 +107,30 @@ typedef int (*sysctl_handler)(struct sysctl_oid *, int, int);
|
||||
TEXT_SET(sysctl_##parent##_##name, sysctl__##parent##_##name);
|
||||
|
||||
/* This is a string len can be 0 to indicate '\0' termination */
|
||||
#define SYSCTL_STRING(parent,number,name,access,arg,len,handler,descr) \
|
||||
#define SYSCTL_STRING(parent,number,name,access,arg,len,descr) \
|
||||
SYSCTL_OID(parent,number,name, CTLTYPE_STRING|access,\
|
||||
arg,len,handler,descr);
|
||||
arg,len,sysctl_handle_string,descr);
|
||||
|
||||
/* This is a integer, if ptr is NULL, val is returned */
|
||||
#define SYSCTL_INT(parent,number,name,access,ptr,val,handler,descr) \
|
||||
#define SYSCTL_INT(parent,number,name,access,ptr,val,descr) \
|
||||
SYSCTL_OID(parent,number,name,CTLTYPE_INT|access,\
|
||||
ptr,val,handler,descr);
|
||||
ptr,val,sysctl_handle_int,descr);
|
||||
|
||||
/* This is anything, specified by a pointer and a lenth */
|
||||
#define SYSCTL_OPAQUE(parent,number,name,access,ptr,len,handler,descr) \
|
||||
#define SYSCTL_OPAQUE(parent,number,name,access,ptr,len,descr) \
|
||||
SYSCTL_OID(parent,number,name,CTLTYPE_OPAQUE|access,\
|
||||
ptr,len,handler,descr);
|
||||
ptr,len,sysctl_handle_opaque,descr);
|
||||
|
||||
/* This is a struct, specified by a pointer and type */
|
||||
#define SYSCTL_STRUCT(parent,number,name,access,ptr,type,handler,descr) \
|
||||
#define SYSCTL_STRUCT(parent,number,name,access,ptr,type,descr) \
|
||||
SYSCTL_OID(parent,number,name,CTLTYPE_OPAQUE|access,\
|
||||
ptr,sizeof(struct type),handler,descr);
|
||||
ptr,sizeof(struct type),sysctl_handle_opaque,descr);
|
||||
|
||||
/* Needs a proc. Specify by pointer and arg */
|
||||
#define SYSCTL_PROC(parent,number,name,access,ptr,arg,handler,descr) \
|
||||
SYSCTL_OID(parent,number,name,CTLTYPE_PROC|access,\
|
||||
SYSCTL_OID(parent,number,name,access,\
|
||||
ptr,arg,handler,descr);
|
||||
#endif /* KERNEL */
|
||||
|
||||
/*
|
||||
* Top-level identifiers
|
||||
@ -254,37 +246,6 @@ typedef int (*sysctl_handler)(struct sysctl_oid *, int, int);
|
||||
#define KERN_PROC_UID 5 /* by effective uid */
|
||||
#define KERN_PROC_RUID 6 /* by real uid */
|
||||
|
||||
/*
|
||||
* KERN_PROC subtype ops return arrays of augmented proc structures:
|
||||
*/
|
||||
struct kinfo_proc {
|
||||
struct proc kp_proc; /* proc structure */
|
||||
struct eproc {
|
||||
struct proc *e_paddr; /* address of proc */
|
||||
struct session *e_sess; /* session pointer */
|
||||
struct pcred e_pcred; /* process credentials */
|
||||
struct ucred e_ucred; /* current credentials */
|
||||
struct vmspace e_vm; /* address space */
|
||||
pid_t e_ppid; /* parent process id */
|
||||
pid_t e_pgid; /* process group id */
|
||||
short e_jobc; /* job control counter */
|
||||
dev_t e_tdev; /* controlling tty dev */
|
||||
pid_t e_tpgid; /* tty process group id */
|
||||
struct session *e_tsess; /* tty session pointer */
|
||||
#define WMESGLEN 7
|
||||
char e_wmesg[WMESGLEN+1]; /* wchan message */
|
||||
segsz_t e_xsize; /* text size */
|
||||
short e_xrssize; /* text rss */
|
||||
short e_xccount; /* text references */
|
||||
short e_xswrss;
|
||||
long e_flag;
|
||||
#define EPROC_CTTY 0x01 /* controlling tty vnode active */
|
||||
#define EPROC_SLEADER 0x02 /* session leader */
|
||||
char e_login[MAXLOGNAME]; /* setlogin() name */
|
||||
long e_spare[4];
|
||||
} kp_eproc;
|
||||
};
|
||||
|
||||
/*
|
||||
* CTL_HW identifiers
|
||||
*/
|
||||
@ -400,7 +361,6 @@ extern struct ctldebug debug15, debug16, debug17, debug18, debug19;
|
||||
#endif /* DEBUG */
|
||||
|
||||
extern char cpu_model[];
|
||||
extern int hw_float;
|
||||
extern char machine[];
|
||||
extern char osrelease[];
|
||||
extern char ostype[];
|
||||
@ -432,7 +392,6 @@ int sysctl_string __P((void *, size_t *, void *, size_t, char *, int));
|
||||
int sysctl_rdstring __P((void *, size_t *, void *, char *));
|
||||
int sysctl_rdstruct __P((void *, size_t *, void *, void *, int));
|
||||
int sysctl_struct __P((void *oldp, size_t *, void *, size_t, void *, int));
|
||||
void fill_eproc __P((struct proc *, struct eproc *));
|
||||
|
||||
int sysctl_clockrate __P((char *, size_t*));
|
||||
int sysctl_vnode __P((char *, size_t*));
|
||||
|
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)user.h 8.2 (Berkeley) 9/23/93
|
||||
* $Id: user.h,v 1.3 1994/08/21 04:42:10 paul Exp $
|
||||
* $Id: user.h,v 1.4 1995/05/30 08:14:50 rgrimes Exp $
|
||||
*/
|
||||
|
||||
#ifndef _SYS_USER_H_
|
||||
@ -49,7 +49,46 @@
|
||||
#include <sys/resourcevar.h>
|
||||
#include <sys/signalvar.h>
|
||||
#include <vm/vm.h> /* XXX */
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
|
||||
#ifndef KERNEL
|
||||
#include <sys/time.h>
|
||||
#include <sys/ucred.h>
|
||||
#include <sys/proc.h>
|
||||
#include <vm/vm.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* KERN_PROC subtype ops return arrays of augmented proc structures:
|
||||
*/
|
||||
struct kinfo_proc {
|
||||
struct proc kp_proc; /* proc structure */
|
||||
struct eproc {
|
||||
struct proc *e_paddr; /* address of proc */
|
||||
struct session *e_sess; /* session pointer */
|
||||
struct pcred e_pcred; /* process credentials */
|
||||
struct ucred e_ucred; /* current credentials */
|
||||
struct vmspace e_vm; /* address space */
|
||||
pid_t e_ppid; /* parent process id */
|
||||
pid_t e_pgid; /* process group id */
|
||||
short e_jobc; /* job control counter */
|
||||
dev_t e_tdev; /* controlling tty dev */
|
||||
pid_t e_tpgid; /* tty process group id */
|
||||
struct session *e_tsess; /* tty session pointer */
|
||||
#define WMESGLEN 7
|
||||
char e_wmesg[WMESGLEN+1]; /* wchan message */
|
||||
segsz_t e_xsize; /* text size */
|
||||
short e_xrssize; /* text rss */
|
||||
short e_xccount; /* text references */
|
||||
short e_xswrss;
|
||||
long e_flag;
|
||||
#define EPROC_CTTY 0x01 /* controlling tty vnode active */
|
||||
#define EPROC_SLEADER 0x02 /* session leader */
|
||||
char e_login[MAXLOGNAME]; /* setlogin() name */
|
||||
long e_spare[4];
|
||||
} kp_eproc;
|
||||
};
|
||||
void fill_eproc __P((struct proc *, struct eproc *));
|
||||
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user