mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-24 14:00:30 +00:00
libio: Remove the usage of __libc_IO_vtables
Instead of using a special ELF section along with a linker script directive to put the IO vtables within the RELRO section, the libio vtables are all moved to an array marked as data.relro (so linker will place in the RELRO segment without the need of extra directives). To avoid static linking namespace issues and including all vtable referenced objects, all required function pointers are set to weak alias. Checked on x86_64-linux-gnu, i686-linux-gnu, and aarch64-linux-gnu. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
This commit is contained in:
parent
f65ca70dea
commit
3020f72618
24
Makerules
24
Makerules
@ -544,34 +544,10 @@ $(LINK.o) -shared -static-libgcc -Wl,-O1 $(sysdep-LDFLAGS) \
|
|||||||
-L$(subst :, -L,$(rpath-link)) -Wl,-rpath-link=$(rpath-link)
|
-L$(subst :, -L,$(rpath-link)) -Wl,-rpath-link=$(rpath-link)
|
||||||
endef
|
endef
|
||||||
|
|
||||||
ifeq (yes,$(use-default-link))
|
|
||||||
# If the linker is good enough, we can let it use its default linker script.
|
# If the linker is good enough, we can let it use its default linker script.
|
||||||
# In the long term the custom linker script will be removed.
|
# In the long term the custom linker script will be removed.
|
||||||
shlib-lds =
|
shlib-lds =
|
||||||
shlib-lds-flags =
|
shlib-lds-flags =
|
||||||
else
|
|
||||||
# binutils only position loadable notes into the first page for binaries,
|
|
||||||
# not for shared objects
|
|
||||||
# lld --verbose does not dump a linker script. Use -fuse-ld=bfd.
|
|
||||||
$(common-objpfx)shlib.lds: $(common-objpfx)config.make $(..)Makerules
|
|
||||||
$(LINK.o) -shared -Wl,-O1 \
|
|
||||||
-nostdlib -nostartfiles -fuse-ld=bfd \
|
|
||||||
$(sysdep-LDFLAGS) $(rtld-LDFLAGS) $(LDFLAGS.so) \
|
|
||||||
-Wl,--verbose 2>/dev/null | \
|
|
||||||
sed > $@T \
|
|
||||||
-e '/^=========/,/^=========/!d;/^=========/d' \
|
|
||||||
-e 's@^.*\*(\.jcr).*$$@& \
|
|
||||||
PROVIDE(__start___libc_IO_vtables = .);\
|
|
||||||
__libc_IO_vtables : { *(__libc_IO_vtables) }\
|
|
||||||
PROVIDE(__stop___libc_IO_vtables = .);\
|
|
||||||
/DISCARD/ : { *(.gnu.glibc-stub.*) }@'
|
|
||||||
test -s $@T
|
|
||||||
mv -f $@T $@
|
|
||||||
common-generated += shlib.lds
|
|
||||||
|
|
||||||
shlib-lds = $(common-objpfx)shlib.lds
|
|
||||||
shlib-lds-flags = -T $(shlib-lds)
|
|
||||||
endif
|
|
||||||
|
|
||||||
define build-shlib
|
define build-shlib
|
||||||
$(build-shlib-helper) -o $@ $(shlib-lds-flags) \
|
$(build-shlib-helper) -o $@ $(shlib-lds-flags) \
|
||||||
|
16
elf/Makefile
16
elf/Makefile
@ -595,23 +595,9 @@ $(objpfx)tst-relro-ldso.out: tst-relro-symbols.py $(..)/scripts/glibcelf.py \
|
|||||||
$(objpfx)tst-relro-libc.out: tst-relro-symbols.py $(..)/scripts/glibcelf.py \
|
$(objpfx)tst-relro-libc.out: tst-relro-symbols.py $(..)/scripts/glibcelf.py \
|
||||||
$(common-objpfx)libc.so
|
$(common-objpfx)libc.so
|
||||||
$(PYTHON) tst-relro-symbols.py $(common-objpfx)libc.so \
|
$(PYTHON) tst-relro-symbols.py $(common-objpfx)libc.so \
|
||||||
--required=_IO_cookie_jumps \
|
|
||||||
--required=_IO_file_jumps \
|
--required=_IO_file_jumps \
|
||||||
--required=_IO_file_jumps_maybe_mmap \
|
|
||||||
--required=_IO_file_jumps_mmap \
|
|
||||||
--required=_IO_mem_jumps \
|
|
||||||
--required=_IO_printf_buffer_as_file_jumps \
|
|
||||||
--required=_IO_proc_jumps \
|
|
||||||
--required=_IO_str_jumps \
|
|
||||||
--required=_IO_wfile_jumps \
|
--required=_IO_wfile_jumps \
|
||||||
--required=_IO_wfile_jumps_maybe_mmap \
|
--required=__io_vtables \
|
||||||
--required=_IO_wfile_jumps_mmap \
|
|
||||||
--required=_IO_wmem_jumps \
|
|
||||||
--required=_IO_wprintf_buffer_as_file_jumps \
|
|
||||||
--required=_IO_wstr_jumps \
|
|
||||||
--optional=_IO_old_cookie_jumps \
|
|
||||||
--optional=_IO_old_file_jumps \
|
|
||||||
--optional=_IO_old_proc_jumps \
|
|
||||||
> $@ 2>&1; $(evaluate-test)
|
> $@ 2>&1; $(evaluate-test)
|
||||||
|
|
||||||
ifeq ($(run-built-tests),yes)
|
ifeq ($(run-built-tests),yes)
|
||||||
|
@ -243,20 +243,26 @@ for linking")
|
|||||||
This is only necessary when defining something in assembly, or playing
|
This is only necessary when defining something in assembly, or playing
|
||||||
funny alias games where the size should be other than what the compiler
|
funny alias games where the size should be other than what the compiler
|
||||||
thinks it is. */
|
thinks it is. */
|
||||||
#ifdef __ASSEMBLER__
|
#define declare_object_symbol_alias(symbol, original, size) \
|
||||||
# define declare_object_symbol_alias(symbol, original, size) \
|
|
||||||
declare_object_symbol_alias_1 (symbol, original, size)
|
declare_object_symbol_alias_1 (symbol, original, size)
|
||||||
|
#ifdef __ASSEMBLER__
|
||||||
# define declare_object_symbol_alias_1(symbol, original, s_size) \
|
# define declare_object_symbol_alias_1(symbol, original, s_size) \
|
||||||
strong_alias (original, symbol) ASM_LINE_SEP \
|
strong_alias (original, symbol) ASM_LINE_SEP \
|
||||||
.type C_SYMBOL_NAME (symbol), %object ASM_LINE_SEP \
|
.type C_SYMBOL_NAME (symbol), %object ASM_LINE_SEP \
|
||||||
.size C_SYMBOL_NAME (symbol), s_size ASM_LINE_SEP
|
.size C_SYMBOL_NAME (symbol), s_size ASM_LINE_SEP
|
||||||
#else /* Not __ASSEMBLER__. */
|
#else /* Not __ASSEMBLER__. */
|
||||||
# ifdef HAVE_ASM_SET_DIRECTIVE
|
# ifdef HAVE_ASM_SET_DIRECTIVE
|
||||||
# define declare_symbol_alias_1_alias(symbol, original) \
|
# define declare_object_symbol_alias_1(symbol, original, size) \
|
||||||
".set " __SYMBOL_PREFIX #symbol ", " __SYMBOL_PREFIX #original
|
asm (".global " __SYMBOL_PREFIX # symbol "\n" \
|
||||||
|
".type " __SYMBOL_PREFIX # symbol ", %object\n" \
|
||||||
|
".set " __SYMBOL_PREFIX #symbol ", " __SYMBOL_PREFIX original "\n" \
|
||||||
|
".size " __SYMBOL_PREFIX #symbol ", " #size "\n");
|
||||||
# else
|
# else
|
||||||
# define declare_symbol_alias_1_alias(symbol, original) \
|
# define declare_object_symbol_alias_1(symbol, original, size) \
|
||||||
__SYMBOL_PREFIX #symbol " = " __SYMBOL_PREFIX #original
|
asm (".global " __SYMBOL_PREFIX # symbol "\n" \
|
||||||
|
".type " __SYMBOL_PREFIX # symbol ", %object\n" \
|
||||||
|
__SYMBOL_PREFIX #symbol " = " __SYMBOL_PREFIX original "\n" \
|
||||||
|
".size " __SYMBOL_PREFIX #symbol ", " #size "\n");
|
||||||
# endif /* HAVE_ASM_SET_DIRECTIVE */
|
# endif /* HAVE_ASM_SET_DIRECTIVE */
|
||||||
#endif /* __ASSEMBLER__ */
|
#endif /* __ASSEMBLER__ */
|
||||||
|
|
||||||
|
@ -51,6 +51,8 @@ routines := \
|
|||||||
\
|
\
|
||||||
libc_fatal fmemopen oldfmemopen vtables
|
libc_fatal fmemopen oldfmemopen vtables
|
||||||
|
|
||||||
|
gen-as-const-headers += libio-macros.sym
|
||||||
|
|
||||||
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-ext2 \
|
tst_wprintf2 tst-widetext test-fmemopen tst-ext tst-ext2 \
|
||||||
tst-fgetws tst-ungetwc1 tst-ungetwc2 tst-swscanf tst-sscanf \
|
tst-fgetws tst-ungetwc1 tst-ungetwc2 tst-swscanf tst-sscanf \
|
||||||
|
@ -815,7 +815,7 @@ _IO_new_file_sync (FILE *fp)
|
|||||||
}
|
}
|
||||||
libc_hidden_ver (_IO_new_file_sync, _IO_file_sync)
|
libc_hidden_ver (_IO_new_file_sync, _IO_file_sync)
|
||||||
|
|
||||||
static int
|
int
|
||||||
_IO_file_sync_mmap (FILE *fp)
|
_IO_file_sync_mmap (FILE *fp)
|
||||||
{
|
{
|
||||||
if (fp->_IO_read_ptr != fp->_IO_read_end)
|
if (fp->_IO_read_ptr != fp->_IO_read_end)
|
||||||
@ -1109,7 +1109,7 @@ _IO_file_seekoff_mmap (FILE *fp, off64_t offset, int dir, int mode)
|
|||||||
return offset;
|
return offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
static off64_t
|
off64_t
|
||||||
_IO_file_seekoff_maybe_mmap (FILE *fp, off64_t offset, int dir,
|
_IO_file_seekoff_maybe_mmap (FILE *fp, off64_t offset, int dir,
|
||||||
int mode)
|
int mode)
|
||||||
{
|
{
|
||||||
@ -1360,7 +1360,7 @@ _IO_file_xsgetn (FILE *fp, void *data, size_t n)
|
|||||||
}
|
}
|
||||||
libc_hidden_def (_IO_file_xsgetn)
|
libc_hidden_def (_IO_file_xsgetn)
|
||||||
|
|
||||||
static size_t
|
size_t
|
||||||
_IO_file_xsgetn_mmap (FILE *fp, void *data, size_t n)
|
_IO_file_xsgetn_mmap (FILE *fp, void *data, size_t n)
|
||||||
{
|
{
|
||||||
size_t have;
|
size_t have;
|
||||||
@ -1405,7 +1405,7 @@ _IO_file_xsgetn_mmap (FILE *fp, void *data, size_t n)
|
|||||||
return s - (char *) data;
|
return s - (char *) data;
|
||||||
}
|
}
|
||||||
|
|
||||||
static size_t
|
size_t
|
||||||
_IO_file_xsgetn_maybe_mmap (FILE *fp, void *data, size_t n)
|
_IO_file_xsgetn_maybe_mmap (FILE *fp, void *data, size_t n)
|
||||||
{
|
{
|
||||||
/* We only get here if this is the first attempt to read something.
|
/* We only get here if this is the first attempt to read something.
|
||||||
@ -1428,76 +1428,3 @@ versioned_symbol (libc, _IO_new_file_seekoff, _IO_file_seekoff, GLIBC_2_1);
|
|||||||
versioned_symbol (libc, _IO_new_file_underflow, _IO_file_underflow, GLIBC_2_1);
|
versioned_symbol (libc, _IO_new_file_underflow, _IO_file_underflow, GLIBC_2_1);
|
||||||
versioned_symbol (libc, _IO_new_file_write, _IO_file_write, GLIBC_2_1);
|
versioned_symbol (libc, _IO_new_file_write, _IO_file_write, GLIBC_2_1);
|
||||||
versioned_symbol (libc, _IO_new_file_xsputn, _IO_file_xsputn, GLIBC_2_1);
|
versioned_symbol (libc, _IO_new_file_xsputn, _IO_file_xsputn, GLIBC_2_1);
|
||||||
|
|
||||||
const struct _IO_jump_t _IO_file_jumps libio_vtable =
|
|
||||||
{
|
|
||||||
JUMP_INIT_DUMMY,
|
|
||||||
JUMP_INIT(finish, _IO_file_finish),
|
|
||||||
JUMP_INIT(overflow, _IO_file_overflow),
|
|
||||||
JUMP_INIT(underflow, _IO_file_underflow),
|
|
||||||
JUMP_INIT(uflow, _IO_default_uflow),
|
|
||||||
JUMP_INIT(pbackfail, _IO_default_pbackfail),
|
|
||||||
JUMP_INIT(xsputn, _IO_file_xsputn),
|
|
||||||
JUMP_INIT(xsgetn, _IO_file_xsgetn),
|
|
||||||
JUMP_INIT(seekoff, _IO_new_file_seekoff),
|
|
||||||
JUMP_INIT(seekpos, _IO_default_seekpos),
|
|
||||||
JUMP_INIT(setbuf, _IO_new_file_setbuf),
|
|
||||||
JUMP_INIT(sync, _IO_new_file_sync),
|
|
||||||
JUMP_INIT(doallocate, _IO_file_doallocate),
|
|
||||||
JUMP_INIT(read, _IO_file_read),
|
|
||||||
JUMP_INIT(write, _IO_new_file_write),
|
|
||||||
JUMP_INIT(seek, _IO_file_seek),
|
|
||||||
JUMP_INIT(close, _IO_file_close),
|
|
||||||
JUMP_INIT(stat, _IO_file_stat),
|
|
||||||
JUMP_INIT(showmanyc, _IO_default_showmanyc),
|
|
||||||
JUMP_INIT(imbue, _IO_default_imbue)
|
|
||||||
};
|
|
||||||
libc_hidden_data_def (_IO_file_jumps)
|
|
||||||
|
|
||||||
const struct _IO_jump_t _IO_file_jumps_mmap libio_vtable =
|
|
||||||
{
|
|
||||||
JUMP_INIT_DUMMY,
|
|
||||||
JUMP_INIT(finish, _IO_file_finish),
|
|
||||||
JUMP_INIT(overflow, _IO_file_overflow),
|
|
||||||
JUMP_INIT(underflow, _IO_file_underflow_mmap),
|
|
||||||
JUMP_INIT(uflow, _IO_default_uflow),
|
|
||||||
JUMP_INIT(pbackfail, _IO_default_pbackfail),
|
|
||||||
JUMP_INIT(xsputn, _IO_new_file_xsputn),
|
|
||||||
JUMP_INIT(xsgetn, _IO_file_xsgetn_mmap),
|
|
||||||
JUMP_INIT(seekoff, _IO_file_seekoff_mmap),
|
|
||||||
JUMP_INIT(seekpos, _IO_default_seekpos),
|
|
||||||
JUMP_INIT(setbuf, (_IO_setbuf_t) _IO_file_setbuf_mmap),
|
|
||||||
JUMP_INIT(sync, _IO_file_sync_mmap),
|
|
||||||
JUMP_INIT(doallocate, _IO_file_doallocate),
|
|
||||||
JUMP_INIT(read, _IO_file_read),
|
|
||||||
JUMP_INIT(write, _IO_new_file_write),
|
|
||||||
JUMP_INIT(seek, _IO_file_seek),
|
|
||||||
JUMP_INIT(close, _IO_file_close_mmap),
|
|
||||||
JUMP_INIT(stat, _IO_file_stat),
|
|
||||||
JUMP_INIT(showmanyc, _IO_default_showmanyc),
|
|
||||||
JUMP_INIT(imbue, _IO_default_imbue)
|
|
||||||
};
|
|
||||||
|
|
||||||
const struct _IO_jump_t _IO_file_jumps_maybe_mmap libio_vtable =
|
|
||||||
{
|
|
||||||
JUMP_INIT_DUMMY,
|
|
||||||
JUMP_INIT(finish, _IO_file_finish),
|
|
||||||
JUMP_INIT(overflow, _IO_file_overflow),
|
|
||||||
JUMP_INIT(underflow, _IO_file_underflow_maybe_mmap),
|
|
||||||
JUMP_INIT(uflow, _IO_default_uflow),
|
|
||||||
JUMP_INIT(pbackfail, _IO_default_pbackfail),
|
|
||||||
JUMP_INIT(xsputn, _IO_new_file_xsputn),
|
|
||||||
JUMP_INIT(xsgetn, _IO_file_xsgetn_maybe_mmap),
|
|
||||||
JUMP_INIT(seekoff, _IO_file_seekoff_maybe_mmap),
|
|
||||||
JUMP_INIT(seekpos, _IO_default_seekpos),
|
|
||||||
JUMP_INIT(setbuf, (_IO_setbuf_t) _IO_file_setbuf_mmap),
|
|
||||||
JUMP_INIT(sync, _IO_new_file_sync),
|
|
||||||
JUMP_INIT(doallocate, _IO_file_doallocate),
|
|
||||||
JUMP_INIT(read, _IO_file_read),
|
|
||||||
JUMP_INIT(write, _IO_new_file_write),
|
|
||||||
JUMP_INIT(seek, _IO_file_seek),
|
|
||||||
JUMP_INIT(close, _IO_file_close),
|
|
||||||
JUMP_INIT(stat, _IO_file_stat),
|
|
||||||
JUMP_INIT(showmanyc, _IO_default_showmanyc),
|
|
||||||
JUMP_INIT(imbue, _IO_default_imbue)
|
|
||||||
};
|
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
#include <shlib-compat.h>
|
#include <shlib-compat.h>
|
||||||
#include <pointer_guard.h>
|
#include <pointer_guard.h>
|
||||||
|
|
||||||
static ssize_t
|
ssize_t
|
||||||
_IO_cookie_read (FILE *fp, void *buf, ssize_t size)
|
_IO_cookie_read (FILE *fp, void *buf, ssize_t size)
|
||||||
{
|
{
|
||||||
struct _IO_cookie_file *cfile = (struct _IO_cookie_file *) fp;
|
struct _IO_cookie_file *cfile = (struct _IO_cookie_file *) fp;
|
||||||
@ -43,7 +43,7 @@ _IO_cookie_read (FILE *fp, void *buf, ssize_t size)
|
|||||||
return read_cb (cfile->__cookie, buf, size);
|
return read_cb (cfile->__cookie, buf, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t
|
ssize_t
|
||||||
_IO_cookie_write (FILE *fp, const void *buf, ssize_t size)
|
_IO_cookie_write (FILE *fp, const void *buf, ssize_t size)
|
||||||
{
|
{
|
||||||
struct _IO_cookie_file *cfile = (struct _IO_cookie_file *) fp;
|
struct _IO_cookie_file *cfile = (struct _IO_cookie_file *) fp;
|
||||||
@ -63,7 +63,7 @@ _IO_cookie_write (FILE *fp, const void *buf, ssize_t size)
|
|||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
static off64_t
|
off64_t
|
||||||
_IO_cookie_seek (FILE *fp, off64_t offset, int dir)
|
_IO_cookie_seek (FILE *fp, off64_t offset, int dir)
|
||||||
{
|
{
|
||||||
struct _IO_cookie_file *cfile = (struct _IO_cookie_file *) fp;
|
struct _IO_cookie_file *cfile = (struct _IO_cookie_file *) fp;
|
||||||
@ -77,7 +77,7 @@ _IO_cookie_seek (FILE *fp, off64_t offset, int dir)
|
|||||||
? _IO_pos_BAD : offset);
|
? _IO_pos_BAD : offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
int
|
||||||
_IO_cookie_close (FILE *fp)
|
_IO_cookie_close (FILE *fp)
|
||||||
{
|
{
|
||||||
struct _IO_cookie_file *cfile = (struct _IO_cookie_file *) fp;
|
struct _IO_cookie_file *cfile = (struct _IO_cookie_file *) fp;
|
||||||
@ -91,7 +91,7 @@ _IO_cookie_close (FILE *fp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static off64_t
|
off64_t
|
||||||
_IO_cookie_seekoff (FILE *fp, off64_t offset, int dir, int mode)
|
_IO_cookie_seekoff (FILE *fp, off64_t offset, int dir, int mode)
|
||||||
{
|
{
|
||||||
/* We must force the fileops code to always use seek to determine
|
/* We must force the fileops code to always use seek to determine
|
||||||
@ -100,31 +100,6 @@ _IO_cookie_seekoff (FILE *fp, off64_t offset, int dir, int mode)
|
|||||||
return _IO_file_seekoff (fp, offset, dir, mode);
|
return _IO_file_seekoff (fp, offset, dir, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static const struct _IO_jump_t _IO_cookie_jumps libio_vtable = {
|
|
||||||
JUMP_INIT_DUMMY,
|
|
||||||
JUMP_INIT(finish, _IO_file_finish),
|
|
||||||
JUMP_INIT(overflow, _IO_file_overflow),
|
|
||||||
JUMP_INIT(underflow, _IO_file_underflow),
|
|
||||||
JUMP_INIT(uflow, _IO_default_uflow),
|
|
||||||
JUMP_INIT(pbackfail, _IO_default_pbackfail),
|
|
||||||
JUMP_INIT(xsputn, _IO_file_xsputn),
|
|
||||||
JUMP_INIT(xsgetn, _IO_default_xsgetn),
|
|
||||||
JUMP_INIT(seekoff, _IO_cookie_seekoff),
|
|
||||||
JUMP_INIT(seekpos, _IO_default_seekpos),
|
|
||||||
JUMP_INIT(setbuf, _IO_file_setbuf),
|
|
||||||
JUMP_INIT(sync, _IO_file_sync),
|
|
||||||
JUMP_INIT(doallocate, _IO_file_doallocate),
|
|
||||||
JUMP_INIT(read, _IO_cookie_read),
|
|
||||||
JUMP_INIT(write, _IO_cookie_write),
|
|
||||||
JUMP_INIT(seek, _IO_cookie_seek),
|
|
||||||
JUMP_INIT(close, _IO_cookie_close),
|
|
||||||
JUMP_INIT(stat, _IO_default_stat),
|
|
||||||
JUMP_INIT(showmanyc, _IO_default_showmanyc),
|
|
||||||
JUMP_INIT(imbue, _IO_default_imbue),
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/* Copy the callbacks from SOURCE to *TARGET, with pointer
|
/* Copy the callbacks from SOURCE to *TARGET, with pointer
|
||||||
mangling. */
|
mangling. */
|
||||||
static void
|
static void
|
||||||
@ -209,7 +184,7 @@ versioned_symbol (libc, _IO_fopencookie, fopencookie, GLIBC_2_2);
|
|||||||
|
|
||||||
#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2)
|
#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2)
|
||||||
|
|
||||||
static off64_t
|
off64_t
|
||||||
attribute_compat_text_section
|
attribute_compat_text_section
|
||||||
_IO_old_cookie_seek (FILE *fp, off64_t offset, int dir)
|
_IO_old_cookie_seek (FILE *fp, off64_t offset, int dir)
|
||||||
{
|
{
|
||||||
@ -226,29 +201,6 @@ _IO_old_cookie_seek (FILE *fp, off64_t offset, int dir)
|
|||||||
return (ret == -1) ? _IO_pos_BAD : ret;
|
return (ret == -1) ? _IO_pos_BAD : ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct _IO_jump_t _IO_old_cookie_jumps libio_vtable = {
|
|
||||||
JUMP_INIT_DUMMY,
|
|
||||||
JUMP_INIT(finish, _IO_file_finish),
|
|
||||||
JUMP_INIT(overflow, _IO_file_overflow),
|
|
||||||
JUMP_INIT(underflow, _IO_file_underflow),
|
|
||||||
JUMP_INIT(uflow, _IO_default_uflow),
|
|
||||||
JUMP_INIT(pbackfail, _IO_default_pbackfail),
|
|
||||||
JUMP_INIT(xsputn, _IO_file_xsputn),
|
|
||||||
JUMP_INIT(xsgetn, _IO_default_xsgetn),
|
|
||||||
JUMP_INIT(seekoff, _IO_cookie_seekoff),
|
|
||||||
JUMP_INIT(seekpos, _IO_default_seekpos),
|
|
||||||
JUMP_INIT(setbuf, _IO_file_setbuf),
|
|
||||||
JUMP_INIT(sync, _IO_file_sync),
|
|
||||||
JUMP_INIT(doallocate, _IO_file_doallocate),
|
|
||||||
JUMP_INIT(read, _IO_cookie_read),
|
|
||||||
JUMP_INIT(write, _IO_cookie_write),
|
|
||||||
JUMP_INIT(seek, _IO_old_cookie_seek),
|
|
||||||
JUMP_INIT(close, _IO_cookie_close),
|
|
||||||
JUMP_INIT(stat, _IO_default_stat),
|
|
||||||
JUMP_INIT(showmanyc, _IO_default_showmanyc),
|
|
||||||
JUMP_INIT(imbue, _IO_default_imbue),
|
|
||||||
};
|
|
||||||
|
|
||||||
FILE *
|
FILE *
|
||||||
attribute_compat_text_section
|
attribute_compat_text_section
|
||||||
_IO_old_fopencookie (void *cookie, const char *mode,
|
_IO_old_fopencookie (void *cookie, const char *mode,
|
||||||
|
@ -45,8 +45,6 @@ struct _IO_proc_file
|
|||||||
};
|
};
|
||||||
typedef struct _IO_proc_file _IO_proc_file;
|
typedef struct _IO_proc_file _IO_proc_file;
|
||||||
|
|
||||||
static const struct _IO_jump_t _IO_proc_jumps;
|
|
||||||
|
|
||||||
static struct _IO_proc_file *proc_file_chain;
|
static struct _IO_proc_file *proc_file_chain;
|
||||||
|
|
||||||
#ifdef _IO_MTSAFE_IO
|
#ifdef _IO_MTSAFE_IO
|
||||||
@ -297,29 +295,6 @@ _IO_new_proc_close (FILE *fp)
|
|||||||
return wstatus;
|
return wstatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct _IO_jump_t _IO_proc_jumps libio_vtable = {
|
|
||||||
JUMP_INIT_DUMMY,
|
|
||||||
JUMP_INIT(finish, _IO_new_file_finish),
|
|
||||||
JUMP_INIT(overflow, _IO_new_file_overflow),
|
|
||||||
JUMP_INIT(underflow, _IO_new_file_underflow),
|
|
||||||
JUMP_INIT(uflow, _IO_default_uflow),
|
|
||||||
JUMP_INIT(pbackfail, _IO_default_pbackfail),
|
|
||||||
JUMP_INIT(xsputn, _IO_new_file_xsputn),
|
|
||||||
JUMP_INIT(xsgetn, _IO_default_xsgetn),
|
|
||||||
JUMP_INIT(seekoff, _IO_new_file_seekoff),
|
|
||||||
JUMP_INIT(seekpos, _IO_default_seekpos),
|
|
||||||
JUMP_INIT(setbuf, _IO_new_file_setbuf),
|
|
||||||
JUMP_INIT(sync, _IO_new_file_sync),
|
|
||||||
JUMP_INIT(doallocate, _IO_file_doallocate),
|
|
||||||
JUMP_INIT(read, _IO_file_read),
|
|
||||||
JUMP_INIT(write, _IO_new_file_write),
|
|
||||||
JUMP_INIT(seek, _IO_file_seek),
|
|
||||||
JUMP_INIT(close, _IO_new_proc_close),
|
|
||||||
JUMP_INIT(stat, _IO_file_stat),
|
|
||||||
JUMP_INIT(showmanyc, _IO_default_showmanyc),
|
|
||||||
JUMP_INIT(imbue, _IO_default_imbue)
|
|
||||||
};
|
|
||||||
|
|
||||||
strong_alias (_IO_new_popen, __new_popen)
|
strong_alias (_IO_new_popen, __new_popen)
|
||||||
versioned_symbol (libc, _IO_new_popen, _IO_popen, GLIBC_2_1);
|
versioned_symbol (libc, _IO_new_popen, _IO_popen, GLIBC_2_1);
|
||||||
versioned_symbol (libc, __new_popen, popen, GLIBC_2_1);
|
versioned_symbol (libc, __new_popen, popen, GLIBC_2_1);
|
||||||
|
7
libio/libio-macros.sym
Normal file
7
libio/libio-macros.sym
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#include <libioP.h>
|
||||||
|
|
||||||
|
--
|
||||||
|
|
||||||
|
IO_JUMP_T_SIZE sizeof (struct _IO_jump_t)
|
||||||
|
IO_FILE_JUMPS_OFFSET sizeof (struct _IO_jump_t) * IO_FILE_JUMPS
|
||||||
|
IO_WFILE_JUMPS_OFFSET sizeof (struct _IO_jump_t) * IO_WFILE_JUMPS
|
136
libio/libioP.h
136
libio/libioP.h
@ -469,19 +469,68 @@ extern int _IO_default_sync (FILE *) __THROW;
|
|||||||
extern int _IO_default_showmanyc (FILE *) __THROW;
|
extern int _IO_default_showmanyc (FILE *) __THROW;
|
||||||
extern void _IO_default_imbue (FILE *, void *) __THROW;
|
extern void _IO_default_imbue (FILE *, void *) __THROW;
|
||||||
|
|
||||||
extern const struct _IO_jump_t _IO_file_jumps;
|
extern int __printf_buffer_as_file_overflow (FILE *fp, int ch);
|
||||||
libc_hidden_proto (_IO_file_jumps)
|
extern size_t __printf_buffer_as_file_xsputn (FILE *fp, const void *buf,
|
||||||
extern const struct _IO_jump_t _IO_file_jumps_mmap attribute_hidden;
|
size_t len);
|
||||||
extern const struct _IO_jump_t _IO_file_jumps_maybe_mmap attribute_hidden;
|
extern wint_t __wprintf_buffer_as_file_overflow (FILE *fp, int ch);
|
||||||
extern const struct _IO_jump_t _IO_wfile_jumps;
|
extern size_t __wprintf_buffer_as_file_xsputn (FILE *fp, const void *buf,
|
||||||
libc_hidden_proto (_IO_wfile_jumps)
|
size_t len);
|
||||||
extern const struct _IO_jump_t _IO_wfile_jumps_mmap attribute_hidden;
|
|
||||||
extern const struct _IO_jump_t _IO_wfile_jumps_maybe_mmap attribute_hidden;
|
enum
|
||||||
extern const struct _IO_jump_t _IO_old_file_jumps attribute_hidden;
|
{
|
||||||
extern const struct _IO_jump_t _IO_streambuf_jumps;
|
IO_STR_JUMPS = 0,
|
||||||
extern const struct _IO_jump_t _IO_old_proc_jumps attribute_hidden;
|
IO_WSTR_JUMPS = 1,
|
||||||
extern const struct _IO_jump_t _IO_str_jumps attribute_hidden;
|
IO_FILE_JUMPS = 2,
|
||||||
extern const struct _IO_jump_t _IO_wstr_jumps attribute_hidden;
|
IO_FILE_JUMPS_MMAP = 3,
|
||||||
|
IO_FILE_JUMPS_MAYBE_MMAP = 4,
|
||||||
|
IO_WFILE_JUMPS = 5,
|
||||||
|
IO_WFILE_JUMPS_MMAP = 6,
|
||||||
|
IO_WFILE_JUMPS_MAYBE_MMAP = 7,
|
||||||
|
IO_COOKIE_JUMPS = 8,
|
||||||
|
IO_PROC_JUMPS = 9,
|
||||||
|
IO_MEM_JUMPS = 10,
|
||||||
|
IO_WMEM_JUMPS = 11,
|
||||||
|
IO_PRINTF_BUFFER_AS_FILE_JUMPS = 12,
|
||||||
|
IO_WPRINTF_BUFFER_AS_FILE_JUMPS = 13,
|
||||||
|
#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
|
||||||
|
IO_OLD_FILE_JUMPS = 14,
|
||||||
|
IO_OLD_PROC_JUMPS = 15,
|
||||||
|
IO_OLD_COOKIED_JUMPS = 16,
|
||||||
|
IO_VTABLES_NUM = IO_OLD_COOKIED_JUMPS + 1,
|
||||||
|
#elif SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2)
|
||||||
|
IO_OLD_COOKIED_JUMPS = 14,
|
||||||
|
IO_VTABLES_NUM = IO_OLD_COOKIED_JUMPS + 1,
|
||||||
|
#else
|
||||||
|
IO_VTABLES_NUM = IO_WPRINTF_BUFFER_AS_FILE_JUMPS + 1
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
#define IO_VTABLES_LEN (IO_VTABLES_NUM * sizeof (struct _IO_jump_t))
|
||||||
|
|
||||||
|
extern const struct _IO_jump_t __io_vtables[] attribute_hidden;
|
||||||
|
#define _IO_str_jumps (__io_vtables[IO_STR_JUMPS])
|
||||||
|
#define _IO_wstr_jumps (__io_vtables[IO_WSTR_JUMPS])
|
||||||
|
#define _IO_file_jumps (__io_vtables[IO_FILE_JUMPS])
|
||||||
|
#define _IO_file_jumps_mmap (__io_vtables[IO_FILE_JUMPS_MMAP])
|
||||||
|
#define _IO_file_jumps_maybe_mmap (__io_vtables[IO_FILE_JUMPS_MAYBE_MMAP])
|
||||||
|
#define _IO_wfile_jumps (__io_vtables[IO_WFILE_JUMPS])
|
||||||
|
#define _IO_wfile_jumps_mmap (__io_vtables[IO_WFILE_JUMPS_MMAP])
|
||||||
|
#define _IO_wfile_jumps_maybe_mmap (__io_vtables[IO_WFILE_JUMPS_MAYBE_MMAP])
|
||||||
|
#define _IO_cookie_jumps (__io_vtables[IO_COOKIE_JUMPS])
|
||||||
|
#define _IO_proc_jumps (__io_vtables[IO_PROC_JUMPS])
|
||||||
|
#define _IO_mem_jumps (__io_vtables[IO_MEM_JUMPS])
|
||||||
|
#define _IO_wmem_jumps (__io_vtables[IO_WMEM_JUMPS])
|
||||||
|
#define _IO_printf_buffer_as_file_jumps (__io_vtables[IO_PRINTF_BUFFER_AS_FILE_JUMPS])
|
||||||
|
#define _IO_wprintf_buffer_as_file_jumps (__io_vtables[IO_WPRINTF_BUFFER_AS_FILE_JUMPS])
|
||||||
|
#define _IO_old_file_jumps (__io_vtables[IO_OLD_FILE_JUMPS])
|
||||||
|
#define _IO_old_proc_jumps (__io_vtables[IO_OLD_PROC_JUMPS])
|
||||||
|
#define _IO_old_cookie_jumps (__io_vtables[IO_OLD_COOKIED_JUMPS])
|
||||||
|
|
||||||
|
#ifdef SHARED
|
||||||
|
# define libio_static_fn_required(name)
|
||||||
|
#else
|
||||||
|
# define libio_static_fn_required(name) __asm (".globl " #name);
|
||||||
|
#endif
|
||||||
|
|
||||||
extern int _IO_do_write (FILE *, const char *, size_t);
|
extern int _IO_do_write (FILE *, const char *, size_t);
|
||||||
libc_hidden_proto (_IO_do_write)
|
libc_hidden_proto (_IO_do_write)
|
||||||
extern int _IO_new_do_write (FILE *, const char *, size_t);
|
extern int _IO_new_do_write (FILE *, const char *, size_t);
|
||||||
@ -593,6 +642,14 @@ extern void _IO_new_file_init_internal (struct _IO_FILE_plus *)
|
|||||||
extern FILE* _IO_new_file_setbuf (FILE *, char *, ssize_t);
|
extern FILE* _IO_new_file_setbuf (FILE *, char *, ssize_t);
|
||||||
extern FILE* _IO_file_setbuf_mmap (FILE *, char *, ssize_t);
|
extern FILE* _IO_file_setbuf_mmap (FILE *, char *, ssize_t);
|
||||||
extern int _IO_new_file_sync (FILE *);
|
extern int _IO_new_file_sync (FILE *);
|
||||||
|
extern int _IO_file_sync_mmap (FILE *) attribute_hidden;
|
||||||
|
extern size_t _IO_file_xsgetn_maybe_mmap (FILE *fp, void *data, size_t n)
|
||||||
|
attribute_hidden;
|
||||||
|
extern size_t _IO_file_xsgetn_mmap (FILE *fp, void *data, size_t n)
|
||||||
|
attribute_hidden;
|
||||||
|
extern off64_t _IO_file_seekoff_maybe_mmap (FILE *fp, off64_t offset, int dir,
|
||||||
|
int mode)
|
||||||
|
attribute_hidden;
|
||||||
extern int _IO_new_file_underflow (FILE *);
|
extern int _IO_new_file_underflow (FILE *);
|
||||||
extern int _IO_new_file_overflow (FILE *, int);
|
extern int _IO_new_file_overflow (FILE *, int);
|
||||||
extern off64_t _IO_new_file_seekoff (FILE *, off64_t, int, int);
|
extern off64_t _IO_new_file_seekoff (FILE *, off64_t, int, int);
|
||||||
@ -625,6 +682,10 @@ extern wint_t _IO_wfile_overflow (FILE *, wint_t);
|
|||||||
libc_hidden_proto (_IO_wfile_overflow)
|
libc_hidden_proto (_IO_wfile_overflow)
|
||||||
extern off64_t _IO_wfile_seekoff (FILE *, off64_t, int, int);
|
extern off64_t _IO_wfile_seekoff (FILE *, off64_t, int, int);
|
||||||
libc_hidden_proto (_IO_wfile_seekoff)
|
libc_hidden_proto (_IO_wfile_seekoff)
|
||||||
|
extern wint_t _IO_wfile_underflow_maybe_mmap (FILE *fp)
|
||||||
|
attribute_hidden;
|
||||||
|
extern wint_t _IO_wfile_underflow_mmap (FILE *fp)
|
||||||
|
attribute_hidden;
|
||||||
|
|
||||||
/* Jumptable functions for proc_files. */
|
/* Jumptable functions for proc_files. */
|
||||||
extern FILE* _IO_proc_open (FILE *, const char *, const char *)
|
extern FILE* _IO_proc_open (FILE *, const char *, const char *)
|
||||||
@ -643,13 +704,41 @@ extern int _IO_str_overflow (FILE *, int) __THROW;
|
|||||||
libc_hidden_proto (_IO_str_overflow)
|
libc_hidden_proto (_IO_str_overflow)
|
||||||
extern int _IO_str_pbackfail (FILE *, int) __THROW;
|
extern int _IO_str_pbackfail (FILE *, int) __THROW;
|
||||||
libc_hidden_proto (_IO_str_pbackfail)
|
libc_hidden_proto (_IO_str_pbackfail)
|
||||||
extern off64_t _IO_str_seekoff (FILE *, off64_t, int, int) __THROW;
|
extern off64_t _IO_str_seekoff (FILE *, off64_t, int, int) __THROW
|
||||||
|
;
|
||||||
libc_hidden_proto (_IO_str_seekoff)
|
libc_hidden_proto (_IO_str_seekoff)
|
||||||
extern void _IO_str_finish (FILE *, int) __THROW;
|
extern void _IO_str_finish (FILE *, int) __THROW;
|
||||||
|
extern int _IO_str_chk_overflow (FILE *fp, int c) __THROW
|
||||||
|
attribute_hidden;
|
||||||
|
|
||||||
|
/* Jumptable functions for fopencookie. */
|
||||||
|
extern ssize_t _IO_cookie_read (FILE *fp, void *buf, ssize_t size)
|
||||||
|
attribute_hidden;
|
||||||
|
extern ssize_t _IO_cookie_write (FILE *fp, const void *buf, ssize_t size)
|
||||||
|
attribute_hidden;
|
||||||
|
extern off64_t _IO_cookie_seek (FILE *fp, off64_t offset, int dir)
|
||||||
|
attribute_hidden;
|
||||||
|
extern int _IO_cookie_close (FILE *fp) attribute_hidden;
|
||||||
|
extern off64_t _IO_cookie_seekoff (FILE *fp, off64_t offset, int dir, int mode)
|
||||||
|
attribute_hidden;
|
||||||
|
extern off64_t _IO_old_cookie_seek (FILE *fp, off64_t offset, int dir)
|
||||||
|
attribute_hidden;
|
||||||
|
|
||||||
|
/* Jumptable functions for obstack. */
|
||||||
|
extern int __IO_obstack_overflow (FILE *fp, int c) attribute_hidden;
|
||||||
|
extern size_t __IO_obstack_xsputn (FILE *fp, const void *data, size_t n)
|
||||||
|
attribute_hidden;
|
||||||
|
|
||||||
|
/* Jumptable functions for open_{w}memstream. */
|
||||||
|
extern int _IO_mem_sync (FILE* fp) __THROW attribute_hidden;
|
||||||
|
extern void _IO_mem_finish (FILE* fp, int) __THROW attribute_hidden;
|
||||||
|
extern int _IO_wmem_sync (FILE* fp) __THROW attribute_hidden;
|
||||||
|
extern void _IO_wmem_finish (FILE* fp, int) __THROW attribute_hidden;
|
||||||
|
|
||||||
/* Other strfile functions */
|
/* Other strfile functions */
|
||||||
struct _IO_strfile_;
|
struct _IO_strfile_;
|
||||||
extern ssize_t _IO_str_count (FILE *) __THROW;
|
extern ssize_t _IO_str_count (FILE *) __THROW;
|
||||||
|
extern int _IO_strn_overflow (FILE *fp, int c) __THROW attribute_hidden;
|
||||||
|
|
||||||
/* And the wide character versions. */
|
/* And the wide character versions. */
|
||||||
extern void _IO_wstr_init_static (FILE *, wchar_t *, size_t, wchar_t *)
|
extern void _IO_wstr_init_static (FILE *, wchar_t *, size_t, wchar_t *)
|
||||||
@ -662,6 +751,10 @@ extern off64_t _IO_wstr_seekoff (FILE *, off64_t, int, int)
|
|||||||
extern wint_t _IO_wstr_pbackfail (FILE *, wint_t) __THROW;
|
extern wint_t _IO_wstr_pbackfail (FILE *, wint_t) __THROW;
|
||||||
extern void _IO_wstr_finish (FILE *, int) __THROW;
|
extern void _IO_wstr_finish (FILE *, int) __THROW;
|
||||||
|
|
||||||
|
/* Helper functions. */
|
||||||
|
int _IO_helper_overflow (FILE *s, int c);
|
||||||
|
int _IO_whelper_overflow (FILE *s, int c);
|
||||||
|
|
||||||
/* Internal versions of v*printf that take an additional flags
|
/* Internal versions of v*printf that take an additional flags
|
||||||
parameter. */
|
parameter. */
|
||||||
extern int __vfprintf_internal (FILE *fp, const char *format, va_list ap,
|
extern int __vfprintf_internal (FILE *fp, const char *format, va_list ap,
|
||||||
@ -895,14 +988,6 @@ _IO_acquire_lock_fct (FILE **p)
|
|||||||
} while (0)
|
} while (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Collect all vtables in a special section for vtable verification.
|
|
||||||
These symbols cover the extent of this section. */
|
|
||||||
symbol_set_declare (__libc_IO_vtables)
|
|
||||||
|
|
||||||
/* libio vtables need to carry this attribute so that they pass
|
|
||||||
validation. */
|
|
||||||
#define libio_vtable __attribute__ ((section ("__libc_IO_vtables")))
|
|
||||||
|
|
||||||
#ifdef SHARED
|
#ifdef SHARED
|
||||||
/* If equal to &_IO_vtable_check (with pointer guard protection),
|
/* If equal to &_IO_vtable_check (with pointer guard protection),
|
||||||
unknown vtable pointers are valid. This function pointer is solely
|
unknown vtable pointers are valid. This function pointer is solely
|
||||||
@ -937,12 +1022,9 @@ void _IO_vtable_check (void) attribute_hidden;
|
|||||||
static inline const struct _IO_jump_t *
|
static inline const struct _IO_jump_t *
|
||||||
IO_validate_vtable (const struct _IO_jump_t *vtable)
|
IO_validate_vtable (const struct _IO_jump_t *vtable)
|
||||||
{
|
{
|
||||||
/* Fast path: The vtable pointer is within the __libc_IO_vtables
|
|
||||||
section. */
|
|
||||||
uintptr_t section_length = __stop___libc_IO_vtables - __start___libc_IO_vtables;
|
|
||||||
uintptr_t ptr = (uintptr_t) vtable;
|
uintptr_t ptr = (uintptr_t) vtable;
|
||||||
uintptr_t offset = ptr - (uintptr_t) __start___libc_IO_vtables;
|
uintptr_t offset = ptr - (uintptr_t) &__io_vtables;
|
||||||
if (__glibc_unlikely (offset >= section_length))
|
if (__glibc_unlikely (offset >= IO_VTABLES_LEN))
|
||||||
/* The vtable pointer is not in the expected section. Use the
|
/* The vtable pointer is not in the expected section. Use the
|
||||||
slow path, which will terminate the process if necessary. */
|
slow path, which will terminate the process if necessary. */
|
||||||
_IO_vtable_check ();
|
_IO_vtable_check ();
|
||||||
|
@ -29,34 +29,6 @@ struct _IO_FILE_memstream
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static int _IO_mem_sync (FILE* fp) __THROW;
|
|
||||||
static void _IO_mem_finish (FILE* fp, int) __THROW;
|
|
||||||
|
|
||||||
|
|
||||||
static const struct _IO_jump_t _IO_mem_jumps libio_vtable =
|
|
||||||
{
|
|
||||||
JUMP_INIT_DUMMY,
|
|
||||||
JUMP_INIT (finish, _IO_mem_finish),
|
|
||||||
JUMP_INIT (overflow, _IO_str_overflow),
|
|
||||||
JUMP_INIT (underflow, _IO_str_underflow),
|
|
||||||
JUMP_INIT (uflow, _IO_default_uflow),
|
|
||||||
JUMP_INIT (pbackfail, _IO_str_pbackfail),
|
|
||||||
JUMP_INIT (xsputn, _IO_default_xsputn),
|
|
||||||
JUMP_INIT (xsgetn, _IO_default_xsgetn),
|
|
||||||
JUMP_INIT (seekoff, _IO_str_seekoff),
|
|
||||||
JUMP_INIT (seekpos, _IO_default_seekpos),
|
|
||||||
JUMP_INIT (setbuf, _IO_default_setbuf),
|
|
||||||
JUMP_INIT (sync, _IO_mem_sync),
|
|
||||||
JUMP_INIT (doallocate, _IO_default_doallocate),
|
|
||||||
JUMP_INIT (read, _IO_default_read),
|
|
||||||
JUMP_INIT (write, _IO_default_write),
|
|
||||||
JUMP_INIT (seek, _IO_default_seek),
|
|
||||||
JUMP_INIT (close, _IO_default_close),
|
|
||||||
JUMP_INIT (stat, _IO_default_stat),
|
|
||||||
JUMP_INIT(showmanyc, _IO_default_showmanyc),
|
|
||||||
JUMP_INIT(imbue, _IO_default_imbue)
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Open a stream that writes into a malloc'd buffer that is expanded as
|
/* Open a stream that writes into a malloc'd buffer that is expanded as
|
||||||
necessary. *BUFLOC and *SIZELOC are updated with the buffer's location
|
necessary. *BUFLOC and *SIZELOC are updated with the buffer's location
|
||||||
and the number of characters written on fflush or fclose. */
|
and the number of characters written on fflush or fclose. */
|
||||||
@ -105,7 +77,7 @@ libc_hidden_def (__open_memstream)
|
|||||||
weak_alias (__open_memstream, open_memstream)
|
weak_alias (__open_memstream, open_memstream)
|
||||||
|
|
||||||
|
|
||||||
static int
|
int
|
||||||
_IO_mem_sync (FILE *fp)
|
_IO_mem_sync (FILE *fp)
|
||||||
{
|
{
|
||||||
struct _IO_FILE_memstream *mp = (struct _IO_FILE_memstream *) fp;
|
struct _IO_FILE_memstream *mp = (struct _IO_FILE_memstream *) fp;
|
||||||
@ -123,7 +95,7 @@ _IO_mem_sync (FILE *fp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
void
|
||||||
_IO_mem_finish (FILE *fp, int dummy)
|
_IO_mem_finish (FILE *fp, int dummy)
|
||||||
{
|
{
|
||||||
struct _IO_FILE_memstream *mp = (struct _IO_FILE_memstream *) fp;
|
struct _IO_FILE_memstream *mp = (struct _IO_FILE_memstream *) fp;
|
||||||
|
@ -716,29 +716,6 @@ _IO_old_file_xsputn (FILE *f, const void *data, size_t n)
|
|||||||
return n - to_do;
|
return n - to_do;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const struct _IO_jump_t _IO_old_file_jumps libio_vtable =
|
|
||||||
{
|
|
||||||
JUMP_INIT_DUMMY,
|
|
||||||
JUMP_INIT(finish, _IO_old_file_finish),
|
|
||||||
JUMP_INIT(overflow, _IO_old_file_overflow),
|
|
||||||
JUMP_INIT(underflow, _IO_old_file_underflow),
|
|
||||||
JUMP_INIT(uflow, _IO_default_uflow),
|
|
||||||
JUMP_INIT(pbackfail, _IO_default_pbackfail),
|
|
||||||
JUMP_INIT(xsputn, _IO_old_file_xsputn),
|
|
||||||
JUMP_INIT(xsgetn, _IO_default_xsgetn),
|
|
||||||
JUMP_INIT(seekoff, _IO_old_file_seekoff),
|
|
||||||
JUMP_INIT(seekpos, _IO_default_seekpos),
|
|
||||||
JUMP_INIT(setbuf, _IO_old_file_setbuf),
|
|
||||||
JUMP_INIT(sync, _IO_old_file_sync),
|
|
||||||
JUMP_INIT(doallocate, _IO_file_doallocate),
|
|
||||||
JUMP_INIT(read, _IO_file_read),
|
|
||||||
JUMP_INIT(write, _IO_old_file_write),
|
|
||||||
JUMP_INIT(seek, _IO_file_seek),
|
|
||||||
JUMP_INIT(close, _IO_file_close),
|
|
||||||
JUMP_INIT(stat, _IO_file_stat)
|
|
||||||
};
|
|
||||||
|
|
||||||
compat_symbol (libc, _IO_old_do_write, _IO_do_write, GLIBC_2_0);
|
compat_symbol (libc, _IO_old_do_write, _IO_do_write, GLIBC_2_0);
|
||||||
compat_symbol (libc, _IO_old_file_attach, _IO_file_attach, GLIBC_2_0);
|
compat_symbol (libc, _IO_old_file_attach, _IO_file_attach, GLIBC_2_0);
|
||||||
compat_symbol (libc, _IO_old_file_close_it, _IO_file_close_it, GLIBC_2_0);
|
compat_symbol (libc, _IO_old_file_close_it, _IO_file_close_it, GLIBC_2_0);
|
||||||
|
@ -208,29 +208,6 @@ _IO_old_proc_close (FILE *fp)
|
|||||||
return wstatus;
|
return wstatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct _IO_jump_t _IO_old_proc_jumps libio_vtable = {
|
|
||||||
JUMP_INIT_DUMMY,
|
|
||||||
JUMP_INIT(finish, _IO_old_file_finish),
|
|
||||||
JUMP_INIT(overflow, _IO_old_file_overflow),
|
|
||||||
JUMP_INIT(underflow, _IO_old_file_underflow),
|
|
||||||
JUMP_INIT(uflow, _IO_default_uflow),
|
|
||||||
JUMP_INIT(pbackfail, _IO_default_pbackfail),
|
|
||||||
JUMP_INIT(xsputn, _IO_old_file_xsputn),
|
|
||||||
JUMP_INIT(xsgetn, _IO_default_xsgetn),
|
|
||||||
JUMP_INIT(seekoff, _IO_old_file_seekoff),
|
|
||||||
JUMP_INIT(seekpos, _IO_default_seekpos),
|
|
||||||
JUMP_INIT(setbuf, _IO_old_file_setbuf),
|
|
||||||
JUMP_INIT(sync, _IO_old_file_sync),
|
|
||||||
JUMP_INIT(doallocate, _IO_file_doallocate),
|
|
||||||
JUMP_INIT(read, _IO_file_read),
|
|
||||||
JUMP_INIT(write, _IO_old_file_write),
|
|
||||||
JUMP_INIT(seek, _IO_file_seek),
|
|
||||||
JUMP_INIT(close, _IO_old_proc_close),
|
|
||||||
JUMP_INIT(stat, _IO_file_stat),
|
|
||||||
JUMP_INIT(showmanyc, _IO_default_showmanyc),
|
|
||||||
JUMP_INIT(imbue, _IO_default_imbue)
|
|
||||||
};
|
|
||||||
|
|
||||||
strong_alias (_IO_old_popen, __old_popen)
|
strong_alias (_IO_old_popen, __old_popen)
|
||||||
compat_symbol (libc, _IO_old_popen, _IO_popen, GLIBC_2_0);
|
compat_symbol (libc, _IO_old_popen, _IO_popen, GLIBC_2_0);
|
||||||
compat_symbol (libc, __old_popen, popen, GLIBC_2_0);
|
compat_symbol (libc, __old_popen, popen, GLIBC_2_0);
|
||||||
|
@ -33,3 +33,6 @@
|
|||||||
FILE *stdin = (FILE *) &_IO_2_1_stdin_;
|
FILE *stdin = (FILE *) &_IO_2_1_stdin_;
|
||||||
FILE *stdout = (FILE *) &_IO_2_1_stdout_;
|
FILE *stdout = (FILE *) &_IO_2_1_stdout_;
|
||||||
FILE *stderr = (FILE *) &_IO_2_1_stderr_;
|
FILE *stderr = (FILE *) &_IO_2_1_stderr_;
|
||||||
|
|
||||||
|
libio_static_fn_required (_IO_file_open);
|
||||||
|
libio_static_fn_required (_IO_file_doallocate);
|
||||||
|
@ -78,8 +78,6 @@ typedef struct
|
|||||||
wchar_t overflow_buf[64];
|
wchar_t overflow_buf[64];
|
||||||
} _IO_wstrnfile;
|
} _IO_wstrnfile;
|
||||||
|
|
||||||
extern const struct _IO_jump_t _IO_wstrn_jumps attribute_hidden;
|
|
||||||
|
|
||||||
/* Initialize an _IO_strfile SF to read from narrow string STRING, and
|
/* Initialize an _IO_strfile SF to read from narrow string STRING, and
|
||||||
return the corresponding FILE object. It is not necessary to fclose
|
return the corresponding FILE object. It is not necessary to fclose
|
||||||
the FILE when it is no longer needed. */
|
the FILE when it is no longer needed. */
|
||||||
|
@ -352,27 +352,3 @@ _IO_str_finish (FILE *fp, int dummy)
|
|||||||
|
|
||||||
_IO_default_finish (fp, 0);
|
_IO_default_finish (fp, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct _IO_jump_t _IO_str_jumps libio_vtable =
|
|
||||||
{
|
|
||||||
JUMP_INIT_DUMMY,
|
|
||||||
JUMP_INIT(finish, _IO_str_finish),
|
|
||||||
JUMP_INIT(overflow, _IO_str_overflow),
|
|
||||||
JUMP_INIT(underflow, _IO_str_underflow),
|
|
||||||
JUMP_INIT(uflow, _IO_default_uflow),
|
|
||||||
JUMP_INIT(pbackfail, _IO_str_pbackfail),
|
|
||||||
JUMP_INIT(xsputn, _IO_default_xsputn),
|
|
||||||
JUMP_INIT(xsgetn, _IO_default_xsgetn),
|
|
||||||
JUMP_INIT(seekoff, _IO_str_seekoff),
|
|
||||||
JUMP_INIT(seekpos, _IO_default_seekpos),
|
|
||||||
JUMP_INIT(setbuf, _IO_default_setbuf),
|
|
||||||
JUMP_INIT(sync, _IO_default_sync),
|
|
||||||
JUMP_INIT(doallocate, _IO_default_doallocate),
|
|
||||||
JUMP_INIT(read, _IO_default_read),
|
|
||||||
JUMP_INIT(write, _IO_default_write),
|
|
||||||
JUMP_INIT(seek, _IO_default_seek),
|
|
||||||
JUMP_INIT(close, _IO_default_close),
|
|
||||||
JUMP_INIT(stat, _IO_default_stat),
|
|
||||||
JUMP_INIT(showmanyc, _IO_default_showmanyc),
|
|
||||||
JUMP_INIT(imbue, _IO_default_imbue)
|
|
||||||
};
|
|
||||||
|
@ -21,7 +21,12 @@
|
|||||||
/* Provide an interposed definition of the standard file handles with
|
/* Provide an interposed definition of the standard file handles with
|
||||||
our own vtable. stdout/stdin/stderr will not work as a result, but
|
our own vtable. stdout/stdin/stderr will not work as a result, but
|
||||||
a succesful test does not print anything, so this is fine. */
|
a succesful test does not print anything, so this is fine. */
|
||||||
|
#include "libioP.h"
|
||||||
|
#undef _IO_file_jumps
|
||||||
#define _IO_file_jumps jumps
|
#define _IO_file_jumps jumps
|
||||||
|
#undef _IO_wfile_jumps
|
||||||
|
extern const struct _IO_jump_t _IO_wfile_jumps;
|
||||||
|
#define _IO_wfile_jumps _IO_wfile_jumps
|
||||||
#include "stdfiles.c"
|
#include "stdfiles.c"
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
478
libio/vtables.c
478
libio/vtables.c
@ -21,6 +21,472 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <ldsodefs.h>
|
#include <ldsodefs.h>
|
||||||
#include <pointer_guard.h>
|
#include <pointer_guard.h>
|
||||||
|
#include <libio-macros.h>
|
||||||
|
|
||||||
|
/* Both _IO_str_* and _IO_new_file functions are pulled into every link (from
|
||||||
|
stdio initialization). */
|
||||||
|
#ifndef SHARED
|
||||||
|
/* NB: the following directives do add pragma weak for _IO_default _* and
|
||||||
|
_IO_wdefault_* symbols to potentially avoid link failures, since they
|
||||||
|
are always used when the __io_vtables is used. */
|
||||||
|
# pragma weak _IO_wstr_finish
|
||||||
|
# pragma weak _IO_wstr_overflow
|
||||||
|
# pragma weak _IO_wstr_pbackfail
|
||||||
|
# pragma weak _IO_wstr_seekoff
|
||||||
|
# pragma weak _IO_wstr_underflow
|
||||||
|
|
||||||
|
# pragma weak _IO_file_close
|
||||||
|
# pragma weak _IO_file_close_mmap
|
||||||
|
# pragma weak _IO_file_doallocate
|
||||||
|
# pragma weak _IO_file_finish
|
||||||
|
# pragma weak _IO_file_jumps_alias
|
||||||
|
# pragma weak _IO_file_overflow
|
||||||
|
# pragma weak _IO_file_read
|
||||||
|
# pragma weak _IO_file_seek
|
||||||
|
# pragma weak _IO_file_seekoff_maybe_mmap
|
||||||
|
# pragma weak _IO_file_seekoff_mmap
|
||||||
|
# pragma weak _IO_file_setbuf
|
||||||
|
# pragma weak _IO_file_setbuf_mmap
|
||||||
|
# pragma weak _IO_file_setbuf_mmap
|
||||||
|
# pragma weak _IO_file_stat
|
||||||
|
# pragma weak _IO_file_sync
|
||||||
|
# pragma weak _IO_file_sync_mmap
|
||||||
|
# pragma weak _IO_file_underflow
|
||||||
|
# pragma weak _IO_file_underflow_maybe_mmap
|
||||||
|
# pragma weak _IO_file_underflow_mmap
|
||||||
|
# pragma weak _IO_file_xsgetn
|
||||||
|
# pragma weak _IO_file_xsgetn_maybe_mmap
|
||||||
|
# pragma weak _IO_file_xsgetn_mmap
|
||||||
|
# pragma weak _IO_file_xsputn
|
||||||
|
|
||||||
|
# pragma weak _IO_wfile_overflow
|
||||||
|
# pragma weak _IO_wfile_sync
|
||||||
|
# pragma weak _IO_wfile_underflow
|
||||||
|
# pragma weak _IO_wfile_underflow_maybe_mmap
|
||||||
|
# pragma weak _IO_wfile_underflow_mmap
|
||||||
|
# pragma weak _IO_wfile_doallocate
|
||||||
|
# pragma weak _IO_wfile_jumps_alia
|
||||||
|
# pragma weak _IO_wfile_seekoff
|
||||||
|
# pragma weak _IO_wfile_xsputn
|
||||||
|
|
||||||
|
# pragma weak _IO_new_proc_close
|
||||||
|
|
||||||
|
# pragma weak _IO_cookie_close
|
||||||
|
# pragma weak _IO_cookie_read
|
||||||
|
# pragma weak _IO_cookie_seek
|
||||||
|
# pragma weak _IO_cookie_seekoff
|
||||||
|
# pragma weak _IO_cookie_write
|
||||||
|
|
||||||
|
# pragma weak _IO_mem_finish
|
||||||
|
# pragma weak _IO_mem_sync
|
||||||
|
|
||||||
|
# pragma weak _IO_wmem_finish
|
||||||
|
# pragma weak _IO_wmem_sync
|
||||||
|
|
||||||
|
# pragma weak __printf_buffer_as_file_overflow
|
||||||
|
# pragma weak __printf_buffer_as_file_xsputn
|
||||||
|
|
||||||
|
# pragma weak __wprintf_buffer_as_file_overflow
|
||||||
|
# pragma weak __wprintf_buffer_as_file_xsputn
|
||||||
|
#endif
|
||||||
|
|
||||||
|
const struct _IO_jump_t __io_vtables[IO_VTABLES_LEN] attribute_relro =
|
||||||
|
{
|
||||||
|
/* _IO_str_jumps */
|
||||||
|
[IO_STR_JUMPS] =
|
||||||
|
{
|
||||||
|
JUMP_INIT_DUMMY,
|
||||||
|
JUMP_INIT (finish, _IO_str_finish),
|
||||||
|
JUMP_INIT (overflow, _IO_str_overflow),
|
||||||
|
JUMP_INIT (underflow, _IO_str_underflow),
|
||||||
|
JUMP_INIT (uflow, _IO_default_uflow),
|
||||||
|
JUMP_INIT (pbackfail, _IO_str_pbackfail),
|
||||||
|
JUMP_INIT (xsputn, _IO_default_xsputn),
|
||||||
|
JUMP_INIT (xsgetn, _IO_default_xsgetn),
|
||||||
|
JUMP_INIT (seekoff, _IO_str_seekoff),
|
||||||
|
JUMP_INIT (seekpos, _IO_default_seekpos),
|
||||||
|
JUMP_INIT (setbuf, _IO_default_setbuf),
|
||||||
|
JUMP_INIT (sync, _IO_default_sync),
|
||||||
|
JUMP_INIT (doallocate, _IO_default_doallocate),
|
||||||
|
JUMP_INIT (read, _IO_default_read),
|
||||||
|
JUMP_INIT (write, _IO_default_write),
|
||||||
|
JUMP_INIT (seek, _IO_default_seek),
|
||||||
|
JUMP_INIT (close, _IO_default_close),
|
||||||
|
JUMP_INIT (stat, _IO_default_stat),
|
||||||
|
JUMP_INIT (showmanyc, _IO_default_showmanyc),
|
||||||
|
JUMP_INIT (imbue, _IO_default_imbue)
|
||||||
|
},
|
||||||
|
/* _IO_wstr_jumps */
|
||||||
|
[IO_WSTR_JUMPS] = {
|
||||||
|
JUMP_INIT_DUMMY,
|
||||||
|
JUMP_INIT (finish, _IO_wstr_finish),
|
||||||
|
JUMP_INIT (overflow, (_IO_overflow_t) _IO_wstr_overflow),
|
||||||
|
JUMP_INIT (underflow, (_IO_underflow_t) _IO_wstr_underflow),
|
||||||
|
JUMP_INIT (uflow, (_IO_underflow_t) _IO_wdefault_uflow),
|
||||||
|
JUMP_INIT (pbackfail, (_IO_pbackfail_t) _IO_wstr_pbackfail),
|
||||||
|
JUMP_INIT (xsputn, _IO_wdefault_xsputn),
|
||||||
|
JUMP_INIT (xsgetn, _IO_wdefault_xsgetn),
|
||||||
|
JUMP_INIT (seekoff, _IO_wstr_seekoff),
|
||||||
|
JUMP_INIT (seekpos, _IO_default_seekpos),
|
||||||
|
JUMP_INIT (setbuf, _IO_default_setbuf),
|
||||||
|
JUMP_INIT (sync, _IO_default_sync),
|
||||||
|
JUMP_INIT (doallocate, _IO_wdefault_doallocate),
|
||||||
|
JUMP_INIT (read, _IO_default_read),
|
||||||
|
JUMP_INIT (write, _IO_default_write),
|
||||||
|
JUMP_INIT (seek, _IO_default_seek),
|
||||||
|
JUMP_INIT (close, _IO_default_close),
|
||||||
|
JUMP_INIT (stat, _IO_default_stat),
|
||||||
|
JUMP_INIT (showmanyc, _IO_default_showmanyc),
|
||||||
|
JUMP_INIT (imbue, _IO_default_imbue)
|
||||||
|
},
|
||||||
|
/* _IO_file_jumps */
|
||||||
|
[IO_FILE_JUMPS] = {
|
||||||
|
JUMP_INIT_DUMMY,
|
||||||
|
JUMP_INIT (finish, _IO_file_finish),
|
||||||
|
JUMP_INIT (overflow, _IO_file_overflow),
|
||||||
|
JUMP_INIT (underflow, _IO_file_underflow),
|
||||||
|
JUMP_INIT (uflow, _IO_default_uflow),
|
||||||
|
JUMP_INIT (pbackfail, _IO_default_pbackfail),
|
||||||
|
JUMP_INIT (xsputn, _IO_file_xsputn),
|
||||||
|
JUMP_INIT (xsgetn, _IO_file_xsgetn),
|
||||||
|
JUMP_INIT (seekoff, _IO_new_file_seekoff),
|
||||||
|
JUMP_INIT (seekpos, _IO_default_seekpos),
|
||||||
|
JUMP_INIT (setbuf, _IO_new_file_setbuf),
|
||||||
|
JUMP_INIT (sync, _IO_new_file_sync),
|
||||||
|
JUMP_INIT (doallocate, _IO_file_doallocate),
|
||||||
|
JUMP_INIT (read, _IO_file_read),
|
||||||
|
JUMP_INIT (write, _IO_new_file_write),
|
||||||
|
JUMP_INIT (seek, _IO_file_seek),
|
||||||
|
JUMP_INIT (close, _IO_file_close),
|
||||||
|
JUMP_INIT (stat, _IO_file_stat),
|
||||||
|
JUMP_INIT (showmanyc, _IO_default_showmanyc),
|
||||||
|
JUMP_INIT (imbue, _IO_default_imbue)
|
||||||
|
},
|
||||||
|
/* _IO_file_jumps_mmap */
|
||||||
|
[IO_FILE_JUMPS_MMAP] = {
|
||||||
|
JUMP_INIT_DUMMY,
|
||||||
|
JUMP_INIT (finish, _IO_file_finish),
|
||||||
|
JUMP_INIT (overflow, _IO_file_overflow),
|
||||||
|
JUMP_INIT (underflow, _IO_file_underflow_mmap),
|
||||||
|
JUMP_INIT (uflow, _IO_default_uflow),
|
||||||
|
JUMP_INIT (pbackfail, _IO_default_pbackfail),
|
||||||
|
JUMP_INIT (xsputn, _IO_new_file_xsputn),
|
||||||
|
JUMP_INIT (xsgetn, _IO_file_xsgetn_mmap),
|
||||||
|
JUMP_INIT (seekoff, _IO_file_seekoff_mmap),
|
||||||
|
JUMP_INIT (seekpos, _IO_default_seekpos),
|
||||||
|
JUMP_INIT (setbuf, (_IO_setbuf_t) _IO_file_setbuf_mmap),
|
||||||
|
JUMP_INIT (sync, _IO_file_sync_mmap),
|
||||||
|
JUMP_INIT (doallocate, _IO_file_doallocate),
|
||||||
|
JUMP_INIT (read, _IO_file_read),
|
||||||
|
JUMP_INIT (write, _IO_new_file_write),
|
||||||
|
JUMP_INIT (seek, _IO_file_seek),
|
||||||
|
JUMP_INIT (close, _IO_file_close_mmap),
|
||||||
|
JUMP_INIT (stat, _IO_file_stat),
|
||||||
|
JUMP_INIT (showmanyc, _IO_default_showmanyc),
|
||||||
|
JUMP_INIT (imbue, _IO_default_imbue)
|
||||||
|
},
|
||||||
|
/* _IO_file_jumps_maybe_mmap */
|
||||||
|
[IO_FILE_JUMPS_MAYBE_MMAP] = {
|
||||||
|
JUMP_INIT_DUMMY,
|
||||||
|
JUMP_INIT (finish, _IO_file_finish),
|
||||||
|
JUMP_INIT (overflow, _IO_file_overflow),
|
||||||
|
JUMP_INIT (underflow, _IO_file_underflow_maybe_mmap),
|
||||||
|
JUMP_INIT (uflow, _IO_default_uflow),
|
||||||
|
JUMP_INIT (pbackfail, _IO_default_pbackfail),
|
||||||
|
JUMP_INIT (xsputn, _IO_new_file_xsputn),
|
||||||
|
JUMP_INIT (xsgetn, _IO_file_xsgetn_maybe_mmap),
|
||||||
|
JUMP_INIT (seekoff, _IO_file_seekoff_maybe_mmap),
|
||||||
|
JUMP_INIT (seekpos, _IO_default_seekpos),
|
||||||
|
JUMP_INIT (setbuf, (_IO_setbuf_t) _IO_file_setbuf_mmap),
|
||||||
|
JUMP_INIT (sync, _IO_new_file_sync),
|
||||||
|
JUMP_INIT (doallocate, _IO_file_doallocate),
|
||||||
|
JUMP_INIT (read, _IO_file_read),
|
||||||
|
JUMP_INIT (write, _IO_new_file_write),
|
||||||
|
JUMP_INIT (seek, _IO_file_seek),
|
||||||
|
JUMP_INIT (close, _IO_file_close),
|
||||||
|
JUMP_INIT (stat, _IO_file_stat),
|
||||||
|
JUMP_INIT (showmanyc, _IO_default_showmanyc),
|
||||||
|
JUMP_INIT (imbue, _IO_default_imbue)
|
||||||
|
},
|
||||||
|
/* _IO_wfile_jumps */
|
||||||
|
[IO_WFILE_JUMPS] = {
|
||||||
|
JUMP_INIT_DUMMY,
|
||||||
|
JUMP_INIT (finish, _IO_new_file_finish),
|
||||||
|
JUMP_INIT (overflow, (_IO_overflow_t) _IO_wfile_overflow),
|
||||||
|
JUMP_INIT (underflow, (_IO_underflow_t) _IO_wfile_underflow),
|
||||||
|
JUMP_INIT (uflow, (_IO_underflow_t) _IO_wdefault_uflow),
|
||||||
|
JUMP_INIT (pbackfail, (_IO_pbackfail_t) _IO_wdefault_pbackfail),
|
||||||
|
JUMP_INIT (xsputn, _IO_wfile_xsputn),
|
||||||
|
JUMP_INIT (xsgetn, _IO_file_xsgetn),
|
||||||
|
JUMP_INIT (seekoff, _IO_wfile_seekoff),
|
||||||
|
JUMP_INIT (seekpos, _IO_default_seekpos),
|
||||||
|
JUMP_INIT (setbuf, _IO_new_file_setbuf),
|
||||||
|
JUMP_INIT (sync, (_IO_sync_t) _IO_wfile_sync),
|
||||||
|
JUMP_INIT (doallocate, _IO_wfile_doallocate),
|
||||||
|
JUMP_INIT (read, _IO_file_read),
|
||||||
|
JUMP_INIT (write, _IO_new_file_write),
|
||||||
|
JUMP_INIT (seek, _IO_file_seek),
|
||||||
|
JUMP_INIT (close, _IO_file_close),
|
||||||
|
JUMP_INIT (stat, _IO_file_stat),
|
||||||
|
JUMP_INIT (showmanyc, _IO_default_showmanyc),
|
||||||
|
JUMP_INIT (imbue, _IO_default_imbue)
|
||||||
|
},
|
||||||
|
/* _IO_wfile_jumps_mmap */
|
||||||
|
[IO_WFILE_JUMPS_MMAP] = {
|
||||||
|
JUMP_INIT_DUMMY,
|
||||||
|
JUMP_INIT (finish, _IO_new_file_finish),
|
||||||
|
JUMP_INIT (overflow, (_IO_overflow_t) _IO_wfile_overflow),
|
||||||
|
JUMP_INIT (underflow, (_IO_underflow_t) _IO_wfile_underflow_mmap),
|
||||||
|
JUMP_INIT (uflow, (_IO_underflow_t) _IO_wdefault_uflow),
|
||||||
|
JUMP_INIT (pbackfail, (_IO_pbackfail_t) _IO_wdefault_pbackfail),
|
||||||
|
JUMP_INIT (xsputn, _IO_wfile_xsputn),
|
||||||
|
JUMP_INIT (xsgetn, _IO_file_xsgetn),
|
||||||
|
JUMP_INIT (seekoff, _IO_wfile_seekoff),
|
||||||
|
JUMP_INIT (seekpos, _IO_default_seekpos),
|
||||||
|
JUMP_INIT (setbuf, _IO_file_setbuf_mmap),
|
||||||
|
JUMP_INIT (sync, (_IO_sync_t) _IO_wfile_sync),
|
||||||
|
JUMP_INIT (doallocate, _IO_wfile_doallocate),
|
||||||
|
JUMP_INIT (read, _IO_file_read),
|
||||||
|
JUMP_INIT (write, _IO_new_file_write),
|
||||||
|
JUMP_INIT (seek, _IO_file_seek),
|
||||||
|
JUMP_INIT (close, _IO_file_close_mmap),
|
||||||
|
JUMP_INIT (stat, _IO_file_stat),
|
||||||
|
JUMP_INIT (showmanyc, _IO_default_showmanyc),
|
||||||
|
JUMP_INIT (imbue, _IO_default_imbue)
|
||||||
|
},
|
||||||
|
/* _IO_wfile_jumps_maybe_mmap */
|
||||||
|
[IO_WFILE_JUMPS_MAYBE_MMAP] = {
|
||||||
|
JUMP_INIT_DUMMY,
|
||||||
|
JUMP_INIT (finish, _IO_new_file_finish),
|
||||||
|
JUMP_INIT (overflow, (_IO_overflow_t) _IO_wfile_overflow),
|
||||||
|
JUMP_INIT (underflow, (_IO_underflow_t) _IO_wfile_underflow_maybe_mmap),
|
||||||
|
JUMP_INIT (uflow, (_IO_underflow_t) _IO_wdefault_uflow),
|
||||||
|
JUMP_INIT (pbackfail, (_IO_pbackfail_t) _IO_wdefault_pbackfail),
|
||||||
|
JUMP_INIT (xsputn, _IO_wfile_xsputn),
|
||||||
|
JUMP_INIT (xsgetn, _IO_file_xsgetn),
|
||||||
|
JUMP_INIT (seekoff, _IO_wfile_seekoff),
|
||||||
|
JUMP_INIT (seekpos, _IO_default_seekpos),
|
||||||
|
JUMP_INIT (setbuf, _IO_file_setbuf_mmap),
|
||||||
|
JUMP_INIT (sync, (_IO_sync_t) _IO_wfile_sync),
|
||||||
|
JUMP_INIT (doallocate, _IO_wfile_doallocate),
|
||||||
|
JUMP_INIT (read, _IO_file_read),
|
||||||
|
JUMP_INIT (write, _IO_new_file_write),
|
||||||
|
JUMP_INIT (seek, _IO_file_seek),
|
||||||
|
JUMP_INIT (close, _IO_file_close),
|
||||||
|
JUMP_INIT (stat, _IO_file_stat),
|
||||||
|
JUMP_INIT (showmanyc, _IO_default_showmanyc),
|
||||||
|
JUMP_INIT (imbue, _IO_default_imbue)
|
||||||
|
},
|
||||||
|
/* _IO_cookie_jumps */
|
||||||
|
[IO_COOKIE_JUMPS] = {
|
||||||
|
JUMP_INIT_DUMMY,
|
||||||
|
JUMP_INIT (finish, _IO_file_finish),
|
||||||
|
JUMP_INIT (overflow, _IO_file_overflow),
|
||||||
|
JUMP_INIT (underflow, _IO_file_underflow),
|
||||||
|
JUMP_INIT (uflow, _IO_default_uflow),
|
||||||
|
JUMP_INIT (pbackfail, _IO_default_pbackfail),
|
||||||
|
JUMP_INIT (xsputn, _IO_file_xsputn),
|
||||||
|
JUMP_INIT (xsgetn, _IO_default_xsgetn),
|
||||||
|
JUMP_INIT (seekoff, _IO_cookie_seekoff),
|
||||||
|
JUMP_INIT (seekpos, _IO_default_seekpos),
|
||||||
|
JUMP_INIT (setbuf, _IO_file_setbuf),
|
||||||
|
JUMP_INIT (sync, _IO_file_sync),
|
||||||
|
JUMP_INIT (doallocate, _IO_file_doallocate),
|
||||||
|
JUMP_INIT (read, _IO_cookie_read),
|
||||||
|
JUMP_INIT (write, _IO_cookie_write),
|
||||||
|
JUMP_INIT (seek, _IO_cookie_seek),
|
||||||
|
JUMP_INIT (close, _IO_cookie_close),
|
||||||
|
JUMP_INIT (stat, _IO_default_stat),
|
||||||
|
JUMP_INIT (showmanyc, _IO_default_showmanyc),
|
||||||
|
JUMP_INIT (imbue, _IO_default_imbue),
|
||||||
|
},
|
||||||
|
/* _IO_proc_jumps */
|
||||||
|
[IO_PROC_JUMPS] = {
|
||||||
|
JUMP_INIT_DUMMY,
|
||||||
|
JUMP_INIT (finish, _IO_new_file_finish),
|
||||||
|
JUMP_INIT (overflow, _IO_new_file_overflow),
|
||||||
|
JUMP_INIT (underflow, _IO_new_file_underflow),
|
||||||
|
JUMP_INIT (uflow, _IO_default_uflow),
|
||||||
|
JUMP_INIT (pbackfail, _IO_default_pbackfail),
|
||||||
|
JUMP_INIT (xsputn, _IO_new_file_xsputn),
|
||||||
|
JUMP_INIT (xsgetn, _IO_default_xsgetn),
|
||||||
|
JUMP_INIT (seekoff, _IO_new_file_seekoff),
|
||||||
|
JUMP_INIT (seekpos, _IO_default_seekpos),
|
||||||
|
JUMP_INIT (setbuf, _IO_new_file_setbuf),
|
||||||
|
JUMP_INIT (sync, _IO_new_file_sync),
|
||||||
|
JUMP_INIT (doallocate, _IO_file_doallocate),
|
||||||
|
JUMP_INIT (read, _IO_file_read),
|
||||||
|
JUMP_INIT (write, _IO_new_file_write),
|
||||||
|
JUMP_INIT (seek, _IO_file_seek),
|
||||||
|
JUMP_INIT (close, _IO_new_proc_close),
|
||||||
|
JUMP_INIT (stat, _IO_file_stat),
|
||||||
|
JUMP_INIT (showmanyc, _IO_default_showmanyc),
|
||||||
|
JUMP_INIT (imbue, _IO_default_imbue)
|
||||||
|
},
|
||||||
|
/* _IO_mem_jumps */
|
||||||
|
[IO_MEM_JUMPS] = {
|
||||||
|
JUMP_INIT_DUMMY,
|
||||||
|
JUMP_INIT (finish, _IO_mem_finish),
|
||||||
|
JUMP_INIT (overflow, _IO_str_overflow),
|
||||||
|
JUMP_INIT (underflow, _IO_str_underflow),
|
||||||
|
JUMP_INIT (uflow, _IO_default_uflow),
|
||||||
|
JUMP_INIT (pbackfail, _IO_str_pbackfail),
|
||||||
|
JUMP_INIT (xsputn, _IO_default_xsputn),
|
||||||
|
JUMP_INIT (xsgetn, _IO_default_xsgetn),
|
||||||
|
JUMP_INIT (seekoff, _IO_str_seekoff),
|
||||||
|
JUMP_INIT (seekpos, _IO_default_seekpos),
|
||||||
|
JUMP_INIT (setbuf, _IO_default_setbuf),
|
||||||
|
JUMP_INIT (sync, _IO_mem_sync),
|
||||||
|
JUMP_INIT (doallocate, _IO_default_doallocate),
|
||||||
|
JUMP_INIT (read, _IO_default_read),
|
||||||
|
JUMP_INIT (write, _IO_default_write),
|
||||||
|
JUMP_INIT (seek, _IO_default_seek),
|
||||||
|
JUMP_INIT (close, _IO_default_close),
|
||||||
|
JUMP_INIT (stat, _IO_default_stat),
|
||||||
|
JUMP_INIT (showmanyc, _IO_default_showmanyc),
|
||||||
|
JUMP_INIT (imbue, _IO_default_imbue)
|
||||||
|
},
|
||||||
|
/* _IO_wmem_jumps */
|
||||||
|
[IO_WMEM_JUMPS] = {
|
||||||
|
JUMP_INIT_DUMMY,
|
||||||
|
JUMP_INIT (finish, _IO_wmem_finish),
|
||||||
|
JUMP_INIT (overflow, (_IO_overflow_t) _IO_wstr_overflow),
|
||||||
|
JUMP_INIT (underflow, (_IO_underflow_t) _IO_wstr_underflow),
|
||||||
|
JUMP_INIT (uflow, (_IO_underflow_t) _IO_wdefault_uflow),
|
||||||
|
JUMP_INIT (pbackfail, (_IO_pbackfail_t) _IO_wstr_pbackfail),
|
||||||
|
JUMP_INIT (xsputn, _IO_wdefault_xsputn),
|
||||||
|
JUMP_INIT (xsgetn, _IO_wdefault_xsgetn),
|
||||||
|
JUMP_INIT (seekoff, _IO_wstr_seekoff),
|
||||||
|
JUMP_INIT (seekpos, _IO_default_seekpos),
|
||||||
|
JUMP_INIT (setbuf, _IO_default_setbuf),
|
||||||
|
JUMP_INIT (sync, _IO_wmem_sync),
|
||||||
|
JUMP_INIT (doallocate, _IO_wdefault_doallocate),
|
||||||
|
JUMP_INIT (read, _IO_default_read),
|
||||||
|
JUMP_INIT (write, _IO_default_write),
|
||||||
|
JUMP_INIT (seek, _IO_default_seek),
|
||||||
|
JUMP_INIT (close, _IO_default_close),
|
||||||
|
JUMP_INIT (stat, _IO_default_stat),
|
||||||
|
JUMP_INIT (showmanyc, _IO_default_showmanyc),
|
||||||
|
JUMP_INIT (imbue, _IO_default_imbue)
|
||||||
|
},
|
||||||
|
[IO_PRINTF_BUFFER_AS_FILE_JUMPS] = {
|
||||||
|
JUMP_INIT_DUMMY,
|
||||||
|
JUMP_INIT (finish, NULL),
|
||||||
|
JUMP_INIT (overflow, __printf_buffer_as_file_overflow),
|
||||||
|
JUMP_INIT (underflow, NULL),
|
||||||
|
JUMP_INIT (uflow, NULL),
|
||||||
|
JUMP_INIT (pbackfail, NULL),
|
||||||
|
JUMP_INIT (xsputn, __printf_buffer_as_file_xsputn),
|
||||||
|
JUMP_INIT (xsgetn, NULL),
|
||||||
|
JUMP_INIT (seekoff, NULL),
|
||||||
|
JUMP_INIT (seekpos, NULL),
|
||||||
|
JUMP_INIT (setbuf, NULL),
|
||||||
|
JUMP_INIT (sync, NULL),
|
||||||
|
JUMP_INIT (doallocate, NULL),
|
||||||
|
JUMP_INIT (read, NULL),
|
||||||
|
JUMP_INIT (write, NULL),
|
||||||
|
JUMP_INIT (seek, NULL),
|
||||||
|
JUMP_INIT (close, NULL),
|
||||||
|
JUMP_INIT (stat, NULL),
|
||||||
|
JUMP_INIT (showmanyc, NULL),
|
||||||
|
JUMP_INIT (imbue, NULL)
|
||||||
|
},
|
||||||
|
[IO_WPRINTF_BUFFER_AS_FILE_JUMPS] = {
|
||||||
|
JUMP_INIT_DUMMY,
|
||||||
|
JUMP_INIT (finish, NULL),
|
||||||
|
JUMP_INIT (overflow, (_IO_overflow_t) __wprintf_buffer_as_file_overflow),
|
||||||
|
JUMP_INIT (underflow, NULL),
|
||||||
|
JUMP_INIT (uflow, NULL),
|
||||||
|
JUMP_INIT (pbackfail, NULL),
|
||||||
|
JUMP_INIT (xsputn, __wprintf_buffer_as_file_xsputn),
|
||||||
|
JUMP_INIT (xsgetn, NULL),
|
||||||
|
JUMP_INIT (seekoff, NULL),
|
||||||
|
JUMP_INIT (seekpos, NULL),
|
||||||
|
JUMP_INIT (setbuf, NULL),
|
||||||
|
JUMP_INIT (sync, NULL),
|
||||||
|
JUMP_INIT (doallocate, NULL),
|
||||||
|
JUMP_INIT (read, NULL),
|
||||||
|
JUMP_INIT (write, NULL),
|
||||||
|
JUMP_INIT (seek, NULL),
|
||||||
|
JUMP_INIT (close, NULL),
|
||||||
|
JUMP_INIT (stat, NULL),
|
||||||
|
JUMP_INIT (showmanyc, NULL),
|
||||||
|
JUMP_INIT (imbue, NULL)
|
||||||
|
},
|
||||||
|
|
||||||
|
#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
|
||||||
|
/* _IO_old_file_jumps */
|
||||||
|
[IO_OLD_FILE_JUMPS] = {
|
||||||
|
JUMP_INIT_DUMMY,
|
||||||
|
JUMP_INIT (finish, _IO_old_file_finish),
|
||||||
|
JUMP_INIT (overflow, _IO_old_file_overflow),
|
||||||
|
JUMP_INIT (underflow, _IO_old_file_underflow),
|
||||||
|
JUMP_INIT (uflow, _IO_default_uflow),
|
||||||
|
JUMP_INIT (pbackfail, _IO_default_pbackfail),
|
||||||
|
JUMP_INIT (xsputn, _IO_old_file_xsputn),
|
||||||
|
JUMP_INIT (xsgetn, _IO_default_xsgetn),
|
||||||
|
JUMP_INIT (seekoff, _IO_old_file_seekoff),
|
||||||
|
JUMP_INIT (seekpos, _IO_default_seekpos),
|
||||||
|
JUMP_INIT (setbuf, _IO_old_file_setbuf),
|
||||||
|
JUMP_INIT (sync, _IO_old_file_sync),
|
||||||
|
JUMP_INIT (doallocate, _IO_file_doallocate),
|
||||||
|
JUMP_INIT (read, _IO_file_read),
|
||||||
|
JUMP_INIT (write, _IO_old_file_write),
|
||||||
|
JUMP_INIT (seek, _IO_file_seek),
|
||||||
|
JUMP_INIT (close, _IO_file_close),
|
||||||
|
JUMP_INIT (stat, _IO_file_stat)
|
||||||
|
},
|
||||||
|
/* _IO_old_proc_jumps */
|
||||||
|
[IO_OLD_PROC_JUMPS] = {
|
||||||
|
JUMP_INIT_DUMMY,
|
||||||
|
JUMP_INIT (finish, _IO_old_file_finish),
|
||||||
|
JUMP_INIT (overflow, _IO_old_file_overflow),
|
||||||
|
JUMP_INIT (underflow, _IO_old_file_underflow),
|
||||||
|
JUMP_INIT (uflow, _IO_default_uflow),
|
||||||
|
JUMP_INIT (pbackfail, _IO_default_pbackfail),
|
||||||
|
JUMP_INIT (xsputn, _IO_old_file_xsputn),
|
||||||
|
JUMP_INIT (xsgetn, _IO_default_xsgetn),
|
||||||
|
JUMP_INIT (seekoff, _IO_old_file_seekoff),
|
||||||
|
JUMP_INIT (seekpos, _IO_default_seekpos),
|
||||||
|
JUMP_INIT (setbuf, _IO_old_file_setbuf),
|
||||||
|
JUMP_INIT (sync, _IO_old_file_sync),
|
||||||
|
JUMP_INIT (doallocate, _IO_file_doallocate),
|
||||||
|
JUMP_INIT (read, _IO_file_read),
|
||||||
|
JUMP_INIT (write, _IO_old_file_write),
|
||||||
|
JUMP_INIT (seek, _IO_file_seek),
|
||||||
|
JUMP_INIT (close, _IO_old_proc_close),
|
||||||
|
JUMP_INIT (stat, _IO_file_stat),
|
||||||
|
JUMP_INIT (showmanyc, _IO_default_showmanyc),
|
||||||
|
JUMP_INIT (imbue, _IO_default_imbue)
|
||||||
|
},
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2)
|
||||||
|
/* _IO_old_cookie_jumps */
|
||||||
|
[IO_OLD_COOKIED_JUMPS] = {
|
||||||
|
JUMP_INIT_DUMMY,
|
||||||
|
JUMP_INIT (finish, _IO_file_finish),
|
||||||
|
JUMP_INIT (overflow, _IO_file_overflow),
|
||||||
|
JUMP_INIT (underflow, _IO_file_underflow),
|
||||||
|
JUMP_INIT (uflow, _IO_default_uflow),
|
||||||
|
JUMP_INIT (pbackfail, _IO_default_pbackfail),
|
||||||
|
JUMP_INIT (xsputn, _IO_file_xsputn),
|
||||||
|
JUMP_INIT (xsgetn, _IO_default_xsgetn),
|
||||||
|
JUMP_INIT (seekoff, _IO_cookie_seekoff),
|
||||||
|
JUMP_INIT (seekpos, _IO_default_seekpos),
|
||||||
|
JUMP_INIT (setbuf, _IO_file_setbuf),
|
||||||
|
JUMP_INIT (sync, _IO_file_sync),
|
||||||
|
JUMP_INIT (doallocate, _IO_file_doallocate),
|
||||||
|
JUMP_INIT (read, _IO_cookie_read),
|
||||||
|
JUMP_INIT (write, _IO_cookie_write),
|
||||||
|
JUMP_INIT (seek, _IO_old_cookie_seek),
|
||||||
|
JUMP_INIT (close, _IO_cookie_close),
|
||||||
|
JUMP_INIT (stat, _IO_default_stat),
|
||||||
|
JUMP_INIT (showmanyc, _IO_default_showmanyc),
|
||||||
|
JUMP_INIT (imbue, _IO_default_imbue),
|
||||||
|
},
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
#ifdef SHARED
|
#ifdef SHARED
|
||||||
|
|
||||||
@ -82,3 +548,15 @@ check_stdfiles_vtables (void)
|
|||||||
IO_set_accept_foreign_vtables (&_IO_vtable_check);
|
IO_set_accept_foreign_vtables (&_IO_vtable_check);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define STR(s) XSTR(s)
|
||||||
|
#define XSTR(s) #s
|
||||||
|
|
||||||
|
#undef _IO_file_jumps
|
||||||
|
#define _IO_file_jumps_alias "__io_vtables + " STR(IO_FILE_JUMPS_OFFSET)
|
||||||
|
declare_object_symbol_alias (_IO_file_jumps, _IO_file_jumps_alias,
|
||||||
|
IO_JUMP_T_SIZE)
|
||||||
|
#undef _IO_wfile_jumps
|
||||||
|
#define _IO_wfile_jumps_alias "__io_vtables + " STR(IO_WFILE_JUMPS_OFFSET)
|
||||||
|
declare_object_symbol_alias (_IO_wfile_jumps, _IO_wfile_jumps_alias,
|
||||||
|
IO_JUMP_T_SIZE)
|
||||||
|
@ -328,7 +328,7 @@ _IO_wfile_underflow (FILE *fp)
|
|||||||
libc_hidden_def (_IO_wfile_underflow)
|
libc_hidden_def (_IO_wfile_underflow)
|
||||||
|
|
||||||
|
|
||||||
static wint_t
|
wint_t
|
||||||
_IO_wfile_underflow_mmap (FILE *fp)
|
_IO_wfile_underflow_mmap (FILE *fp)
|
||||||
{
|
{
|
||||||
struct _IO_codecvt *cd;
|
struct _IO_codecvt *cd;
|
||||||
@ -389,7 +389,7 @@ _IO_wfile_underflow_mmap (FILE *fp)
|
|||||||
return WEOF;
|
return WEOF;
|
||||||
}
|
}
|
||||||
|
|
||||||
static wint_t
|
wint_t
|
||||||
_IO_wfile_underflow_maybe_mmap (FILE *fp)
|
_IO_wfile_underflow_maybe_mmap (FILE *fp)
|
||||||
{
|
{
|
||||||
/* This is the first read attempt. Doing the underflow will choose mmap
|
/* This is the first read attempt. Doing the underflow will choose mmap
|
||||||
@ -1017,78 +1017,3 @@ _IO_wfile_xsputn (FILE *f, const void *data, size_t n)
|
|||||||
return n - to_do;
|
return n - to_do;
|
||||||
}
|
}
|
||||||
libc_hidden_def (_IO_wfile_xsputn)
|
libc_hidden_def (_IO_wfile_xsputn)
|
||||||
|
|
||||||
|
|
||||||
const struct _IO_jump_t _IO_wfile_jumps libio_vtable =
|
|
||||||
{
|
|
||||||
JUMP_INIT_DUMMY,
|
|
||||||
JUMP_INIT(finish, _IO_new_file_finish),
|
|
||||||
JUMP_INIT(overflow, (_IO_overflow_t) _IO_wfile_overflow),
|
|
||||||
JUMP_INIT(underflow, (_IO_underflow_t) _IO_wfile_underflow),
|
|
||||||
JUMP_INIT(uflow, (_IO_underflow_t) _IO_wdefault_uflow),
|
|
||||||
JUMP_INIT(pbackfail, (_IO_pbackfail_t) _IO_wdefault_pbackfail),
|
|
||||||
JUMP_INIT(xsputn, _IO_wfile_xsputn),
|
|
||||||
JUMP_INIT(xsgetn, _IO_file_xsgetn),
|
|
||||||
JUMP_INIT(seekoff, _IO_wfile_seekoff),
|
|
||||||
JUMP_INIT(seekpos, _IO_default_seekpos),
|
|
||||||
JUMP_INIT(setbuf, _IO_new_file_setbuf),
|
|
||||||
JUMP_INIT(sync, (_IO_sync_t) _IO_wfile_sync),
|
|
||||||
JUMP_INIT(doallocate, _IO_wfile_doallocate),
|
|
||||||
JUMP_INIT(read, _IO_file_read),
|
|
||||||
JUMP_INIT(write, _IO_new_file_write),
|
|
||||||
JUMP_INIT(seek, _IO_file_seek),
|
|
||||||
JUMP_INIT(close, _IO_file_close),
|
|
||||||
JUMP_INIT(stat, _IO_file_stat),
|
|
||||||
JUMP_INIT(showmanyc, _IO_default_showmanyc),
|
|
||||||
JUMP_INIT(imbue, _IO_default_imbue)
|
|
||||||
};
|
|
||||||
libc_hidden_data_def (_IO_wfile_jumps)
|
|
||||||
|
|
||||||
|
|
||||||
const struct _IO_jump_t _IO_wfile_jumps_mmap libio_vtable =
|
|
||||||
{
|
|
||||||
JUMP_INIT_DUMMY,
|
|
||||||
JUMP_INIT(finish, _IO_new_file_finish),
|
|
||||||
JUMP_INIT(overflow, (_IO_overflow_t) _IO_wfile_overflow),
|
|
||||||
JUMP_INIT(underflow, (_IO_underflow_t) _IO_wfile_underflow_mmap),
|
|
||||||
JUMP_INIT(uflow, (_IO_underflow_t) _IO_wdefault_uflow),
|
|
||||||
JUMP_INIT(pbackfail, (_IO_pbackfail_t) _IO_wdefault_pbackfail),
|
|
||||||
JUMP_INIT(xsputn, _IO_wfile_xsputn),
|
|
||||||
JUMP_INIT(xsgetn, _IO_file_xsgetn),
|
|
||||||
JUMP_INIT(seekoff, _IO_wfile_seekoff),
|
|
||||||
JUMP_INIT(seekpos, _IO_default_seekpos),
|
|
||||||
JUMP_INIT(setbuf, _IO_file_setbuf_mmap),
|
|
||||||
JUMP_INIT(sync, (_IO_sync_t) _IO_wfile_sync),
|
|
||||||
JUMP_INIT(doallocate, _IO_wfile_doallocate),
|
|
||||||
JUMP_INIT(read, _IO_file_read),
|
|
||||||
JUMP_INIT(write, _IO_new_file_write),
|
|
||||||
JUMP_INIT(seek, _IO_file_seek),
|
|
||||||
JUMP_INIT(close, _IO_file_close_mmap),
|
|
||||||
JUMP_INIT(stat, _IO_file_stat),
|
|
||||||
JUMP_INIT(showmanyc, _IO_default_showmanyc),
|
|
||||||
JUMP_INIT(imbue, _IO_default_imbue)
|
|
||||||
};
|
|
||||||
|
|
||||||
const struct _IO_jump_t _IO_wfile_jumps_maybe_mmap libio_vtable =
|
|
||||||
{
|
|
||||||
JUMP_INIT_DUMMY,
|
|
||||||
JUMP_INIT(finish, _IO_new_file_finish),
|
|
||||||
JUMP_INIT(overflow, (_IO_overflow_t) _IO_wfile_overflow),
|
|
||||||
JUMP_INIT(underflow, (_IO_underflow_t) _IO_wfile_underflow_maybe_mmap),
|
|
||||||
JUMP_INIT(uflow, (_IO_underflow_t) _IO_wdefault_uflow),
|
|
||||||
JUMP_INIT(pbackfail, (_IO_pbackfail_t) _IO_wdefault_pbackfail),
|
|
||||||
JUMP_INIT(xsputn, _IO_wfile_xsputn),
|
|
||||||
JUMP_INIT(xsgetn, _IO_file_xsgetn),
|
|
||||||
JUMP_INIT(seekoff, _IO_wfile_seekoff),
|
|
||||||
JUMP_INIT(seekpos, _IO_default_seekpos),
|
|
||||||
JUMP_INIT(setbuf, _IO_file_setbuf_mmap),
|
|
||||||
JUMP_INIT(sync, (_IO_sync_t) _IO_wfile_sync),
|
|
||||||
JUMP_INIT(doallocate, _IO_wfile_doallocate),
|
|
||||||
JUMP_INIT(read, _IO_file_read),
|
|
||||||
JUMP_INIT(write, _IO_new_file_write),
|
|
||||||
JUMP_INIT(seek, _IO_file_seek),
|
|
||||||
JUMP_INIT(close, _IO_file_close),
|
|
||||||
JUMP_INIT(stat, _IO_file_stat),
|
|
||||||
JUMP_INIT(showmanyc, _IO_default_showmanyc),
|
|
||||||
JUMP_INIT(imbue, _IO_default_imbue)
|
|
||||||
};
|
|
||||||
|
@ -30,34 +30,6 @@ struct _IO_FILE_wmemstream
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static int _IO_wmem_sync (FILE* fp) __THROW;
|
|
||||||
static void _IO_wmem_finish (FILE* fp, int) __THROW;
|
|
||||||
|
|
||||||
|
|
||||||
static const struct _IO_jump_t _IO_wmem_jumps libio_vtable =
|
|
||||||
{
|
|
||||||
JUMP_INIT_DUMMY,
|
|
||||||
JUMP_INIT (finish, _IO_wmem_finish),
|
|
||||||
JUMP_INIT (overflow, (_IO_overflow_t) _IO_wstr_overflow),
|
|
||||||
JUMP_INIT (underflow, (_IO_underflow_t) _IO_wstr_underflow),
|
|
||||||
JUMP_INIT (uflow, (_IO_underflow_t) _IO_wdefault_uflow),
|
|
||||||
JUMP_INIT (pbackfail, (_IO_pbackfail_t) _IO_wstr_pbackfail),
|
|
||||||
JUMP_INIT (xsputn, _IO_wdefault_xsputn),
|
|
||||||
JUMP_INIT (xsgetn, _IO_wdefault_xsgetn),
|
|
||||||
JUMP_INIT (seekoff, _IO_wstr_seekoff),
|
|
||||||
JUMP_INIT (seekpos, _IO_default_seekpos),
|
|
||||||
JUMP_INIT (setbuf, _IO_default_setbuf),
|
|
||||||
JUMP_INIT (sync, _IO_wmem_sync),
|
|
||||||
JUMP_INIT (doallocate, _IO_wdefault_doallocate),
|
|
||||||
JUMP_INIT (read, _IO_default_read),
|
|
||||||
JUMP_INIT (write, _IO_default_write),
|
|
||||||
JUMP_INIT (seek, _IO_default_seek),
|
|
||||||
JUMP_INIT (close, _IO_default_close),
|
|
||||||
JUMP_INIT (stat, _IO_default_stat),
|
|
||||||
JUMP_INIT (showmanyc, _IO_default_showmanyc),
|
|
||||||
JUMP_INIT (imbue, _IO_default_imbue)
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Open a stream that writes into a malloc'd buffer that is expanded as
|
/* Open a stream that writes into a malloc'd buffer that is expanded as
|
||||||
necessary. *BUFLOC and *SIZELOC are updated with the buffer's location
|
necessary. *BUFLOC and *SIZELOC are updated with the buffer's location
|
||||||
and the number of characters written on fflush or fclose. */
|
and the number of characters written on fflush or fclose. */
|
||||||
@ -105,7 +77,7 @@ open_wmemstream (wchar_t **bufloc, size_t *sizeloc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
int
|
||||||
_IO_wmem_sync (FILE *fp)
|
_IO_wmem_sync (FILE *fp)
|
||||||
{
|
{
|
||||||
struct _IO_FILE_wmemstream *mp = (struct _IO_FILE_wmemstream *) fp;
|
struct _IO_FILE_wmemstream *mp = (struct _IO_FILE_wmemstream *) fp;
|
||||||
@ -124,7 +96,7 @@ _IO_wmem_sync (FILE *fp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
void
|
||||||
_IO_wmem_finish (FILE *fp, int dummy)
|
_IO_wmem_finish (FILE *fp, int dummy)
|
||||||
{
|
{
|
||||||
struct _IO_FILE_wmemstream *mp = (struct _IO_FILE_wmemstream *) fp;
|
struct _IO_FILE_wmemstream *mp = (struct _IO_FILE_wmemstream *) fp;
|
||||||
|
@ -361,27 +361,3 @@ _IO_wstr_finish (FILE *fp, int dummy)
|
|||||||
|
|
||||||
_IO_wdefault_finish (fp, 0);
|
_IO_wdefault_finish (fp, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct _IO_jump_t _IO_wstr_jumps libio_vtable =
|
|
||||||
{
|
|
||||||
JUMP_INIT_DUMMY,
|
|
||||||
JUMP_INIT(finish, _IO_wstr_finish),
|
|
||||||
JUMP_INIT(overflow, (_IO_overflow_t) _IO_wstr_overflow),
|
|
||||||
JUMP_INIT(underflow, (_IO_underflow_t) _IO_wstr_underflow),
|
|
||||||
JUMP_INIT(uflow, (_IO_underflow_t) _IO_wdefault_uflow),
|
|
||||||
JUMP_INIT(pbackfail, (_IO_pbackfail_t) _IO_wstr_pbackfail),
|
|
||||||
JUMP_INIT(xsputn, _IO_wdefault_xsputn),
|
|
||||||
JUMP_INIT(xsgetn, _IO_wdefault_xsgetn),
|
|
||||||
JUMP_INIT(seekoff, _IO_wstr_seekoff),
|
|
||||||
JUMP_INIT(seekpos, _IO_default_seekpos),
|
|
||||||
JUMP_INIT(setbuf, _IO_default_setbuf),
|
|
||||||
JUMP_INIT(sync, _IO_default_sync),
|
|
||||||
JUMP_INIT(doallocate, _IO_wdefault_doallocate),
|
|
||||||
JUMP_INIT(read, _IO_default_read),
|
|
||||||
JUMP_INIT(write, _IO_default_write),
|
|
||||||
JUMP_INIT(seek, _IO_default_seek),
|
|
||||||
JUMP_INIT(close, _IO_default_close),
|
|
||||||
JUMP_INIT(stat, _IO_default_stat),
|
|
||||||
JUMP_INIT(showmanyc, _IO_default_showmanyc),
|
|
||||||
JUMP_INIT(imbue, _IO_default_imbue)
|
|
||||||
};
|
|
||||||
|
@ -48,7 +48,7 @@ __printf_buffer_as_file_switch_to_buffer (struct __printf_buffer_as_file *file)
|
|||||||
/* Only a small subset of the vtable functions is implemented here,
|
/* Only a small subset of the vtable functions is implemented here,
|
||||||
following _IO_obstack_jumps. */
|
following _IO_obstack_jumps. */
|
||||||
|
|
||||||
static int
|
int
|
||||||
__printf_buffer_as_file_overflow (FILE *fp, int ch)
|
__printf_buffer_as_file_overflow (FILE *fp, int ch)
|
||||||
{
|
{
|
||||||
struct __printf_buffer_as_file *file = (struct __printf_buffer_as_file *) fp;
|
struct __printf_buffer_as_file *file = (struct __printf_buffer_as_file *) fp;
|
||||||
@ -72,7 +72,7 @@ __printf_buffer_as_file_overflow (FILE *fp, int ch)
|
|||||||
return EOF;
|
return EOF;
|
||||||
}
|
}
|
||||||
|
|
||||||
static size_t
|
size_t
|
||||||
__printf_buffer_as_file_xsputn (FILE *fp, const void *buf, size_t len)
|
__printf_buffer_as_file_xsputn (FILE *fp, const void *buf, size_t len)
|
||||||
{
|
{
|
||||||
struct __printf_buffer_as_file *file = (struct __printf_buffer_as_file *) fp;
|
struct __printf_buffer_as_file *file = (struct __printf_buffer_as_file *) fp;
|
||||||
@ -93,30 +93,6 @@ __printf_buffer_as_file_xsputn (FILE *fp, const void *buf, size_t len)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct _IO_jump_t _IO_printf_buffer_as_file_jumps libio_vtable =
|
|
||||||
{
|
|
||||||
JUMP_INIT_DUMMY,
|
|
||||||
JUMP_INIT(finish, NULL),
|
|
||||||
JUMP_INIT(overflow, __printf_buffer_as_file_overflow),
|
|
||||||
JUMP_INIT(underflow, NULL),
|
|
||||||
JUMP_INIT(uflow, NULL),
|
|
||||||
JUMP_INIT(pbackfail, NULL),
|
|
||||||
JUMP_INIT(xsputn, __printf_buffer_as_file_xsputn),
|
|
||||||
JUMP_INIT(xsgetn, NULL),
|
|
||||||
JUMP_INIT(seekoff, NULL),
|
|
||||||
JUMP_INIT(seekpos, NULL),
|
|
||||||
JUMP_INIT(setbuf, NULL),
|
|
||||||
JUMP_INIT(sync, NULL),
|
|
||||||
JUMP_INIT(doallocate, NULL),
|
|
||||||
JUMP_INIT(read, NULL),
|
|
||||||
JUMP_INIT(write, NULL),
|
|
||||||
JUMP_INIT(seek, NULL),
|
|
||||||
JUMP_INIT(close, NULL),
|
|
||||||
JUMP_INIT(stat, NULL),
|
|
||||||
JUMP_INIT(showmanyc, NULL),
|
|
||||||
JUMP_INIT(imbue, NULL)
|
|
||||||
};
|
|
||||||
|
|
||||||
void
|
void
|
||||||
__printf_buffer_as_file_init (struct __printf_buffer_as_file *file,
|
__printf_buffer_as_file_init (struct __printf_buffer_as_file *file,
|
||||||
struct __printf_buffer *next)
|
struct __printf_buffer *next)
|
||||||
|
@ -48,7 +48,7 @@ __wprintf_buffer_as_file_switch_to_buffer (struct __wprintf_buffer_as_file *file
|
|||||||
/* Only a small subset of the vtable functions is implemented here,
|
/* Only a small subset of the vtable functions is implemented here,
|
||||||
following _IO_obstack_jumps. */
|
following _IO_obstack_jumps. */
|
||||||
|
|
||||||
static wint_t
|
wint_t
|
||||||
__wprintf_buffer_as_file_overflow (FILE *fp, int ch)
|
__wprintf_buffer_as_file_overflow (FILE *fp, int ch)
|
||||||
{
|
{
|
||||||
struct __wprintf_buffer_as_file *file
|
struct __wprintf_buffer_as_file *file
|
||||||
@ -75,7 +75,7 @@ __wprintf_buffer_as_file_overflow (FILE *fp, int ch)
|
|||||||
return WEOF;
|
return WEOF;
|
||||||
}
|
}
|
||||||
|
|
||||||
static size_t
|
size_t
|
||||||
__wprintf_buffer_as_file_xsputn (FILE *fp, const void *buf, size_t len)
|
__wprintf_buffer_as_file_xsputn (FILE *fp, const void *buf, size_t len)
|
||||||
{
|
{
|
||||||
struct __wprintf_buffer_as_file *file
|
struct __wprintf_buffer_as_file *file
|
||||||
@ -97,30 +97,6 @@ __wprintf_buffer_as_file_xsputn (FILE *fp, const void *buf, size_t len)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct _IO_jump_t _IO_wprintf_buffer_as_file_jumps libio_vtable =
|
|
||||||
{
|
|
||||||
JUMP_INIT_DUMMY,
|
|
||||||
JUMP_INIT(finish, NULL),
|
|
||||||
JUMP_INIT(overflow, (_IO_overflow_t) __wprintf_buffer_as_file_overflow),
|
|
||||||
JUMP_INIT(underflow, NULL),
|
|
||||||
JUMP_INIT(uflow, NULL),
|
|
||||||
JUMP_INIT(pbackfail, NULL),
|
|
||||||
JUMP_INIT(xsputn, __wprintf_buffer_as_file_xsputn),
|
|
||||||
JUMP_INIT(xsgetn, NULL),
|
|
||||||
JUMP_INIT(seekoff, NULL),
|
|
||||||
JUMP_INIT(seekpos, NULL),
|
|
||||||
JUMP_INIT(setbuf, NULL),
|
|
||||||
JUMP_INIT(sync, NULL),
|
|
||||||
JUMP_INIT(doallocate, NULL),
|
|
||||||
JUMP_INIT(read, NULL),
|
|
||||||
JUMP_INIT(write, NULL),
|
|
||||||
JUMP_INIT(seek, NULL),
|
|
||||||
JUMP_INIT(close, NULL),
|
|
||||||
JUMP_INIT(stat, NULL),
|
|
||||||
JUMP_INIT(showmanyc, NULL),
|
|
||||||
JUMP_INIT(imbue, NULL)
|
|
||||||
};
|
|
||||||
|
|
||||||
void
|
void
|
||||||
__wprintf_buffer_as_file_init (struct __wprintf_buffer_as_file *file,
|
__wprintf_buffer_as_file_init (struct __wprintf_buffer_as_file *file,
|
||||||
struct __wprintf_buffer *next)
|
struct __wprintf_buffer *next)
|
||||||
|
Loading…
Reference in New Issue
Block a user