summary refs log tree commit diff
path: root/libio/stdfiles.c
diff options
context:
space:
mode:
Diffstat (limited to 'libio/stdfiles.c')
-rw-r--r--libio/stdfiles.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/libio/stdfiles.c b/libio/stdfiles.c
index 1d0ef85be9..c50d5f1d8b 100644
--- a/libio/stdfiles.c
+++ b/libio/stdfiles.c
@@ -31,10 +31,16 @@ the executable file might be covered by the GNU General Public License. */
 
 #include "libioP.h"
 
-
+#ifdef _IO_MTSAFE_IO
+#define DEF_STDFILE(NAME, FD, CHAIN, FLAGS) \
+  static _IO_lock_t _IO_stdfile_##FD##_lock = _IO_lock_init; \
+  struct _IO_FILE_plus NAME \
+    = {FILEBUF_LITERAL(CHAIN, FLAGS, FD), &_IO_file_jumps}
+#else
 #define DEF_STDFILE(NAME, FD, CHAIN, FLAGS) \
   struct _IO_FILE_plus NAME \
     = {FILEBUF_LITERAL(CHAIN, FLAGS, FD), &_IO_file_jumps}
+#endif
 
 DEF_STDFILE(_IO_stdin_, 0, 0, _IO_NO_WRITES);
 DEF_STDFILE(_IO_stdout_, 1, &_IO_stdin_.file, _IO_NO_READS);