aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog67
-rw-r--r--Makefile5
-rwxr-xr-xconfigure47
-rw-r--r--configure.in10
-rw-r--r--grp/grp.h2
-rw-r--r--io/fts.c2
-rw-r--r--io/getwd.c30
-rw-r--r--libio/fileops.c20
-rw-r--r--libio/iosetvbuf.c3
-rw-r--r--manual/nss.texi16
-rw-r--r--misc/err.c1
-rw-r--r--misc/ioctltst.c6
-rw-r--r--misc/syslog.c92
-rw-r--r--misc/tst-dirname.c4
-rw-r--r--posix/glob.c4
-rw-r--r--stdlib/Makefile2
-rw-r--r--stdlib/canonicalize.c50
-rw-r--r--stdlib/rand_r.c (renamed from sysdeps/unix/sysv/linux/alpha/llseek.S)75
-rw-r--r--sysdeps/posix/getcwd.c2
-rw-r--r--sysdeps/stub/libc-lock.h6
-rw-r--r--sysdeps/unix/sysv/linux/Dist1
-rw-r--r--sysdeps/unix/sysv/linux/Makefile2
-rw-r--r--sysdeps/unix/sysv/linux/configure53
-rw-r--r--sysdeps/unix/sysv/linux/configure.in47
-rw-r--r--sysdeps/unix/sysv/linux/sys/socketvar.h3
25 files changed, 382 insertions, 168 deletions
diff --git a/ChangeLog b/ChangeLog
index 6ffef25..573b618 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,68 @@
+Sat Dec 7 03:24:36 1996 Ulrich Drepper <drepper@cygnus.com>
+
+ * configure.in: Discard error message from test in test for
+ bash-2.0.
+
+ * io/getpw.c: Don't apply getcwd on user supplied buffer.
+ Instead always use temporary buffer and only copy the result.
+ Patch by HJ Lu.
+ * stdlib/canonicalize.c: Likewise.
+
+ * libio/fileops.c: Change comments according to libg++2.8b5.
+ * libio/iosetvbuf.c: Follow change in libg++-2.8b5 to clear
+ unbuffered flag.
+ Reported by HJ Lu.
+
+ * manual/nss.texi: Correct prototypes.
+
+ * misc/syslog.c: Make reentrant. Catch SIGPIPE signal to prevent
+ crash if syslog daemon is restarted.
+
+ * stdlib/rand_r.c: New file. Implementation of POSIX.2 function
+ rand_r.
+ * stdlib/Makefile (routines): Add rand_r.
+
+ * sysdeps/stub/libc-lock.h: Define __libc_lock_trylock and
+ __libc_mutex_lock.
+
+ * configure.in: Add --disable-sanity-check option.
+ * sysdeps/unix/sysv/linux/configure.in: If linuxthreads or
+ des-crypt are not available and --disbale-sanity-check is not
+ given abort with a message.
+
+Thu Dec 5 19:19:53 1996 Richard Henderson <rth@tamu.edu>
+
+ * posix/glob.c: Tests against STDC_HEADERS should also test
+ __GNU_LIBRARY__.
+
+Thu Dec 5 16:20:55 1996 Ulrich Drepper <drepper@cygnus.com>
+
+ * misc/err.c (vwarn): Set errno again before using %m format.
+
+Thu Dec 5 10:14:05 1996 Andreas Jaeger <aj@arthur.pfalz.de>
+
+ * grp/grp.h: Add declaration of __getgrent_r.
+
+ * io/fts.c (fts_build): Remove "register" from variables dirbuf
+ and dp since their address is needed.
+
+ * sysdeps/posix/getcwd.c (__getcwd): Remove "register" from
+ variable d since d's address is needed.
+
+ * misc/tst-dirname.c (main): Provide prototype.
+ * misc/ioctltst.c (main): Dito.
+
+ * Makefile: Add gnu/lib-names.h to install-others before including
+ Makerules.
+
+Wed Dec 4 16:00:09 1996 Ulrich Drepper <drepper@cygnus.com>
+
+ * sysdeps/unix/sysv/linux/sys/socketvar.h: New file. Simply use
+ <sys/socket.h>.
+ * sysdeps/unix/sysv/linux/Dist: Add sys/socketvar.h.
+ * sysdeps/unix/sysv/linux/Makefile [$(subdir)=inet)]: Add
+ sys/socketvar.h to sysdep_headers.
+
Tue Dec 3 08:38:15 1996 Richard Henderson <rth@tamu.edu>
* sysdeps/unix/alpha/sysdep.S: Remove definition of __errno_location.
@@ -125,7 +190,7 @@ Mon Dec 2 03:59:38 1996 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/unix/sysv/linux/gethostid.c: Likewise.
* posix/getconf.c: Treat _SC_UNIT_MAX and _SC_ULONG_MAX separately
- since the value might be outsode the range of the `long int'.
+ since the value might be outside the range of the `long int'.
Print string `undefined' when a value is undefined.
* stdlib/l64a.c: Return correct pointer.
diff --git a/Makefile b/Makefile
index 1ab8945..cd25373 100644
--- a/Makefile
+++ b/Makefile
@@ -90,6 +90,9 @@ echo-headers: subdir_echo-headers
# What to install.
install-others = $(includedir)/stubs.h
+ifeq (yes,$(build-shared))
+install-others += $(includedir)/gnu/lib-names.h
+endif
ifeq (yes,$(gnu-ld))
libc-init = set-init
@@ -200,8 +203,6 @@ $(includedir)/gnu/lib-names.h: $(common-objpfx)soversions.mk
then echo 'gnu/lib-names.h unchanged'; \
else $(INSTALL_DATA) $(objpfx)lib-names.h $@; fi
rm -f $(objpfx)lib-names.h
-
-install-others += $(includedir)/gnu/lib-names.h
endif
# This makes the Info or DVI file of the documentation from the Texinfo source.
diff --git a/configure b/configure
index 4d2a968..7450207 100755
--- a/configure
+++ b/configure
@@ -1373,7 +1373,8 @@ else
echo "$ac_t""no" 1>&6
fi
-if test "$BASH" != no && $BASH -c 'test "$BASH_VERSINFO" -ge 2'; then
+if test "$BASH" != no &&
+ $BASH -c 'test "$BASH_VERSINFO" -ge 2 >&/dev/null'; then
libc_cv_have_bash2=yes
else
libc_cv_have_bash2=no
@@ -1381,7 +1382,7 @@ fi
echo $ac_n "checking for signed size_t type""... $ac_c" 1>&6
-echo "configure:1385: checking for signed size_t type" >&5
+echo "configure:1386: checking for signed size_t type" >&5
if eval "test \"`echo '$''{'libc_cv_signed_size_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1405,12 +1406,12 @@ EOF
fi
echo $ac_n "checking for libc-friendly stddef.h""... $ac_c" 1>&6
-echo "configure:1409: checking for libc-friendly stddef.h" >&5
+echo "configure:1410: checking for libc-friendly stddef.h" >&5
if eval "test \"`echo '$''{'libc_cv_friendly_stddef'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1414 "configure"
+#line 1415 "configure"
#include "confdefs.h"
#define __need_size_t
#define __need_wchar_t
@@ -1425,7 +1426,7 @@ size_t size; wchar_t wchar;
if (&size == NULL || &wchar == NULL) abort ();
; return 0; }
EOF
-if { (eval echo configure:1429: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1430: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
libc_cv_friendly_stddef=yes
else
@@ -1444,7 +1445,7 @@ override stddef.h = # The installed <stddef.h> seems to be libc-friendly."
fi
echo $ac_n "checking whether we need to use -P to assemble .S files""... $ac_c" 1>&6
-echo "configure:1448: checking whether we need to use -P to assemble .S files" >&5
+echo "configure:1449: checking whether we need to use -P to assemble .S files" >&5
if eval "test \"`echo '$''{'libc_cv_need_minus_P'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1467,7 +1468,7 @@ asm-CPPFLAGS = -P # The assembler can't grok cpp's # line directives."
fi
echo $ac_n "checking for assembler global-symbol directive""... $ac_c" 1>&6
-echo "configure:1471: checking for assembler global-symbol directive" >&5
+echo "configure:1472: checking for assembler global-symbol directive" >&5
if eval "test \"`echo '$''{'libc_cv_asm_global_directive'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1497,7 +1498,7 @@ EOF
fi
echo $ac_n "checking for .set assembler directive""... $ac_c" 1>&6
-echo "configure:1501: checking for .set assembler directive" >&5
+echo "configure:1502: checking for .set assembler directive" >&5
if eval "test \"`echo '$''{'libc_cv_asm_set_directive'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1532,12 +1533,12 @@ fi
if test $elf != yes; then
echo $ac_n "checking for .init and .fini sections""... $ac_c" 1>&6
-echo "configure:1536: checking for .init and .fini sections" >&5
+echo "configure:1537: checking for .init and .fini sections" >&5
if eval "test \"`echo '$''{'libc_cv_have_initfini'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1541 "configure"
+#line 1542 "configure"
#include "confdefs.h"
int main() {
@@ -1546,7 +1547,7 @@ asm (".section .init");
asm (".text");
; return 0; }
EOF
-if { (eval echo configure:1550: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1551: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
libc_cv_have_initfini=yes
else
@@ -1571,19 +1572,19 @@ if test $elf = yes; then
libc_cv_asm_underscores=no
else
echo $ac_n "checking for _ prefix on C symbol names""... $ac_c" 1>&6
-echo "configure:1575: checking for _ prefix on C symbol names" >&5
+echo "configure:1576: checking for _ prefix on C symbol names" >&5
if eval "test \"`echo '$''{'libc_cv_asm_underscores'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1580 "configure"
+#line 1581 "configure"
#include "confdefs.h"
asm ("_glibc_foobar:");
int main() {
glibc_foobar ();
; return 0; }
EOF
-if { (eval echo configure:1587: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1588: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
libc_cv_asm_underscores=yes
else
@@ -1610,7 +1611,7 @@ if test $elf = yes; then
libc_cv_asm_weakext_directive=no
else
echo $ac_n "checking for assembler .weak directive""... $ac_c" 1>&6
-echo "configure:1614: checking for assembler .weak directive" >&5
+echo "configure:1615: checking for assembler .weak directive" >&5
if eval "test \"`echo '$''{'libc_cv_asm_weak_directive'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1633,7 +1634,7 @@ echo "$ac_t""$libc_cv_asm_weak_directive" 1>&6
if test $libc_cv_asm_weak_directive = no; then
echo $ac_n "checking for assembler .weakext directive""... $ac_c" 1>&6
-echo "configure:1637: checking for assembler .weakext directive" >&5
+echo "configure:1638: checking for assembler .weakext directive" >&5
if eval "test \"`echo '$''{'libc_cv_asm_weakext_directive'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1670,7 +1671,7 @@ EOF
fi
echo $ac_n "checking for ld --no-whole-archive""... $ac_c" 1>&6
-echo "configure:1674: checking for ld --no-whole-archive" >&5
+echo "configure:1675: checking for ld --no-whole-archive" >&5
if eval "test \"`echo '$''{'libc_cv_ld_no_whole_archive'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1681,7 +1682,7 @@ __throw () {}
EOF
if { ac_try='${CC-cc} $CFLAGS
-nostdlib -nostartfiles -Wl,--no-whole-archive
- -o conftest conftest.c'; { (eval echo configure:1685: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
+ -o conftest conftest.c'; { (eval echo configure:1686: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
libc_cv_ld_no_whole_archive=yes
else
libc_cv_ld_no_whole_archive=no
@@ -1692,7 +1693,7 @@ fi
echo "$ac_t""$libc_cv_ld_no_whole_archive" 1>&6
echo $ac_n "checking for gcc -fno-exceptions""... $ac_c" 1>&6
-echo "configure:1696: checking for gcc -fno-exceptions" >&5
+echo "configure:1697: checking for gcc -fno-exceptions" >&5
if eval "test \"`echo '$''{'libc_cv_gcc_no_exceptions'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1703,7 +1704,7 @@ __throw () {}
EOF
if { ac_try='${CC-cc} $CFLAGS
-nostdlib -nostartfiles -fno-exceptions
- -o conftest conftest.c'; { (eval echo configure:1707: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
+ -o conftest conftest.c'; { (eval echo configure:1708: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
libc_cv_gcc_no_exceptions=yes
else
libc_cv_gcc_no_exceptions=no
@@ -1755,7 +1756,7 @@ if test "$uname" = generic; then
fi
echo $ac_n "checking OS release for uname""... $ac_c" 1>&6
-echo "configure:1759: checking OS release for uname" >&5
+echo "configure:1760: checking OS release for uname" >&5
if eval "test \"`echo '$''{'libc_cv_uname_release'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1777,7 +1778,7 @@ echo "$ac_t""$libc_cv_uname_release" 1>&6
uname_release="$libc_cv_uname_release"
echo $ac_n "checking OS version for uname""... $ac_c" 1>&6
-echo "configure:1781: checking OS version for uname" >&5
+echo "configure:1782: checking OS version for uname" >&5
if eval "test \"`echo '$''{'libc_cv_uname_version'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1799,7 +1800,7 @@ else
fi
echo $ac_n "checking stdio selection""... $ac_c" 1>&6
-echo "configure:1803: checking stdio selection" >&5
+echo "configure:1804: checking stdio selection" >&5
case $stdio in
libio) cat >> confdefs.h <<\EOF
diff --git a/configure.in b/configure.in
index 4a3f663..3a4d200 100644
--- a/configure.in
+++ b/configure.in
@@ -34,7 +34,7 @@ esac
dnl Arguments to specify presence of other packages/features.
AC_ARG_WITH(fp, dnl
- --with-fp if using floating-point hardware [default=yes],
+[ --with-fp if using floating-point hardware [default=yes]],
with_fp=$withval, with_fp=yes)
AC_ARG_WITH(gnu-binutils, dnl
--with-gnu-binutils if using GNU binutils (as and ld),
@@ -59,6 +59,11 @@ AC_ARG_ENABLE(libio, dnl
fi],
stdio=default)
+AC_ARG_ENABLE(sanity-checks, dnl
+[ --disable-sanity-checks really do not use threads (should not be used
+ except in special situations) [default=yes]],
+ enable_sanity=$enableval, enable_sanity=yes)
+
dnl Arguments to enable or disable building the shared, profiled, and
dnl -fomit-frame-pointer libraries.
AC_ARG_ENABLE(shared, dnl
@@ -360,7 +365,8 @@ AC_CHECK_TOOL(AR, ar)
AC_CHECK_TOOL(RANLIB, ranlib, :)
AC_PATH_PROG(BASH, bash, no)
-if test "$BASH" != no && $BASH -c 'test "$BASH_VERSINFO" -ge 2'; then
+if test "$BASH" != no &&
+ $BASH -c 'test "$BASH_VERSINFO" -ge 2 >&/dev/null'; then
libc_cv_have_bash2=yes
else
libc_cv_have_bash2=no
diff --git a/grp/grp.h b/grp/grp.h
index 3e2bd05..164bdd7 100644
--- a/grp/grp.h
+++ b/grp/grp.h
@@ -105,6 +105,8 @@ extern struct group *getgrnam __P ((__const char *__name));
POSIX people would choose. */
#if defined(__USE_SVID) || defined (__USE_BSD) || defined(__USE_XOPEN_EXTENDED)
+extern int __getgrent_r __P ((struct group *__resultbuf, char *buffer,
+ size_t __buflen, struct group **__result));
extern int getgrent_r __P ((struct group *__resultbuf, char *buffer,
size_t __buflen, struct group **__result));
#endif
diff --git a/io/fts.c b/io/fts.c
index cfc8fa6..2a7100e 100644
--- a/io/fts.c
+++ b/io/fts.c
@@ -570,7 +570,7 @@ fts_build(sp, type)
register FTS *sp;
int type;
{
- register struct dirent dirbuf, *dp;
+ struct dirent dirbuf, *dp;
register FTSENT *p, *head;
register int nitems;
FTSENT *cur, *tail;
diff --git a/io/getwd.c b/io/getwd.c
index 4488cef..510a681 100644
--- a/io/getwd.c
+++ b/io/getwd.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1991, 1992, 1996 Free Software Foundation, Inc.
+/* Obsolete function to get current working directory.
+ Copyright (C) 1991, 1992, 1996 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -21,19 +22,15 @@
#include <string.h>
#include <unistd.h>
-/* Put the absolute pathname of the current working direction in BUF.
- If successful, return BUF. If not, put an error message in
- BUF and return NULL. BUF should be at least PATH_MAX bytes long. */
+
char *
getwd (buf)
char *buf;
{
#ifndef PATH_MAX
#define PATH_MAX 1024
- char fetchbuf[PATH_MAX];
-#else
-#define fetchbuf buf
#endif
+ char tmpbuf[PATH_MAX];
if (buf == NULL)
{
@@ -41,18 +38,21 @@ getwd (buf)
return NULL;
}
- if (getcwd (fetchbuf, PATH_MAX) == NULL)
+ if (getcwd (tmpbuf, LOCAL_PATH_MAX) == NULL)
{
-#if defined HAVE_STRERROR_R || defined _LIBC
- __strerror_r (errno, buf, PATH_MAX);
-#else
- strncpy (buf, strerror (errno), PATH_MAX);
-#endif
+ /* We use 1024 here since it should really be enough and because
+ this is a save value. */
+ __strerror_r (errno, buf, 1024);
return NULL;
}
- if (fetchbuf != buf)
- strcpy (buf, fetchbuf);
+ /* This is completely unsafe. Nobody can say how big the user
+ provided buffer is. Perhaps the application and the libc
+ disagree about the value of PATH_MAX. */
+ strcpy (buf, tmpbuf);
return buf;
}
+
+link_warning (getwd,
+ "the `getwd' function is dangerous and should not be used.")
diff --git a/libio/fileops.c b/libio/fileops.c
index 1851d9a..d3f4831 100644
--- a/libio/fileops.c
+++ b/libio/fileops.c
@@ -45,21 +45,27 @@ extern int errno;
is that of gptr(); in put mode that of pptr().
The position in the buffer that corresponds to the position
- in external file system is file_ptr().
- This is normally _IO_read_end, except in putback mode,
+ in external file system is normally _IO_read_end, except in putback
+ mode, when it is _IO_save_end.
when it is _IO_save_end.
If the field _fb._offset is >= 0, it gives the offset in
the file as a whole corresponding to eGptr(). (?)
PUT MODE:
- If a filebuf is in put mode, pbase() is non-NULL and equal to base().
- Also, epptr() == ebuf().
- Also, eback() == gptr() && gptr() == egptr().
- The un-flushed character are those between pbase() and pptr().
+ If a filebuf is in put mode, then all of _IO_read_ptr, _IO_read_end,
+ and _IO_read_base are equal to each other. These are usually equal
+ to _IO_buf_base, though not necessarily if we have switched from
+ get mode to put mode. (The reason is to maintain the invariant
+ that _IO_read_end corresponds to the external file position.)
+ _IO_write_base is non-NULL and usually equal to _IO_base_base.
+ We also have _IO_write_end == _IO_buf_end, but only in fully buffered mode.
+ The un-flushed character are those between _IO_write_base and _IO_write_ptr.
+
GET MODE:
If a filebuf is in get or putback mode, eback() != egptr().
In get mode, the unread characters are between gptr() and egptr().
The OS file position corresponds to that of egptr().
+
PUTBACK MODE:
Putback mode is used to remember "excess" characters that have
been sputbackc'd in a separate putback buffer.
@@ -72,7 +78,7 @@ extern int errno;
The OS position corresponds to that of save_egptr().
LINE BUFFERED OUTPUT:
- During line buffered output, pbase()==base() && epptr()==base().
+ During line buffered output, _IO_write_base==base() && epptr()==base().
However, ptr() may be anywhere between base() and ebuf().
This forces a call to filebuf::overflow(int C) on every put.
If there is more space in the buffer, and C is not a '\n',
diff --git a/libio/iosetvbuf.c b/libio/iosetvbuf.c
index 3776330..8ba9753 100644
--- a/libio/iosetvbuf.c
+++ b/libio/iosetvbuf.c
@@ -42,7 +42,7 @@ _IO_setvbuf (fp, buf, mode, size)
switch (mode)
{
case _IOFBF:
- fp->_IO_file_flags &= ~_IO_LINE_BUF;
+ fp->_IO_file_flags &= ~_IO_LINE_BUF|_IO_UNBUFFERED;
if (buf == NULL)
{
if (fp->_IO_buf_base == NULL)
@@ -72,6 +72,7 @@ _IO_setvbuf (fp, buf, mode, size)
}
break;
case _IOLBF:
+ fp->_IO_file_flags &= ~_IO_UNBUFFERED;
fp->_IO_file_flags |= _IO_LINE_BUF;
if (buf == NULL)
{
diff --git a/manual/nss.texi b/manual/nss.texi
index 074b857..4a81edc 100644
--- a/manual/nss.texi
+++ b/manual/nss.texi
@@ -378,9 +378,9 @@ the non-reentrant and reentrant versions of our function above are:
@smallexample
struct hostent *gethostbyname (const char *name)
-struct hostent *gethostbyname_r (const char *name,
- struct hostent *result_buf, char *buf,
- int buflen, int *h_errnop)
+int gethostbyname_r (const char *name, struct hostent *result_buf,
+ char *buf, size_t buflen, struct hostent **result,
+ int *h_errnop)
@end smallexample
@noindent
@@ -389,7 +389,7 @@ The actual prototype of the function in the NSS modules in this case is
@smallexample
enum nss_status _nss_files_gethostbyname_r (const char *name,
struct hostent *result_buf,
- char *buf, int buflen,
+ char *buf, size_t buflen,
int *h_errnop)
@end smallexample
@@ -553,7 +553,7 @@ the interface. All derive from the traditional ones for system databases.
database (e.g., it is @code{pw} for the password database).
@table @code
-@item int _nss_@var{database}_set@var{db}ent (void)
+@item enum nss_status _nss_@var{database}_set@var{db}ent (void)
This function prepares the service for following operations. For a
simple file based lookup this means files could be opened, for other
services this function simply is a noop.
@@ -566,14 +566,14 @@ argument for some @var{database}s (i.e., the interface is
The return value should be @var{NSS_STATUS_SUCCESS} or according to the
table above in case of an error (@pxref{NSS Modules Interface}).
-@item int _nss_@var{database}_end@var{db}ent (void)
+@item enum nss_status _nss_@var{database}_end@var{db}ent (void)
This function simply closes all files which are still open or removes
buffer caches. If there are no files or buffers to remove this is again
a simple noop.
There normally is no return value different to @var{NSS_STATUS_SUCCESS}.
-@item int _nss_@var{database}_get@var{db}ent_r (@var{STRUCTURE} *result, char *buffer, int buflen)
+@item enum nss_status _nss_@var{database}_get@var{db}ent_r (@var{STRUCTURE} *result, char *buffer, size_t buflen)
Since this function will be called several times in a row to retrieve
one entry after the other it must keep some kind of state. But this
also means the functions are not really reentrant. They are reentrant
@@ -602,7 +602,7 @@ returned. When the service was not formerly initialized by a call to
@code{_nss_@var{DATABASE}_set@var{db}ent} all return value allowed for
this function can also be returned here.
-@item int _nss_@var{DATABASE}_get@var{db}by@var{XX}_r (@var{PARAMS}, @var{STRUCTURE} *result, char *buffer, int buflen)
+@item enum nss_status _nss_@var{DATABASE}_get@var{db}by@var{XX}_r (@var{PARAMS}, @var{STRUCTURE} *result, char *buffer, size_t buflen)
This function shall return the entry from the database which is
addressed by the @var{PARAMS}. The type and number of these arguments
vary. It must be individually determined by looking to the user-level
diff --git a/misc/err.c b/misc/err.c
index d527573..56ca808 100644
--- a/misc/err.c
+++ b/misc/err.c
@@ -56,6 +56,7 @@ vwarn (const char *format, __gnuc_va_list ap)
vfprintf (stderr, format, ap);
fputs (": ", stderr);
}
+ __set_errno (error);
fprintf (stderr, "%m\n");
}
diff --git a/misc/ioctltst.c b/misc/ioctltst.c
index 3e8ea99..bf3286b 100644
--- a/misc/ioctltst.c
+++ b/misc/ioctltst.c
@@ -10,7 +10,7 @@
* open a socket, get the process group information of the socket, and use the
* socket to get the network interface configuration list
*/
-main()
+main(int argc, char *argv[])
{
int sock;
int ioctl_result;
@@ -26,7 +26,7 @@ main()
/* use ioctl() to get the process group information */
{
int get_process_group;
-
+
ioctl_result = ioctl(sock, SIOCGPGRP, (char *) &get_process_group);
if (ioctl_result < 0)
@@ -41,7 +41,7 @@ main()
/* use ioctl() to get the interface configuration list */
{
static struct ifconf ifc; /* init to 0 */
-
+
ioctl_result = ioctl(sock, SIOCGIFCONF, (char *) &ifc);
if (ioctl_result < 0)
diff --git a/misc/syslog.c b/misc/syslog.c
index 9db16ca..205909e 100644
--- a/misc/syslog.c
+++ b/misc/syslog.c
@@ -49,6 +49,8 @@ static char sccsid[] = "@(#)syslog.c 8.4 (Berkeley) 3/18/94";
#include <time.h>
#include <unistd.h>
#include <stdlib.h>
+#include <libc-lock.h>
+#include <signal.h>
#if __STDC__
#include <stdarg.h>
@@ -65,6 +67,14 @@ static int LogFacility = LOG_USER; /* default facility code */
static int LogMask = 0xff; /* mask of priorities to be logged */
extern char *__progname; /* Program name, from crt0. */
+/* Define the lock. */
+__libc_lock_define_initialized (static, syslog_lock)
+
+static void openlog_internal(const char *, int, int);
+static void closelog_internal(void);
+static void sigpipe_handler (int);
+static void cancel_handler (void *);
+
/*
* syslog, vsyslog --
* print message on log file; output is intended for syslogd(8).
@@ -103,6 +113,9 @@ vsyslog(pri, fmt, ap)
char *buf = 0;
size_t bufsize = 0;
size_t prioff, msgoff;
+ struct sigaction action, oldaction;
+ struct sigaction *oldaction_ptr = NULL;
+ int sigpipe;
#define INTERNALLOG LOG_ERR|LOG_CONS|LOG_PERROR|LOG_PID
/* Check for invalid bits. */
@@ -163,9 +176,22 @@ vsyslog(pri, fmt, ap)
(void)writev(STDERR_FILENO, iov, 2);
}
+ /* Prepare for multiple users. We have to take care: open and
+ write are cancelation points. */
+ __libc_cleanup_region_start (cancel_handler, &oldaction_ptr);
+ __libc_lock_lock (syslog_lock);
+
+ /* Prepare for a broken connection. */
+ memset (&action, 0, sizeof (action));
+ action.sa_handler = sigpipe_handler;
+ sigemptyset (&action.sa_mask);
+ sigpipe = sigaction (SIGPIPE, &action, &oldaction);
+ if (sigpipe == 0)
+ oldaction_ptr = &oldaction;
+
/* Get connected, output the message to the local logger. */
if (!connected)
- openlog(LogTag, LogStat | LOG_NDELAY, 0);
+ openlog_internal(LogTag, LogStat | LOG_NDELAY, 0);
/* If we have a SOCK_STREAM connection, also send ASCII NUL as
a record terminator. */
@@ -174,7 +200,7 @@ vsyslog(pri, fmt, ap)
if (__send(LogFile, buf, bufsize, 0) < 0)
{
- closelog (); /* attempt re-open next time */
+ closelog_internal (); /* attempt re-open next time */
/*
* Output the message to the console; don't worry about blocking,
* if console blocks everything will. Make sure the error reported
@@ -188,15 +214,20 @@ vsyslog(pri, fmt, ap)
}
}
+ if (sigpipe == 0)
+ sigaction (SIGPIPE, &oldaction, (struct sigaction *) NULL);
+
+ /* End of critical section. */
+ __libc_cleanup_region_end (0);
+ __libc_lock_unlock (syslog_lock);
+
free (buf);
}
static struct sockaddr SyslogAddr; /* AF_UNIX address of local logger */
-void
-openlog(ident, logstat, logfac)
- const char *ident;
- int logstat, logfac;
+static void
+openlog_internal(const char *ident, int logstat, int logfac)
{
if (ident != NULL)
LogTag = ident;
@@ -237,13 +268,60 @@ openlog(ident, logstat, logfac)
}
void
-closelog()
+openlog (const char *ident, int logstat, int logfac)
+{
+ /* Protect against multiple users. */
+ __libc_cleanup_region_start ((void (*) __P ((void *))) __libc_mutex_unlock,
+ &syslog_lock);
+ __libc_lock_lock (syslog_lock);
+
+ openlog_internal (ident, logstat, logfac);
+
+ /* Free the lock. */
+ __libc_cleanup_region_end (1);
+}
+
+static void
+sigpipe_handler (int signo)
+{
+ closelog_internal();
+}
+
+static void
+closelog_internal()
{
(void)close(LogFile);
LogFile = -1;
connected = 0;
}
+void
+closelog ()
+{
+ /* Protect against multiple users. */
+ __libc_cleanup_region_start ((void (*) __P ((void *))) __libc_mutex_unlock,
+ &syslog_lock);
+ __libc_lock_lock (syslog_lock);
+
+ closelog_internal ();
+
+ /* Free the lock. */
+ __libc_cleanup_region_end (1);
+}
+
+static void
+cancel_handler (void *ptr)
+{
+ /* Restore the old signal handler. */
+ struct sigaction *oldaction = *((struct sigaction **) ptr);
+
+ if (oldaction != (struct sigaction *) NULL)
+ sigaction (SIGPIPE, oldaction, (struct sigaction *) NULL);
+
+ /* Free the lock. */
+ __libc_lock_unlock (syslog_lock);
+}
+
/* setlogmask -- set the log mask level */
int
setlogmask(pmask)
diff --git a/misc/tst-dirname.c b/misc/tst-dirname.c
index 78eb1b5..472c290 100644
--- a/misc/tst-dirname.c
+++ b/misc/tst-dirname.c
@@ -43,7 +43,9 @@ test (input, result)
}
int
-main ()
+main (argc, argv)
+ int argc;
+ char *argv[];
{
int result = 0;
diff --git a/posix/glob.c b/posix/glob.c
index 5dab2f2..ba5f236 100644
--- a/posix/glob.c
+++ b/posix/glob.c
@@ -52,7 +52,7 @@
#ifndef ELIDE_CODE
-#ifdef STDC_HEADERS
+#if defined(STDC_HEADERS) || defined(__GNU_LIBRARY__)
#include <stddef.h>
#endif
@@ -222,7 +222,7 @@ extern char *alloca ();
#endif
#endif
-#ifndef STDC_HEADERS
+#if !(defined (STDC_HEADERS) || defined (__GNU_LIBRARY__))
#undef size_t
#define size_t unsigned int
#endif
diff --git a/stdlib/Makefile b/stdlib/Makefile
index 66f28ff..9d5744f 100644
--- a/stdlib/Makefile
+++ b/stdlib/Makefile
@@ -32,7 +32,7 @@ routines := \
abs labs llabs \
div ldiv lldiv \
mblen mbstowcs mbtowc wcstombs wctomb \
- random random_r rand \
+ random random_r rand rand_r \
drand48 erand48 lrand48 nrand48 mrand48 jrand48 \
srand48 seed48 lcong48 \
drand48_r erand48_r lrand48_r nrand48_r mrand48_r jrand48_r \
diff --git a/stdlib/canonicalize.c b/stdlib/canonicalize.c
index 554e1b2..8c0074a 100644
--- a/stdlib/canonicalize.c
+++ b/stdlib/canonicalize.c
@@ -1,21 +1,21 @@
/* Return the canonical absolute name of a given file.
-Copyright (C) 1996 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+ Copyright (C) 1996 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
-The GNU C 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
-Library General Public License for more details.
+ The GNU C 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
+ Library General Public License for more details.
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB. If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA. */
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
#include <assert.h>
#include <stdlib.h>
@@ -58,10 +58,22 @@ canonicalize (const char *name, char *resolved)
if (!resolved)
rpath = malloc (path_max);
- strcpy (rpath, "/");
- if (name[0] != '/' && !getcwd (rpath, path_max))
- goto error;
- dest = rpath + strlen (rpath);
+ if (name[0] != '/')
+ {
+ /* We don't write to RPATH directly since the application and
+ the library might disagree about the value for PATH_MAX. */
+ char tmpbuf[path_max];
+
+ if (!getcwd (rpath, path_max))
+ goto error;
+
+ dest = __stpcpy (rpath, tmpbuf);
+ }
+ else
+ {
+ rpath[0] = '/';
+ dest = rpath + 1;
+ }
for (start = end = name; *start; start = end)
{
@@ -164,9 +176,9 @@ error:
free (rpath);
return NULL;
}
-
weak_alias (canonicalize, realpath)
+
char *
canonicalize_file_name (const char *name)
{
diff --git a/sysdeps/unix/sysv/linux/alpha/llseek.S b/stdlib/rand_r.c
index a2e644c..3e0b8b2 100644
--- a/sysdeps/unix/sysv/linux/alpha/llseek.S
+++ b/stdlib/rand_r.c
@@ -1,6 +1,7 @@
-/* Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc.
+/* Reentrant random function frm POSIX.1c.
+ Copyright (C) 1996 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- Contributed by David Mosberger <davidm@cs.arizona.edu>, 1995.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
@@ -17,44 +18,32 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-/* For compatibility only: a "long" is 64 bits on the Alpha, so
- llseek() isn't really needed. But there are some programs out
- there who may depend on it being around. */
-
-#include <sysdep.h>
-
- .text
-ENTRY(llseek)
-#ifdef PROF
- ldgp gp, 0(pv)
- .set noat
- lda AT, _mcount
- jsr AT, (AT), _mcount
- .set at
- .prologue 1
-#else
- .prologue 0
-#endif
-
- sll a1, 32, a1 /* build a 64 bit ofs out of 32 bit operands */
- zap a2, 0xf0, a2
- mov a3, t0 /* save result address */
- bis a2, a1, a1
-
- mov a4, a2 /* shift down whence */
-
- ldi v0, __NR_lseek
- call_pal PAL_callsys
- bne a3, error
-
- stq v0, 0(t0)
- ret
-
-error:
-#ifndef PROF
- br gp, 1f
-1: ldgp gp, 0(gp)
-#endif
- jmp zero, __syscall_error
-
- END(llseek)
+#include <stdlib.h>
+
+
+/* This algorithm is mentioned in the ISO C standard, here extended
+ for 32 bits. */
+int
+rand_r (unsigned int *seed)
+{
+ unsigned int next = *seed;
+ int result;
+
+ next *= 1103515245;
+ next += 12345;
+ result = (unsigned int) (next / 65536) % 2048;
+
+ next *= 1103515245;
+ next += 12345;
+ result <<= 11;
+ result ^= (unsigned int) (next / 65536) % 1024;
+
+ next *= 1103515245;
+ next += 12345;
+ result <<= 10;
+ result ^= (unsigned int) (next / 65536) % 1024;
+
+ *seed = next;
+
+ return result;
+}
diff --git a/sysdeps/posix/getcwd.c b/sysdeps/posix/getcwd.c
index 92196ac..4ea90a7 100644
--- a/sysdeps/posix/getcwd.c
+++ b/sysdeps/posix/getcwd.c
@@ -253,7 +253,7 @@ __getcwd (buf, size)
while (!(thisdev == rootdev && thisino == rootino))
{
register DIR *dirstream;
- register struct dirent *d;
+ struct dirent *d;
#if defined HAVE_READDIR_R || defined _LIBC
struct dirent dirbuf;
#endif
diff --git a/sysdeps/stub/libc-lock.h b/sysdeps/stub/libc-lock.h
index 158a221..d0a82fe 100644
--- a/sysdeps/stub/libc-lock.h
+++ b/sysdeps/stub/libc-lock.h
@@ -48,6 +48,9 @@
/* Lock the named lock variable. */
#define __libc_lock_lock(NAME)
+/* Try tp lock the named lock variable. */
+#define __libc_lock_trylock(NAME)
+
/* Unlock the named lock variable. */
#define __libc_lock_unlock(NAME)
@@ -58,4 +61,7 @@
#define __libc_cleanup_region_end(DOIT)
+/* We need protable names for some of the functions. */
+#define __libc_mutex_unlock
+
#endif /* libc-lock.h */
diff --git a/sysdeps/unix/sysv/linux/Dist b/sysdeps/unix/sysv/linux/Dist
index 0adc370..40f65b8 100644
--- a/sysdeps/unix/sysv/linux/Dist
+++ b/sysdeps/unix/sysv/linux/Dist
@@ -22,6 +22,7 @@ sys/mtio.h
sys/procfs.h
sys/quota.h
sys/socketcall.h
+sys/socketvar.h
sys/soundcard.h
sys/sysctl.h
sys/sysinfo.h
diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
index c7cf1f9..c03d966 100644
--- a/sysdeps/unix/sysv/linux/Makefile
+++ b/sysdeps/unix/sysv/linux/Makefile
@@ -51,7 +51,7 @@ inhibit-siglist := yes
endif
ifeq ($(subdir), inet)
-sysdep_headers += netinet/in_systm.h
+sysdep_headers += netinet/in_systm.h sys/socketvar.h
endif
# Don't compile the ctype glue code, since there is no old non-GNU C library.
diff --git a/sysdeps/unix/sysv/linux/configure b/sysdeps/unix/sysv/linux/configure
index ef7590d..867d4fb 100644
--- a/sysdeps/unix/sysv/linux/configure
+++ b/sysdeps/unix/sysv/linux/configure
@@ -1,39 +1,16 @@
- # Local configure fragment for sysdeps/unix/sysv/linux.
-
-# On Linux, the default is to use libio instead of stdio.
-test $stdio = default && stdio=libio
-
-# Don't bother trying to generate any glue code to be compatible with the
-# existing system library, because we are the only system library.
-inhibit_glue=yes
-
-echo $ac_n "checking installed Linux kernel header files""... $ac_c" 1>&6
-if eval "test \"`echo '$''{'libc_cv_linux2010'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 16 "configure"
-#include "confdefs.h"
-#include <linux/version.h>
-int main() { return 0; }
-int t() {
-#if LINUX_VERSION_CODE < (2 *65536+ 0 *256+ 10) /* 2.0.10 */
-eat flaming death
-#endif
-; return 0; }
-EOF
-if { (eval echo configure:26: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+; then
rm -rf conftest*
libc_cv_linux2010='2.0.10 or later'
else
+ echo "configure: failed program was:" >&AC_FD_CC
+ cat conftest.$ac_ext >&AC_FD_CC
rm -rf conftest*
libc_cv_linux2010='TOO OLD!'
fi
rm -f conftest*
-
fi
-echo "$ac_t""$libc_cv_linux2010" 1>&6
+echo "$ac_t""$libc_cv_linux2010" 1>&AC_FD_MSG
if test "$libc_cv_linux2010" != '2.0.10 or later'; then
{ echo "configure: error: GNU libc requires kernel header files from
Linux 2.0.10 or later to be installed before configuring.
@@ -57,20 +34,36 @@ fi
case $add_ons in
# Both are available. Good.
*linuxthreads*des-crypt* | *des-crypt*linuxthreads*)
+ message=
;;
*linuxthreads*)
- echo "\
+ message="\
*** WARNING:
*** Are you sure you do not want to use the \`crypt' add-on?"
;;
*des-crypt*)
- echo "\
+ message="\
*** WARNING:
*** Are you sure you do not want to use the \`LinuxThread' add-on?"
;;
*)
- echo "\
+ message="\
*** WARNING: Are you sure you do not want to use the \`LinuxThreads'
*** and \`crypt' add-ons?"
;;
esac
+
+if test "$message"; then
+ if test $enable_sanity = yes; then
+ echo "\
+*** You should not compile the GNU libc without the \`LinuxThreads' and
+*** \`crypt' add-on. Not using them risks to be incompatible with the
+*** libraries of other systems. Consider getting the add-ons and restart
+*** the configuration.
+*** If you really mean to avoid those add-ons run configure again, now
+*** using the extra parameter \`--disable-sanity-checks'."
+ exit 1
+ else
+ echo "$message"
+ fi
+fi
diff --git a/sysdeps/unix/sysv/linux/configure.in b/sysdeps/unix/sysv/linux/configure.in
index c493792..b6474a9 100644
--- a/sysdeps/unix/sysv/linux/configure.in
+++ b/sysdeps/unix/sysv/linux/configure.in
@@ -29,3 +29,50 @@ Linux LIBC_LINUX_VERSION or later. This check uses <linux/version.h>, so
make sure that file was built correctly when installing the kernel header
files.])
fi
+
+# The Linux filesystem standard prescribes where to place "essential"
+# files. I.e., when the installation prefix is "/usr" we have to place
+# shared library objects and the configuation files on the root partition
+# in /lib and /etc.
+if test "$prefix" = "/usr"; then
+ libc_cv_slibdir="/lib"
+ libc_cv_sysconfdir="/etc"
+fi
+
+# Under Linux the LinuxThreads and crypt add-on should be available.
+case $add_ons in
+ # Both are available. Good.
+ *linuxthreads*des-crypt* | *des-crypt*linuxthreads*)
+ message=
+ ;;
+ *linuxthreads*)
+ message="\
+*** WARNING:
+*** Are you sure you do not want to use the \`crypt' add-on?"
+ ;;
+ *des-crypt*)
+ message="\
+*** WARNING:
+*** Are you sure you do not want to use the \`LinuxThread' add-on?"
+ ;;
+ *)
+ message="\
+*** WARNING: Are you sure you do not want to use the \`LinuxThreads'
+*** and \`crypt' add-ons?"
+ ;;
+esac
+
+if test "$message"; then
+ if test $enable_sanity = yes; then
+ echo "\
+*** You should not compile the GNU libc without the \`LinuxThreads' and
+*** \`crypt' add-on. Not using them risks to be incompatible with the
+*** libraries of other systems. Consider getting the add-ons and restart
+*** the configuration.
+*** If you really mean to avoid those add-ons run configure again, now
+*** using the extra parameter \`--disable-sanity-checks'."
+ exit 1
+ else
+ echo "$message"
+ fi
+fi
diff --git a/sysdeps/unix/sysv/linux/sys/socketvar.h b/sysdeps/unix/sysv/linux/sys/socketvar.h
new file mode 100644
index 0000000..3945db1
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sys/socketvar.h
@@ -0,0 +1,3 @@
+/* This header is used on many systems but for Linux we have everything
+ already defined in the standard header. */
+#include <sys/socket.h>