From 7f039d6033803cfd9d36e7031809e675a8762496 Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Mon, 18 Dec 2006 05:51:45 +0000 Subject: [PATCH] add offsetof helper --- include/sigar_private.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/sigar_private.h b/include/sigar_private.h index 99145273..1f8bed98 100644 --- a/include/sigar_private.h +++ b/include/sigar_private.h @@ -31,6 +31,7 @@ #ifndef WIN32 #include +#include #ifndef DARWIN #include #endif @@ -100,6 +101,12 @@ #define strnEQ(s1, s2, n) (strncmp(s1, s2, n) == 0) #endif +#ifdef offsetof +#define sigar_offsetof offsetof +#else +#define sigar_offsetof(type, field) ((size_t)(&((type *)0)->field)) +#endif + #define SIGAR_MSEC 1000L #define SIGAR_NSEC 1000000000L