Re: [PATCH 33/45] include/uapi/asm-generic/signal.h: include stdlib.h in userspace

Mikko Rapeli
2015-03-10T22:58:30Z

On Tue, Feb 17, 2015 at 10:44:48AM +0100, Arnd Bergmann wrote:
> On Tuesday 17 February 2015 00:05:36 Mikko Rapeli wrote:
> > Fixes compiler warning:
> > error: unknown type name ‘size_t’
> >
> > Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
> > ---
> > include/uapi/asm-generic/signal.h | 4 ++++
> > 1 file changed, 4 insertions(+)
> >
> > diff --git a/include/uapi/asm-generic/signal.h b/include/uapi/asm-generic/signal.h
> > index 9df61f1..8a341a2 100644
> > --- a/include/uapi/asm-generic/signal.h
> > +++ b/include/uapi/asm-generic/signal.h
> > @@ -3,6 +3,10 @@
> >
> > #include <linux/types.h>
> >
> > +#ifndef __KERNEL__
> > +#include <stdlib.h>
> > +#endif
> > +
>
> Hmm, maybe we should use __kernel_size_t instead?

This problem is in several uapi header files on x86:

asm-generic/shmbuf.h
asm-generic/signal.h
asm/signal.h
drm/drm.h
linux/agpgart.h
linux/kexec.h
linux/ncp_fs.h
linux/nfc.h
linux/omapfb.h
linux/reiserfs_xattr.h
linux/sysctl.h
sound/asound.h

so I guess using __kernel_size_t is the correct approach for all of them,
right?

linux/kexec.h seems suspicious though:

#ifndef __KERNEL__
/*
* This structure is used to hold the arguments that are used when
* loading kernel binaries.
*/
struct kexec_segment {
const void *buf;
size_t bufsz;
const void *mem;
size_t memsz;
};

#endif /* __KERNEL__ */

-Mikko