linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] uapi: fix linux/sysctl.h userspace compilation errors
@ 2017-02-22 23:06 Dmitry V. Levin
  2017-02-23  1:34 ` Eric W. Biederman
  0 siblings, 1 reply; 4+ messages in thread
From: Dmitry V. Levin @ 2017-02-22 23:06 UTC (permalink / raw)
  To: Alexey Dobriyan, Andrew Morton, Eric W. Biederman; +Cc: linux-kernel

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.

Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
---
 include/uapi/linux/sysctl.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/include/uapi/linux/sysctl.h b/include/uapi/linux/sysctl.h
index d2b1215..c6d18aa 100644
--- a/include/uapi/linux/sysctl.h
+++ b/include/uapi/linux/sysctl.h
@@ -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
-- 
ldv

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] uapi: fix linux/sysctl.h userspace compilation errors
  2017-02-22 23:06 [PATCH] uapi: fix linux/sysctl.h userspace compilation errors Dmitry V. Levin
@ 2017-02-23  1:34 ` Eric W. Biederman
  2017-02-23  2:49   ` [PATCH] uapi: stop including linux/sysctl.h in uapi/linux/netfilter.h Dmitry V. Levin
  0 siblings, 1 reply; 4+ messages in thread
From: Eric W. Biederman @ 2017-02-23  1:34 UTC (permalink / raw)
  To: Dmitry V. Levin; +Cc: Alexey Dobriyan, Andrew Morton, linux-kernel

"Dmitry V. Levin" <ldv@altlinux.org> writes:

> 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


> Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
> ---
>  include/uapi/linux/sysctl.h | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/include/uapi/linux/sysctl.h b/include/uapi/linux/sysctl.h
> index d2b1215..c6d18aa 100644
> --- a/include/uapi/linux/sysctl.h
> +++ b/include/uapi/linux/sysctl.h
> @@ -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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] uapi: stop including linux/sysctl.h in uapi/linux/netfilter.h
  2017-02-23  1:34 ` Eric W. Biederman
@ 2017-02-23  2:49   ` Dmitry V. Levin
  2017-02-23 20:51     ` Pablo Neira Ayuso
  0 siblings, 1 reply; 4+ messages in thread
From: Dmitry V. Levin @ 2017-02-23  2:49 UTC (permalink / raw)
  To: Eric W. Biederman, Pablo Neira Ayuso, Jozsef Kadlecsik
  Cc: netfilter-devel, coreteam, linux-kernel

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.

Suggested-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
---
 include/uapi/linux/netfilter.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/include/uapi/linux/netfilter.h b/include/uapi/linux/netfilter.h
index 7550e91..c111a91 100644
--- a/include/uapi/linux/netfilter.h
+++ b/include/uapi/linux/netfilter.h
@@ -3,7 +3,6 @@
 
 #include <linux/types.h>
 #include <linux/compiler.h>
-#include <linux/sysctl.h>
 #include <linux/in.h>
 #include <linux/in6.h>
 
-- 
ldv

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] uapi: stop including linux/sysctl.h in uapi/linux/netfilter.h
  2017-02-23  2:49   ` [PATCH] uapi: stop including linux/sysctl.h in uapi/linux/netfilter.h Dmitry V. Levin
@ 2017-02-23 20:51     ` Pablo Neira Ayuso
  0 siblings, 0 replies; 4+ messages in thread
From: Pablo Neira Ayuso @ 2017-02-23 20:51 UTC (permalink / raw)
  To: Dmitry V. Levin
  Cc: Eric W. Biederman, Jozsef Kadlecsik, netfilter-devel, coreteam,
	linux-kernel

On Thu, Feb 23, 2017 at 05:49:28AM +0300, Dmitry V. Levin wrote:
> 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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-02-23 20:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-22 23:06 [PATCH] uapi: fix linux/sysctl.h userspace compilation errors Dmitry V. Levin
2017-02-23  1:34 ` Eric W. Biederman
2017-02-23  2:49   ` [PATCH] uapi: stop including linux/sysctl.h in uapi/linux/netfilter.h Dmitry V. Levin
2017-02-23 20:51     ` Pablo Neira Ayuso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).