This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 2/4] Installed-header compilation hygiene, 2/4 (struct osockaddr).


This is a little ugly, but I don't see a cleaner alternative, and it
only affects things that probably nobody uses anymore anyway.

zw

	BZ #20366, 2/4 (struct osockaddr)

	* socket/sys/socket.h: Only define struct osockaddr if not already
	defined; guard macro is __struct_osockaddr_defined.
	* inet/protocols/talkd.h: Duplicate definition of struct osockaddr
	here, also guarded by __struct_osockaddr_defined.
---
 inet/protocols/talkd.h | 12 ++++++++++++
 socket/sys/socket.h    |  6 +++++-
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/inet/protocols/talkd.h b/inet/protocols/talkd.h
index 34e2654..99b241b 100644
--- a/inet/protocols/talkd.h
+++ b/inet/protocols/talkd.h
@@ -54,6 +54,18 @@
 #include <sys/socket.h>
 #include <stdint.h>
 
+#ifndef __struct_osockaddr_defined
+/* This is the 4.3 BSD `struct sockaddr' format, which is used as wire
+   format in the grotty old 4.3 `talk' protocol.  It's also defined in
+   sys/socket.h, but only under __USE_MISC.  */
+struct osockaddr
+  {
+    unsigned short int sa_family;
+    unsigned char sa_data[14];
+  };
+# define __struct_osockaddr_defined
+#endif
+
 /*
  * Client->server request message format.
  */
diff --git a/socket/sys/socket.h b/socket/sys/socket.h
index c9f0f50..dfdd8cd 100644
--- a/socket/sys/socket.h
+++ b/socket/sys/socket.h
@@ -38,13 +38,17 @@ __BEGIN_DECLS
 #include <bits/socket.h>
 
 #ifdef __USE_MISC
+# ifndef __struct_osockaddr_defined
 /* This is the 4.3 BSD `struct sockaddr' format, which is used as wire
-   format in the grotty old 4.3 `talk' protocol.  */
+   format in the grotty old 4.3 `talk' protocol.  It is also defined,
+   unconditionally, in protocols/talkd.h.  */
 struct osockaddr
   {
     unsigned short int sa_family;
     unsigned char sa_data[14];
   };
+#  define __struct_osockaddr_defined
+# endif
 #endif
 
 /* The following constants should be used for the second parameter of
-- 
2.8.1


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]