[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <201203211937.22423.l.lunak@suse.cz>
Date: Wed, 21 Mar 2012 19:37:22 +0100
From: Lubos Lunak <l.lunak@...e.cz>
To: Arnd Bergmann <arnd@...db.de>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
Andrew Morton <akpm@...ux-foundation.org>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] do not export kernel's NULL #define to userspace
On Wednesday 21 of March 2012, Arnd Bergmann wrote:
> On Wednesday 21 March 2012, Lubos Lunak wrote:
> > > If so, we might have to replace it with a __KERNEL_NULL constant
> > > or something, like we do for the stuff in linux/types.h, so we
> > > don't accidentally break user applications that rely on the
> > > header files to be self-contained.
> > >
> > > I think there is at least a NULL usage in linux/wireless.h and some
> > > netfilter headers.
> >
> > I see. How about the attached patch then?
>
> Strictly speaking, you should not include standard headers from kernel
> provided headers, and the problems would be similar to those before
> your patch: anyone who currently doesn't include <stddef.h> but has
> their own definition of NULL will still get a conflict from including
> a kernel header that includes <linux/stddef.h>.
I guess I should point out that I'm not a kernel developer, I simply want to
fix the problem that kernel headers redefine NULL to something suboptimal in
userspace. So I don't know what the requirements on the headers are from the
kernel side (and I wonder why you need your own NULL in the kernel when it
comes with the compiler).
Let me provide one more patch then, which only surrounds the NULL definition
by #ifndef NULL instead of bluntly doing #undef NULL. That way kernel should
keep using this NULL definition, while it won't be forced in userspace.
--
Lubos Lunak
l.lunak@...e.cz
View attachment "0001-do-not-redefine-userspace-s-NULL-define.patch" of type "text/x-diff" (1170 bytes)
Powered by blists - more mailing lists