diff --git a/src/unix/internal.h b/src/unix/internal.h index 492efdad..42283ca2 100644 --- a/src/unix/internal.h +++ b/src/unix/internal.h @@ -25,6 +25,8 @@ #include "uv-common.h" #include "uv-eio.h" +#include /* offsetof */ + #if defined(__linux__) #include @@ -59,6 +61,17 @@ # define HAVE_FUTIMES #endif +#define container_of(ptr, type, member) \ + ((type *) ((char *) (ptr) - offsetof(type, member))) + +#define SAVE_ERRNO(block) \ + do { \ + int _saved_errno = errno; \ + do { block; } while (0); \ + errno = _saved_errno; \ + } \ + while (0); + /* flags */ enum { UV_CLOSING = 0x00000001, /* uv_close() called but not finished. */ diff --git a/src/unix/linux.c b/src/unix/linux.c index e0f72bb0..0b4ce64d 100644 --- a/src/unix/linux.c +++ b/src/unix/linux.c @@ -22,7 +22,6 @@ #include "internal.h" #include -#include #include #include #include @@ -35,17 +34,6 @@ #undef NANOSEC #define NANOSEC 1000000000 -#define container_of(ptr, type, member) \ - ((type *) ((char *) (ptr) - offsetof(type, member))) - -#define SAVE_ERRNO(block) \ - do { \ - int _saved_errno = errno; \ - do { block; } while (0); \ - errno = _saved_errno; \ - } \ - while (0); - /* Don't look aghast, this is exactly how glibc's basename() works. */ static char* basename_r(const char* path) {