From 5d4e7d8e7e1655b56185b6fba36dc55445d5bb6f Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Fri, 2 Jan 2009 02:34:03 -0500 Subject: [PATCH] linux/stddef.h: export offsetof() to userspace Some userspace headers (like fuse.h) utilize the offsetof() macro. Some userspace packages (like lkcd) expect linux/stddef.h to provide this as well. Signed-off-by: Mike Frysinger --- include/linux/stddef.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/include/linux/stddef.h b/include/linux/stddef.h index 1747b67..f69354b 100644 --- a/include/linux/stddef.h +++ b/include/linux/stddef.h @@ -16,9 +16,12 @@ enum { #undef offsetof #ifdef __compiler_offsetof #define offsetof(TYPE,MEMBER) __compiler_offsetof(TYPE,MEMBER) -#else -#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) #endif #endif /* __KERNEL__ */ +#include /* newer gcc includes this */ +#ifndef offsetof +#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) +#endif + #endif -- 1.7.9.7