Implement the following macros for completeness:
SYSCTL_QUAD() SYSCTL_ADD_QUAD() TUNABLE_QUAD() TUNABLE_QUAD_FETCH() Now we can use 64bit tunables on 32bit systems.
This commit is contained in:
parent
37876323b1
commit
7f41115ef6
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=180661
@ -40,7 +40,8 @@
|
|||||||
.Nm SYSCTL_UINT ,
|
.Nm SYSCTL_UINT ,
|
||||||
.Nm SYSCTL_ULONG ,
|
.Nm SYSCTL_ULONG ,
|
||||||
.Nm SYSCTL_XINT ,
|
.Nm SYSCTL_XINT ,
|
||||||
.Nm SYSCTL_XLONG
|
.Nm SYSCTL_XLONG ,
|
||||||
|
.Nm SYSCTL_QUAD
|
||||||
.Nd Static sysctl declaration functions
|
.Nd Static sysctl declaration functions
|
||||||
.Sh SYNOPSIS
|
.Sh SYNOPSIS
|
||||||
.In sys/types.h
|
.In sys/types.h
|
||||||
@ -57,6 +58,7 @@
|
|||||||
.Fn SYSCTL_ULONG parent nbr name access ptr val descr
|
.Fn SYSCTL_ULONG parent nbr name access ptr val descr
|
||||||
.Fn SYSCTL_XINT parent nbr name access ptr val descr
|
.Fn SYSCTL_XINT parent nbr name access ptr val descr
|
||||||
.Fn SYSCTL_XLONG parent nbr name access ptr val descr
|
.Fn SYSCTL_XLONG parent nbr name access ptr val descr
|
||||||
|
.Fn SYSCTL_QUAD parent nbr name access ptr val descr
|
||||||
.Sh DESCRIPTION
|
.Sh DESCRIPTION
|
||||||
The
|
The
|
||||||
.Nm SYSCTL
|
.Nm SYSCTL
|
||||||
@ -83,8 +85,9 @@ New nodes are declared using one of
|
|||||||
.Fn SYSCTL_UINT ,
|
.Fn SYSCTL_UINT ,
|
||||||
.Fn SYSCTL_ULONG ,
|
.Fn SYSCTL_ULONG ,
|
||||||
.Fn SYSCTL_XINT ,
|
.Fn SYSCTL_XINT ,
|
||||||
|
.Fn SYSCTL_XLONG ,
|
||||||
and
|
and
|
||||||
.Fn SYSCTL_XLONG .
|
.Fn SYSCTL_QUAD .
|
||||||
Each macro accepts a parent name, as declared using
|
Each macro accepts a parent name, as declared using
|
||||||
.Fn SYSCTL_DECL ,
|
.Fn SYSCTL_DECL ,
|
||||||
an OID number, typically
|
an OID number, typically
|
||||||
|
@ -147,6 +147,16 @@
|
|||||||
.Fa "const char *descr"
|
.Fa "const char *descr"
|
||||||
.Fc
|
.Fc
|
||||||
.Ft struct sysctl_oid *
|
.Ft struct sysctl_oid *
|
||||||
|
.Fo SYSCTL_ADD_QUAD
|
||||||
|
.Fa "struct sysctl_ctx_list *ctx"
|
||||||
|
.Fa "struct sysctl_oid_list *parent"
|
||||||
|
.Fa "int number"
|
||||||
|
.Fa "const char *name"
|
||||||
|
.Fa "int access"
|
||||||
|
.Fa "int64_t *arg"
|
||||||
|
.Fa "const char *descr"
|
||||||
|
.Fc
|
||||||
|
.Ft struct sysctl_oid *
|
||||||
.Fo SYSCTL_ADD_OPAQUE
|
.Fo SYSCTL_ADD_OPAQUE
|
||||||
.Fa "struct sysctl_ctx_list *ctx"
|
.Fa "struct sysctl_ctx_list *ctx"
|
||||||
.Fa "struct sysctl_oid_list *parent"
|
.Fa "struct sysctl_oid_list *parent"
|
||||||
@ -430,6 +440,10 @@ variable.
|
|||||||
creates an oid that handles an
|
creates an oid that handles an
|
||||||
.Li unsigned long
|
.Li unsigned long
|
||||||
variable.
|
variable.
|
||||||
|
.It Fn SYSCTL_ADD_QUAD
|
||||||
|
creates an oid that handles an
|
||||||
|
.Li int64_t
|
||||||
|
variable.
|
||||||
.It Fn SYSCTL_ADD_OPAQUE
|
.It Fn SYSCTL_ADD_OPAQUE
|
||||||
creates an oid that handles any chunk of opaque data
|
creates an oid that handles any chunk of opaque data
|
||||||
of the size specified by the
|
of the size specified by the
|
||||||
|
@ -563,6 +563,14 @@ tunable_ulong_init(void *data)
|
|||||||
TUNABLE_ULONG_FETCH(d->path, d->var);
|
TUNABLE_ULONG_FETCH(d->path, d->var);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
tunable_quad_init(void *data)
|
||||||
|
{
|
||||||
|
struct tunable_quad *d = (struct tunable_quad *)data;
|
||||||
|
|
||||||
|
TUNABLE_QUAD_FETCH(d->path, d->var);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
tunable_str_init(void *data)
|
tunable_str_init(void *data)
|
||||||
{
|
{
|
||||||
|
@ -329,6 +329,25 @@ struct tunable_ulong {
|
|||||||
|
|
||||||
#define TUNABLE_ULONG_FETCH(path, var) getenv_ulong((path), (var))
|
#define TUNABLE_ULONG_FETCH(path, var) getenv_ulong((path), (var))
|
||||||
|
|
||||||
|
/*
|
||||||
|
* quad
|
||||||
|
*/
|
||||||
|
extern void tunable_quad_init(void *);
|
||||||
|
struct tunable_quad {
|
||||||
|
const char *path;
|
||||||
|
quad_t *var;
|
||||||
|
};
|
||||||
|
#define TUNABLE_QUAD(path, var) \
|
||||||
|
static struct tunable_quad __CONCAT(__tunable_quad_, __LINE__) = { \
|
||||||
|
(path), \
|
||||||
|
(var), \
|
||||||
|
}; \
|
||||||
|
SYSINIT(__CONCAT(__Tunable_init_, __LINE__), \
|
||||||
|
SI_SUB_TUNABLES, SI_ORDER_MIDDLE, tunable_quad_init, \
|
||||||
|
&__CONCAT(__tunable_quad_, __LINE__))
|
||||||
|
|
||||||
|
#define TUNABLE_QUAD_FETCH(path, var) getenv_quad((path), (var))
|
||||||
|
|
||||||
extern void tunable_str_init(void *);
|
extern void tunable_str_init(void *);
|
||||||
struct tunable_str {
|
struct tunable_str {
|
||||||
const char *path;
|
const char *path;
|
||||||
|
@ -294,6 +294,15 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry);
|
|||||||
sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_ULONG|(access), \
|
sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_ULONG|(access), \
|
||||||
ptr, 0, sysctl_handle_long, "LX", __DESCR(descr))
|
ptr, 0, sysctl_handle_long, "LX", __DESCR(descr))
|
||||||
|
|
||||||
|
/* Oid for a quad. The pointer must be non NULL. */
|
||||||
|
#define SYSCTL_QUAD(parent, nbr, name, access, ptr, val, descr) \
|
||||||
|
SYSCTL_OID(parent, nbr, name, CTLTYPE_QUAD|(access), \
|
||||||
|
ptr, val, sysctl_handle_quad, "Q", __DESCR(descr))
|
||||||
|
|
||||||
|
#define SYSCTL_ADD_QUAD(ctx, parent, nbr, name, access, ptr, descr) \
|
||||||
|
sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_QUAD|(access), \
|
||||||
|
ptr, 0, sysctl_handle_quad, "Q", __DESCR(descr))
|
||||||
|
|
||||||
/* Oid for an opaque object. Specified by a pointer and a length. */
|
/* Oid for an opaque object. Specified by a pointer and a length. */
|
||||||
#define SYSCTL_OPAQUE(parent, nbr, name, access, ptr, len, fmt, descr) \
|
#define SYSCTL_OPAQUE(parent, nbr, name, access, ptr, len, fmt, descr) \
|
||||||
SYSCTL_OID(parent, nbr, name, CTLTYPE_OPAQUE|(access), \
|
SYSCTL_OID(parent, nbr, name, CTLTYPE_OPAQUE|(access), \
|
||||||
|
Loading…
Reference in New Issue
Block a user