about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--io/Makefile4
-rw-r--r--libio/Makefile6
-rw-r--r--libio/oldtmpfile.c4
-rw-r--r--login/Makefile4
-rw-r--r--misc/Makefile7
-rw-r--r--misc/fstab.h10
-rw-r--r--misc/mntent.h12
-rw-r--r--posix/Makefile2
-rw-r--r--posix/unistd.h6
-rw-r--r--posix/wordexp.h4
-rw-r--r--stdlib/Makefile1
-rw-r--r--stdlib/fmtmsg.c16
-rw-r--r--stdlib/fmtmsg.h4
-rw-r--r--stdlib/stdlib.h4
-rw-r--r--sysdeps/generic/tmpfile.c4
-rw-r--r--sysdeps/generic/wordexp.c39
-rw-r--r--sysdeps/unix/sysv/linux/getloadavg.c9
17 files changed, 91 insertions, 45 deletions
diff --git a/io/Makefile b/io/Makefile
index bfd040f5fe..0e59459597 100644
--- a/io/Makefile
+++ b/io/Makefile
@@ -67,6 +67,10 @@ CFLAGS-fts.c = -Wno-uninitialized
 CFLAGS-fcntl.c = -fexceptions -fasynchronous-unwind-tables
 CFLAGS-poll.c = -fexceptions -fasynchronous-unwind-tables
 CFLAGS-lockf.c = -fexceptions
+CFLAGS-statfs.c = -fexceptions
+CFLAGS-fstatfs.c = -fexceptions
+CFLAGS-statvfs.c = -fexceptions
+CFLAGS-fstatvfs.c = -fexceptions
 
 CFLAGS-test-stat.c = -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE
 CFLAGS-test-lfs.c = -D_LARGEFILE64_SOURCE
diff --git a/libio/Makefile b/libio/Makefile
index 645448f9f1..38245a8c3d 100644
--- a/libio/Makefile
+++ b/libio/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1995,96,97,98,99,2000,01,02 Free Software Foundation, Inc.
+# Copyright (C) 1995-2002, 2003 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
@@ -129,6 +129,10 @@ CFLAGS-putwchar.c = $(exceptions)
 CFLAGS-rewind.c = $(exceptions)
 CFLAGS-wfileops.c = $(exceptions)
 CFLAGS-wgenops.c = $(exceptions)
+CFLAGS-oldiofopen.c = $(exceptions)
+CFLAGS-iofopen.c = $(exceptions)
+CFLAGS-iofopen64.c = $(exceptions)
+CFLAGS-oldtmpfile.c = $(exceptions)
 # XXX Do we need filedoalloc and wfiledoalloc?  Others?
 
 CFLAGS-tst_putwc.c = -DOBJPFX=\"$(objpfx)\"
diff --git a/libio/oldtmpfile.c b/libio/oldtmpfile.c
index 22dd6681a5..a277914d26 100644
--- a/libio/oldtmpfile.c
+++ b/libio/oldtmpfile.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1993, 1996-1999, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1993, 1996-2000, 2003 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
@@ -43,7 +43,7 @@ __old_tmpfile (void)
 
   /* Note that this relies on the Unix semantics that
      a file is not really removed until it is closed.  */
-  (void) remove (buf);
+  (void) __unlink (buf);
 
   if ((f = _IO_old_fdopen (fd, "w+b")) == NULL)
     __close (fd);
diff --git a/login/Makefile b/login/Makefile
index 48f7fefb68..2e414a3ee7 100644
--- a/login/Makefile
+++ b/login/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1996,1997,1998,2000,2001,2002 Free Software Foundation, Inc.
+# Copyright (C) 1996-1998,2000-2002,2003 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
@@ -47,6 +47,8 @@ libutil-routines:= login login_tty logout logwtmp openpty forkpty
 
 include ../Rules
 
+CFLAGS-getpt.c = -fexceptions
+
 ifeq (yes,$(build-static-nss))
 otherlibs += $(nssobjdir)/libnss_files.a $(resolvobjdir)/libnss_dns.a \
 	     $(resolvobjdir)/libresolv.a $(common-objpfx)libc.a
