From patchwork Wed Jul 13 20:45:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zack Weinberg X-Patchwork-Id: 13785 Received: (qmail 27695 invoked by alias); 13 Jul 2016 20:46:08 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 27426 invoked by uid 89); 13 Jul 2016 20:46:07 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.7 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 spammy=Duplicate, Client X-HELO: mailbackend.panix.com From: Zack Weinberg To: libc-alpha@sourceware.org Subject: [PATCH 2/4] Installed-header compilation hygiene, 2/4 (struct osockaddr). Date: Wed, 13 Jul 2016 16:45:59 -0400 Message-Id: <2af4c6fd5f5c6e98426e2d5c967a7341dbca19e2.1468441534.git.zackw@panix.com> In-Reply-To: References: 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 #include +#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 #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