From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10858 invoked by alias); 2 Jul 2019 17:25:25 -0000 Mailing-List: contact glibc-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: , Sender: glibc-cvs-owner@sourceware.org List-Subscribe: Received: (qmail 9427 invoked by uid 9943); 2 Jul 2019 17:25:23 -0000 Date: Tue, 02 Jul 2019 17:25:00 -0000 Message-ID: <20190702172523.9422.qmail@sourceware.org> Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Adhemerval Zanella To: glibc-cvs@sourceware.org Subject: [glibc/azanella/master-posix_clock] support: Add xdlvsym function X-Act-Checkin: glibc X-Git-Author: Florian Weimer X-Git-Refname: refs/heads/azanella/master-posix_clock X-Git-Oldrev: 5a659ccc0ec217ab02a4c273a1f6d346a359560a X-Git-Newrev: 17432d7150bdab3bce2ea66c70ad6c920f54077a X-SW-Source: 2019-q3/txt/msg00010.txt.bz2 https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=17432d7150bdab3bce2ea66c70ad6c920f54077a commit 17432d7150bdab3bce2ea66c70ad6c920f54077a Author: Florian Weimer Date: Fri Jun 28 10:15:30 2019 +0200 support: Add xdlvsym function Diff: --- ChangeLog | 5 +++++ support/xdlfcn.c | 20 ++++++++++++++++++++ support/xdlfcn.h | 1 + 3 files changed, 26 insertions(+) diff --git a/ChangeLog b/ChangeLog index a354988..07d1bd6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2019-06-28 Florian Weimer + * support/xdlfcn.h (xdlvsym): Declare function. + * support/xdlfcn.c (xdlvsym): Define funciton. + +2019-06-28 Florian Weimer + [BZ #24744] io: Remove the copy_file_range emulation. * sysdeps/unix/sysv/linux/copy_file_range.c (copy_file_range): Do diff --git a/support/xdlfcn.c b/support/xdlfcn.c index b2e5c21..11fe489 100644 --- a/support/xdlfcn.c +++ b/support/xdlfcn.c @@ -51,6 +51,26 @@ xdlsym (void *handle, const char *symbol) return sym; } +void * +xdlvsym (void *handle, const char *symbol, const char *version) +{ + /* Clear any pending errors. */ + dlerror (); + + void *sym = dlvsym (handle, symbol, version); + + if (sym == NULL) + { + const char *error = dlerror (); + if (error != NULL) + FAIL_EXIT1 ("error: dlvsym: %s\n", error); + /* If there was no error, we found a NULL symbol. Return the + NULL value in this case. */ + } + + return sym; +} + void xdlclose (void *handle) { diff --git a/support/xdlfcn.h b/support/xdlfcn.h index c9cd810..7f8d493 100644 --- a/support/xdlfcn.h +++ b/support/xdlfcn.h @@ -27,6 +27,7 @@ __BEGIN_DECLS void *xdlopen (const char *filename, int flags); void *xdlmopen (Lmid_t lmid, const char *filename, int flags); void *xdlsym (void *handle, const char *symbol); +void *xdlvsym (void *handle, const char *symbol, const char *version); void xdlclose (void *handle); __END_DECLS