-/* $OpenBSD: kern_sysctl.c,v 1.393 2021/05/04 19:04:56 bluhm Exp $ */
+/* $OpenBSD: kern_sysctl.c,v 1.394 2021/05/04 21:57:15 bluhm Exp $ */
/* $NetBSD: kern_sysctl.c,v 1.17 1996/05/20 17:49:05 mrg Exp $ */
/*-
return (error);
}
+/*
+ * As above, but read-only.
+ */
+int
+sysctl_rdint(void *oldp, size_t *oldlenp, void *newp, int val)
+{
+ int error = 0;
+
+ if (oldp && *oldlenp < sizeof(int))
+ return (ENOMEM);
+ if (newp)
+ return (EPERM);
+ *oldlenp = sizeof(int);
+ if (oldp)
+ error = copyout((caddr_t)&val, oldp, sizeof(int));
+ return (error);
+}
+
+/*
+ * Read-only or bounded integer values.
+ */
int
sysctl_int_bounded(void *oldp, size_t *oldlenp, void *newp, size_t newlen,
int *valp, int minimum, int maximum)
}
/*
- * As above, but read-only.
- */
-int
-sysctl_rdint(void *oldp, size_t *oldlenp, void *newp, int val)
-{
- int error = 0;
-
- if (oldp && *oldlenp < sizeof(int))
- return (ENOMEM);
- if (newp)
- return (EPERM);
- *oldlenp = sizeof(int);
- if (oldp)
- error = copyout((caddr_t)&val, oldp, sizeof(int));
- return (error);
-}
-
-/*
- * Array of bounded integer values.
+ * Array of read-only or bounded integer values.
*/
int
sysctl_bounded_arr(const struct sysctl_bounded_args *valpp, u_int valplen,
-/* $OpenBSD: sysctl.h,v 1.216 2021/05/01 16:18:58 gnezdo Exp $ */
+/* $OpenBSD: sysctl.h,v 1.217 2021/05/04 21:57:15 bluhm Exp $ */
/* $NetBSD: sysctl.h,v 1.16 1996/04/09 20:55:36 cgd Exp $ */
/*
*/
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_int(void *, size_t *, void *, size_t, int *);
int sysctl_rdint(void *, size_t *, void *, int);
+int sysctl_int_bounded(void *, size_t *, void *, size_t, int *, int, int);
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 *);