diff --git a/misc/Makefile b/misc/Makefile
index 5c93e43ec6..406ed0fed9 100644
--- a/misc/Makefile
+++ b/misc/Makefile
@@ -84,6 +84,13 @@ CFLAGS-usleep.c = -fexceptions
 CFLAGS-syslog.c = -fexceptions
 CFLAGS-error.c = -fexceptions
 CFLAGS-getpass.c = -fexceptions
+CFLAGS-mkstemp.c = -fexceptions
+CFLAGS-mkstemp64.c = -fexceptions
+CFLAGS-mntent_r.c = -fexceptions
+CFLAGS-mntent.c = -fexceptions
+CFLAGS-fstab.c = -fexceptions
+CFLAGS-getsysstats.c = -fexceptions
+CFLAGS-getusershell.c = -fexceptions
 
 include ../Rules
 
diff --git a/misc/fstab.h b/misc/fstab.h
index 24ecad7dbc..421c65a5c6 100644
--- a/misc/fstab.h
+++ b/misc/fstab.h
@@ -68,11 +68,11 @@ struct fstab
 
 __BEGIN_DECLS
 
-extern struct fstab *getfsent (void) __THROW;
-extern struct fstab *getfsspec (__const char *__name) __THROW;
-extern struct fstab *getfsfile (__const char *__name) __THROW;
-extern int setfsent (void) __THROW;
-extern void endfsent (void) __THROW;
+extern struct fstab *getfsent (void);
+extern struct fstab *getfsspec (__const char *__name);
+extern struct fstab *getfsfile (__const char *__name);
+extern int setfsent (void);
+extern void endfsent (void);
 
 __END_DECLS
 
diff --git a/misc/mntent.h b/misc/mntent.h
index a82e9539af..863664c6bf 100644
--- a/misc/mntent.h
+++ b/misc/mntent.h
@@ -1,5 +1,5 @@
 /* Utilities for reading/writing fstab, mtab, etc.
-   Copyright (C) 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1995-1999, 2003 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
@@ -64,28 +64,28 @@ struct mntent
 
 /* Prepare to begin reading and/or writing mount table entries from the
    beginning of FILE.  MODE is as for `fopen'.  */
-extern FILE *setmntent (__const char *__file, __const char *__mode) __THROW;
+extern FILE *setmntent (__const char *__file, __const char *__mode);
 
 /* Read one mount table entry from STREAM.  Returns a pointer to storage
    reused on the next call, or null for EOF or error (use feof/ferror to
    check).  */
-extern struct mntent *getmntent (FILE *__stream) __THROW;
+extern struct mntent *getmntent (FILE *__stream);
 
 #ifdef __USE_MISC
 /* Reentrant version of the above function.  */
 extern struct mntent *getmntent_r (FILE *__restrict __stream,
 				   struct mntent *__restrict __result,
 				   char *__restrict __buffer,
-				   int __bufsize) __THROW;
+				   int __bufsize);
 #endif
 
 /* Write the mount table entry described by MNT to STREAM.
    Return zero on success, nonzero on failure.  */
 extern int addmntent (FILE *__restrict __stream,
-		      __const struct mntent *__restrict __mnt) __THROW;
+		      __const struct mntent *__restrict __mnt);
 
 /* Close a stream opened with `setmntent'.  */
-extern int endmntent (FILE *__stream) __THROW;
+extern int endmntent (FILE *__stream);
 
 /* Search MNT->mnt_opts for an option matching OPT.
    Returns the address of the substring, or null if none found.  */
diff --git a/posix/Makefile b/posix/Makefile
index c617612e14..59cc1a62d8 100644
--- a/posix/Makefile
+++ b/posix/Makefile
@@ -128,6 +128,8 @@ CFLAGS-wait.c = -fexceptions -fasynchronous-unwind-tables
 CFLAGS-waitid.c = -fexceptions
 CFLAGS-waitpid.c = -fexceptions -fasynchronous-unwind-tables
 CFLAGS-getopt.c = -fexceptions
+CFLAGS-wordexp.c = -fexceptions
+CFLAGS-sysconf.c = -fexceptions
 
 tstgetopt-ARGS = -a -b -cfoobar --required foobar --optional=bazbug \
 		--none random --col --color --colour
diff --git a/posix/unistd.h b/posix/unistd.h
index 4a7be1c7fc..44a22b17af 100644
--- a/posix/unistd.h
+++ b/posix/unistd.h
@@ -525,13 +525,13 @@ extern void _exit (int __status) __attribute__ ((__noreturn__));
 #include <bits/confname.h>
 
 /* Get file-specific configuration information about PATH.  */
-extern long int pathconf (__const char *__path, int __name) __THROW;
+extern long int pathconf (__const char *__path, int __name);
 
 /* Get file-specific configuration about descriptor FD.  */
-extern long int fpathconf (int __fd, int __name) __THROW;
+extern long int fpathconf (int __fd, int __name);
 
 /* Get the value of the system variable NAME.  */
-extern long int sysconf (int __name) __THROW __attribute__ ((__const__));
+extern long int sysconf (int __name) __attribute__ ((__const__));
 
 #ifdef	__USE_POSIX2
 /* Get the value of the string-valued system variable NAME.  */
diff --git a/posix/wordexp.h b/posix/wordexp.h
index 0ce36ec73d..1c40e61684 100644
--- a/posix/wordexp.h
+++ b/posix/wordexp.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 92, 96, 97, 98, 99, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 92, 1996-1999, 2001, 2003 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
@@ -61,7 +61,7 @@ enum
 
 /* Do word expansion of WORDS into PWORDEXP.  */
 extern int wordexp (__const char *__restrict __words,
-		    wordexp_t *__restrict __pwordexp, int __flags) __THROW;
+		    wordexp_t *__restrict __pwordexp, int __flags);
 
 /* Free the storage allocated by a `wordexp' call.  */
 extern void wordfree (wordexp_t *__wordexp) __THROW;
diff --git a/stdlib/Makefile b/stdlib/Makefile
index 7b4df2ea6f..21490703f7 100644
--- a/stdlib/Makefile
+++ b/stdlib/Makefile
@@ -84,6 +84,7 @@ CFLAGS-msort.c = $(exceptions)
 CFLAGS-qsort.c = $(exceptions)
 CFLAGS-system.c = -fexceptions
 CFLAGS-mkstemp.c = -fexceptions
+CFLAGS-fmtmsg.c = -fexceptions
 
 include ../Makeconfig
 
diff --git a/stdlib/fmtmsg.c b/stdlib/fmtmsg.c
index 37c641c7ef..2ab97b7d90 100644
--- a/stdlib/fmtmsg.c
+++ b/stdlib/fmtmsg.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1997,1999,2000,2001,2002,2003 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -108,7 +108,7 @@ fmtmsg (long int classification, const char *label, int severity,
   int result = MM_OK;
   struct severity_info *severity_rec;
 
-  /* make sure everything is initialized.  */
+  /* Make sure everything is initialized.  */
   __libc_once (once, init);
 
   /* Start the real work.  First check whether the input is ok.  */
@@ -137,6 +137,14 @@ fmtmsg (long int classification, const char *label, int severity,
     return MM_NOTOK;
 
 
+#ifdef __libc_ptf_call
+  /* We do not want this call to be cut short by a thread
+     cancellation.  Therefore disable cancellation for now.  */
+  int state = PTHREAD_CANCEL_ENABLE;
+  __libc_ptf_call (pthread_setcancelstate, (PTHREAD_CANCEL_DISABLE, &state),
+		   0);
+#endif
+
   /* Now we can print.  */
   if (classification & MM_PRINT)
     {
@@ -206,6 +214,10 @@ fmtmsg (long int classification, const char *label, int severity,
 	      do_tag ? tag : "");
     }
 
+#ifdef __libc_ptf_call
+  __libc_ptf_call (pthread_setcancelstate, (state, NULL), 0);
+#endif
+
   return result;
 }
 
diff --git a/stdlib/fmtmsg.h b/stdlib/fmtmsg.h
index cd9bdeaffd..53e3e53d89 100644
--- a/stdlib/fmtmsg.h
+++ b/stdlib/fmtmsg.h
@@ -1,5 +1,5 @@
 /* Message display handling.
-   Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1999, 2000, 2003 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
@@ -94,7 +94,7 @@ enum
    and TAG to console or standard error.  */
 extern int fmtmsg (long int __classification, __const char *__label,
 		   int __severity, __const char *__text,
-		   __const char *__action, __const char *__tag) __THROW;
+		   __const char *__action, __const char *__tag);
 
 #ifdef __USE_SVID
 /* Add or remove severity level.  */
diff --git a/stdlib/stdlib.h b/stdlib/stdlib.h
index a6f1e5e8a0..1349753b78 100644
--- a/stdlib/stdlib.h
+++ b/stdlib/stdlib.h
@@ -879,7 +879,7 @@ extern void setkey (__const char *__key) __THROW;
 
 #ifdef __USE_XOPEN2K
 /* Return a master pseudo-terminal handle.  */
-extern int posix_openpt (int __oflag) __THROW;
+extern int posix_openpt (int __oflag);
 #endif
 
 #ifdef __USE_XOPEN
@@ -906,7 +906,7 @@ extern char *ptsname (int __fd) __THROW;
 extern int ptsname_r (int __fd, char *__buf, size_t __buflen) __THROW;
 
 /* Open a master pseudo terminal and return its file descriptor.  */
-extern int getpt (void) __THROW;
+extern int getpt (void);
 #endif
 
 #ifdef __USE_BSD
diff --git a/sysdeps/generic/tmpfile.c b/sysdeps/generic/tmpfile.c
index 847a7446b3..41f12bc8ba 100644
--- a/sysdeps/generic/tmpfile.c
+++ b/sysdeps/generic/tmpfile.c
@@ -1,5 +1,5 @@
 /* Open a stdio stream on an anonymous temporary file.  Generic/POSIX version.
-   Copyright (C) 1991,93,96,97,98,99,2000,2002 Free Software Foundation, Inc.
+   Copyright (C) 1991,93,1996-2000,2002,2003 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
@@ -51,7 +51,7 @@ tmpfile (void)
 
   /* Note that this relies on the Unix semantics that
      a file is not really removed until it is closed.  */
-  (void) remove (buf);
+  (void) __unlink (buf);
 
   if ((f = __fdopen (fd, "w+b")) == NULL)
     __close (fd);
diff --git a/sysdeps/generic/wordexp.c b/sysdeps/generic/wordexp.c
index bb870c967d..ae9fabb9b1 100644
--- a/sysdeps/generic/wordexp.c
+++ b/sysdeps/generic/wordexp.c
@@ -18,6 +18,7 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
+#include <alloca.h>
 #include <ctype.h>
 #include <errno.h>
 #include <fcntl.h>
@@ -42,6 +43,7 @@
 #endif
 #include <wordexp.h>
 
+#include <bits/libc-lock.h>
 #include <stdio-common/_itoa.h>
 
 /* Undefine the following line for the production version.  */
