(do_release_all): Add __libc_freeres_fn_section.

This commit is contained in:
Ulrich Drepper 2004-08-04 21:58:10 +00:00
parent 01f7e92814
commit 7c11c4a146
9 changed files with 31 additions and 25 deletions

View File

@ -565,7 +565,7 @@ libc_hidden_def (_dl_close)
#ifdef USE_TLS
static bool
static bool __libc_freeres_fn_section
free_slotinfo (struct dtv_slotinfo_list **elemp)
{
size_t cnt;
@ -623,11 +623,12 @@ libc_freeres_fn (free_mem)
/* There was no initial TLS setup, it was set up later when
it used the normal malloc. */
free_slotinfo (&GL(dl_tls_dtv_slotinfo_list));
else
# endif
/* The first element of the list does not have to be deallocated.
It was allocated in the dynamic linker (i.e., with a different
malloc), and in the static library it's in .bss space. */
free_slotinfo (&GL(dl_tls_dtv_slotinfo_list)->next);
/* The first element of the list does not have to be deallocated.
It was allocated in the dynamic linker (i.e., with a different
malloc), and in the static library it's in .bss space. */
free_slotinfo (&GL(dl_tls_dtv_slotinfo_list)->next);
}
#endif
}

View File

@ -24,6 +24,7 @@
#include <string.h>
#include <sys/param.h>
#include <bits/libc-lock.h>
#include <locale/localeinfo.h>
#include <dlfcn.h>
#include <gconv_int.h>
@ -170,7 +171,7 @@ add_derivation (const char *fromset, const char *toset,
not all memory will be freed. */
}
static void
static void __libc_freeres_fn_section
free_derivation (void *p)
{
struct known_derivation *deriv = (struct known_derivation *) p;
@ -765,7 +766,7 @@ __gconv_close_transform (struct __gconv_step *steps, size_t nsteps)
/* Free the modules mentioned. */
static void
internal_function
internal_function __libc_freeres_fn_section
free_modules_db (struct gconv_module *node)
{
if (node->left != NULL)
@ -786,6 +787,10 @@ free_modules_db (struct gconv_module *node)
/* Free all resources if necessary. */
libc_freeres_fn (free_mem)
{
/* First free locale memory. This needs to be done before freeing derivations,
as ctype cleanup functions dereference steps arrays which we free below. */
_nl_locale_subfreeres ();
if (__gconv_alias_db != NULL)
__tdestroy (__gconv_alias_db, free);

View File

@ -1,5 +1,6 @@
/* Handle loading/unloading of shared object for transformation.
Copyright (C) 1997,1998,1999,2000,2001,2002 Free Software Foundation, Inc.
Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2004
Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@ -191,7 +192,7 @@ __gconv_release_shlib (struct __gconv_loaded_object *handle)
/* We run this if we debug the memory allocation. */
static void
static void __libc_freeres_fn_section
do_release_all (void *nodep)
{
struct __gconv_loaded_object *obj = (struct __gconv_loaded_object *) nodep;

View File

@ -315,6 +315,9 @@ extern struct locale_data *_nl_load_locale_from_archive (int category,
/* Subroutine of setlocale's __libc_subfreeres hook. */
extern void _nl_archive_subfreeres (void) attribute_hidden;
/* Subroutine of gconv-db's __libc_subfreeres hook. */
extern void _nl_locale_subfreeres (void) attribute_hidden;
/* Validate the contents of a locale file and set up the in-core
data structure to point into the data. This leaves the `alloc'
and `name' fields uninitialized, for the caller to fill in.

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1996-2001, 2002, 2003 Free Software Foundation, Inc.
/* Copyright (C) 1996-2001, 2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.org>, 1996.
@ -80,6 +80,7 @@ lr_create (FILE *fp, const char *fname, kw_hash_fct_t hf)
result->comment_char = '#';
result->escape_char = '\\';
result->translate_strings = 1;
result->return_widestr = 0;
n = getdelim (&result->buf, &result->bufsize, '\n', result->fp);
if (n < 0)

View File

@ -1,4 +1,5 @@
/* Copyright (C) 1991, 92, 1995-2000, 2002, 2003 Free Software Foundation, Inc.
/* Copyright (C) 1991, 1992, 1995-2000, 2002, 2003, 2004
Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@ -444,7 +445,7 @@ setlocale (int category, const char *locale)
}
libc_hidden_def (setlocale)
static void
static void __libc_freeres_fn_section
free_category (int category,
struct locale_data *here, struct locale_data *c_data)
{
@ -472,7 +473,10 @@ free_category (int category,
}
}
libc_freeres_fn (free_mem)
/* This is called from iconv/gconv_db.c's free_mem, as locales must
be freed before freeing gconv steps arrays. */
void __libc_freeres_fn_section
_nl_locale_subfreeres (void)
{
#ifdef NL_CURRENT_INDIRECT
/* We don't use the loop because we want to have individual weak

View File

@ -342,7 +342,7 @@ cannot handle old request version %d; current version is %d"),
{
if (req->type == INVALIDATE)
dbg_log ("\t%s (%s)", serv2str[req->type], (char *)key);
else if (req > LASTDBREQ && req < LASTREQ)
else if (req->type > LASTDBREQ && req->type < LASTREQ)
dbg_log ("\t%s", serv2str[req->type]);
else
dbg_log (_("\tinvalid request type %d"), req->type);

View File

@ -201,18 +201,9 @@ printf_size (FILE *fp, const struct printf_info *info, const void *const *args)
/* Prepare to print the number. We want to use `__printf_fp' so we
have to prepare a `printf_info' structure. */
fp_info = *info;
fp_info.spec = 'f';
fp_info.prec = info->prec < 0 ? 3 : info->prec;
fp_info.is_long_double = info->is_long_double;
fp_info.is_short = info->is_short;
fp_info.is_long = info->is_long;
fp_info.alt = info->alt;
fp_info.space = info->space;
fp_info.left = info->left;
fp_info.showsign = info->showsign;
fp_info.group = info->group;
fp_info.extra = info->extra;
fp_info.pad = info->pad;
fp_info.wide = wide;
if (fp_info.left && fp_info.pad == L' ')

View File

@ -62,7 +62,7 @@ main (void)
exit (4);
if ((mmap_data = (char *) mmap (NULL, fs.st_size, PROT_READ,
MAP_SHARED, fd, 0)) == NULL)
MAP_SHARED, fd, 0)) == MAP_FAILED)
{
if (errno == ENOSYS)
exit (0);