+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.
* 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.
# 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
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
\f
# This makes the Info or DVI file of the documentation from the Texinfo source.
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
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
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
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
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
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
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
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() {
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
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
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
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
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
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
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
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
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
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
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
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),
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
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
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
register FTS *sp;
int type;
{
- register struct dirent dirbuf, *dp;
+ struct dirent dirbuf, *dp;
register FTSENT *p, *head;
register int nitems;
FTSENT *cur, *tail;
-/* 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
#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)
{
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.")
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.
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',
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)
}
break;
case _IOLBF:
+ fp->_IO_file_flags &= ~_IO_UNBUFFERED;
fp->_IO_file_flags |= _IO_LINE_BUF;
if (buf == NULL)
{
@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
@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
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.
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
@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
vfprintf (stderr, format, ap);
fputs (": ", stderr);
}
+ __set_errno (error);
fprintf (stderr, "%m\n");
}
* 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;
/* 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)
/* 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)
#include <time.h>
#include <unistd.h>
#include <stdlib.h>
+#include <libc-lock.h>
+#include <signal.h>
#if __STDC__
#include <stdarg.h>
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).
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. */
(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. */
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
}
}
+ 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;
}
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)
}
int
-main ()
+main (argc, argv)
+ int argc;
+ char *argv[];
{
int result = 0;
#ifndef ELIDE_CODE
-#ifdef STDC_HEADERS
+#if defined(STDC_HEADERS) || defined(__GNU_LIBRARY__)
#include <stddef.h>
#endif
#endif
#endif
-#ifndef STDC_HEADERS
+#if !(defined (STDC_HEADERS) || defined (__GNU_LIBRARY__))
#undef size_t
#define size_t unsigned int
#endif
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 \
/* 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>
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)
{
free (rpath);
return NULL;
}
-
weak_alias (canonicalize, realpath)
+
char *
canonicalize_file_name (const char *name)
{
-/* 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
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;
+}
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
/* 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)
#define __libc_cleanup_region_end(DOIT)
+/* We need protable names for some of the functions. */
+#define __libc_mutex_unlock
+
#endif /* libc-lock.h */
sys/procfs.h
sys/quota.h
sys/socketcall.h
+sys/socketvar.h
sys/soundcard.h
sys/sysctl.h
sys/sysinfo.h
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.
- # 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.
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
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
--- /dev/null
+/* This header is used on many systems but for Linux we have everything
+ already defined in the standard header. */
+#include <sys/socket.h>