aboutsummaryrefslogtreecommitdiff
path: root/sys/sys/sysctl.h
diff options
context:
space:
mode:
Diffstat (limited to 'sys/sys/sysctl.h')
-rw-r--r--sys/sys/sysctl.h35
1 files changed, 22 insertions, 13 deletions
diff --git a/sys/sys/sysctl.h b/sys/sys/sysctl.h
index 9e2fc55..5e5115d 100644
--- a/sys/sys/sysctl.h
+++ b/sys/sys/sysctl.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: sysctl.h,v 1.205 2020/03/13 10:07:01 anton Exp $ */
+/* $OpenBSD: sysctl.h,v 1.211 2020/09/01 01:53:50 gnezdo Exp $ */
/* $NetBSD: sysctl.h,v 1.16 1996/04/09 20:55:36 cgd Exp $ */
/*
@@ -679,7 +679,7 @@ do { \
PR_UNLOCK(pr); \
\
if (((pr)->ps_flags & PS_ZOMBIE) == 0) { \
- struct timeval tv; \
+ struct timeval __tv; \
\
(kp)->p_uvalid = 1; \
\
@@ -699,9 +699,9 @@ do { \
(kp)->p_uru_nivcsw = (p)->p_ru.ru_nivcsw; \
\
timeradd(&(pr)->ps_cru.ru_utime, \
- &(pr)->ps_cru.ru_stime, &tv); \
- (kp)->p_uctime_sec = tv.tv_sec; \
- (kp)->p_uctime_usec = tv.tv_usec; \
+ &(pr)->ps_cru.ru_stime, &__tv); \
+ (kp)->p_uctime_sec = __tv.tv_sec; \
+ (kp)->p_uctime_usec = __tv.tv_usec; \
} \
\
(kp)->p_cpuid = KI_NOCPU; \
@@ -957,7 +957,7 @@ struct kinfo_file {
#define CTL_DEBUG_MAXID 20
#ifdef _KERNEL
-#ifdef DEBUG
+#ifdef DEBUG_SYSCTL
/*
* CTL_DEBUG variables.
*
@@ -974,11 +974,18 @@ struct ctldebug {
char *debugname; /* name of debugging variable */
int *debugvar; /* pointer to debugging variable */
};
-extern struct ctldebug debug0, debug1, debug2, debug3, debug4;
-extern struct ctldebug debug5, debug6, debug7, debug8, debug9;
-extern struct ctldebug debug10, debug11, debug12, debug13, debug14;
-extern struct ctldebug debug15, debug16, debug17, debug18, debug19;
-#endif /* DEBUG */
+#endif /* DEBUG_SYSCTL */
+
+/*
+ * Exported sysctl variable with valid bounds. Both bounds are inclusive to
+ * allow full range of values.
+ */
+struct sysctl_bounded_args {
+ int mib; /* identifier shared with userspace as a CTL_ #define */
+ int *var; /* never NULL */
+ int minimum; /* checking is disabled if minimum == maximum */
+ int maximum;
+};
/*
* Internal sysctl function calling convention:
@@ -992,9 +999,11 @@ extern struct ctldebug debug15, debug16, debug17, debug18, debug19;
typedef int (sysctlfn)(int *, u_int, void *, size_t *, void *, size_t, struct proc *);
int sysctl_int(void *, size_t *, void *, size_t, int *);
+int sysctl_int_bounded(void *, size_t *, void *, size_t, int *, int, int);
int sysctl_int_lower(void *, size_t *, void *, size_t, int *);
int sysctl_rdint(void *, size_t *, void *, int);
-int sysctl_int_arr(int **, int *, u_int, void *, size_t *, void *, size_t);
+int sysctl_bounded_arr(const struct sysctl_bounded_args *, u_int,
+ int *, u_int, void *, size_t *, void *, size_t);
int sysctl_quad(void *, size_t *, void *, size_t, int64_t *);
int sysctl_rdquad(void *, size_t *, void *, int64_t);
int sysctl_string(void *, size_t *, void *, size_t, char *, size_t);
@@ -1023,7 +1032,7 @@ int kern_sysctl(int *, u_int, void *, size_t *, void *, size_t,
struct proc *);
int hw_sysctl(int *, u_int, void *, size_t *, void *, size_t,
struct proc *);
-#ifdef DEBUG
+#ifdef DEBUG_SYSCTL
int debug_sysctl(int *, u_int, void *, size_t *, void *, size_t,
struct proc *);
#endif