Update.
* iconv/gconv_db.c: Don't define lock as static. Rename to __gconv_lock and export from the file. * iconv/gconv_int.h: Declare __gconv_lock. * libio/iofclose.c [_LIBC] (_IO_new_fclose): Lock gconv lock before __gconv_release_step calls. Patch by Shunichi Sagawa <s-sagawa@jp.fujitsu.com>. * iconv/gconv_simple.c (internal_ucs4_loop): Fix typo in last change. * iconv/gconv_db.c
This commit is contained in:
parent
c1b202903d
commit
9e26f1295a
11
ChangeLog
11
ChangeLog
|
@ -1,5 +1,16 @@
|
||||||
2004-03-09 Ulrich Drepper <drepper@redhat.com>
|
2004-03-09 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
|
* iconv/gconv_db.c: Don't define lock as static. Rename to
|
||||||
|
__gconv_lock and export from the file.
|
||||||
|
* iconv/gconv_int.h: Declare __gconv_lock.
|
||||||
|
* libio/iofclose.c [_LIBC] (_IO_new_fclose): Lock gconv lock
|
||||||
|
before __gconv_release_step calls.
|
||||||
|
Patch by Shunichi Sagawa <s-sagawa@jp.fujitsu.com>.
|
||||||
|
|
||||||
|
* iconv/gconv_simple.c (internal_ucs4_loop): Fix typo in last change.
|
||||||
|
|
||||||
|
* iconv/gconv_db.c
|
||||||
|
|
||||||
* posix/Makefile (tests): Add tst-vfork1.
|
* posix/Makefile (tests): Add tst-vfork1.
|
||||||
* posix/tst-vfork1.c: New file.
|
* posix/tst-vfork1.c: New file.
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* Provide access to the collection of available transformation modules.
|
/* Provide access to the collection of available transformation modules.
|
||||||
Copyright (C) 1997,98,99,2000,2001,2002,2003 Free Software Foundation, Inc.
|
Copyright (C) 1997-2003, 2004 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ void *__gconv_alias_db;
|
||||||
struct gconv_module *__gconv_modules_db;
|
struct gconv_module *__gconv_modules_db;
|
||||||
|
|
||||||
/* We modify global data. */
|
/* We modify global data. */
|
||||||
__libc_lock_define_initialized (static, lock)
|
__libc_lock_define_initialized (, __gconv_lock)
|
||||||
|
|
||||||
|
|
||||||
/* Provide access to module database. */
|
/* Provide access to module database. */
|
||||||
|
@ -683,20 +683,20 @@ __gconv_find_transform (const char *toset, const char *fromset,
|
||||||
__libc_once (once, __gconv_read_conf);
|
__libc_once (once, __gconv_read_conf);
|
||||||
|
|
||||||
/* Acquire the lock. */
|
/* Acquire the lock. */
|
||||||
__libc_lock_lock (lock);
|
__libc_lock_lock (__gconv_lock);
|
||||||
|
|
||||||
result = __gconv_lookup_cache (toset, fromset, handle, nsteps, flags);
|
result = __gconv_lookup_cache (toset, fromset, handle, nsteps, flags);
|
||||||
if (result != __GCONV_NODB)
|
if (result != __GCONV_NODB)
|
||||||
{
|
{
|
||||||
/* We have a cache and could resolve the request, successful or not. */
|
/* We have a cache and could resolve the request, successful or not. */
|
||||||
__libc_lock_unlock (lock);
|
__libc_lock_unlock (__gconv_lock);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we don't have a module database return with an error. */
|
/* If we don't have a module database return with an error. */
|
||||||
if (__gconv_modules_db == NULL)
|
if (__gconv_modules_db == NULL)
|
||||||
{
|
{
|
||||||
__libc_lock_unlock (lock);
|
__libc_lock_unlock (__gconv_lock);
|
||||||
return __GCONV_NOCONV;
|
return __GCONV_NOCONV;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -715,7 +715,7 @@ __gconv_find_transform (const char *toset, const char *fromset,
|
||||||
&& strcmp (toset_expand, fromset_expand) == 0)))))
|
&& strcmp (toset_expand, fromset_expand) == 0)))))
|
||||||
{
|
{
|
||||||
/* Both character sets are the same. */
|
/* Both character sets are the same. */
|
||||||
__libc_lock_unlock (lock);
|
__libc_lock_unlock (__gconv_lock);
|
||||||
return __GCONV_NOCONV;
|
return __GCONV_NOCONV;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -723,7 +723,7 @@ __gconv_find_transform (const char *toset, const char *fromset,
|
||||||
handle, nsteps);
|
handle, nsteps);
|
||||||
|
|
||||||
/* Release the lock. */
|
/* Release the lock. */
|
||||||
__libc_lock_unlock (lock);
|
__libc_lock_unlock (__gconv_lock);
|
||||||
|
|
||||||
/* The following code is necessary since `find_derivation' will return
|
/* The following code is necessary since `find_derivation' will return
|
||||||
GCONV_OK even when no derivation was found but the same request
|
GCONV_OK even when no derivation was found but the same request
|
||||||
|
@ -743,7 +743,7 @@ __gconv_close_transform (struct __gconv_step *steps, size_t nsteps)
|
||||||
size_t cnt;
|
size_t cnt;
|
||||||
|
|
||||||
/* Acquire the lock. */
|
/* Acquire the lock. */
|
||||||
__libc_lock_lock (lock);
|
__libc_lock_lock (__gconv_lock);
|
||||||
|
|
||||||
#ifndef STATIC_GCONV
|
#ifndef STATIC_GCONV
|
||||||
cnt = nsteps;
|
cnt = nsteps;
|
||||||
|
@ -757,7 +757,7 @@ __gconv_close_transform (struct __gconv_step *steps, size_t nsteps)
|
||||||
__gconv_release_cache (steps, nsteps);
|
__gconv_release_cache (steps, nsteps);
|
||||||
|
|
||||||
/* Release the lock. */
|
/* Release the lock. */
|
||||||
__libc_lock_unlock (lock);
|
__libc_lock_unlock (__gconv_lock);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (C) 1997-2002, 2003 Free Software Foundation, Inc.
|
/* Copyright (C) 1997-2002, 2003, 2004 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@
|
||||||
|
|
||||||
#include "gconv.h"
|
#include "gconv.h"
|
||||||
#include <stdlib.h> /* For alloca used in macro below. */
|
#include <stdlib.h> /* For alloca used in macro below. */
|
||||||
|
#include <bits/libc-lock.h>
|
||||||
|
|
||||||
__BEGIN_DECLS
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
@ -124,6 +125,9 @@ extern struct gconv_module *__gconv_modules_db attribute_hidden;
|
||||||
/* Value of the GCONV_PATH environment variable. */
|
/* Value of the GCONV_PATH environment variable. */
|
||||||
extern const char *__gconv_path_envvar attribute_hidden;
|
extern const char *__gconv_path_envvar attribute_hidden;
|
||||||
|
|
||||||
|
/* Lock for the conversion database content. */
|
||||||
|
__libc_lock_define (extern, __gconv_lock);
|
||||||
|
|
||||||
|
|
||||||
/* The gconv functions expects the name to be in upper case and complete,
|
/* The gconv functions expects the name to be in upper case and complete,
|
||||||
including the trailing slashes if necessary. */
|
including the trailing slashes if necessary. */
|
||||||
|
|
|
@ -91,7 +91,6 @@ internal_ucs4_loop (struct __gconv_step *step,
|
||||||
|
|
||||||
for (cnt = 0; cnt < n_convert; ++cnt, inptr += 4)
|
for (cnt = 0; cnt < n_convert; ++cnt, inptr += 4)
|
||||||
*outptr32++ = bswap_32 (*(const uint32_t *) inptr);
|
*outptr32++ = bswap_32 (*(const uint32_t *) inptr);
|
||||||
outptr =
|
|
||||||
|
|
||||||
*inptrp = inptr;
|
*inptrp = inptr;
|
||||||
*outptrp = (unsigned char *) outptr32;
|
*outptrp = (unsigned char *) outptr32;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (C) 1993,1995,1997-2001,2002,2003 Free Software Foundation, Inc.
|
/* Copyright (C) 1993,1995,1997-2003,2004 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
|
@ -71,8 +71,10 @@ _IO_new_fclose (fp)
|
||||||
the conversion functions. */
|
the conversion functions. */
|
||||||
struct _IO_codecvt *cc = fp->_codecvt;
|
struct _IO_codecvt *cc = fp->_codecvt;
|
||||||
|
|
||||||
|
__libc_lock_lock (__gconv_lock);
|
||||||
__gconv_release_step (cc->__cd_in.__cd.__steps);
|
__gconv_release_step (cc->__cd_in.__cd.__steps);
|
||||||
__gconv_release_step (cc->__cd_out.__cd.__steps);
|
__gconv_release_step (cc->__cd_out.__cd.__steps);
|
||||||
|
__libc_lock_unlock (__gconv_lock);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue