summaryrefslogtreecommitdiff
path: root/libio/oldstdfiles.c
diff options
context:
space:
mode:
Diffstat (limited to 'libio/oldstdfiles.c')
-rw-r--r--libio/oldstdfiles.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/libio/oldstdfiles.c b/libio/oldstdfiles.c
index 64c792f7a0..baf655048d 100644
--- a/libio/oldstdfiles.c
+++ b/libio/oldstdfiles.c
@@ -30,24 +30,24 @@
so the objects defined are not valid C++ objects. On the other
hand, we don't need a C++ compiler to build this file.) */
+#define _IO_USE_OLD_IO_FILE
#include "libioP.h"
#ifdef _IO_MTSAFE_IO
-#define DEF_STDFILE(INAME, NAME, FD, CHAIN, FLAGS) \
+#define DEF_STDFILE(NAME, FD, CHAIN, FLAGS) \
static _IO_lock_t _IO_stdfile_##FD##_lock = _IO_lock_initializer; \
- struct _IO_FILE_plus INAME \
+ struct _IO_FILE_plus NAME \
= {FILEBUF_LITERAL(CHAIN, FLAGS, FD), &_IO_old_file_jumps};
#else
-#define DEF_STDFILE(INAME, NAME, FD, CHAIN, FLAGS) \
- struct _IO_FILE_plus INAME \
+#define DEF_STDFILE(NAME, FD, CHAIN, FLAGS) \
+ struct _IO_FILE_plus NAME \
= {FILEBUF_LITERAL(CHAIN, FLAGS, FD), &_IO_old_file_jumps};
#endif
-DEF_STDFILE(_IO_stdin_, _IO_stdin_, 0, 0, _IO_NO_WRITES);
-DEF_STDFILE(_IO_stdout_, _IO_stdout_, 1, &_IO_stdin_.file,
- _IO_NO_READS);
-DEF_STDFILE(_IO_stderr_, _IO_stderr_, 2, &_IO_stdout_.file,
- _IO_NO_READS+_IO_UNBUFFERED);
+DEF_STDFILE(_IO_stdin_, 0, 0, _IO_NO_WRITES);
+DEF_STDFILE(_IO_stdout_, 1, &_IO_stdin_.file, _IO_NO_READS);
+DEF_STDFILE(_IO_stderr_, 2, &_IO_stdout_.file,
+ _IO_NO_READS+_IO_UNBUFFERED);
#if defined __GNUC__ && __GNUC__ >= 2
@@ -78,9 +78,14 @@ _IO_check_libio ()
if (&_IO_stdin_used == NULL)
{
/* We are using the old one. */
- stdin = &_IO_stdin_.file;
- stdout = &_IO_stdout_.file;
- stderr = _IO_list_all = &_IO_stderr_.file;
+ _IO_stdin = stdin = &_IO_stdin_.file;
+ _IO_stdout = stdout = &_IO_stdout_.file;
+ _IO_stderr = stderr = _IO_list_all = &_IO_stderr_.file;
+ _IO_stdin->_vtable_offset = _IO_stdout->_vtable_offset =
+ _IO_stderr->_vtable_offset = stdin->_vtable_offset =
+ stdout->_vtable_offset = stderr->_vtable_offset =
+ ((int) sizeof (struct _IO_FILE)
+ - (int) sizeof (struct _IO_FILE_complete));
}
}