summaryrefslogtreecommitdiff
path: root/libc
diff options
context:
space:
mode:
authorjoseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2009-05-16 22:38:22 +0000
committerjoseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2009-05-16 22:38:22 +0000
commit8394b52f4259c85b39e1114e6f239599f50fbcc2 (patch)
tree502ea02891b8fad16d4bdfe18d8fd803acfc33c6 /libc
parent5b818e69bce954be61aeebb12d111006ce13c0eb (diff)
Merge changes between r8459 and r8463 from /fsf/trunk.
git-svn-id: svn://svn.eglibc.org/trunk@8464 7b3dc134-2b1b-0410-93df-9e9f96275f8d
Diffstat (limited to 'libc')
-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
14 files changed, 104 insertions, 253 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