add offsetof helper
This commit is contained in:
1 parent
963cfaa843
commit
7f039d6033
1 file changed
+7
@@ -31,6 +31,7 @@
|
||||
|
||||
#ifndef WIN32
|
||||
#include <unistd.h>
|
||||
#include <stddef.h>
|
||||
#ifndef DARWIN
|
||||
#include <strings.h>
|
||||
#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
|
||||
|
||||
|
||||
Reference in new issue
Block a user