Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/sys unconditionally define sockaddr_storage; this is wha...



details:   https://anonhg.NetBSD.org/src/rev/a8ce32544727
branches:  trunk
changeset: 991010:a8ce32544727
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Nov 02 20:35:51 2021 +0000

description:
unconditionally define sockaddr_storage; this is what linux and FreeBSD do
and it has been there since Issue 6:
https://pubs.opengroup.org/onlinepubs/009604599/basedefs/sys/socket.h.html

diffstat:

 sys/sys/socket.h |  12 +++++-------
 1 files changed, 5 insertions(+), 7 deletions(-)

diffs (42 lines):

diff -r f9f82a6381cb -r a8ce32544727 sys/sys/socket.h
--- a/sys/sys/socket.h  Tue Nov 02 20:12:25 2021 +0000
+++ b/sys/sys/socket.h  Tue Nov 02 20:35:51 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: socket.h,v 1.130 2021/10/12 17:06:26 christos Exp $    */
+/*     $NetBSD: socket.h,v 1.131 2021/11/02 20:35:51 christos Exp $    */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -287,17 +287,14 @@
 
 #endif /* _KERNEL */
 
-#if 1
 /*
  * RFC 2553: protocol-independent placeholder for socket addresses
  */
 #define _SS_MAXSIZE    128
 #define _SS_ALIGNSIZE  (sizeof(__int64_t))
 #define _SS_PAD1SIZE   (_SS_ALIGNSIZE - 2)
-#define _SS_PAD2SIZE   (_SS_MAXSIZE - 2 - \
-                               _SS_PAD1SIZE - _SS_ALIGNSIZE)
+#define _SS_PAD2SIZE   (_SS_MAXSIZE - 2 - _SS_PAD1SIZE - _SS_ALIGNSIZE)
 
-#if (_XOPEN_SOURCE - 0) >= 500 || defined(_NETBSD_SOURCE)
 struct sockaddr_storage {
        __uint8_t       ss_len;         /* address length */
        sa_family_t     ss_family;      /* address family */
@@ -305,10 +302,11 @@
        __int64_t     __ss_align;/* force desired structure storage alignment */
        char            __ss_pad2[_SS_PAD2SIZE];
 };
+
+#if defined(_NETBSD_SOURCE)
 #define        sstosa(__ss)    ((struct sockaddr *)(__ss))
 #define        sstocsa(__ss)   ((const struct sockaddr *)(__ss))
-#endif /* _XOPEN_SOURCE >= 500 || _NETBSD_SOURCE */
-#endif /* 1 */
+#endif /* _NETBSD_SOURCE */
 
 /*
  * Protocol families, same as address families for now.



Home | Main Index | Thread Index | Old Index