Browse Source

Go back to original SA_LEN macro.

Due to some circular dependencies on Solaris, this needs to be defined
as a macro. We should just remove SA_LEN usage here next.
OPENBSD_5_7 5.7p2
Brent Cook 10 years ago
parent
commit
8dafd6324d
3 changed files with 15 additions and 25 deletions
  1. +1
    -1
      include/Makefile.am
  2. +0
    -24
      include/netinet/in.h
  3. +14
    -0
      include/sys/socket.h

+ 1
- 1
include/Makefile.am View File

@ -1,8 +1,8 @@
noinst_HEADERS =
noinst_HEADERS += signal.h
noinst_HEADERS += unistd.h
noinst_HEADERS += netinet/in.h
noinst_HEADERS += sys/queue.h
noinst_HEADERS += sys/socket.h
noinst_HEADERS += sys/types.h
noinst_HEADERS += sys/time.h
noinst_HEADERS += err.h


+ 0
- 24
include/netinet/in.h View File

@ -1,24 +0,0 @@
/*
* 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

+ 14
- 0
include/sys/socket.h View File

@ -0,0 +1,14 @@
/*
* Public domain
* sys/socket.h compatibility shim
*/
#include_next <sys/socket.h>
#ifndef SA_LEN
#define SA_LEN(X) \
(((struct sockaddr*)(X))->sa_family == AF_INET ? sizeof(struct sockaddr_in) : \
((struct sockaddr*)(X))->sa_family == AF_INET6 ? sizeof(struct sockaddr_in6) : \
((struct sockaddr*)(X))->sa_family == AF_UNSPEC ? sizeof(struct sockaddr) : \
sizeof(struct sockaddr))
#endif

Loading…
Cancel
Save