@@ -327,10 +329,7 @@ parse_tilde (char **word, size_t *word_length, size_t *max_length,
 
 	  while ((result = __getpwuid_r (uid, &pwd, buffer, buflen, &tpwd)) != 0
 		 && errno == ERANGE)
-	    {
-	      buflen += 1000;
-	      buffer = __alloca (buflen);
-	    }
+	    extend_alloca (buffer, buflen, buflen + 1000);
 
 	  if (result == 0 && tpwd != NULL && pwd.pw_dir != NULL)
 	    {
@@ -357,10 +356,7 @@ parse_tilde (char **word, size_t *word_length, size_t *max_length,
 
       while ((result = __getpwnam_r (user, &pwd, buffer, buflen, &tpwd)) != 0
 	     && errno == ERANGE)
-	{
-	  buflen += 1000;
-	  buffer = __alloca (buflen);
-	}
+	extend_alloca (buffer, buflen, buflen + 1000);
 
       if (result == 0 && tpwd != NULL && pwd.pw_dir)
 	*word = w_addstr (*word, word_length, max_length, pwd.pw_dir);
@@ -840,7 +836,7 @@ exec_comm_child (char *comm, int *fildes, int showerr, int noexec)
     args[1] = "-nc";
 
   /* Redirect output.  */
-  __dup2 (fildes[1], 1);
+  __dup2 (fildes[1], STDOUT_FILENO);
   __close (fildes[1]);
 
   /* Redirect stderr to /dev/null if we have to.  */
@@ -852,12 +848,12 @@ exec_comm_child (char *comm, int *fildes, int showerr, int noexec)
       fd = __open (_PATH_DEVNULL, O_WRONLY);
       if (fd >= 0 && fd != 2)
 	{
-	  __dup2 (fd, 2);
+	  __dup2 (fd, STDERR_FILENO);
 	  __close (fd);
 	}
       /* Be paranoid.  Check that we actually opened the /dev/null
          device.  */
-      if (__builtin_expect (__fxstat64 (_STAT_VER, 2, &st), 0) != 0
+      if (__builtin_expect (__fxstat64 (_STAT_VER, STDERR_FILENO, &st), 0) != 0
 	  || __builtin_expect (S_ISCHR (st.st_mode), 1) == 0
 #if defined DEV_NULL_MAJOR && defined DEV_NULL_MINOR
 	  || st.st_rdev != makedev (DEV_NULL_MAJOR, DEV_NULL_MINOR)
@@ -913,7 +909,7 @@ exec_comm (char *comm, char **word, size_t *word_length, size_t *max_length,
     }
 
   if (pid == 0)
-    exec_comm_child(comm, fildes, (flags & WRDE_SHOWERR), 0);
+    exec_comm_child (comm, fildes, flags & WRDE_SHOWERR, 0);
 
   /* Parent */
 
@@ -1086,7 +1082,7 @@ exec_comm (char *comm, char **word, size_t *word_length, size_t *max_length,
       if (pid == 0)
 	{
           fildes[0] = fildes[1] = -1;
-	  exec_comm_child(comm, fildes, 0, 1);
+	  exec_comm_child (comm, fildes, 0, 1);
 	}
 
       if (__waitpid (pid, &status, 0) == pid && status != 0)
@@ -1142,8 +1138,25 @@ parse_comm (char **word, size_t *word_length, size_t *max_length,
 	      /* Go -- give script to the shell */
 	      if (comm)
 		{
+#ifdef __libc_ptf_call
+		  /* We do not want the exec_comm call to be cut short
+		     by a thread cancellation since cleanup is very
+		     ugly.  Therefore disable cancellation for
+		     now.  */
+		  // XXX Ideally we do want the thread being cancelable.
+		  // XXX If demand is there we'll change it.
+		  int state = PTHREAD_CANCEL_ENABLE;
+		  __libc_ptf_call (pthread_setcancelstate,
+				   (PTHREAD_CANCEL_DISABLE, &state), 0);
+#endif
+
 		  error = exec_comm (comm, word, word_length, max_length,
 				     flags, pwordexp, ifs, ifs_white);
+
+#ifdef __libc_ptf_call
+		  __libc_ptf_call (pthread_setcancelstate, (state, NULL), 0);
+#endif
+
 		  free (comm);
 		}
 
diff --git a/sysdeps/unix/sysv/linux/getloadavg.c b/sysdeps/unix/sysv/linux/getloadavg.c
index e1a372cd5f..6ef17fe0d0 100644
--- a/sysdeps/unix/sysv/linux/getloadavg.c
+++ b/sysdeps/unix/sysv/linux/getloadavg.c
@@ -1,5 +1,5 @@
 /* Get system load averages.  Linux (/proc/loadavg) version.
-   Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2000, 2001, 2003 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
@@ -22,6 +22,7 @@
 #include <locale.h>
 #include <stdlib.h>
 #include <unistd.h>
+#include <not-cancel.h>
 
 /* Put the 1 minute, 5 minute and 15 minute load averages
    into the first NELEM elements of LOADAVG.
@@ -33,7 +34,7 @@ getloadavg (double loadavg[], int nelem)
 {
   int fd;
 
-  fd = __open ("/proc/loadavg", O_RDONLY);
+  fd = open_not_cancel_2 ("/proc/loadavg", O_RDONLY);
   if (fd < 0)
     return -1;
   else
@@ -42,8 +43,8 @@ getloadavg (double loadavg[], int nelem)
       ssize_t nread;
       int i;
 
-      nread = __read (fd, buf, sizeof buf - 1);
-      __close (fd);
+      nread = read_not_cancel (fd, buf, sizeof buf - 1);
+      close_not_cancel_no_status (fd);
       if (nread < 0)
 	return -1;
       buf[nread - 1] = '\0';