From patchwork Tue Apr 11 10:33:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 749399 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3w2Nh26bbDz9sNK for ; Tue, 11 Apr 2017 20:33:54 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="rNmMASJl"; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:to:from:subject:message-id:date:mime-version :content-type; q=dns; s=default; b=MxA9FdH8r0dZBv/R6YsofDtx57MTa A4TiaQdon2aTmocLdda9rjlbXE3Y4OhyyUd4ybgi9wJxjWH80nAep9G0DsHvpBpr PJAS4LxVkPvEAWTwWzbPB/6Hd7WhIgoqQBAmwkIOz8C68lsgSRbT8VLHBWJaPxhY /AjziimrO09dVk= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:to:from:subject:message-id:date:mime-version :content-type; s=default; bh=Dys0JKoOHGu5/py2GSlgUmBjUZE=; b=rNm MASJlh83MusRjTyet+dtUtCXOTzmNY5yTrPNBg1jmeKzQPM8vi6oJJc0XEc+eN8s hgDhZhRAlJ8ciIYpeyQ+GLjUxjZxRcGZ/CQTtHY2JadP+FN+Sn2RmeCEzTovJNje izqp5gu+WLpm0RW7VyKMpX2v00UNqjoySqllpF5g= Received: (qmail 31217 invoked by alias); 11 Apr 2017 10:33:45 -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 30822 invoked by uid 89); 11 Apr 2017 10:33:39 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=tcp X-HELO: mx1.redhat.com DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 2F58C7E9D8 Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=fweimer@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 2F58C7E9D8 To: GNU C Library From: Florian Weimer Subject: [PATCH] Further cleanup Message-ID: Date: Tue, 11 Apr 2017 12:33:36 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 I'm not sure if this is okay from an API compatibility point of view. _res._flags is supposed to be private to the resolver, so the RES_F_* constants should not be in an installed header file, but we nevertheless included them in . The other cleanups definitions should be uncontroversial. The function declarations were discovered by comparing the symbol lists of libc and libresolv with an C AST dump after parsing . Thanks, Florian resolv: Remove internal and unused definitions from The RES_F_* constants are only used with the private _res._flags member. RES_EXHAUSTIVE is unused. The removed function declarations refer to functions not actually exported by glibc, so they are unusable by applications. 2017-04-11 Florian Weimer * resolv/resolv.h (RES_EXHAUSTIVE, p_section, res_npquery) (res_nisourserver): Remove definition. (p_section, res_npquery, res_nisourserver): Remove declaration. (RES_F_VC, RES_F_CONN, RES_F_EDNS0ERR): Move ... * resolv/resolv-internal.h (RES_F_VC, RES_F_CONN, RES_F_EDNS0ERR): ... here. * resolv/res_send.c: Include instead of . * resolv/res_query.c: Likewise. * resolv/res_debug.c (p_section): Define as static. diff --git a/resolv/res_debug.c b/resolv/res_debug.c index 14557dd..e23559b 100644 --- a/resolv/res_debug.c +++ b/resolv/res_debug.c @@ -115,6 +115,8 @@ extern const char *_res_sectioncodes[] attribute_hidden; +static const char *p_section(int section, int opcode); + /* * Print the current options. */ @@ -512,7 +514,7 @@ libresolv_hidden_def (p_type) /* * Return a string for the type. */ -const char * +static const char * p_section(int section, int opcode) { const struct res_sym *symbols; diff --git a/resolv/res_query.c b/resolv/res_query.c index 07dc6f6..6f3eada 100644 --- a/resolv/res_query.c +++ b/resolv/res_query.c @@ -74,6 +74,7 @@ #include #include #include +#include #include #include #include diff --git a/resolv/res_send.c b/resolv/res_send.c index 28c4cab..995e1be 100644 --- a/resolv/res_send.c +++ b/resolv/res_send.c @@ -101,7 +101,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/resolv/resolv-internal.h b/resolv/resolv-internal.h index 99fc17c..d35df1c 100644 --- a/resolv/resolv-internal.h +++ b/resolv/resolv-internal.h @@ -22,6 +22,12 @@ #include #include +/* Resolver flags. Used for _flags in struct __res_state. */ +#define RES_F_VC 0x00000001 /* Socket is TCP. */ +#define RES_F_CONN 0x00000002 /* Socket is connected. */ +#define RES_F_EDNS0ERR 0x00000004 /* EDNS0 caused errors. */ + + /* Internal version of RES_USE_INET6 which does not trigger a deprecation warning. */ #define DEPRECATED_RES_USE_INET6 0x00002000 diff --git a/resolv/resolv.h b/resolv/resolv.h index 7809e2e..9fef8e9 100644 --- a/resolv/resolv.h +++ b/resolv/resolv.h @@ -163,16 +163,6 @@ struct res_sym { }; /* - * Resolver flags (used to be discrete per-module statics ints). - */ -#define RES_F_VC 0x00000001 /* socket is TCP */ -#define RES_F_CONN 0x00000002 /* socket is connected */ -#define RES_F_EDNS0ERR 0x00000004 /* EDNS0 caused errors */ - -/* res_findzonecut() options */ -#define RES_EXHAUSTIVE 0x00000001 /* always do all queries */ - -/* * Resolver options (keep these in synch with res_debug.c, please) */ #define RES_INIT 0x00000001 /* address initialized */ @@ -285,7 +275,6 @@ __END_DECLS #define p_fqnname __p_fqnname #define p_option __p_option #define p_secstodate __p_secstodate -#define p_section __p_section #define p_time __p_time #define p_type __p_type #define p_rcode __p_rcode @@ -299,12 +288,10 @@ __END_DECLS #define res_nclose __res_nclose #define res_ninit __res_ninit #define res_nmkquery __res_nmkquery -#define res_npquery __res_npquery #define res_nquery __res_nquery #define res_nquerydomain __res_nquerydomain #define res_nsearch __res_nsearch #define res_nsend __res_nsend -#define res_nisourserver __res_nisourserver #define res_ownok __res_ownok #define res_queriesmatch __res_queriesmatch #define res_randomid __res_randomid @@ -356,14 +343,9 @@ int res_queriesmatch (const unsigned char *, const unsigned char *, const unsigned char *, const unsigned char *) __THROW; -const char * p_section (int __section, int __opcode) __THROW; /* Things involving a resolver context. */ int res_ninit (res_state) __THROW; -int res_nisourserver (const res_state, - const struct sockaddr_in *) __THROW; void fp_resstat (const res_state, FILE *) __THROW; -void res_npquery (const res_state, const unsigned char *, int, - FILE *) __THROW; const char * res_hostalias (const res_state, const char *, char *, size_t) __THROW; int res_nquery (res_state, const char *, int, int,