aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-07-05 11:57:59 +0000
committerUlrich Drepper <drepper@redhat.com>1998-07-05 11:57:59 +0000
commit77ccaba1fa58f871e797ced648c2966842e477db (patch)
treefec432e9338d6956a0a9b6e5a03d330ff580bb06
parenteb27c43f02ec7890c19f424de458df903745db5d (diff)
downloadglibc-77ccaba1fa58f871e797ced648c2966842e477db.tar
glibc-77ccaba1fa58f871e797ced648c2966842e477db.tar.gz
glibc-77ccaba1fa58f871e797ced648c2966842e477db.tar.bz2
glibc-77ccaba1fa58f871e797ced648c2966842e477db.zip
Update.
1998-07-05 11:54 Ulrich Drepper <drepper@cygnus.com> * Versions: Add pthread_attr_init ti GLIBC_2.1 version in libc.
-rw-r--r--iconv/gconv_conf.c2
-rw-r--r--inet/ruserpass.c2
-rw-r--r--intl/localealias.c9
-rw-r--r--libio/Makefile4
-rw-r--r--libio/Versions1
-rw-r--r--libio/iofgets_u.c56
-rw-r--r--libio/stdio.h6
-rw-r--r--linuxthreads/ChangeLog4
-rw-r--r--linuxthreads/Versions3
9 files changed, 83 insertions, 4 deletions
diff --git a/iconv/gconv_conf.c b/iconv/gconv_conf.c
index 6457e37113..002f4e4232 100644
--- a/iconv/gconv_conf.c
+++ b/iconv/gconv_conf.c
@@ -326,7 +326,7 @@ read_conf_file (const char *filename, const char *directory, size_t dir_len,
/* Process the known entries of the file. Comments start with `#' and
end with the end of the line. Empty lines are ignored. */
- while (!feof (fp))
+ while (!feof_unlocked (fp))
{
char *rp, *endp, *word;
ssize_t n = __getdelim (&line, &line_len, '\n', fp);
diff --git a/inet/ruserpass.c b/inet/ruserpass.c
index 9c0905132e..3cdacd1625 100644
--- a/inet/ruserpass.c
+++ b/inet/ruserpass.c
@@ -265,7 +265,7 @@ token()
int c;
struct toktab *t;
- if (feof(cfile) || ferror(cfile))
+ if (feof_unlocked(cfile) || ferror_unlocked(cfile))
return (0);
while ((c = getc_unlocked(cfile)) != EOF &&
(c == '\n' || c == '\t' || c == ' ' || c == ','))
diff --git a/intl/localealias.c b/intl/localealias.c
index 45c16c6e53..01fbe04f2e 100644
--- a/intl/localealias.c
+++ b/intl/localealias.c
@@ -131,6 +131,15 @@ struct block_list
# define alloca(size) (malloc (size))
#endif /* have alloca */
+#if defined _LIBC || defined HAVE_FGETS_UNLOCKED
+# undef fgets
+# define fgets(buf, len, s) fgets_unlocked (buf, len, s)
+#endif
+#if defined _LIBC || defined HAVE_FEOF_UNLOCKED
+# undef feof
+# define feof(s) feof_unlocked (s)
+#endif
+
struct alias_map
{
diff --git a/libio/Makefile b/libio/Makefile
index 3c75183987..bc43ebb674 100644
--- a/libio/Makefile
+++ b/libio/Makefile
@@ -34,7 +34,7 @@ routines := \
clearerr feof ferror fgetc fileno fputc freopen fseek getc getchar \
memstream pclose putc putchar rewind setbuf setlinebuf vasprintf \
iovdprintf vscanf vsnprintf obprintf fcloseall fseeko ftello \
- freopen64 fseeko64 ftello64 iofread_u iofwrite_u \
+ freopen64 fseeko64 ftello64 \
\
libc_fatal
@@ -50,7 +50,7 @@ CPPFLAGS-.o += -DIO_DEBUG
ifneq (,$(filter %REENTRANT, $(defines)))
routines += clearerr_u feof_u ferror_u fputc_u getc_u getchar_u \
- iofflush_u putc_u putchar_u peekc
+ iofflush_u putc_u putchar_u peekc iofread_u iofwrite_u iofgets_u
CPPFLAGS += -D_IO_MTSAFE_IO
endif
diff --git a/libio/Versions b/libio/Versions
index 12277ae29f..e837abb5d7 100644
--- a/libio/Versions
+++ b/libio/Versions
@@ -99,5 +99,6 @@ libc {
# f*
fgetpos64; fopen64; freopen64; fseeko; fseeko64; fsetpos64; ftello;
ftello64; fopen; fclose; fdopen; fread_unlocked; fwrite_unlocked;
+ fgets_unlocked;
}
}
diff --git a/libio/iofgets_u.c b/libio/iofgets_u.c
new file mode 100644
index 0000000000..1eb98bd542
--- /dev/null
+++ b/libio/iofgets_u.c
@@ -0,0 +1,56 @@
+/* Copyright (C) 1993, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+ This file is part of the GNU IO Library.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2, or (at
+ your option) any later version.
+
+ This 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
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this library; see the file COPYING. If not, write to
+ the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+ MA 02111-1307, USA.
+
+ As a special exception, if you link this library with files
+ compiled with a GNU compiler to produce an executable, this does
+ not cause the resulting executable to be covered by the GNU General
+ Public License. This exception does not however invalidate any
+ other reasons why the executable file might be covered by the GNU
+ General Public License. */
+
+#include "libioP.h"
+#include <stdio.h>
+
+char *
+fgets_unlocked (buf, n, fp)
+ char *buf;
+ int n;
+ _IO_FILE *fp;
+{
+ _IO_size_t count;
+ char *result;
+ int old_error;
+ CHECK_FILE (fp, NULL);
+ if (n <= 0)
+ return NULL;
+ /* This is very tricky since a file descriptor may be in the
+ non-blocking mode. The error flag doesn't mean much in this
+ case. We return an error only when there is a new error. */
+ old_error = fp->_IO_file_flags & _IO_ERR_SEEN;
+ fp->_IO_file_flags &= ~_IO_ERR_SEEN;
+ count = _IO_getline (fp, buf, n - 1, '\n', 1);
+ if (count == 0 || (fp->_IO_file_flags & _IO_ERR_SEEN))
+ result = NULL;
+ else
+ {
+ buf[count] = '\0';
+ result = buf;
+ }
+ fp->_IO_file_flags |= old_error;
+ return result;
+}
diff --git a/libio/stdio.h b/libio/stdio.h
index e716cee61e..b220e41081 100644
--- a/libio/stdio.h
+++ b/libio/stdio.h
@@ -476,6 +476,12 @@ extern int putw __P ((int __w, FILE *__stream));
extern char *fgets __P ((char *__restrict __s, int __n,
FILE *__restrict __stream));
+#ifdef __USE_GNU
+/* This function does the same as `fgets' but does not lock the stream. */
+extern char *fgets_unlocked __P ((char *__restrict __s, int __n,
+ FILE *__restrict __stream));
+#endif
+
/* Get a newline-terminated string from stdin, removing the newline.
DO NOT USE THIS FUNCTION!! There is no limit on how much it will read. */
extern char *gets __P ((char *__s));
diff --git a/linuxthreads/ChangeLog b/linuxthreads/ChangeLog
index 9619ae48f0..d0181c840a 100644
--- a/linuxthreads/ChangeLog
+++ b/linuxthreads/ChangeLog
@@ -1,3 +1,7 @@
+1998-07-05 11:54 Ulrich Drepper <drepper@cygnus.com>
+
+ * Versions: Add pthread_attr_init ti GLIBC_2.1 version in libc.
+
1998-07-01 Andreas Jaeger <aj@arthur.rhein-neckar.de>
* attr.c: Include <string.h>.
diff --git a/linuxthreads/Versions b/linuxthreads/Versions
index 4c36f2c393..2df1490804 100644
--- a/linuxthreads/Versions
+++ b/linuxthreads/Versions
@@ -14,6 +14,9 @@ libc {
pthread_self; pthread_setcancelstate; pthread_setcanceltype;
pthread_setschedparam;
}
+ GLIBC_2.1 {
+ pthread_attr_init;
+ }
}
libpthread {