Update.
2002-06-17 Jakub Jelinek <jakub@redhat.com> * elf/dl-lookup.c (_dl_debug_bindings): Use type_class 4 for TLS lookups. * elf/rtld.c (dl_main): Move TLS setup code before LD_TRACE_PRELINKING code. Print TLS modid and offset for modules containing PT_TLS segments. 2002-06-09 Jakub Jelinek <jakub@redhat.com> * sysdeps/unix/sysv/linux/i386/dl-brk.c: Move... * sysdeps/unix/sysv/linux/dl-brk.c: ...here. * sysdeps/unix/sysv/linux/i386/dl-sbrk.c: Move... * sysdeps/unix/sysv/linux/dl-sbrk.c: ...here. 2002-06-07 Jakub Jelinek <jakub@redhat.com> * nss/getXXbyYY_r.c (NEW, NEW1): Define. (NEW (REENTRANT_NAME)): Strong alias to INTERNAL (REENTRANT_NAME). (REENTRANT_NAME@@GLIBC_2.1.2): Use NEW (REENTRANT_NAME). * nss/getXXent_r.c (NEW, NEW1): Define. (NEW (REENTRANT_GETNAME)): Strong alias to INTERNAL (REENTRANT_GETNAME). (REENTRANT_GETNAME@@GLIBC_2.1.2): Use NEW (REENTRANT_GETNAME). 2002-06-21 Ulrich Drepper <drepper@redhat.com> * libio/fileops.c (_IO_file_setbuf_mmap): New function. (_IO_file_jumps_mmap): Use it. * libio/iosetvbuf.c: Don't call _IO_WSETBUF. * libio/libioP.h: Remove _IO_wdefault_setbuf and _IO_wdefault_setbuf_internal prorotypes. Add _IO_file_setbuf_mmap prototype. * libio/wfileops.c (_IO_wfile_setbuf): Removed. (_IO_wfile_jumps_mmap): Don't use it anymore. * libio/wgenops.c (_IO_wdefault_setbuf): Removed. * libio/memstream.c (_IO_wmem_jumps): Use _IO_default_setbuf not _IO_wdefault_setbuf. * libio/vswprintf.c (_IO_wstrn_jumps): Likewise. * libio/wstrops.c (_IO_wstr_jumps): Likewise. * stdio-common/vfprintf.c (_IO_helper_jumps): Likewise. 2002-06-05 Jakub Jelinek <jakub@redhat.com> * libio/Makefile (tests): Add tst-mmap-setvbuf. * libio/tst-mmap-setvbuf.c: New test.
This commit is contained in:
parent
90f0056f74
commit
bff334e090
47
ChangeLog
47
ChangeLog
@ -1,3 +1,50 @@
|
|||||||
|
2002-06-17 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
|
* elf/dl-lookup.c (_dl_debug_bindings): Use type_class 4 for TLS
|
||||||
|
lookups.
|
||||||
|
* elf/rtld.c (dl_main): Move TLS setup code before LD_TRACE_PRELINKING
|
||||||
|
code. Print TLS modid and offset for modules containing PT_TLS
|
||||||
|
segments.
|
||||||
|
|
||||||
|
2002-06-09 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
|
* sysdeps/unix/sysv/linux/i386/dl-brk.c: Move...
|
||||||
|
* sysdeps/unix/sysv/linux/dl-brk.c: ...here.
|
||||||
|
* sysdeps/unix/sysv/linux/i386/dl-sbrk.c: Move...
|
||||||
|
* sysdeps/unix/sysv/linux/dl-sbrk.c: ...here.
|
||||||
|
|
||||||
|
2002-06-07 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
|
* nss/getXXbyYY_r.c (NEW, NEW1): Define.
|
||||||
|
(NEW (REENTRANT_NAME)): Strong alias to INTERNAL (REENTRANT_NAME).
|
||||||
|
(REENTRANT_NAME@@GLIBC_2.1.2): Use NEW (REENTRANT_NAME).
|
||||||
|
* nss/getXXent_r.c (NEW, NEW1): Define.
|
||||||
|
(NEW (REENTRANT_GETNAME)): Strong alias to
|
||||||
|
INTERNAL (REENTRANT_GETNAME).
|
||||||
|
(REENTRANT_GETNAME@@GLIBC_2.1.2): Use NEW (REENTRANT_GETNAME).
|
||||||
|
|
||||||
|
2002-06-21 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
|
* libio/fileops.c (_IO_file_setbuf_mmap): New function.
|
||||||
|
(_IO_file_jumps_mmap): Use it.
|
||||||
|
* libio/iosetvbuf.c: Don't call _IO_WSETBUF.
|
||||||
|
* libio/libioP.h: Remove _IO_wdefault_setbuf and
|
||||||
|
_IO_wdefault_setbuf_internal prorotypes. Add _IO_file_setbuf_mmap
|
||||||
|
prototype.
|
||||||
|
* libio/wfileops.c (_IO_wfile_setbuf): Removed.
|
||||||
|
(_IO_wfile_jumps_mmap): Don't use it anymore.
|
||||||
|
* libio/wgenops.c (_IO_wdefault_setbuf): Removed.
|
||||||
|
* libio/memstream.c (_IO_wmem_jumps): Use _IO_default_setbuf not
|
||||||
|
_IO_wdefault_setbuf.
|
||||||
|
* libio/vswprintf.c (_IO_wstrn_jumps): Likewise.
|
||||||
|
* libio/wstrops.c (_IO_wstr_jumps): Likewise.
|
||||||
|
* stdio-common/vfprintf.c (_IO_helper_jumps): Likewise.
|
||||||
|
|
||||||
|
2002-06-05 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
|
* libio/Makefile (tests): Add tst-mmap-setvbuf.
|
||||||
|
* libio/tst-mmap-setvbuf.c: New test.
|
||||||
|
|
||||||
2002-06-21 Andreas Jaeger <aj@suse.de>
|
2002-06-21 Andreas Jaeger <aj@suse.de>
|
||||||
|
|
||||||
* sysdeps/i386/fpu/libm-test-ulps: Add some ulps from my P3.
|
* sysdeps/i386/fpu/libm-test-ulps: Add some ulps from my P3.
|
||||||
|
@ -663,6 +663,12 @@ _dl_debug_bindings (const char *undef_name, struct link_map *undef_map,
|
|||||||
(int) sizeof (ElfW(Addr)) * 2,
|
(int) sizeof (ElfW(Addr)) * 2,
|
||||||
(ElfW(Addr)) (val.s ? val.s->st_value : 0));
|
(ElfW(Addr)) (val.s ? val.s->st_value : 0));
|
||||||
|
|
||||||
|
#ifdef USE_TLS
|
||||||
|
if (value->s
|
||||||
|
&& (__builtin_expect (ELFW(ST_TYPE) (value->s->st_info)
|
||||||
|
== STT_TLS, 0)))
|
||||||
|
type_class = 4;
|
||||||
|
#endif
|
||||||
_dl_printf ("/%x %s\n", type_class, undef_name);
|
_dl_printf ("/%x %s\n", type_class, undef_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
150
elf/rtld.c
150
elf/rtld.c
@ -1006,6 +1006,76 @@ of this helper program; chances are you did not intend to run this program.\n\
|
|||||||
_dl_receive_error (print_missing_version, version_check_doit, &args);
|
_dl_receive_error (print_missing_version, version_check_doit, &args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef USE_TLS
|
||||||
|
/* Now it is time to determine the layout of the static TLS block
|
||||||
|
and allocate it for the initial thread. Note that we always
|
||||||
|
allocate the static block, we never defer it even if no
|
||||||
|
DF_STATIC_TLS bit is set. The reason is that we know glibc will
|
||||||
|
use the static model. First add the dynamic linker to the list
|
||||||
|
if it also uses TLS. */
|
||||||
|
if (GL(dl_rtld_map).l_tls_blocksize != 0)
|
||||||
|
/* Assign a module ID. */
|
||||||
|
GL(dl_rtld_map).l_tls_modid = _dl_next_tls_modid ();
|
||||||
|
|
||||||
|
# ifndef SHARED
|
||||||
|
/* If dynamic loading of modules with TLS is impossible we do not
|
||||||
|
have to initialize any of the TLS functionality unless any of the
|
||||||
|
initial modules uses TLS. */
|
||||||
|
if (GL(dl_tls_max_dtv_idx) > 0)
|
||||||
|
# endif
|
||||||
|
{
|
||||||
|
struct link_map *l;
|
||||||
|
size_t nelem;
|
||||||
|
struct dtv_slotinfo *slotinfo;
|
||||||
|
|
||||||
|
/* Number of elements in the static TLS block. */
|
||||||
|
GL(dl_tls_static_nelem) = GL(dl_tls_max_dtv_idx);
|
||||||
|
|
||||||
|
/* Allocate the array which contains the information about the
|
||||||
|
dtv slots. We allocate a few entries more than needed to
|
||||||
|
avoid the need for reallocation. */
|
||||||
|
nelem = GL(dl_tls_max_dtv_idx) + 1 + TLS_SLOTINFO_SURPLUS;
|
||||||
|
|
||||||
|
/* Allocate. */
|
||||||
|
GL(dl_tls_dtv_slotinfo_list) = (struct dtv_slotinfo_list *)
|
||||||
|
malloc (sizeof (struct dtv_slotinfo_list)
|
||||||
|
+ nelem * sizeof (struct dtv_slotinfo));
|
||||||
|
/* No need to check the return value. If memory allocation failed
|
||||||
|
the program would have been terminated. */
|
||||||
|
|
||||||
|
slotinfo = memset (GL(dl_tls_dtv_slotinfo_list)->slotinfo, '\0',
|
||||||
|
nelem * sizeof (struct dtv_slotinfo));
|
||||||
|
GL(dl_tls_dtv_slotinfo_list)->len = nelem;
|
||||||
|
GL(dl_tls_dtv_slotinfo_list)->next = NULL;
|
||||||
|
|
||||||
|
/* Fill in the information from the loaded modules. */
|
||||||
|
for (l = GL(dl_loaded), i = 0; l != NULL; l = l->l_next)
|
||||||
|
if (l->l_tls_blocksize != 0)
|
||||||
|
/* This is a module with TLS data. Store the map reference.
|
||||||
|
The generation counter is zero. */
|
||||||
|
slotinfo[++i].map = l;
|
||||||
|
assert (i == GL(dl_tls_max_dtv_idx));
|
||||||
|
|
||||||
|
/* Computer the TLS offsets for the various blocks. We call this
|
||||||
|
function even if none of the modules available at startup time
|
||||||
|
uses TLS to initialize some variables. */
|
||||||
|
_dl_determine_tlsoffset ();
|
||||||
|
|
||||||
|
/* Construct the static TLS block and the dtv for the initial
|
||||||
|
thread. For some platforms this will include allocating memory
|
||||||
|
for the thread descriptor. The memory for the TLS block will
|
||||||
|
never be freed. It should be allocated accordingly. The dtv
|
||||||
|
array can be changed if dynamic loading requires it. */
|
||||||
|
tcbp = INTUSE(_dl_allocate_tls) ();
|
||||||
|
if (tcbp == NULL)
|
||||||
|
_dl_fatal_printf ("\
|
||||||
|
cannot allocate TLS data structures for inital thread");
|
||||||
|
|
||||||
|
/* And finally install it for the main thread. */
|
||||||
|
TLS_INIT_TP (tcbp);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (__builtin_expect (mode, normal) != normal)
|
if (__builtin_expect (mode, normal) != normal)
|
||||||
{
|
{
|
||||||
/* We were run just to list the shared libraries. It is
|
/* We were run just to list the shared libraries. It is
|
||||||
@ -1032,7 +1102,7 @@ of this helper program; chances are you did not intend to run this program.\n\
|
|||||||
}
|
}
|
||||||
if (_dl_name_match_p (GL(dl_trace_prelink), l))
|
if (_dl_name_match_p (GL(dl_trace_prelink), l))
|
||||||
GL(dl_trace_prelink_map) = l;
|
GL(dl_trace_prelink_map) = l;
|
||||||
_dl_printf ("\t%s => %s (0x%0*Zx, 0x%0*Zx)\n",
|
_dl_printf ("\t%s => %s (0x%0*Zx, 0x%0*Zx)",
|
||||||
l->l_libname->name[0] ? l->l_libname->name
|
l->l_libname->name[0] ? l->l_libname->name
|
||||||
: rtld_progname ?: "<main program>",
|
: rtld_progname ?: "<main program>",
|
||||||
l->l_name[0] ? l->l_name
|
l->l_name[0] ? l->l_name
|
||||||
@ -1041,6 +1111,14 @@ of this helper program; chances are you did not intend to run this program.\n\
|
|||||||
l->l_map_start,
|
l->l_map_start,
|
||||||
(int) sizeof l->l_addr * 2,
|
(int) sizeof l->l_addr * 2,
|
||||||
l->l_addr);
|
l->l_addr);
|
||||||
|
#ifdef USE_TLS
|
||||||
|
if (l->l_tls_modid)
|
||||||
|
_dl_printf (" TLS(0x%Zx, 0x%0*Zx)\n", l->l_tls_modid,
|
||||||
|
(int) sizeof l->l_tls_offset * 2,
|
||||||
|
l->l_tls_offset);
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
_dl_printf ("\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1182,76 +1260,6 @@ of this helper program; chances are you did not intend to run this program.\n\
|
|||||||
_exit (0);
|
_exit (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_TLS
|
|
||||||
/* Now it is time to determine the layout of the static TLS block
|
|
||||||
and allocate it for the initial thread. Note that we always
|
|
||||||
allocate the static block, we never defer it even if no
|
|
||||||
DF_STATIC_TLS bit is set. The reason is that we know glibc will
|
|
||||||
use the static model. First add the dynamic linker to the list
|
|
||||||
if it also uses TLS. */
|
|
||||||
if (GL(dl_rtld_map).l_tls_blocksize != 0)
|
|
||||||
/* Assign a module ID. */
|
|
||||||
GL(dl_rtld_map).l_tls_modid = _dl_next_tls_modid ();
|
|
||||||
|
|
||||||
# ifndef SHARED
|
|
||||||
/* If dynamic loading of modules with TLS is impossible we do not
|
|
||||||
have to initialize any of the TLS functionality unless any of the
|
|
||||||
initial modules uses TLS. */
|
|
||||||
if (GL(dl_tls_max_dtv_idx) > 0)
|
|
||||||
# endif
|
|
||||||
{
|
|
||||||
struct link_map *l;
|
|
||||||
size_t nelem;
|
|
||||||
struct dtv_slotinfo *slotinfo;
|
|
||||||
|
|
||||||
/* Number of elements in the static TLS block. */
|
|
||||||
GL(dl_tls_static_nelem) = GL(dl_tls_max_dtv_idx);
|
|
||||||
|
|
||||||
/* Allocate the array which contains the information about the
|
|
||||||
dtv slots. We allocate a few entries more than needed to
|
|
||||||
avoid the need for reallocation. */
|
|
||||||
nelem = GL(dl_tls_max_dtv_idx) + 1 + TLS_SLOTINFO_SURPLUS;
|
|
||||||
|
|
||||||
/* Allocate. */
|
|
||||||
GL(dl_tls_dtv_slotinfo_list) = (struct dtv_slotinfo_list *)
|
|
||||||
malloc (sizeof (struct dtv_slotinfo_list)
|
|
||||||
+ nelem * sizeof (struct dtv_slotinfo));
|
|
||||||
/* No need to check the return value. If memory allocation failed
|
|
||||||
the program would have been terminated. */
|
|
||||||
|
|
||||||
slotinfo = memset (GL(dl_tls_dtv_slotinfo_list)->slotinfo, '\0',
|
|
||||||
nelem * sizeof (struct dtv_slotinfo));
|
|
||||||
GL(dl_tls_dtv_slotinfo_list)->len = nelem;
|
|
||||||
GL(dl_tls_dtv_slotinfo_list)->next = NULL;
|
|
||||||
|
|
||||||
/* Fill in the information from the loaded modules. */
|
|
||||||
for (l = GL(dl_loaded), i = 0; l != NULL; l = l->l_next)
|
|
||||||
if (l->l_tls_blocksize != 0)
|
|
||||||
/* This is a module with TLS data. Store the map reference.
|
|
||||||
The generation counter is zero. */
|
|
||||||
slotinfo[++i].map = l;
|
|
||||||
assert (i == GL(dl_tls_max_dtv_idx));
|
|
||||||
|
|
||||||
/* Computer the TLS offsets for the various blocks. We call this
|
|
||||||
function even if none of the modules available at startup time
|
|
||||||
uses TLS to initialize some variables. */
|
|
||||||
_dl_determine_tlsoffset ();
|
|
||||||
|
|
||||||
/* Construct the static TLS block and the dtv for the initial
|
|
||||||
thread. For some platforms this will include allocating memory
|
|
||||||
for the thread descriptor. The memory for the TLS block will
|
|
||||||
never be freed. It should be allocated accordingly. The dtv
|
|
||||||
array can be changed if dynamic loading requires it. */
|
|
||||||
tcbp = INTUSE(_dl_allocate_tls) ();
|
|
||||||
if (tcbp == NULL)
|
|
||||||
_dl_fatal_printf ("\
|
|
||||||
cannot allocate TLS data structures for inital thread");
|
|
||||||
|
|
||||||
/* And finally install it for the main thread. */
|
|
||||||
TLS_INIT_TP (tcbp);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (GL(dl_loaded)->l_info [ADDRIDX (DT_GNU_LIBLIST)]
|
if (GL(dl_loaded)->l_info [ADDRIDX (DT_GNU_LIBLIST)]
|
||||||
&& ! __builtin_expect (GL(dl_profile) != NULL, 0))
|
&& ! __builtin_expect (GL(dl_profile) != NULL, 0))
|
||||||
{
|
{
|
||||||
|
@ -49,7 +49,7 @@ routines := \
|
|||||||
tests = tst_swprintf tst_wprintf tst_swscanf tst_wscanf tst_getwc tst_putwc \
|
tests = tst_swprintf tst_wprintf tst_swscanf tst_wscanf tst_getwc tst_putwc \
|
||||||
tst_wprintf2 tst-widetext test-fmemopen tst-ext tst-fopenloc \
|
tst_wprintf2 tst-widetext test-fmemopen tst-ext tst-fopenloc \
|
||||||
tst-fgetws tst-ungetwc1 tst-ungetwc2 tst-swscanf tst-sscanf \
|
tst-fgetws tst-ungetwc1 tst-ungetwc2 tst-swscanf tst-sscanf \
|
||||||
bug-ungetwc1 bug-ungetwc2
|
tst-mmap-setvbuf bug-ungetwc1 bug-ungetwc2
|
||||||
test-srcs = test-freopen
|
test-srcs = test-freopen
|
||||||
|
|
||||||
all: # Make this the default target; it will be defined in Rules.
|
all: # Make this the default target; it will be defined in Rules.
|
||||||
|
@ -440,6 +440,32 @@ _IO_new_file_setbuf (fp, p, len)
|
|||||||
}
|
}
|
||||||
INTDEF2(_IO_new_file_setbuf, _IO_file_setbuf)
|
INTDEF2(_IO_new_file_setbuf, _IO_file_setbuf)
|
||||||
|
|
||||||
|
|
||||||
|
_IO_FILE *
|
||||||
|
_IO_file_setbuf_mmap (fp, p, len)
|
||||||
|
_IO_FILE *fp;
|
||||||
|
char *p;
|
||||||
|
_IO_ssize_t len;
|
||||||
|
{
|
||||||
|
_IO_FILE *result;
|
||||||
|
|
||||||
|
/* Change the function table. */
|
||||||
|
_IO_JUMPS ((struct _IO_FILE_plus *) fp) = &_IO_file_jumps;
|
||||||
|
fp->_wide_data->_wide_vtable = &_IO_wfile_jumps;
|
||||||
|
|
||||||
|
/* And perform the normal operation. */
|
||||||
|
result = _IO_new_file_setbuf (fp, p, len);
|
||||||
|
|
||||||
|
/* If the call failed, restore to using mmap. */
|
||||||
|
if (result == NULL)
|
||||||
|
{
|
||||||
|
_IO_JUMPS ((struct _IO_FILE_plus *) fp) = &_IO_file_jumps_mmap;
|
||||||
|
fp->_wide_data->_wide_vtable = &_IO_wfile_jumps_mmap;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
static int new_do_write __P ((_IO_FILE *, const char *, _IO_size_t));
|
static int new_do_write __P ((_IO_FILE *, const char *, _IO_size_t));
|
||||||
|
|
||||||
/* Write TO_DO bytes from DATA to FP.
|
/* Write TO_DO bytes from DATA to FP.
|
||||||
@ -1293,7 +1319,7 @@ struct _IO_jump_t _IO_file_jumps_mmap =
|
|||||||
JUMP_INIT(xsgetn, _IO_file_xsgetn_mmap),
|
JUMP_INIT(xsgetn, _IO_file_xsgetn_mmap),
|
||||||
JUMP_INIT(seekoff, _IO_file_seekoff_mmap),
|
JUMP_INIT(seekoff, _IO_file_seekoff_mmap),
|
||||||
JUMP_INIT(seekpos, _IO_default_seekpos),
|
JUMP_INIT(seekpos, _IO_default_seekpos),
|
||||||
JUMP_INIT(setbuf, _IO_new_file_setbuf),
|
JUMP_INIT(setbuf, (_IO_setbuf_t) _IO_file_setbuf_mmap),
|
||||||
JUMP_INIT(sync, _IO_new_file_sync),
|
JUMP_INIT(sync, _IO_new_file_sync),
|
||||||
JUMP_INIT(doallocate, INTUSE(_IO_file_doallocate)),
|
JUMP_INIT(doallocate, INTUSE(_IO_file_doallocate)),
|
||||||
JUMP_INIT(read, INTUSE(_IO_file_read)),
|
JUMP_INIT(read, INTUSE(_IO_file_read)),
|
||||||
|
@ -94,10 +94,6 @@ _IO_setvbuf (fp, buf, mode, size)
|
|||||||
goto unlock_return;
|
goto unlock_return;
|
||||||
}
|
}
|
||||||
result = _IO_SETBUF (fp, buf, size) == NULL ? EOF : 0;
|
result = _IO_SETBUF (fp, buf, size) == NULL ? EOF : 0;
|
||||||
if (result == 0 && fp->_vtable_offset == 0 && fp->_mode == 0
|
|
||||||
&& _IO_CHECK_WIDE (fp))
|
|
||||||
/* We also have to set the buffer using the wide char function. */
|
|
||||||
result = _IO_WSETBUF (fp, buf, size) == NULL ? EOF : 0;
|
|
||||||
|
|
||||||
unlock_return:
|
unlock_return:
|
||||||
_IO_funlockfile (fp);
|
_IO_funlockfile (fp);
|
||||||
|
@ -404,8 +404,6 @@ extern void _IO_wdefault_finish __P ((_IO_FILE *, int));
|
|||||||
extern int _IO_default_pbackfail __P ((_IO_FILE *, int));
|
extern int _IO_default_pbackfail __P ((_IO_FILE *, int));
|
||||||
extern wint_t _IO_wdefault_pbackfail __P ((_IO_FILE *, wint_t));
|
extern wint_t _IO_wdefault_pbackfail __P ((_IO_FILE *, wint_t));
|
||||||
extern _IO_FILE* _IO_default_setbuf __P ((_IO_FILE *, char *, _IO_ssize_t));
|
extern _IO_FILE* _IO_default_setbuf __P ((_IO_FILE *, char *, _IO_ssize_t));
|
||||||
extern _IO_FILE* _IO_wdefault_setbuf __P ((_IO_FILE *, wchar_t *,
|
|
||||||
_IO_ssize_t));
|
|
||||||
extern _IO_size_t _IO_default_xsputn __P ((_IO_FILE *, const void *,
|
extern _IO_size_t _IO_default_xsputn __P ((_IO_FILE *, const void *,
|
||||||
_IO_size_t));
|
_IO_size_t));
|
||||||
extern _IO_size_t _IO_wdefault_xsputn __P ((_IO_FILE *, const void *,
|
extern _IO_size_t _IO_wdefault_xsputn __P ((_IO_FILE *, const void *,
|
||||||
@ -532,6 +530,7 @@ extern void _IO_no_init __P ((_IO_FILE *, int, int, struct _IO_wide_data *,
|
|||||||
struct _IO_jump_t *));
|
struct _IO_jump_t *));
|
||||||
extern void _IO_new_file_init __P ((struct _IO_FILE_plus *));
|
extern void _IO_new_file_init __P ((struct _IO_FILE_plus *));
|
||||||
extern _IO_FILE* _IO_new_file_setbuf __P ((_IO_FILE *, char *, _IO_ssize_t));
|
extern _IO_FILE* _IO_new_file_setbuf __P ((_IO_FILE *, char *, _IO_ssize_t));
|
||||||
|
extern _IO_FILE* _IO_file_setbuf_mmap __P ((_IO_FILE *, char *, _IO_ssize_t));
|
||||||
extern int _IO_new_file_sync __P ((_IO_FILE *));
|
extern int _IO_new_file_sync __P ((_IO_FILE *));
|
||||||
extern int _IO_new_file_underflow __P ((_IO_FILE *));
|
extern int _IO_new_file_underflow __P ((_IO_FILE *));
|
||||||
extern int _IO_new_file_overflow __P ((_IO_FILE *, int));
|
extern int _IO_new_file_overflow __P ((_IO_FILE *, int));
|
||||||
@ -640,8 +639,6 @@ extern _IO_size_t _IO_wdefault_xsputn_internal __P ((_IO_FILE *, const void *,
|
|||||||
_IO_size_t));
|
_IO_size_t));
|
||||||
extern _IO_size_t _IO_wdefault_xsgetn_internal __P ((_IO_FILE *, void *,
|
extern _IO_size_t _IO_wdefault_xsgetn_internal __P ((_IO_FILE *, void *,
|
||||||
_IO_size_t));
|
_IO_size_t));
|
||||||
extern _IO_FILE* _IO_wdefault_setbuf_internal __P ((_IO_FILE *, wchar_t *,
|
|
||||||
_IO_ssize_t));
|
|
||||||
extern int _IO_wdefault_doallocate_internal __P ((_IO_FILE *));
|
extern int _IO_wdefault_doallocate_internal __P ((_IO_FILE *));
|
||||||
extern wint_t _IO_wdefault_uflow_internal __P ((_IO_FILE *));
|
extern wint_t _IO_wdefault_uflow_internal __P ((_IO_FILE *));
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ static struct _IO_jump_t _IO_wmem_jumps =
|
|||||||
JUMP_INIT (xsgetn, (_IO_xsgetn_t) INTUSE(_IO_wdefault_xsgetn)),
|
JUMP_INIT (xsgetn, (_IO_xsgetn_t) INTUSE(_IO_wdefault_xsgetn)),
|
||||||
JUMP_INIT (seekoff, _IO_wstr_seekoff),
|
JUMP_INIT (seekoff, _IO_wstr_seekoff),
|
||||||
JUMP_INIT (seekpos, _IO_default_seekpos),
|
JUMP_INIT (seekpos, _IO_default_seekpos),
|
||||||
JUMP_INIT (setbuf, (_IO_setbuf_t) INTUSE(_IO_wdefault_setbuf)),
|
JUMP_INIT (setbuf, _IO_default_setbuf),
|
||||||
JUMP_INIT (sync, (_IO_sync_t) _IO_wmem_sync),
|
JUMP_INIT (sync, (_IO_sync_t) _IO_wmem_sync),
|
||||||
JUMP_INIT (doallocate, INTUSE(_IO_wdefault_doallocate)),
|
JUMP_INIT (doallocate, INTUSE(_IO_wdefault_doallocate)),
|
||||||
JUMP_INIT (read, _IO_default_read),
|
JUMP_INIT (read, _IO_default_read),
|
||||||
|
82
libio/tst-mmap-setvbuf.c
Normal file
82
libio/tst-mmap-setvbuf.c
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
/* Test setvbuf on readonly fopen (using mmap stdio).
|
||||||
|
Copyright (C) 2002 Free Software Foundation, Inc.
|
||||||
|
This file is part of the GNU C Library.
|
||||||
|
Contributed by Jakub Jelinek <jakub@redhat.com>, 2002.
|
||||||
|
|
||||||
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Lesser General Public
|
||||||
|
License as published by the Free Software Foundation; either
|
||||||
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public
|
||||||
|
License along with the GNU C Library; if not, write to the Free
|
||||||
|
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||||
|
02111-1307 USA. */
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
int main (void)
|
||||||
|
{
|
||||||
|
char name[] = "/tmp/tst-mmap-setvbuf.XXXXXX";
|
||||||
|
char buf[4096];
|
||||||
|
const char * const test = "Let's see if mmap stdio works with setvbuf.\n";
|
||||||
|
char temp[strlen (test) + 1];
|
||||||
|
int fd = mkstemp (name);
|
||||||
|
FILE *f;
|
||||||
|
|
||||||
|
if (fd == -1)
|
||||||
|
{
|
||||||
|
printf ("%Zd: cannot open temporary file: %m\n", __LINE__);
|
||||||
|
exit (1);
|
||||||
|
}
|
||||||
|
|
||||||
|
f = fdopen (fd, "w");
|
||||||
|
if (f == NULL)
|
||||||
|
{
|
||||||
|
printf ("%Zd: cannot fdopen temporary file: %m\n", __LINE__);
|
||||||
|
exit (1);
|
||||||
|
}
|
||||||
|
|
||||||
|
fputs (test, f);
|
||||||
|
fclose (f);
|
||||||
|
|
||||||
|
f = fopen (name, "r");
|
||||||
|
if (f == NULL)
|
||||||
|
{
|
||||||
|
printf ("%Zd: cannot fopen temporary file: %m\n", __LINE__);
|
||||||
|
exit (1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (setvbuf (f, buf, _IOFBF, sizeof buf))
|
||||||
|
{
|
||||||
|
printf ("%Zd: setvbuf failed: %m\n", __LINE__);
|
||||||
|
exit (1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fread (temp, 1, strlen (test), f) != strlen (test))
|
||||||
|
{
|
||||||
|
printf ("%Zd: couldn't read the file back: %m\n", __LINE__);
|
||||||
|
exit (1);
|
||||||
|
}
|
||||||
|
temp [strlen (test)] = '\0';
|
||||||
|
|
||||||
|
if (strcmp (test, temp))
|
||||||
|
{
|
||||||
|
printf ("%Zd: read different string than was written:\n%s%s",
|
||||||
|
__LINE__, test, temp);
|
||||||
|
exit (1);
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose (f);
|
||||||
|
|
||||||
|
unlink (name);
|
||||||
|
exit (0);
|
||||||
|
}
|
@ -87,7 +87,7 @@ static struct _IO_jump_t _IO_wstrn_jumps =
|
|||||||
JUMP_INIT(xsgetn, INTUSE(_IO_wdefault_xsgetn)),
|
JUMP_INIT(xsgetn, INTUSE(_IO_wdefault_xsgetn)),
|
||||||
JUMP_INIT(seekoff, _IO_wstr_seekoff),
|
JUMP_INIT(seekoff, _IO_wstr_seekoff),
|
||||||
JUMP_INIT(seekpos, _IO_default_seekpos),
|
JUMP_INIT(seekpos, _IO_default_seekpos),
|
||||||
JUMP_INIT(setbuf, (_IO_setbuf_t) INTUSE(_IO_wdefault_setbuf)),
|
JUMP_INIT(setbuf, _IO_default_setbuf),
|
||||||
JUMP_INIT(sync, _IO_default_sync),
|
JUMP_INIT(sync, _IO_default_sync),
|
||||||
JUMP_INIT(doallocate, INTUSE(_IO_wdefault_doallocate)),
|
JUMP_INIT(doallocate, INTUSE(_IO_wdefault_doallocate)),
|
||||||
JUMP_INIT(read, _IO_default_read),
|
JUMP_INIT(read, _IO_default_read),
|
||||||
|
@ -52,24 +52,6 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
_IO_FILE *
|
|
||||||
_IO_wfile_setbuf (fp, p, len)
|
|
||||||
_IO_FILE *fp;
|
|
||||||
wchar_t *p;
|
|
||||||
_IO_ssize_t len;
|
|
||||||
{
|
|
||||||
if (INTUSE(_IO_wdefault_setbuf) (fp, p, len) == NULL)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
fp->_wide_data->_IO_write_base = fp->_wide_data->_IO_write_ptr =
|
|
||||||
fp->_wide_data->_IO_write_end = fp->_wide_data->_IO_buf_base;
|
|
||||||
_IO_wsetg (fp, fp->_wide_data->_IO_buf_base, fp->_wide_data->_IO_buf_base,
|
|
||||||
fp->_wide_data->_IO_buf_base);
|
|
||||||
|
|
||||||
return fp;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Convert TO_DO wide character from DATA to FP.
|
/* Convert TO_DO wide character from DATA to FP.
|
||||||
Then mark FP as having empty buffers. */
|
Then mark FP as having empty buffers. */
|
||||||
int
|
int
|
||||||
@ -877,7 +859,7 @@ struct _IO_jump_t _IO_wfile_jumps_mmap =
|
|||||||
JUMP_INIT(xsgetn, INTUSE(_IO_file_xsgetn)),
|
JUMP_INIT(xsgetn, INTUSE(_IO_file_xsgetn)),
|
||||||
JUMP_INIT(seekoff, INTUSE(_IO_wfile_seekoff)),
|
JUMP_INIT(seekoff, INTUSE(_IO_wfile_seekoff)),
|
||||||
JUMP_INIT(seekpos, _IO_default_seekpos),
|
JUMP_INIT(seekpos, _IO_default_seekpos),
|
||||||
JUMP_INIT(setbuf, _IO_new_file_setbuf),
|
JUMP_INIT(setbuf, _IO_file_setbuf_mmap),
|
||||||
JUMP_INIT(sync, (_IO_sync_t) INTUSE(_IO_wfile_sync)),
|
JUMP_INIT(sync, (_IO_sync_t) INTUSE(_IO_wfile_sync)),
|
||||||
JUMP_INIT(doallocate, _IO_wfile_doallocate),
|
JUMP_INIT(doallocate, _IO_wfile_doallocate),
|
||||||
JUMP_INIT(read, INTUSE(_IO_file_read)),
|
JUMP_INIT(read, INTUSE(_IO_file_read)),
|
||||||
|
@ -423,34 +423,6 @@ _IO_wdoallocbuf (fp)
|
|||||||
INTDEF(_IO_wdoallocbuf)
|
INTDEF(_IO_wdoallocbuf)
|
||||||
|
|
||||||
|
|
||||||
_IO_FILE *
|
|
||||||
_IO_wdefault_setbuf (fp, p, len)
|
|
||||||
_IO_FILE *fp;
|
|
||||||
wchar_t *p;
|
|
||||||
_IO_ssize_t len;
|
|
||||||
{
|
|
||||||
if (_IO_SYNC (fp) == EOF)
|
|
||||||
return NULL;
|
|
||||||
if (p == NULL || len == 0)
|
|
||||||
{
|
|
||||||
fp->_flags |= _IO_UNBUFFERED;
|
|
||||||
INTUSE(_IO_wsetb) (fp, fp->_wide_data->_shortbuf,
|
|
||||||
fp->_wide_data->_shortbuf + 1, 0);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
fp->_flags &= ~_IO_UNBUFFERED;
|
|
||||||
INTUSE(_IO_wsetb) (fp, p, p + len, 0);
|
|
||||||
}
|
|
||||||
fp->_wide_data->_IO_write_base = fp->_wide_data->_IO_write_ptr
|
|
||||||
= fp->_wide_data->_IO_write_end = 0;
|
|
||||||
fp->_wide_data->_IO_read_base = fp->_wide_data->_IO_read_ptr
|
|
||||||
= fp->_wide_data->_IO_read_end = 0;
|
|
||||||
return fp;
|
|
||||||
}
|
|
||||||
INTDEF(_IO_wdefault_setbuf)
|
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
_IO_wdefault_doallocate (fp)
|
_IO_wdefault_doallocate (fp)
|
||||||
_IO_FILE *fp;
|
_IO_FILE *fp;
|
||||||
|
@ -320,7 +320,7 @@ struct _IO_jump_t _IO_wstr_jumps =
|
|||||||
JUMP_INIT(xsgetn, INTUSE(_IO_wdefault_xsgetn)),
|
JUMP_INIT(xsgetn, INTUSE(_IO_wdefault_xsgetn)),
|
||||||
JUMP_INIT(seekoff, _IO_wstr_seekoff),
|
JUMP_INIT(seekoff, _IO_wstr_seekoff),
|
||||||
JUMP_INIT(seekpos, _IO_default_seekpos),
|
JUMP_INIT(seekpos, _IO_default_seekpos),
|
||||||
JUMP_INIT(setbuf, (_IO_setbuf_t) INTUSE(_IO_wdefault_setbuf)),
|
JUMP_INIT(setbuf, _IO_default_setbuf),
|
||||||
JUMP_INIT(sync, _IO_default_sync),
|
JUMP_INIT(sync, _IO_default_sync),
|
||||||
JUMP_INIT(doallocate, INTUSE(_IO_wdefault_doallocate)),
|
JUMP_INIT(doallocate, INTUSE(_IO_wdefault_doallocate)),
|
||||||
JUMP_INIT(read, _IO_default_read),
|
JUMP_INIT(read, _IO_default_read),
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
2002-06-14 H.J. Lu <hjl@gnu.org>
|
||||||
|
|
||||||
|
* td_thr_tls_get_addr.c (td_thr_tls_get_addr): Don't include
|
||||||
|
"tls.h". Return TD_ERR if USE_TLS is not defined.
|
||||||
|
|
||||||
2002-06-12 Ulrich Drepper <drepper@redhat.com>
|
2002-06-12 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
* td_thr_tls_get_addr.c: New file.
|
* td_thr_tls_get_addr.c: New file.
|
||||||
|
@ -63,6 +63,8 @@
|
|||||||
#define APPEND_R1(name) name##_r
|
#define APPEND_R1(name) name##_r
|
||||||
#define INTERNAL(name) INTERNAL1 (name)
|
#define INTERNAL(name) INTERNAL1 (name)
|
||||||
#define INTERNAL1(name) __##name
|
#define INTERNAL1(name) __##name
|
||||||
|
#define NEW(name) NEW1 (name)
|
||||||
|
#define NEW1(name) __new_##name
|
||||||
|
|
||||||
#ifdef USE_NSCD
|
#ifdef USE_NSCD
|
||||||
# define NSCD_NAME ADD_NSCD (REENTRANT_NAME)
|
# define NSCD_NAME ADD_NSCD (REENTRANT_NAME)
|
||||||
@ -257,7 +259,12 @@ OLD (REENTRANT_NAME) (ADD_PARAMS, LOOKUP_TYPE *resbuf, char *buffer,
|
|||||||
do_symbol_version (OLD (REENTRANT_NAME), REENTRANT_NAME, GLIBC_2_0);
|
do_symbol_version (OLD (REENTRANT_NAME), REENTRANT_NAME, GLIBC_2_0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* As INTERNAL (REENTRANT_NAME) may be hidden, we need an alias
|
||||||
|
in between so that the REENTRANT_NAME@@GLIBC_2.1.2 is not
|
||||||
|
hidden too. */
|
||||||
|
strong_alias (INTERNAL (REENTRANT_NAME), NEW (REENTRANT_NAME));
|
||||||
|
|
||||||
#define do_default_symbol_version(real, name, version) \
|
#define do_default_symbol_version(real, name, version) \
|
||||||
versioned_symbol (libc, real, name, version)
|
versioned_symbol (libc, real, name, version)
|
||||||
do_default_symbol_version (INTERNAL (REENTRANT_NAME),
|
do_default_symbol_version (NEW (REENTRANT_NAME),
|
||||||
REENTRANT_NAME, GLIBC_2_1_2);
|
REENTRANT_NAME, GLIBC_2_1_2);
|
||||||
|
@ -53,6 +53,8 @@
|
|||||||
#define INTERNAL(Name) CONCAT2_2 (__, Name)
|
#define INTERNAL(Name) CONCAT2_2 (__, Name)
|
||||||
#define CONCAT2_1(Pre, Post) CONCAT2_2 (Pre, Post)
|
#define CONCAT2_1(Pre, Post) CONCAT2_2 (Pre, Post)
|
||||||
#define CONCAT2_2(Pre, Post) Pre##Post
|
#define CONCAT2_2(Pre, Post) Pre##Post
|
||||||
|
#define NEW(name) NEW1 (name)
|
||||||
|
#define NEW1(name) __new_##name
|
||||||
|
|
||||||
#define SETFUNC_NAME_STRING STRINGIZE (SETFUNC_NAME)
|
#define SETFUNC_NAME_STRING STRINGIZE (SETFUNC_NAME)
|
||||||
#define GETFUNC_NAME_STRING STRINGIZE (REENTRANT_GETNAME)
|
#define GETFUNC_NAME_STRING STRINGIZE (REENTRANT_GETNAME)
|
||||||
@ -189,7 +191,12 @@ OLD (REENTRANT_GETNAME) (LOOKUP_TYPE *resbuf, char *buffer, size_t buflen,
|
|||||||
do_symbol_version (OLD (REENTRANT_GETNAME), REENTRANT_GETNAME, GLIBC_2_0);
|
do_symbol_version (OLD (REENTRANT_GETNAME), REENTRANT_GETNAME, GLIBC_2_0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* As INTERNAL (REENTRANT_GETNAME) may be hidden, we need an alias
|
||||||
|
in between so that the REENTRANT_GETNAME@@GLIBC_2.1.2 is not
|
||||||
|
hidden too. */
|
||||||
|
strong_alias (INTERNAL (REENTRANT_GETNAME), NEW (REENTRANT_GETNAME));
|
||||||
|
|
||||||
#define do_default_symbol_version(real, name, version) \
|
#define do_default_symbol_version(real, name, version) \
|
||||||
versioned_symbol (libc, real, name, version)
|
versioned_symbol (libc, real, name, version)
|
||||||
do_default_symbol_version (INTERNAL (REENTRANT_GETNAME),
|
do_default_symbol_version (NEW (REENTRANT_GETNAME),
|
||||||
REENTRANT_GETNAME, GLIBC_2_1_2);
|
REENTRANT_GETNAME, GLIBC_2_1_2);
|
||||||
|
@ -2089,7 +2089,7 @@ static const struct _IO_jump_t _IO_helper_jumps =
|
|||||||
JUMP_INIT (xsgetn, INTUSE(_IO_wdefault_xsgetn)),
|
JUMP_INIT (xsgetn, INTUSE(_IO_wdefault_xsgetn)),
|
||||||
JUMP_INIT (seekoff, _IO_default_seekoff),
|
JUMP_INIT (seekoff, _IO_default_seekoff),
|
||||||
JUMP_INIT (seekpos, _IO_default_seekpos),
|
JUMP_INIT (seekpos, _IO_default_seekpos),
|
||||||
JUMP_INIT (setbuf,(_IO_setbuf_t) INTUSE(_IO_wdefault_setbuf)),
|
JUMP_INIT (setbuf, _IO_default_setbuf),
|
||||||
JUMP_INIT (sync, _IO_default_sync),
|
JUMP_INIT (sync, _IO_default_sync),
|
||||||
JUMP_INIT (doallocate, INTUSE(_IO_wdefault_doallocate)),
|
JUMP_INIT (doallocate, INTUSE(_IO_wdefault_doallocate)),
|
||||||
JUMP_INIT (read, _IO_default_read),
|
JUMP_INIT (read, _IO_default_read),
|
||||||
|
Loading…
Reference in New Issue
Block a user