Re: uml fails to compile due to missing offsetof

From: Roland Dreier
Date: Sun Nov 19 2006 - 12:09:34 EST


> I fail to see how arch/um/sys-i386/user-offsets.c can compile since
> offsetof() was declared __KERNEL__ only in include/linux/stddef.h.
> Does it work for anyone else? If so, is linux/stddef.h or
> /usr/include/linux/stddef.h used during compilation?
> The x86_64 variant looks weird as well, linux/stddef.h is appearently
> included via some other headers.

Yes, the

#include <linux/stddef.h>

looks weird to me. AFAIK the C standard says that offsetof() comes
from plain old <stddef.h>. Does the (untested) patch below fix the
build for you?

diff --git a/arch/um/sys-i386/user-offsets.c b/arch/um/sys-i386/user-offsets.c
index 6f4ef2b..447306b 100644
--- a/arch/um/sys-i386/user-offsets.c
+++ b/arch/um/sys-i386/user-offsets.c
@@ -2,7 +2,7 @@ #include <stdio.h>
#include <signal.h>
#include <asm/ptrace.h>
#include <asm/user.h>
-#include <linux/stddef.h>
+#include <stddef.h>
#include <sys/poll.h>

#define DEFINE(sym, val) \
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/