From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9035 invoked by alias); 30 Apr 2019 22:57:33 -0000 Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org Received: (qmail 8960 invoked by uid 89); 30 Apr 2019 22:57:33 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-24.9 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_HELO_PASS,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 spammy= X-HELO: userp2120.oracle.com Received: from userp2120.oracle.com (HELO userp2120.oracle.com) (156.151.31.85) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 30 Apr 2019 22:57:26 +0000 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x3UMsvP2101820 for ; Tue, 30 Apr 2019 22:57:25 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=corp-2018-07-02; bh=ndT94JShMaTApvSEqwmsaWoNrTpm5QGk0Zjo+ab86kw=; b=vTgCYCm+tv/6+Ib6JNmPHGoNRPuqfj9taflsIMXRV46cE996iC+QOOGn5pGnPx1ZhLnc Tlnp+Fi7lkTQzaSYQGiBMNzWUQvmkGvyWpr2rdk3QRnSO/fz+6DM+ClKBtTu3nkD5Ba1 6yMC3y5b0kGwcH8knZiorrHn57qjgzXogQHUxyN9/DjUkYEngul2mH12N3hE3yO9L3S4 o7g6ik/xF12NNB79DNmwjDqhHxmxr7URriSouHYeM8Zo1a6l47ncddkvhYPtZqReMdpq z1D7/87txql96WdumyZhwt8tx6+lou4YkTF0T1OvuFhpBzydXH/ws03k6K7hU8dBcKmm uA== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2120.oracle.com with ESMTP id 2s6xhyg6y3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 30 Apr 2019 22:57:24 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x3UMukHB006283 for ; Tue, 30 Apr 2019 22:57:24 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserp3020.oracle.com with ESMTP id 2s6xhg0q7n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 30 Apr 2019 22:57:24 +0000 Received: from abhmp0020.oracle.com (abhmp0020.oracle.com [141.146.116.26]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x3UMvNEu020964 for ; Tue, 30 Apr 2019 22:57:23 GMT Received: from loom.srvr.nix (/81.187.191.129) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 30 Apr 2019 15:57:23 -0700 From: Nick Alcock To: binutils@sourceware.org Subject: [PATCH 14/19] libctf: library version enforcement Date: Tue, 30 Apr 2019 22:57:00 -0000 Message-Id: <20190430225706.159422-15-nick.alcock@oracle.com> In-Reply-To: <20190430225706.159422-1-nick.alcock@oracle.com> References: <20190430225706.159422-1-nick.alcock@oracle.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2019-04/txt/msg00283.txt.bz2 This old Solaris standard allows callers to specify that they are expecting one particular API and/or CTF file format from the library. It is basically vestigial and I would be amenable to dropping it. libctf/ * ctf-lib.c (ctf_version): New. include/ * ctf-api.h (ctf_version): New. --- include/ctf-api.h | 1 + libctf/ctf-lib.c | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/include/ctf-api.h b/include/ctf-api.h index 0adecfee7e..3fcb1d2d6c 100644 --- a/include/ctf-api.h +++ b/include/ctf-api.h @@ -233,6 +233,7 @@ extern void *ctf_getspecific (ctf_file_t *); extern int ctf_errno (ctf_file_t *); extern const char *ctf_errmsg (int); +extern int ctf_version (int); extern int ctf_func_info (ctf_file_t *, unsigned long, ctf_funcinfo_t *); extern int ctf_func_args (ctf_file_t *, unsigned long, uint32_t, ctf_id_t *); diff --git a/libctf/ctf-lib.c b/libctf/ctf-lib.c index e60d2c985b..3a52539755 100644 --- a/libctf/ctf-lib.c +++ b/libctf/ctf-lib.c @@ -478,3 +478,29 @@ ctf_write (ctf_file_t *fp, int fd) return 0; } + +/* Set the CTF library client version to the specified version. If version is + zero, we just return the default library version number. */ +int +ctf_version (int version) +{ + if (version < 0) + { + errno = EINVAL; + return -1; + } + + if (version > 0) + { + /* Dynamic version switching is not presently supported. */ + if (version != CTF_VERSION) + { + errno = ENOTSUP; + return -1; + } + ctf_dprintf ("ctf_version: client using version %d\n", version); + _libctf_version = version; + } + + return _libctf_version; +} -- 2.21.0.237.gd0cfaa883d