Skip to contentSkip to conversation

uapi: fix linux/sysctl.h userspace compilation errors

PATCH In review Dmitry V. Levin 3 participants 4 messages Feb 22, 2017 – Feb 23, 2017 netfilter

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 uapi: fix linux/sysctl.h userspace compilation errors

Include <stddef.h> (guarded by #ifndef __KERNEL__) to fix the following linux/sysctl.h userspace compilation errors:

/usr/include/linux/sysctl.h:38:2: error: unknown type name 'size_t'
size_t *oldlenp;
/usr/include/linux/sysctl.h:40:2: error: unknown type name 'size_t'
size_t newlen;

This also fixes userspace compilation of uapi headers that include linux/sysctl.h, e.g. linux/netfilter.h.

---
 include/uapi/linux/sysctl.h | 4 ++++
 1 file changed, 4 insertions(+)
include/uapi/linux/sysctl.h +4 -0
index d2b1215..c6d18aa 100644
@@ -26,6 +26,10 @@
 #include <linux/types.h>
 #include <linux/compiler.h>
 
+#ifndef __KERNEL__
+#include <stddef.h>		/* For size_t. */
+#endif
+
 #define CTL_MAXNAME 10		/* how many path components do we allow in a
 				   call to sysctl?   In other words, what is
 				   the largest acceptable value for the nlen
Signature · 1 line
ldv
#1 lore raw
Quoted 10 lines · Dmitry V. Levin

Include <stddef.h> (guarded by #ifndef __KERNEL__) to fix the following linux/sysctl.h userspace compilation errors:

/usr/include/linux/sysctl.h:38:2: error: unknown type name 'size_t'
size_t *oldlenp;
/usr/include/linux/sysctl.h:40:2: error: unknown type name 'size_t'
size_t newlen;

This also fixes userspace compilation of uapi headers that include linux/sysctl.h, e.g. linux/netfilter.h.

Are these compilation errors new?

Perhaps we should just refactor linux/netfilter.h not to depend on linux/sysctl.h. The definitions in linux/sysctl.h are essentially dead at this point and I would not expect any new, are really not any old programs to depend on linux/sysctl.h. As I don't expect new users of linux/sysctl.h I don't see how changing anything in the header is meaningful.

Either the old users work or the old users are broken.

Eric

Quoted 20 lines
---
 include/uapi/linux/sysctl.h | 4 ++++
 1 file changed, 4 insertions(+)
include/uapi/linux/sysctl.h +4 -0
index d2b1215..c6d18aa 100644
@@ -26,6 +26,10 @@
 #include <linux/types.h>
 #include <linux/compiler.h>
 
+#ifndef __KERNEL__
+#include <stddef.h>		/* For size_t. */
+#endif
+
 #define CTL_MAXNAME 10		/* how many path components do we allow in a
 				   call to sysctl?   In other words, what is
 				   the largest acceptable value for the nlen
#2 lore raw

PATCH 1/1 uapi: stop including linux/sysctl.h in uapi/linux/netfilter.h

linux/netfilter.h is the last uapi header file that includes linux/sysctl.h but it does not depend on definitions provided by this essentially dead header file.

---
 include/uapi/linux/netfilter.h | 1 -
 1 file changed, 1 deletion(-)
include/uapi/linux/netfilter.h +0 -1
index 7550e91..c111a91 100644
@@ -3,7 +3,6 @@
 
 #include <linux/types.h>
 #include <linux/compiler.h>
-#include <linux/sysctl.h>
 #include <linux/in.h>
 #include <linux/in6.h>
 
Signature · 1 line
ldv
maintainer Applied
#3 lore raw

Re: [PATCH] uapi: stop including linux/sysctl.h in uapi/linux/netfilter.h

Quoted 3 lines · Dmitry V. Levin

linux/netfilter.h is the last uapi header file that includes linux/sysctl.h but it does not depend on definitions provided by this essentially dead header file.

Applied, thanks.