summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libc/ChangeLog14
-rw-r--r--libc/nptl/ChangeLog15
-rw-r--r--libc/nptl/Makefile12
-rw-r--r--libc/nptl/cancellation.c3
-rw-r--r--libc/nptl/libc-cancellation.c110
-rw-r--r--libc/nptl/libc-cleanup.c28
-rw-r--r--libc/nptl/nptl-init.c (renamed from libc/nptl/init.c)13
-rw-r--r--libc/nptl/sysdeps/pthread/librt-cancellation.c91
-rw-r--r--libc/nscd/nscd-client.h5
-rw-r--r--libc/nscd/nscd.h5
-rw-r--r--libc/nscd/nscd_helper.c2
-rw-r--r--libc/posix/sys/wait.h26
-rw-r--r--libc/stdlib/stdlib.h32
-rw-r--r--libc/sunrpc/.gitignore1
-rw-r--r--ports/ChangeLog.arm11
-rw-r--r--ports/ChangeLog.m68k5
-rw-r--r--ports/ChangeLog.mips14
-rw-r--r--ports/sysdeps/arm/____longjmp_chk.S55
-rw-r--r--ports/sysdeps/arm/__longjmp.S6
-rw-r--r--ports/sysdeps/arm/eabi/__longjmp.S6
-rw-r--r--ports/sysdeps/mips/____longjmp_chk.c22
-rw-r--r--ports/sysdeps/mips/__longjmp.c9
-rw-r--r--ports/sysdeps/mips/mips64/__longjmp.c9
-rw-r--r--ports/sysdeps/unix/sysv/linux/arm/kernel-features.h2
-rw-r--r--ports/sysdeps/unix/sysv/linux/m68k/Versions3
-rw-r--r--ports/sysdeps/unix/sysv/linux/mips/mips64/n32/fallocate.c34
-rw-r--r--ports/sysdeps/unix/sysv/linux/mips/mips64/n32/fallocate64.c34
-rw-r--r--ports/sysdeps/unix/sysv/linux/mips/mips64/n64/fallocate.c1
-rw-r--r--ports/sysdeps/unix/sysv/linux/mips/mips64/n64/fallocate64.c1
29 files changed, 306 insertions, 263 deletions
diff --git a/libc/ChangeLog b/libc/ChangeLog
index bf3dd4936..04c04bab3 100644
--- a/libc/ChangeLog
+++ b/libc/ChangeLog
@@ -1,8 +1,16 @@
+2009-05-16 Ulrich Drepper <drepper@redhat.com>
+
+ * posix/sys/wait.h: Fix typos. Pretty printing.
+ * stdlib/stdlib.h: Likewise. Correct comments.
+
+ [BZ #10159]
+ * stdlib/stdlib.h (__WAIT_INT): Match the definition in <sys/wait.h>.
+
+ * nscd/nscd_helper.c (__nscd_cache_search): Fix exit condition in last
+ patch.
+
2009-05-15 Ulrich Drepper <drepper@redhat.com>
- * nscd/nscd.h: Move Definition for BLOCK_ALIGN_LOG, BLOCK_ALIGN, and
- BLOCK_ALIGN_M1 to ...
- * nscd/nscd-client.h: ...here.
* nscd/nscd_helper.c (__nscd_cache_search): Introduce loop counter.
Use it if we absolutely cannot reach any more correct list elements
because that many do not fit into the currently mapped database.
diff --git a/libc/nptl/ChangeLog b/libc/nptl/ChangeLog
index f3bd32f57..d83b46125 100644
--- a/libc/nptl/ChangeLog
+++ b/libc/nptl/ChangeLog
@@ -1,3 +1,18 @@
+2009-05-16 Ulrich Drepper <drepper@redhat.com>
+
+ * libc-cancellation.c: Move __libc_cleanup_routine to...
+ * libc-cleanup.c: ...here. New file.
+ * Makefile (routines): Add libc-cleanup.
+
+ * cancellation.c (__pthread_disable_asynccancel): Remove unnecessary
+ test.
+ * libc-cancellation.c: Use <nptl/cancellation.c: to define the code.
+ * sysdeps/pthread/librt-cancellation.c: Likewise.
+
+ [BZ #9924]
+ * nptl-init.c: Renamed from init.c.
+ * Makefile: Change all occurences of init.c to nptl-init.c.
+
2009-05-15 Ulrich Drepper <drepper@redhat.com>
* cancellation.c (__pthread_disable_asynccancel): Correct the bits
diff --git a/libc/nptl/Makefile b/libc/nptl/Makefile
index 9d7686669..0f6f12979 100644
--- a/libc/nptl/Makefile
+++ b/libc/nptl/Makefile
@@ -1,5 +1,4 @@
-# Copyright (C) 2002,2003,2004,2005,2006,2007,2008
-# Free Software Foundation, Inc.
+# Copyright (C) 2002-2008,2009 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
@@ -30,10 +29,11 @@ extra-libs := libpthread
extra-libs-others := $(extra-libs)
install-lib-ldscripts := libpthread.so
-routines = alloca_cutoff forward libc-lowlevellock libc-cancellation
+routines = alloca_cutoff forward libc-lowlevellock libc-cancellation \
+ libc-cleanup
shared-only-routines = forward
-libpthread-routines = init vars events version \
+libpthread-routines = nptl-init vars events version \
pthread_create pthread_exit pthread_detach \
pthread_join pthread_tryjoin pthread_timedjoin \
pthread_self pthread_equal pthread_yield \
@@ -143,8 +143,8 @@ CFLAGS-pthread_atfork.c = -DNOT_IN_libc
# we have to compile some files with exception handling enabled, some
# even with asynchronous unwind tables.
-# init.c contains sigcancel_handler().
-CFLAGS-init.c = -fexceptions -fasynchronous-unwind-tables
+# nptl-init.c contains sigcancel_handler().
+CFLAGS-nptl-init.c = -fexceptions -fasynchronous-unwind-tables
# The unwind code itself,
CFLAGS-unwind.c = -fexceptions
CFLAGS-unwind-forcedunwind.c = -fexceptions -fasynchronous-unwind-tables
diff --git a/libc/nptl/cancellation.c b/libc/nptl/cancellation.c
index 2a6f83d28..eac7973db 100644
--- a/libc/nptl/cancellation.c
+++ b/libc/nptl/cancellation.c
@@ -78,9 +78,6 @@ __pthread_disable_asynccancel (int oldtype)
{
newval = oldval & ~CANCELTYPE_BITMASK;
- if (newval == oldval)
- break;
-
int curval = THREAD_ATOMIC_CMPXCHG_VAL (self, cancelhandling, newval,
oldval);
if (__builtin_expect (curval == oldval, 1))
diff --git a/libc/nptl/libc-cancellation.c b/libc/nptl/libc-cancellation.c
index cada464d2..308be382d 100644
--- a/libc/nptl/libc-cancellation.c
+++ b/libc/nptl/libc-cancellation.c
@@ -17,113 +17,9 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-#include <setjmp.h>
-#include <stdlib.h>
#include "pthreadP.h"
-#include <atomic.h>
-#include <bits/libc-lock.h>
-#ifndef NOT_IN_libc
-
-/* The next two functions are similar to pthread_setcanceltype() but
- more specialized for the use in the cancelable functions like write().
- They do not need to check parameters etc. */
-int
-attribute_hidden
-__libc_enable_asynccancel (void)
-{
- struct pthread *self = THREAD_SELF;
- int oldval = THREAD_GETMEM (self, cancelhandling);
-
- while (1)
- {
- int newval = oldval | CANCELTYPE_BITMASK;
-
- if (__builtin_expect ((oldval & CANCELED_BITMASK) != 0, 0))
- {
- /* If we are already exiting or if PTHREAD_CANCEL_DISABLED,
- stop right here. */
- if ((oldval & (EXITING_BITMASK | CANCELSTATE_BITMASK)) != 0)
- break;
-
- int curval = THREAD_ATOMIC_CMPXCHG_VAL (self, cancelhandling,
- newval, oldval);
- if (__builtin_expect (curval != oldval, 0))
- {
- /* Somebody else modified the word, try again. */
- oldval = curval;
- continue;
- }
-
- THREAD_SETMEM (self, result, PTHREAD_CANCELED);
-
- __do_cancel ();
-
- /* NOTREACHED */
- }
-
- int curval = THREAD_ATOMIC_CMPXCHG_VAL (self, cancelhandling, newval,
- oldval);
- if (__builtin_expect (curval == oldval, 1))
- break;
-
- /* Prepare the next round. */
- oldval = curval;
- }
-
- return oldval;
-}
-
-
-void
-internal_function attribute_hidden
-__libc_disable_asynccancel (int oldtype)
-{
- /* If asynchronous cancellation was enabled before we do not have
- anything to do. */
- if (oldtype & CANCELTYPE_BITMASK)
- return;
-
- struct pthread *self = THREAD_SELF;
- int newval;
-
- int oldval = THREAD_GETMEM (self, cancelhandling);
-
- while (1)
- {
- newval = oldval & ~CANCELTYPE_BITMASK;
-
- if (newval == oldval)
- break;
-
- int curval = THREAD_ATOMIC_CMPXCHG_VAL (self, cancelhandling, newval,
- oldval);
- if (__builtin_expect (curval == oldval, 1))
- break;
-
- /* Prepare the next round. */
- oldval = curval;
- }
-
- /* We cannot return when we are being canceled. Upon return the
- thread might be things which would have to be undone. The
- following loop should loop until the cancellation signal is
- delivered. */
- while (__builtin_expect ((newval & (CANCELING_BITMASK | CANCELED_BITMASK))
- == CANCELING_BITMASK, 0))
- {
- lll_futex_wait (&self->cancelhandling, newval, LLL_PRIVATE);
- newval = THREAD_GETMEM (self, cancelhandling);
- }
-}
-
-
-void
-__libc_cleanup_routine (struct __pthread_cleanup_frame *f)
-{
- if (f->__do_it)
- f->__cancel_routine (f->__cancel_arg);
-}
-
-#endif
+#define __pthread_enable_asynccancel __libc_enable_asynccancel
+#define __pthread_disable_asynccancel __libc_disable_asynccancel
+#include <nptl/cancellation.c>
diff --git a/libc/nptl/libc-cleanup.c b/libc/nptl/libc-cleanup.c
new file mode 100644
index 000000000..0256d0956
--- /dev/null
+++ b/libc/nptl/libc-cleanup.c
@@ -0,0 +1,28 @@
+/* Copyright (C) 2002, 2003, 2005, 2009 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include "pthreadP.h"
+
+
+void
+__libc_cleanup_routine (struct __pthread_cleanup_frame *f)
+{
+ if (f->__do_it)
+ f->__cancel_routine (f->__cancel_arg);
+}
diff --git a/libc/nptl/init.c b/libc/nptl/nptl-init.c
index 0449ec077..5e9c250ff 100644
--- a/libc/nptl/init.c
+++ b/libc/nptl/nptl-init.c
@@ -245,21 +245,12 @@ sighandler_setxid (int sig, siginfo_t *si, void *ctx)
/* Reset the SETXID flag. */
struct pthread *self = THREAD_SELF;
- int flags, newval;
- do
- {
- flags = THREAD_GETMEM (self, cancelhandling);
- newval = THREAD_ATOMIC_CMPXCHG_VAL (self, cancelhandling,
- flags & ~SETXID_BITMASK, flags);
- }
- while (flags != newval);
+ int flags = THREAD_GETMEM (self, cancelhandling);
+ THREAD_SETMEM (self, cancelhandling, flags & ~SETXID_BITMASK);
/* And release the futex. */
self->setxid_futex = 1;
lll_futex_wake (&self->setxid_futex, 1, LLL_PRIVATE);
-
- if (atomic_decrement_val (&__xidcmd->cntr) == 0)
- lll_futex_wake (&__xidcmd->cntr, 1, LLL_PRIVATE);
}
diff --git a/libc/nptl/sysdeps/pthread/librt-cancellation.c b/libc/nptl/sysdeps/pthread/librt-cancellation.c
index 753a2d831..d9f7ad9ea 100644
--- a/libc/nptl/sysdeps/pthread/librt-cancellation.c
+++ b/libc/nptl/sysdeps/pthread/librt-cancellation.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -17,92 +17,9 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-#include <setjmp.h>
-#include <signal.h>
-#include <stdlib.h>
#include "pthreadP.h"
-#include "atomic.h"
-#ifdef IS_IN_librt
-/* The next two functions are similar to pthread_setcanceltype() but
- more specialized for the use in the cancelable functions like write().
- They do not need to check parameters etc. */
-int
-attribute_hidden
-__librt_enable_asynccancel (void)
-{
- struct pthread *self = THREAD_SELF;
- int oldval = THREAD_GETMEM (self, cancelhandling);
-
- while (1)
- {
- int newval = oldval | CANCELTYPE_BITMASK;
-
- if (__builtin_expect ((oldval & CANCELED_BITMASK) != 0, 0))
- {
- /* If we are already exiting or if PTHREAD_CANCEL_DISABLED,
- stop right here. */
- if ((oldval & (EXITING_BITMASK | CANCELSTATE_BITMASK)) != 0)
- break;
-
- int curval = THREAD_ATOMIC_CMPXCHG_VAL (self, cancelhandling,
- newval, oldval);
- if (__builtin_expect (curval != oldval, 0))
- {
- /* Somebody else modified the word, try again. */
- oldval = curval;
- continue;
- }
-
- THREAD_SETMEM (self, result, PTHREAD_CANCELED);
-
- __do_cancel ();
-
- /* NOTREACHED */
- }
-
- int curval = THREAD_ATOMIC_CMPXCHG_VAL (self, cancelhandling, newval,
- oldval);
- if (__builtin_expect (curval == oldval, 1))
- break;
-
- /* Prepare the next round. */
- oldval = curval;
- }
-
- return oldval;
-}
-
-
-void
-internal_function attribute_hidden
-__librt_disable_asynccancel (int oldtype)
-{
- /* If asynchronous cancellation was enabled before we do not have
- anything to do. */
- if (oldtype & CANCELTYPE_BITMASK)
- return;
-
- struct pthread *self = THREAD_SELF;
- int oldval = THREAD_GETMEM (self, cancelhandling);
-
- while (1)
- {
- int newval = oldval & ~CANCELTYPE_BITMASK;
-
- if (newval == oldval)
- break;
-
- int curval = THREAD_ATOMIC_CMPXCHG_VAL (self, cancelhandling, newval,
- oldval);
- if (__builtin_expect (curval == oldval, 1))
- break;
-
- /* Prepare the next round. */
- oldval = curval;
- }
-}
-
-
-#endif
+#define __pthread_enable_asynccancel __librt_enable_asynccancel
+#define __pthread_disable_asynccancel __librt_disable_asynccancel
+#include <nptl/cancellation.c>
diff --git a/libc/nscd/nscd-client.h b/libc/nscd/nscd-client.h
index 81ca3d56b..c6c09cbdd 100644
--- a/libc/nscd/nscd-client.h
+++ b/libc/nscd/nscd-client.h
@@ -47,11 +47,6 @@
/* Maximum allowed length for the key. */
#define MAXKEYLEN 1024
-/* Maximum alignment requirement we will encounter. */
-#define BLOCK_ALIGN_LOG 3
-#define BLOCK_ALIGN (1 << BLOCK_ALIGN_LOG)
-#define BLOCK_ALIGN_M1 (BLOCK_ALIGN - 1)
-
/* Available services. */
typedef enum
diff --git a/libc/nscd/nscd.h b/libc/nscd/nscd.h
index 632bf58dc..3279b8543 100644
--- a/libc/nscd/nscd.h
+++ b/libc/nscd/nscd.h
@@ -111,6 +111,11 @@ struct database_dyn
/* Path used when not using persistent storage. */
#define _PATH_NSCD_XYZ_DB_TMP "/var/run/nscd/dbXXXXXX"
+/* Maximum alignment requirement we will encounter. */
+#define BLOCK_ALIGN_LOG 3
+#define BLOCK_ALIGN (1 << BLOCK_ALIGN_LOG)
+#define BLOCK_ALIGN_M1 (BLOCK_ALIGN - 1)
+
/* Default value for the maximum size of the database files. */
#define DEFAULT_MAX_DB_SIZE (32 * 1024 * 1024)
diff --git a/libc/nscd/nscd_helper.c b/libc/nscd/nscd_helper.c
index 80ee3e1dd..c09f00859 100644
--- a/libc/nscd/nscd_helper.c
+++ b/libc/nscd/nscd_helper.c
@@ -528,7 +528,7 @@ __nscd_cache_search (request_type type, const char *key, size_t keylen,
work = atomic_forced_read (here->next);
/* Prevent endless loops. This should never happen but perhaps
the database got corrupted, accidentally or deliberately. */
- if (work == trail || loop_cnt-- > 0)
+ if (work == trail || loop_cnt-- == 0)
break;
if (tick)
{
diff --git a/libc/posix/sys/wait.h b/libc/posix/sys/wait.h
index fe103570d..d9248426d 100644
--- a/libc/posix/sys/wait.h
+++ b/libc/posix/sys/wait.h
@@ -1,5 +1,5 @@
-/* Copyright (C) 1991-1994,1996-2001,2003,2004,2005,2007
- Free Software Foundation, Inc.
+/* Copyright (C) 1991-1994,1996-2001,2003,2004,2005,2007,2009
+ 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 @@ __BEGIN_DECLS
# endif
/* This is the type of the argument to `wait'. The funky union
- causes redeclarations with ether `int *' or `union wait *' to be
+ causes redeclarations with either `int *' or `union wait *' to be
allowed without complaint. __WAIT_STATUS_DEFN is the type used in
the actual function definitions. */
@@ -79,22 +79,22 @@ typedef union
/* This will define all the `__W*' macros. */
# include <bits/waitstatus.h>
-# define WEXITSTATUS(status) __WEXITSTATUS(__WAIT_INT(status))
-# define WTERMSIG(status) __WTERMSIG(__WAIT_INT(status))
-# define WSTOPSIG(status) __WSTOPSIG(__WAIT_INT(status))
-# define WIFEXITED(status) __WIFEXITED(__WAIT_INT(status))
-# define WIFSIGNALED(status) __WIFSIGNALED(__WAIT_INT(status))
-# define WIFSTOPPED(status) __WIFSTOPPED(__WAIT_INT(status))
+# define WEXITSTATUS(status) __WEXITSTATUS (__WAIT_INT (status))
+# define WTERMSIG(status) __WTERMSIG (__WAIT_INT (status))
+# define WSTOPSIG(status) __WSTOPSIG (__WAIT_INT (status))
+# define WIFEXITED(status) __WIFEXITED (__WAIT_INT (status))
+# define WIFSIGNALED(status) __WIFSIGNALED (__WAIT_INT (status))
+# define WIFSTOPPED(status) __WIFSTOPPED (__WAIT_INT (status))
# ifdef __WIFCONTINUED
-# define WIFCONTINUED(status) __WIFCONTINUED(__WAIT_INT(status))
+# define WIFCONTINUED(status) __WIFCONTINUED (__WAIT_INT (status))
# endif
#endif /* <stdlib.h> not included. */
#ifdef __USE_BSD
# define WCOREFLAG __WCOREFLAG
-# define WCOREDUMP(status) __WCOREDUMP(__WAIT_INT(status))
-# define W_EXITCODE(ret, sig) __W_EXITCODE(ret, sig)
-# define W_STOPCODE(sig) __W_STOPCODE(sig)
+# define WCOREDUMP(status) __WCOREDUMP (__WAIT_INT (status))
+# define W_EXITCODE(ret, sig) __W_EXITCODE (ret, sig)
+# define W_STOPCODE(sig) __W_STOPCODE (sig)
#endif
/* The following values are used by the `waitid' function. */
diff --git a/libc/stdlib/stdlib.h b/libc/stdlib/stdlib.h
index 77bb86045..1b88ce6a5 100644
--- a/libc/stdlib/stdlib.h
+++ b/libc/stdlib/stdlib.h
@@ -48,15 +48,15 @@ __BEGIN_DECLS
as well as POSIX.1 use of `int' for the status word. */
# if defined __GNUC__ && !defined __cplusplus
-# define __WAIT_INT(status) \
- (__extension__ ({ union { __typeof(status) __in; int __i; } __u; \
- __u.__in = (status); __u.__i; }))
+# define __WAIT_INT(status) \
+ (__extension__ (((union { __typeof(status) __in; int __i; }) \
+ { .__in = (status) }).__i))
# else
# define __WAIT_INT(status) (*(int *) &(status))
# endif
/* This is the type of the argument to `wait'. The funky union
- causes redeclarations with ether `int *' or `union wait *' to be
+ causes redeclarations with either `int *' or `union wait *' to be
allowed without complaint. __WAIT_STATUS_DEFN is the type used in
the actual function definitions. */
@@ -82,14 +82,14 @@ typedef union
# endif /* Use BSD. */
/* Define the macros <sys/wait.h> also would define this way. */
-# define WEXITSTATUS(status) __WEXITSTATUS(__WAIT_INT(status))
-# define WTERMSIG(status) __WTERMSIG(__WAIT_INT(status))
-# define WSTOPSIG(status) __WSTOPSIG(__WAIT_INT(status))
-# define WIFEXITED(status) __WIFEXITED(__WAIT_INT(status))
-# define WIFSIGNALED(status) __WIFSIGNALED(__WAIT_INT(status))
-# define WIFSTOPPED(status) __WIFSTOPPED(__WAIT_INT(status))
+# define WEXITSTATUS(status) __WEXITSTATUS (__WAIT_INT (status))
+# define WTERMSIG(status) __WTERMSIG (__WAIT_INT (status))
+# define WSTOPSIG(status) __WSTOPSIG (__WAIT_INT (status))
+# define WIFEXITED(status) __WIFEXITED (__WAIT_INT (status))
+# define WIFSIGNALED(status) __WIFSIGNALED (__WAIT_INT (status))
+# define WIFSTOPPED(status) __WIFSTOPPED (__WAIT_INT (status))
# ifdef __WIFCONTINUED
-# define WIFCONTINUED(status) __WIFCONTINUED(__WAIT_INT(status))
+# define WIFCONTINUED(status) __WIFCONTINUED (__WAIT_INT (status))
# endif
#endif /* X/Open and <sys/wait.h> not included. */
@@ -222,14 +222,14 @@ __END_NAMESPACE_C99
#ifdef __USE_GNU
/* The concept of one static locale per category is not very well
thought out. Many applications will need to process its data using
- information from several different locales. Another application is
+ information from several different locales. Another problem is
the implementation of the internationalization handling in the
- upcoming ISO C++ standard library. To support this another set of
- the functions using locale data exist which have an additional
+ ISO C++ standard library. To support this another set of
+ the functions using locale data exist which take an additional
argument.
- Attention: all these functions are *not* standardized in any form.
- This is a proof-of-concept implementation. */
+ Attention: even though several *_l interfaces are part of POSIX:2008,
+ these are not. */
/* Structure for reentrant locale using functions. This is an
(almost) opaque type for the user level programs. */
diff --git a/libc/sunrpc/.gitignore b/libc/sunrpc/.gitignore
deleted file mode 100644
index fd6ab6bab..000000000
--- a/libc/sunrpc/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-rpcsrc-4.0
diff --git a/ports/ChangeLog.arm b/ports/ChangeLog.arm
index 4b304fb82..1088fc02a 100644
--- a/ports/ChangeLog.arm
+++ b/ports/ChangeLog.arm
@@ -1,5 +1,16 @@
2009-05-16 Joseph Myers <joseph@codesourcery.com>
+ * sysdeps/arm/____longjmp_chk.S: New file.
+ * sysdeps/arm/__longjmp.S: If CHECK_SP is defined, use it.
+ * sysdeps/arm/eabi/__longjmp.S: Likewise.
+
+2009-05-16 Joseph Myers <joseph@codesourcery.com>
+
+ * sysdeps/unix/sysv/linux/arm/kernel-features.h (__ASSUME_PREADV,
+ __ASSUME_PWRITEV): Don't undefine.
+
+2009-05-16 Joseph Myers <joseph@codesourcery.com>
+
* sysdeps/unix/sysv/linux/arm/Versions (libc): Add
fallocate64@@GLIBC_2.11.
diff --git a/ports/ChangeLog.m68k b/ports/ChangeLog.m68k
index c68e94a63..3afc3da05 100644
--- a/ports/ChangeLog.m68k
+++ b/ports/ChangeLog.m68k
@@ -1,3 +1,8 @@
+2009-05-16 Joseph Myers <joseph@codesourcery.com>
+
+ * sysdeps/unix/sysv/linux/m68k/Versions (libc): Add
+ fallocate64@@GLIBC_2.11.
+
2009-04-25 Andreas Schwab <schwab@linux-m68k.org>
* sysdeps/unix/sysv/linux/m68k/kernel-features.h: Revert last
diff --git a/ports/ChangeLog.mips b/ports/ChangeLog.mips
index b951c0bd9..9b0b7bddf 100644
--- a/ports/ChangeLog.mips
+++ b/ports/ChangeLog.mips
@@ -1,5 +1,19 @@
2009-05-16 Joseph Myers <joseph@codesourcery.com>
+ * sysdeps/mips/____longjmp_chk.c: New file.
+ * sysdeps/mips/__longjmp.c: If CHECK_SP is defined, use it. Don't
+ undefine __longjmp.
+ * sysdeps/mips64/__longjmp.c: Likewise.
+
+2009-05-16 Joseph Myers <joseph@codesourcery.com>
+
+ * sysdeps/unix/sysv/linux/mips/mips64/n32/fallocate.c,
+ sysdeps/unix/sysv/linux/mips/mips64/n32/fallocate64.c,
+ sysdeps/unix/sysv/linux/mips/mips64/n64/fallocate.c,
+ sysdeps/unix/sysv/linux/mips/mips64/n64/fallocate64.c: New.
+
+2009-05-16 Joseph Myers <joseph@codesourcery.com>
+
* sysdeps/unix/sysv/linux/mips/Versions (libc): Add
fallocate64@@GLIBC_2.11.
diff --git a/ports/sysdeps/arm/____longjmp_chk.S b/ports/sysdeps/arm/____longjmp_chk.S
new file mode 100644
index 000000000..9b65c368a
--- /dev/null
+++ b/ports/sysdeps/arm/____longjmp_chk.S
@@ -0,0 +1,55 @@
+/* Copyright (C) 2009 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 Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GCC; see the file COPYING. If not, write to the Free
+ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA. */
+
+
+ .section .rodata.str1.1,"aMS",%progbits,1
+ .type longjmp_msg,%object
+longjmp_msg:
+ .string "longjmp causes uninitialized stack frame"
+ .size longjmp_msg, .-longjmp_msg
+ .text
+
+#define __longjmp ____longjmp_chk
+
+#ifdef PIC
+# define CALL_FAIL \
+ ldr sl, .L_GOT; \
+.L_GOT_OFF: \
+ add sl, pc, sl; \
+ ldr r0, .Lstr; \
+ add r0, sl, r0; \
+ B PLTJMP(HIDDEN_JUMPTARGET(__fortify_fail)); \
+.L_GOT: \
+ .word _GLOBAL_OFFSET_TABLE_-(.L_GOT_OFF+8); \
+.Lstr: \
+ .word longjmp_msg(GOTOFF);
+#else
+# define CALL_FAIL \
+ ldr r0, .Lstr; \
+ B HIDDEN_JUMPTARGET(__fortify_fail); \
+.Lstr: \
+ .word longjmp_msg;
+#endif
+
+#define CHECK_SP(reg) \
+ cmp sp, reg; \
+ ble .Lok; \
+ CALL_FAIL \
+.Lok:
+
+#include <__longjmp.S>
diff --git a/ports/sysdeps/arm/__longjmp.S b/ports/sysdeps/arm/__longjmp.S
index 7b3016004..c834e7860 100644
--- a/ports/sysdeps/arm/__longjmp.S
+++ b/ports/sysdeps/arm/__longjmp.S
@@ -1,5 +1,5 @@
/* longjmp for ARM.
- Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1998, 2009 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
@@ -29,5 +29,9 @@ ENTRY (__longjmp)
movs r0, r1 /* get the return value in place */
moveq r0, #1 /* can't let setjmp() return zero! */
+#ifdef CHECK_SP
+ ldr r1, [ip, #32]
+ CHECK_SP (r1)
+#endif
LOADREGS(ia, ip, {v1-v6, sl, fp, sp, pc})
END (__longjmp)
diff --git a/ports/sysdeps/arm/eabi/__longjmp.S b/ports/sysdeps/arm/eabi/__longjmp.S
index fff25cd94..1f3f79156 100644
--- a/ports/sysdeps/arm/eabi/__longjmp.S
+++ b/ports/sysdeps/arm/eabi/__longjmp.S
@@ -1,5 +1,5 @@
/* longjmp for ARM.
- Copyright (C) 1997, 1998, 2005, 2006 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1998, 2005, 2006, 2009 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
@@ -30,6 +30,10 @@ ENTRY (__longjmp)
movs r0, r1 /* get the return value in place */
moveq r0, #1 /* can't let setjmp() return zero! */
+#ifdef CHECK_SP
+ ldr r1, [ip, #32]
+ CHECK_SP (r1)
+#endif
LOADREGS(ia, ip!, {v1-v6, sl, fp, sp, lr})
#ifdef IS_IN_rtld
diff --git a/ports/sysdeps/mips/____longjmp_chk.c b/ports/sysdeps/mips/____longjmp_chk.c
new file mode 100644
index 000000000..a46ed150d
--- /dev/null
+++ b/ports/sysdeps/mips/____longjmp_chk.c
@@ -0,0 +1,22 @@
+/* Copyright (C) 2009 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 Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <stdio.h>
+#define __longjmp ____longjmp_chk
+#define CHECK_SP
+#include <__longjmp.c>
diff --git a/ports/sysdeps/mips/__longjmp.c b/ports/sysdeps/mips/__longjmp.c
index 386c05625..340485de8 100644
--- a/ports/sysdeps/mips/__longjmp.c
+++ b/ports/sysdeps/mips/__longjmp.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992, 1995, 1997, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1992, 1995, 1997, 2000, 2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Brendan Kehoe (brendan@zen.org).
@@ -20,8 +20,6 @@
#include <setjmp.h>
#include <stdlib.h>
-#undef __longjmp
-
#ifndef __GNUC__
#error This file uses GNU C extensions; you must compile with GCC.
#endif
@@ -36,6 +34,11 @@ __longjmp (env, val_arg)
Without this it saves $a1 in a register which gets clobbered
along the way. */
register int val asm ("a1");
+#ifdef CHECK_SP
+ register long sp asm ("$29");
+ if ((long) (env[0].__sp) < sp)
+ __fortify_fail ("longjmp causes uninitialized stack frame");
+#endif
#ifdef __mips_hard_float
/* Pull back the floating point callee-saved registers. */
diff --git a/ports/sysdeps/mips/mips64/__longjmp.c b/ports/sysdeps/mips/mips64/__longjmp.c
index 973b078ae..d7e36ff68 100644
--- a/ports/sysdeps/mips/mips64/__longjmp.c
+++ b/ports/sysdeps/mips/mips64/__longjmp.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992, 1995, 1997, 2000, 2003, 2004
+/* Copyright (C) 1992, 1995, 1997, 2000, 2003, 2004, 2009
Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Brendan Kehoe (brendan@zen.org).
@@ -22,8 +22,6 @@
#include <sgidefs.h>
#include <stdlib.h>
-#undef __longjmp
-
#ifndef __GNUC__
#error This file uses GNU C extensions; you must compile with GCC.
#endif
@@ -38,6 +36,11 @@ __longjmp (env, val_arg)
Without this it saves $a1 in a register which gets clobbered
along the way. */
register int val asm ("a1");
+#ifdef CHECK_SP
+ register long long sp asm ("$29");
+ if ((long long) (env[0].__sp) < sp)
+ __fortify_fail ("longjmp causes uninitialized stack frame");
+#endif
#ifdef __mips_hard_float
/* Pull back the floating point callee-saved registers. */
diff --git a/ports/sysdeps/unix/sysv/linux/arm/kernel-features.h b/ports/sysdeps/unix/sysv/linux/arm/kernel-features.h
index b33c96865..ea439d5a0 100644
--- a/ports/sysdeps/unix/sysv/linux/arm/kernel-features.h
+++ b/ports/sysdeps/unix/sysv/linux/arm/kernel-features.h
@@ -56,5 +56,3 @@
/* These syscalls are not implemented yet for ARM. */
#undef __ASSUME_PSELECT
#undef __ASSUME_PPOLL
-#undef __ASSUME_PREADV
-#undef __ASSUME_PWRITEV
diff --git a/ports/sysdeps/unix/sysv/linux/m68k/Versions b/ports/sysdeps/unix/sysv/linux/m68k/Versions
index 0799bf310..5650f7f77 100644
--- a/ports/sysdeps/unix/sysv/linux/m68k/Versions
+++ b/ports/sysdeps/unix/sysv/linux/m68k/Versions
@@ -29,4 +29,7 @@ libc {
# v*
versionsort64;
}
+ GLIBC_2.11 {
+ fallocate64;
+ }
}
diff --git a/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/fallocate.c b/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/fallocate.c
new file mode 100644
index 000000000..f973250de
--- /dev/null
+++ b/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/fallocate.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 2007, 2009 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 Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <sysdep.h>
+
+
+/* Reserve storage for the data of the file associated with FD. */
+int
+fallocate (int fd, int mode, __off_t offset, __off_t len)
+{
+#ifdef __NR_fallocate
+ return INLINE_SYSCALL (fallocate, 4, fd, mode, offset, len);
+#else
+ __set_errno (ENOSYS);
+ return -1;
+#endif
+}
diff --git a/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/fallocate64.c b/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/fallocate64.c
new file mode 100644
index 000000000..1f37f9121
--- /dev/null
+++ b/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/fallocate64.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 2007, 2009 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 Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <sysdep.h>
+
+
+/* Reserve storage for the data of the file associated with FD. */
+int
+fallocate64 (int fd, int mode, __off64_t offset, __off64_t len)
+{
+#ifdef __NR_fallocate
+ return INLINE_SYSCALL (fallocate, 4, fd, mode, offset, len);
+#else
+ __set_errno (ENOSYS);
+ return -1;
+#endif
+}
diff --git a/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/fallocate.c b/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/fallocate.c
new file mode 100644
index 000000000..d3b72183c
--- /dev/null
+++ b/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/fallocate.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/wordsize-64/fallocate.c>
diff --git a/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/fallocate64.c b/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/fallocate64.c
new file mode 100644
index 000000000..fb2b6813a
--- /dev/null
+++ b/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/fallocate64.c
@@ -0,0 +1 @@
+/* fallocate64 is in fallocate.c */