#ifndef __COMMON_H #define __COMMON_H #define __init __attribute__((constructor)) #define __exit __attribute__((destructor)) #define __export __attribute__((visibility("default"))) #undef offsetof #ifdef __compiler_offsetof #define offsetof(TYPE,MEMBER) __compiler_offsetof(TYPE,MEMBER) #else #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) #endif #define container_of(ptr, type, member) ({ \ const typeof( ((type *)0)->member ) *__mptr = (ptr); \ (type *)( (char *)__mptr - offsetof(type,member) );}) #define likely(x) __builtin_expect((x),1) #define unlikely(x) __builtin_expect((x),0) extern int sock_fd; #endif