about summary refs log tree commit diff
path: root/libio
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1996-09-07 23:56:19 +0000
committerUlrich Drepper <drepper@redhat.com>1996-09-07 23:56:19 +0000
commit499e7464ed5c42246134fe708d783bf44a472c98 (patch)
tree785f6ad88c02bb872deac4e2034275689287e077 /libio
parentedf5b2d7168982e1725f41e142b77e5ec88d7bf2 (diff)
downloadglibc-499e7464ed5c42246134fe708d783bf44a472c98.tar.gz
glibc-499e7464ed5c42246134fe708d783bf44a472c98.tar.xz
glibc-499e7464ed5c42246134fe708d783bf44a472c98.zip
update from main archive 960907
Sat Sep  7 14:00:33 1996  David Mosberger-Tang  <davidm@azstarnet.com>

	* catgets/catgets.c (catopen): Allocate sizeof(*result) bytes
	instead of sizeof(nl_catd) (which is just a pointer!).

Sat Sep  7 19:39:19 1996  Ulrich Drepper  <drepper@cygnus.com>

	* Makefile ($(objpfx)version-info.h): Generate from Banner files.
	* version.c (banner): Add contents of version-info.h to string.

	* Makerules: If $($(subdir)-version) is available name versioned
	shared library according to this value instead of glibc's version.

	* libio/Banner: New file.

	* elf/eval.c (funcall): Write error message in case function is
	not found.
	(eval): Recognize `_' in names.
Diffstat (limited to 'libio')
-rw-r--r--libio/Banner1
-rw-r--r--libio/iofdopen.c4
-rw-r--r--libio/iofopen.c4
-rw-r--r--libio/iofopncook.c4
-rw-r--r--libio/iopopen.c4
-rw-r--r--libio/iovsprintf.c4
-rw-r--r--libio/iovsscanf.c2
-rw-r--r--libio/libio.h1
-rw-r--r--libio/libioP.h10
-rw-r--r--libio/memstream.c4
-rw-r--r--libio/stdfiles.c8
-rw-r--r--libio/vasprintf.c4
-rw-r--r--libio/vdprintf.c4
-rw-r--r--libio/vsnprintf.c4
14 files changed, 55 insertions, 3 deletions
diff --git a/libio/Banner b/libio/Banner
new file mode 100644
index 0000000000..8ec3141927
--- /dev/null
+++ b/libio/Banner
@@ -0,0 +1 @@
+GNU libio by Per Bothner
diff --git a/libio/iofdopen.c b/libio/iofdopen.c
index c49387b1a0..797192eaae 100644
--- a/libio/iofdopen.c
+++ b/libio/iofdopen.c
@@ -42,7 +42,9 @@ _IO_fdopen (fd, mode)
   struct locked_FILE
   {
     struct _IO_FILE_plus fp;
+#ifdef _IO_MTSAFE_IO
     _IO_lock_t lock;
+#endif
   } *new_f;
   int fd_flags;
 
@@ -104,7 +106,9 @@ _IO_fdopen (fd, mode)
   new_f = (struct locked_FILE *) malloc (sizeof (struct locked_FILE));
   if (new_f == NULL)
     return NULL;
+#ifdef _IO_MTSAFE_IO
   new_f->fp.file._lock = &new_f->lock;
+#endif
   _IO_init (&new_f->fp.file, 0);
   _IO_JUMPS (&new_f->fp.file) = &_IO_file_jumps;
   _IO_file_init (&new_f->fp.file);
diff --git a/libio/iofopen.c b/libio/iofopen.c
index 334df4652a..cea2415218 100644
--- a/libio/iofopen.c
+++ b/libio/iofopen.c
@@ -35,12 +35,16 @@ _IO_fopen (filename, mode)
   struct locked_FILE
   {
     struct _IO_FILE_plus fp;
+#ifdef _IO_MTSAFE_IO
     _IO_lock_t lock;
+#endif
   } *new_f = (struct locked_FILE *) malloc (sizeof (struct locked_FILE));
 
   if (new_f == NULL)
     return NULL;
+#ifdef _IO_MTSAFE_IO
   new_f->fp.file._lock = &new_f->lock;
+#endif
   _IO_init (&new_f->fp.file, 0);
   _IO_JUMPS (&new_f->fp.file) = &_IO_file_jumps;
   _IO_file_init (&new_f->fp.file);
diff --git a/libio/iofopncook.c b/libio/iofopncook.c
index 4193c2447d..718205e073 100644
--- a/libio/iofopncook.c
+++ b/libio/iofopncook.c
@@ -131,7 +131,9 @@ fopencookie (cookie, mode, io_functions)
   struct locked_FILE
   {
     struct _IO_cookie_file cfile;
+#ifdef _IO_MTSAFE_IO
     _IO_lock_t lock;
+#endif
   } *new_f;
 
   switch (*mode++)
@@ -154,7 +156,9 @@ fopencookie (cookie, mode, io_functions)
   new_f = (struct locked_FILE *) malloc (sizeof (struct locked_FILE));
   if (new_f == NULL)
     return NULL;
+#ifdef _IO_MTSAFE_IO
   new_f->cfile.file._lock = &new_f->lock;
+#endif
 
   _IO_init (&new_f->cfile.file, 0);
   _IO_JUMPS (&new_f->cfile.file) = &_IO_cookie_jumps;
diff --git a/libio/iopopen.c b/libio/iopopen.c
index ca2a18edac..dc1e74d3eb 100644
--- a/libio/iopopen.c
+++ b/libio/iopopen.c
@@ -152,14 +152,18 @@ DEFUN(_IO_popen, (command, mode),
   struct locked_FILE
   {
     struct _IO_proc_file fpx;
+#ifdef _IO_MTSAFE_IO
     _IO_lock_t lock;
+#endif
   } *new_f;
   _IO_FILE *fp;
 
   new_f = (struct locked_FILE *) malloc (sizeof (struct locked_FILE));
   if (new_f == NULL)
     return NULL;
+#ifdef _IO_MTSAFE_IO
   new_f->fpx.file.file._lock = &new_f->lock;
+#endif
   fp = (_IO_FILE*)&new_f->fpx;
   _IO_init(fp, 0);
   _IO_JUMPS(fp) = &_IO_proc_jumps;
diff --git a/libio/iovsprintf.c b/libio/iovsprintf.c
index 916804f63d..b2e8b67a96 100644
--- a/libio/iovsprintf.c
+++ b/libio/iovsprintf.c
@@ -32,10 +32,14 @@ _IO_vsprintf (string, format, args)
       _IO_va_list args;
 {
   _IO_strfile sf;
+#ifdef _IO_MTSAFE_IO
   _IO_lock_t lock;
+#endif
   int ret;
 
+#ifdef _IO_MTSAFE_IO
   sf._f._lock = &lock;
+#endif
   _IO_init ((_IO_FILE *) &sf, 0);
   _IO_JUMPS ((_IO_FILE *) &sf) = &_IO_str_jumps;
   _IO_str_init_static ((_IO_FILE *) &sf, string, -1, string);
diff --git a/libio/iovsscanf.c b/libio/iovsscanf.c
index 5b4c790517..6e7d8c59e2 100644
--- a/libio/iovsscanf.c
+++ b/libio/iovsscanf.c
@@ -30,8 +30,10 @@ DEFUN(_IO_vsscanf, (string, format, args),
       const char *string AND const char *format AND _IO_va_list args)
 {
   _IO_strfile sf;
+#ifdef _IO_MTSAFE_IO
   _IO_lock_t lock;
   sf._f._lock = &lock;
+#endif
   _IO_init((_IO_FILE*)&sf, 0);
   _IO_JUMPS((_IO_FILE*)&sf) = &_IO_str_jumps;
   _IO_str_init_static ((_IO_FILE*)&sf, (char*)string, 0, NULL);
diff --git a/libio/libio.h b/libio/libio.h
index 17cef91121..36e839fa32 100644
--- a/libio/libio.h
+++ b/libio/libio.h
@@ -152,6 +152,7 @@ typedef struct
 #ifdef _IO_MTSAFE_IO
 #include <pthread.h>
 typedef pthread_mutex_t _IO_lock_t;
+#define _IO_lock_init PTHREAD_MUTEX_INITIALIZER
 #else
 typedef void _IO_lock_t;
 #endif
diff --git a/libio/libioP.h b/libio/libioP.h
index ac4df17ce8..f5e6dc5a0e 100644
--- a/libio/libioP.h
+++ b/libio/libioP.h
@@ -342,10 +342,18 @@ extern int _IO_vscanf __P((const char *, _IO_va_list));
 #else
 #define _IO_FJUMP &_IO_file_jumps,
 #endif
+#ifdef _IO_MTSAFE_IO
 /* check following! */
 #define FILEBUF_LITERAL(CHAIN, FLAGS, FD) \
        { _IO_MAGIC+_IO_LINKED+_IO_IS_FILEBUF+FLAGS, \
-         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, CHAIN, _IO_FJUMP FD}
+         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, CHAIN, _IO_FJUMP FD, \
+	   0, 0, 0, 0, { 0 }, &_IO_stdfile_##FD##_lock }
+#else
+/* check following! */
+#define FILEBUF_LITERAL(CHAIN, FLAGS, FD) \
+       { _IO_MAGIC+_IO_LINKED+_IO_IS_FILEBUF+FLAGS, \
+	   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, CHAIN, _IO_FJUMP FD }
+#endif
 
 /* VTABLE_LABEL defines NAME as of the CLASS class.
    CNLENGTH is strlen(#CLASS).  */
diff --git a/libio/memstream.c b/libio/memstream.c
index 1a4f4b9e96..8f9c8ac92c 100644
--- a/libio/memstream.c
+++ b/libio/memstream.c
@@ -67,14 +67,18 @@ open_memstream (bufloc, sizeloc)
   struct locked_FILE
   {
     struct _IO_FILE_memstream fp;
+#ifdef _IO_MTSAFE_IO
     _IO_lock_t lock;
+#endif
   } *new_f;
   char *buf;
 
   new_f = (struct locked_FILE *) malloc (sizeof (struct locked_FILE));
   if (new_f == NULL)
     return NULL;
+#ifdef _IO_MTSAFE_IO
   new_f->fp._sf._f._lock = &new_f->lock;
+#endif
 
   buf = ALLOC_BUF (_IO_BUFSIZ);
   _IO_init (&new_f->fp._sf._f, 0);
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);
diff --git a/libio/vasprintf.c b/libio/vasprintf.c
index cf50603f0d..57a3b08eba 100644
--- a/libio/vasprintf.c
+++ b/libio/vasprintf.c
@@ -38,12 +38,16 @@ _IO_vasprintf (result_ptr, format, args)
   const _IO_size_t init_string_size = 100;
   char *string;
   _IO_strfile sf;
+#ifdef _IO_MTSAFE_IO
   _IO_lock_t lock;
+#endif
   int ret;
   string = ALLOC_BUF(init_string_size);
   if (string == NULL)
     return -1;
+#ifdef _IO_MTSAFE_IO
   sf._f._lock = &lock;
+#endif
   _IO_init((_IO_FILE*)&sf, 0);
   _IO_JUMPS((_IO_FILE*)&sf) = &_IO_str_jumps;
   _IO_str_init_static ((_IO_FILE*)&sf, string, init_string_size, string);
diff --git a/libio/vdprintf.c b/libio/vdprintf.c
index 8c5833ccbf..b4b1cc337c 100644
--- a/libio/vdprintf.c
+++ b/libio/vdprintf.c
@@ -32,10 +32,14 @@ _IO_vdprintf (d, format, arg)
      _IO_va_list arg;
 {
   struct _IO_FILE_plus tmpfil;
+#ifdef _IO_MTSAFE_IO
   _IO_lock_t lock;
+#endif
   int done;
 
+#ifdef _IO_MTSAFE_IO
   tmpfil.file._lock = &lock;
+#endif
   _IO_init (&tmpfil.file, 0);
   _IO_JUMPS (&tmpfil.file) = &_IO_file_jumps;
   _IO_file_init (&tmpfil.file);
diff --git a/libio/vsnprintf.c b/libio/vsnprintf.c
index 174640daac..9f767b5b06 100644
--- a/libio/vsnprintf.c
+++ b/libio/vsnprintf.c
@@ -33,9 +33,11 @@ _IO_vsnprintf (string, maxlen, format, args)
      _IO_va_list args;
 {
   _IO_strfile sf;
-  _IO_lock_t lock;
   int ret;
+#ifdef _IO_MTSAFE_IO
+  _IO_lock_t lock;
   sf._f._lock = &lock;
+#endif
   _IO_init ((_IO_FILE *) &sf, 0);
   _IO_JUMPS ((_IO_FILE *) &sf) = &_IO_str_jumps;
   _IO_str_init_static ((_IO_FILE *) &sf, string, maxlen - 1, string);