diff options
author | Ulrich Drepper <drepper@redhat.com> | 1999-06-28 15:52:36 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 1999-06-28 15:52:36 +0000 |
commit | b3fc5f84d13573b9494fb1f0db9b5e80679e5098 (patch) | |
tree | dc0a71f8e940437cbc744a1b2fb9e8a01913a5a8 /iconv/gconv_dl.c | |
parent | 738d1a5a43e97ee81d7b62a3c7a5f754f5b51b82 (diff) | |
download | glibc-b3fc5f84d13573b9494fb1f0db9b5e80679e5098.tar.gz |
Update.
* sysdeps/libm-ieee754/e_gamma_r.c: Initialize *signgamp for NaN
returns.
* sysdeps/libm-ieee754/e_gammaf_r.c: Likewise.
* sysdeps/libm-ieee754/e_gammal_r.c: Likewise.
Reported by John Reiser <jreiser@BitWagon.com> [PR libc/1185].
* elf/dl-dst.h: Fix typo.
* elf/dl-open.c: Likewise.
1999-06-26 Zack Weinberg <zack@rabi.columbia.edu>
* elf/dl-libc.c: New file, provides three functions:
__libc_dlopen, __libc_dlclose, __libc_dlsym.
* include/dlfcn.h: Prototype them. Prototype _dl_addr.
* elf/Makefile (routines): Add dl-libc.c.
* elf/dl-profstub.c (_dl_mcount_wrapper): Change type of
argument to void *.
* elf/ldsodefs.h: Change proto and use of _dl_mcount_wrapper to match.
* iconv/gconv.c: Include dlfcn.h.
* iconv/gconv_db.c: Likewise.
* malloc/mtrace.c: Likewise. Don't include ldsodefs.h.
* iconv/gconv_int.h (struct __gconv_loaded_object): Change
`handle' to a void *.
(__gconv_find_func): Delete prototype.
* iconv/gconv_dl.c: Don't include ldsodefs.h. Remove
dlerror_run and related functions and structs. Use
__libc_dlopen, __libc_dlsym, __libc_dlclose.
* nss/nsswitch.c: Likewise.
1999-06-28 Ulrich Drepper <drepper@cygnus.com>
Diffstat (limited to 'iconv/gconv_dl.c')
-rw-r--r-- | iconv/gconv_dl.c | 93 |
1 files changed, 9 insertions, 84 deletions
diff --git a/iconv/gconv_dl.c b/iconv/gconv_dl.c index dc90986077..7d327edc68 100644 --- a/iconv/gconv_dl.c +++ b/iconv/gconv_dl.c @@ -26,10 +26,8 @@ #include <bits/libc-lock.h> #include <sys/param.h> -#include <ldsodefs.h> #include <gconv_int.h> - /* This is a tuning parameter. If a transformation module is not used anymore it gets not immediately unloaded. Instead we wait a certain number of load attempts for further modules. If none of the @@ -39,13 +37,10 @@ before unloading. */ #define TRIES_BEFORE_UNLOAD 2 - /* Array of loaded objects. This is shared by all threads so we have to use semaphores to access it. */ static void *loaded; - - /* Comparison function for searching `loaded_object' tree. */ static int known_compare (const void *p1, const void *p2) @@ -58,70 +53,6 @@ known_compare (const void *p1, const void *p2) return (intptr_t) s1->handle - (intptr_t) s2->handle; } - -static void -do_open (void *a) -{ - struct __gconv_loaded_object *args = (struct __gconv_loaded_object *) a; - /* Open and relocate the shared object. */ - args->handle = _dl_open (args->name, RTLD_LAZY, NULL); -} - - -static int -internal_function -dlerror_run (void (*operate) (void *), void *args) -{ - char *last_errstring = NULL; - int result; - - (void) _dl_catch_error (&last_errstring, operate, args); - - result = last_errstring != NULL; - if (result) - free (last_errstring); - - return result; -} - - -struct get_sym_args -{ - /* Arguments to get_sym. */ - struct link_map *map; - const char *name; - - /* Return values of get_sym. */ - ElfW(Addr) loadbase; - const ElfW(Sym) *ref; -}; - -static void -get_sym (void *a) -{ - struct get_sym_args *args = (struct get_sym_args *) a; - args->ref = NULL; - args->loadbase = _dl_lookup_symbol (args->name, &args->ref, - args->map->l_local_scope, - args->map->l_name, 0); -} - - -void * -internal_function -__gconv_find_func (void *handle, const char *name) -{ - struct get_sym_args args; - - args.map = handle; - args.name = name; - - return (dlerror_run (get_sym, &args) ? NULL - : (void *) (args.loadbase + args.ref->st_value)); -} - - - /* Open the gconv database if necessary. A non-negative return value means success. */ struct __gconv_loaded_object * @@ -170,9 +101,10 @@ __gconv_find_shlib (const char *name) { if (found->counter < -TRIES_BEFORE_UNLOAD) { - if (dlerror_run (do_open, found) == 0) + found->handle = __libc_dlopen (found->name); + if (found->handle != NULL) { - found->fct = __gconv_find_func (found->handle, "gconv"); + found->fct = __libc_dlsym (found->handle, "gconv"); if (found->fct == NULL) { /* Argh, no conversion function. There is something @@ -182,10 +114,8 @@ __gconv_find_shlib (const char *name) } else { - found->init_fct = __gconv_find_func (found->handle, - "gconv_init"); - found->end_fct = __gconv_find_func (found->handle, - "gconv_end"); + found->init_fct = __libc_dlsym (found->handle, "gconv_init"); + found->end_fct = __libc_dlsym (found->handle, "gconv_end"); /* We have succeeded in loading the shared object. */ found->counter = 1; @@ -224,11 +154,8 @@ do_release_shlib (const void *nodep, VISIT value, int level) { if (--obj->counter < -TRIES_BEFORE_UNLOAD && obj->handle != NULL) { - /* Unload the shared object. We don't use the trick to - catch errors since in the case an error is signalled - something is really wrong. */ - _dl_close (obj->handle); - + /* Unload the shared object. */ + __libc_dlclose (obj->handle); obj->handle = NULL; } } @@ -258,11 +185,9 @@ do_release_all (void *nodep) { struct __gconv_loaded_object *obj = (struct __gconv_loaded_object *) nodep; - /* Unload the shared object. We don't use the trick to - catch errors since in the case an error is signalled - something is really wrong. */ + /* Unload the shared object. */ if (obj->handle != NULL) - _dl_close (obj->handle); + __libc_dlclose (obj->handle); free (obj); } |