aboutsummaryrefslogtreecommitdiff
path: root/sysdeps
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/generic/abort.c44
-rw-r--r--sysdeps/mach/libc-lock.h3
-rw-r--r--sysdeps/posix/fpathconf.c32
-rw-r--r--sysdeps/posix/pathconf.c154
-rw-r--r--sysdeps/stub/libc-lock.h2
-rw-r--r--sysdeps/unix/inet/Subdirs2
-rw-r--r--sysdeps/unix/sysv/linux/configure10
-rw-r--r--sysdeps/unix/sysv/linux/configure.in10
-rw-r--r--sysdeps/unix/sysv/linux/paths.h3
9 files changed, 205 insertions, 55 deletions
diff --git a/sysdeps/generic/abort.c b/sysdeps/generic/abort.c
index 8eb45b3..61b9937 100644
--- a/sysdeps/generic/abort.c
+++ b/sysdeps/generic/abort.c
@@ -22,20 +22,54 @@
#include <unistd.h>
#include <signal.h>
+
+/* Function to close all streams and also make sure we don't loop by
+ calling abort while closing the streams. */
+extern void __close_all_streams (void);
+
+
/* Cause an abnormal program termination with core-dump. */
void
abort (void)
{
+ struct sigaction act;
sigset_t sigs;
if (__sigemptyset (&sigs) == 0 &&
__sigaddset (&sigs, SIGABRT) == 0)
__sigprocmask (SIG_UNBLOCK, &sigs, (sigset_t *) NULL);
+ /* If there is a user handler installed use it. We don't close or
+ flush streams. */
+ if (__sigaction (SIGABRT, NULL, &act) >= 0
+ && act.sa_handler != SIG_DFL)
+ {
+ /* Send signal to call user handler. */
+ raise (SIGABRT);
+
+ /* It returns, so we are responsible for closing the streams. */
+ __close_all_streams ();
+
+ /* There was a handler installed. Now remove it. */
+ memset (&act, '\0', sizeof (struct sigaction));
+ act.sa_handler = SIG_DFL;
+ __sigfillset (&act.sa_mask);
+ act.sa_flags = 0;
+ __sigaction (SIGABRT, &act, NULL);
+ }
+ else
+ /* No handler installed so the next `raise' will hopefully
+ terminate the process. Therefore we must close the streams. */
+ __close_all_streams ();
+
+ /* Try again. */
+ raise (SIGABRT);
+
+ /* If we can't signal ourselves, exit. */
+ _exit (127);
+
+ /* If even this fails make sure we never return. */
while (1)
- if (raise (SIGABRT))
- /* If we can't signal ourselves, exit. */
- _exit (127);
- /* If we signal ourselves and are still alive,
- or can't exit, loop forever. */
+ /* For ever and ever. */
+ ;
}
diff --git a/sysdeps/mach/libc-lock.h b/sysdeps/mach/libc-lock.h
index 23f6ed4..e2caa82 100644
--- a/sysdeps/mach/libc-lock.h
+++ b/sysdeps/mach/libc-lock.h
@@ -53,6 +53,9 @@ typedef struct __libc_lock_opaque__ __libc_lock_t;
/* Lock the named lock variable. */
#define __libc_lock_lock(NAME) __mutex_lock (&(NAME))
+/* Lock the named lock variable. */
+#define __libc_lock_trylock(NAME) __mutex_trylock (&(NAME))
+
/* Unlock the named lock variable. */
#define __libc_lock_unlock(NAME) __mutex_unlock (&(NAME))
diff --git a/sysdeps/posix/fpathconf.c b/sysdeps/posix/fpathconf.c
index 572c0de..1a2c374 100644
--- a/sysdeps/posix/fpathconf.c
+++ b/sysdeps/posix/fpathconf.c
@@ -1,20 +1,20 @@
/* Copyright (C) 1991, 1995, 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 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. */
+ 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 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., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
#include <errno.h>
#include <stddef.h>
diff --git a/sysdeps/posix/pathconf.c b/sysdeps/posix/pathconf.c
index 9539957..c069066 100644
--- a/sysdeps/posix/pathconf.c
+++ b/sysdeps/posix/pathconf.c
@@ -1,40 +1,152 @@
/* Copyright (C) 1991, 1995, 1996 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+ 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 <errno.h>
#include <stddef.h>
#include <unistd.h>
+#include <limits.h>
#include <fcntl.h>
+#include <sys/statfs.h>
/* Get file-specific information about PATH. */
long int
__pathconf (const char *path, int name)
{
- int fd = open (path, 0);
- if (fd >= 0)
+ if (path[0] == '\0')
{
- long int value = __fpathconf (fd, name);
- int save = errno;
- (void) close (fd);
- __set_errno (save);
- return value;
+ __set_errno (ENOENT);
+ return -1;
}
- return -1L;
+
+ switch (name)
+ {
+ default:
+ __set_errno (EINVAL);
+ return -1;
+
+ case _PC_LINK_MAX:
+#ifdef LINK_MAX
+ return LINK_MAX;
+#else
+ __set_errno (ENOSYS);
+ return -1;
+#endif
+
+ case _PC_MAX_CANON:
+#ifdef MAX_CANON
+ return MAX_CANON;
+#else
+ __set_errno (ENOSYS);
+ return -1;
+#endif
+
+ case _PC_MAX_INPUT:
+#ifdef MAX_INPUT
+ return MAX_INPUT;
+#else
+ __set_errno (ENOSYS);
+ return -1;
+#endif
+
+ case _PC_NAME_MAX:
+#ifdef NAME_MAX
+ {
+ struct statfs buf;
+
+ if (__statfs (path, &buf) < 0)
+ return errno == ENOSYS ? NAME_MAX : -1;
+ else
+ return buf.f_namelen;
+ }
+#else
+ __set_errno (ENOSYS);
+ return -1;
+#endif
+
+ case _PC_PATH_MAX:
+#ifdef PATH_MAX
+ return PATH_MAX;
+#else
+ __set_errno (ENOSYS);
+ return -1;
+#endif
+
+ case _PC_PIPE_BUF:
+#ifdef PIPE_BUF
+ return PIPE_BUF;
+#else
+ __set_errno (ENOSYS);
+ return -1;
+#endif
+
+ case _PC_CHOWN_RESTRICTED:
+#ifdef _POSIX_CHOWN_RESTRICTED
+ return _POSIX_CHOWN_RESTRICTED;
+#else
+ return -1;
+#endif
+
+ case _PC_NO_TRUNC:
+#ifdef _POSIX_NO_TRUNC
+ return _POSIX_NO_TRUNC;
+#else
+ return -1;
+#endif
+
+ case _PC_VDISABLE:
+#ifdef _POSIX_VDISABLE
+ return _POSIX_VDISABLE;
+#else
+ return -1;
+#endif
+
+ case _PC_SYNC_IO:
+#ifdef _POSIX_SYNC_IO
+ return _POSIX_SYNC_IO;
+#else
+ return -1;
+#endif
+
+ case _PC_ASYNC_IO:
+#ifdef _POSIX_ASYNC_IO
+ return _POSIX_ASYNC_IO;
+#else
+ return -1;
+#endif
+
+ case _PC_PRIO_IO:
+#ifdef _POSIX_PRIO_IO
+ return _POSIX_PRIO_IO;
+#else
+ return -1;
+#endif
+
+ case _PC_SOCK_MAXBUF:
+#ifdef SOCK_MAXBUF
+ return SOCK_MAXBUF;
+#else
+ __set_errno (ENOSYS);
+ return -1;
+#endif
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
}
weak_alias (__pathconf, pathconf)
diff --git a/sysdeps/stub/libc-lock.h b/sysdeps/stub/libc-lock.h
index d0a82fe..5eb698e 100644
--- a/sysdeps/stub/libc-lock.h
+++ b/sysdeps/stub/libc-lock.h
@@ -49,7 +49,7 @@
#define __libc_lock_lock(NAME)
/* Try tp lock the named lock variable. */
-#define __libc_lock_trylock(NAME)
+#define __libc_lock_trylock(NAME) 0
/* Unlock the named lock variable. */
#define __libc_lock_unlock(NAME)
diff --git a/sysdeps/unix/inet/Subdirs b/sysdeps/unix/inet/Subdirs
index bce3ada..5043651 100644
--- a/sysdeps/unix/inet/Subdirs
+++ b/sysdeps/unix/inet/Subdirs
@@ -1,4 +1,4 @@
inet
-nis
resolv
sunrpc
+nis
diff --git a/sysdeps/unix/sysv/linux/configure b/sysdeps/unix/sysv/linux/configure
index ddf8663..4508848 100644
--- a/sysdeps/unix/sysv/linux/configure
+++ b/sysdeps/unix/sysv/linux/configure
@@ -60,7 +60,7 @@ 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*)
+ *linuxthreads*crypt* | *crypt*linuxthreads*)
message=
;;
*linuxthreads*)
@@ -68,14 +68,14 @@ case $add_ons in
*** WARNING:
*** Are you sure you do not want to use the \`crypt' add-on?"
;;
- *des-crypt*)
+ *crypt*)
message="\
*** WARNING:
-*** Are you sure you do not want to use the \`LinuxThread' add-on?"
+*** 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'
+*** WARNING: Are you sure you do not want to use the \`linuxthreads'
*** and \`crypt' add-ons?"
;;
esac
@@ -83,7 +83,7 @@ esac
if test "$message"; then
if test $enable_sanity = yes; then
echo "\
-*** You should not compile the GNU libc without the \`LinuxThreads' and
+*** 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.
diff --git a/sysdeps/unix/sysv/linux/configure.in b/sysdeps/unix/sysv/linux/configure.in
index fe499af..174eb32 100644
--- a/sysdeps/unix/sysv/linux/configure.in
+++ b/sysdeps/unix/sysv/linux/configure.in
@@ -45,7 +45,7 @@ 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*)
+ *linuxthreads*crypt* | *crypt*linuxthreads*)
message=
;;
*linuxthreads*)
@@ -53,14 +53,14 @@ case $add_ons in
*** WARNING:
*** Are you sure you do not want to use the \`crypt' add-on?"
;;
- *des-crypt*)
+ *crypt*)
message="\
*** WARNING:
-*** Are you sure you do not want to use the \`LinuxThread' add-on?"
+*** 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'
+*** WARNING: Are you sure you do not want to use the \`linuxthreads'
*** and \`crypt' add-ons?"
;;
esac
@@ -68,7 +68,7 @@ esac
if test "$message"; then
if test $enable_sanity = yes; then
echo "\
-*** You should not compile the GNU libc without the \`LinuxThreads' and
+*** 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.
diff --git a/sysdeps/unix/sysv/linux/paths.h b/sysdeps/unix/sysv/linux/paths.h
index f5629fc..53c4fc5 100644
--- a/sysdeps/unix/sysv/linux/paths.h
+++ b/sysdeps/unix/sysv/linux/paths.h
@@ -48,8 +48,9 @@
#define _PATH_DEVDB "/var/run/dev.db"
#define _PATH_DEVNULL "/dev/null"
#define _PATH_DRUM "/dev/drum"
+#define _PATH_KLOG "/proc/kmsg"
#define _PATH_KMEM "/dev/kmem"
-#define _PATH_LASTLOG "/var/log/lastlog"
+#define _PATH_LASTLOG "/var/log/lastlog"
#define _PATH_MAILDIR "/var/spool/mail"
#define _PATH_MAN "/usr/man"
#define _PATH_MEM "/dev/mem"