git: 56ee5c551f89 - main - sysctl: make sys/sysctl.h self contained
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 11 Oct 2021 17:24:17 UTC
The branch main has been updated by imp:
URL: https://cgit.FreeBSD.org/src/commit/?id=56ee5c551f89e767e931c55e063a20abd0c55346
commit 56ee5c551f89e767e931c55e063a20abd0c55346
Author: Warner Losh <imp@FreeBSD.org>
AuthorDate: 2021-10-11 17:14:51 +0000
Commit: Warner Losh <imp@FreeBSD.org>
CommitDate: 2021-10-11 17:20:07 +0000
sysctl: make sys/sysctl.h self contained
sys/sysctl.h only needs u_int and size_t from sys/types.h. When the
sysctl interface was designed, having one more more prerequisites
(especially sys/types.h) was the norm. Times have changed, and to make
things more portable, make sys/types.h optional. We do this by including
sys/_types.h, defining size_t if needed, and changing u_int to 'unsigned
int' in a prototype for userland builds. For kernel builds, sys/types.h
is still required.
Sponsored by: Netflix
Reviewed by: kib, jhb
Differential Revision: https://reviews.freebsd.org/D31827
---
sys/sys/sysctl.h | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/sys/sys/sysctl.h b/sys/sys/sysctl.h
index 9e9bd723f4bd..8178c7208f9b 100644
--- a/sys/sys/sysctl.h
+++ b/sys/sys/sysctl.h
@@ -1180,9 +1180,14 @@ struct sbuf *sbuf_new_for_sysctl(struct sbuf *, char *, int,
struct sysctl_req *);
#else /* !_KERNEL */
#include <sys/cdefs.h>
+#include <sys/_types.h>
+#ifndef _SIZE_T_DECLARED
+typedef __size_t size_t;
+#define _SIZE_T_DECLARED
+#endif
__BEGIN_DECLS
-int sysctl(const int *, u_int, void *, size_t *, const void *, size_t);
+int sysctl(const int *, unsigned int, void *, size_t *, const void *, size_t);
int sysctlbyname(const char *, void *, size_t *, const void *, size_t);
int sysctlnametomib(const char *, int *, size_t *);
__END_DECLS