Portable build framework for OpenNTPD
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

24 lines
430 B

/*
* Public domain
* netinet/in.h compatibility shim
*/
#include_next <netinet/in.h>
#ifndef SA_LEN
static inline socklen_t sockaddr_len(void *a)
{
struct sockaddr *sa = a;
switch (sa->sa_family) {
case AF_INET:
return sizeof(struct sockaddr_in);
case AF_INET6:
return sizeof(struct sockaddr_in6);
case AF_UNSPEC:
return sizeof(struct sockaddr);
default:
return 0;
}
}
#define SA_LEN(X) sockaddr_len(X)
#endif