include/uapi/asm-generic/signal.h: include stdlib.h in userspace

Started by Mikko Rapeli on Feb 16, 2015 · 4 messages from 2 authors · Last reply Mar 11, 2015

Subsystems (2)

Maintainers (2)

STALE4261d

open the first message on its own page

Message details and related content
Fixes compiler warning:
error: unknown type name ‘size_t’

Signed-off-by: Mikko Rapeli <redacted>
---
 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
+
 #define _NSIG		64
 #define _NSIG_BPW	__BITS_PER_LONG
 #define _NSIG_WORDS	(_NSIG / _NSIG_BPW)
-- 
2.1.4
Message details and related content
On Tuesday 17 February 2015 00:05:36 Mikko Rapeli wrote:
quoted hunk
Fixes compiler warning:
error: unknown type name ‘size_t’

Signed-off-by: Mikko Rapeli <redacted>
---
 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?

	Arnd
Message details and related content
On Tue, Feb 17, 2015 at 10:44:48AM +0100, Arnd Bergmann wrote:
On Tuesday 17 February 2015 00:05:36 Mikko Rapeli wrote:
quoted
Fixes compiler warning:
error: unknown type name ‘size_t’

Signed-off-by: Mikko Rapeli <redacted>
---
 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
Message details and related content
On Wednesday 11 March 2015 00:58:28 Mikko Rapeli wrote:
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__ */
Hmm, maybe that just needs to be removed as well, after we
have removed the function declaration that used to follow it
as part of this commit:

http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=9dc5c05f45ca8101025046cd

Using __kernel_size_t would work here as well, but I suspect that
the entire structure is useless as it is not used by kernel or
user space, and kexec_tools has its own copy of the structure.

	Arnd
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help