This commit is contained in:
Valery Yatsko 2008-04-05 23:58:49 +04:00
commit 1f42b65e8d

View file

@ -143,20 +143,20 @@ unsigned int geteuid(void);
#define lrb_assert(expr) assert(expr) #define lrb_assert(expr) assert(expr)
#endif #endif
#ifdef SOCKADDR_IN_HAS_LEN #ifdef RB_SOCKADDR_HAS_SA_LEN
#define ss_len sa_len #define ss_len sa_len
#endif #endif
#define GET_SS_FAMILY(x) (((struct sockaddr *)(x))->sa_family) #define GET_SS_FAMILY(x) (((struct sockaddr *)(x))->sa_family)
#ifdef SOCKADDR_IN_HAS_LEN #ifdef RB_SOCKADDR_HAS_SA_LEN
#define SET_SS_LEN(x, y) do { \ #define SET_SS_LEN(x, y) do { \
struct sockaddr *storage; \ struct sockaddr *storage; \
storage = ((struct sockaddr *)(x));\ storage = ((struct sockaddr *)(x));\
storage->sa_len = (y); \ storage->sa_len = (y); \
} while (0) } while (0)
#define GET_SS_LEN(x) (((struct sockaddr *)(x))->sa_len) #define GET_SS_LEN(x) (((struct sockaddr *)(x))->sa_len)
#else /* !SOCKADDR_IN_HAS_LEN */ #else /* !RB_SOCKADDR_HAS_SA_LEN */
#define SET_SS_LEN(x, y) (((struct sockaddr *)(x))->sa_family = ((struct sockaddr *)(x))->sa_family) #define SET_SS_LEN(x, y) (((struct sockaddr *)(x))->sa_family = ((struct sockaddr *)(x))->sa_family)
#ifdef RB_IPV6 #ifdef RB_IPV6
#define GET_SS_LEN(x) (((struct sockaddr *)(x))->sa_family == AF_INET ? sizeof(struct sockaddr_in) : sizeof(struct sockaddr_in6)) #define GET_SS_LEN(x) (((struct sockaddr *)(x))->sa_family == AF_INET ? sizeof(struct sockaddr_in) : sizeof(struct sockaddr_in6))