diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2010-01-06 15:27:05 +0800 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2010-01-06 09:31:34 +0100 |
commit | 8212c8228f6e04817e087a151c5659c7876dec2a (patch) | |
tree | 14cf4a60b35b57101b784155c2e5ac4d7f5df4ff /recipes/glibc/glibc-2.9/0001-malloc-memusage.c-update_data-Fix-handling-of-wrappi.patch | |
parent | 3eae83257fdf3ddd15bcc4385fcd0edf543c17c7 (diff) |
glibc_2.9.bb: Apply recent commits to memusage.c as patches
memusage.c will end up as libmemusage.so and the version in glibc 2.9
has the problem to deal badly with wrap arounds. Apply some upstream
fixes to make the situation a bit better.
Diffstat (limited to 'recipes/glibc/glibc-2.9/0001-malloc-memusage.c-update_data-Fix-handling-of-wrappi.patch')
-rw-r--r-- | recipes/glibc/glibc-2.9/0001-malloc-memusage.c-update_data-Fix-handling-of-wrappi.patch | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/recipes/glibc/glibc-2.9/0001-malloc-memusage.c-update_data-Fix-handling-of-wrappi.patch b/recipes/glibc/glibc-2.9/0001-malloc-memusage.c-update_data-Fix-handling-of-wrappi.patch new file mode 100644 index 0000000000..9a43212f76 --- /dev/null +++ b/recipes/glibc/glibc-2.9/0001-malloc-memusage.c-update_data-Fix-handling-of-wrappi.patch @@ -0,0 +1,46 @@ +From c3ab42a82de7506c17749e78a171ce07ced95dd5 Mon Sep 17 00:00:00 2001 +From: Ulrich Drepper <drepper@redhat.com> +Date: Fri, 6 Feb 2009 18:24:23 +0000 +Subject: [PATCH 1/3] * malloc/memusage.c (update_data): Fix handling of wrapping back + + to the beginning of the buffer. +--- + malloc/memusage.c | 8 +++++--- + 1 files changed, 5 insertions(+), 3 deletions(-) + +diff --git a/malloc/memusage.c b/malloc/memusage.c +index d11e9e6..6c67a8c 100644 +--- a/malloc/memusage.c ++++ b/malloc/memusage.c +@@ -1,5 +1,5 @@ + /* Profile heap and stack memory usage of running program. +- Copyright (C) 1998-2002, 2004, 2005, 2006 Free Software Foundation, Inc. ++ Copyright (C) 1998-2002, 2004-2006, 2009 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998. + +@@ -18,6 +18,7 @@ + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + ++#include <assert.h> + #include <atomic.h> + #include <dlfcn.h> + #include <errno.h> +@@ -168,10 +169,11 @@ update_data (struct header *result, size_t len, size_t old_len) + this fails because of another thread increasing the + counter it does not matter since that thread will take + care of the correction. */ +- unsigned int reset = idx - 2 * buffer_size; +- catomic_compare_and_exchange_val_acq (&buffer_size, reset, idx); ++ uatomic32_t reset = idx % (2 * buffer_size); ++ catomic_compare_and_exchange_val_acq (&buffer_cnt, reset, idx); + idx = reset; + } ++ assert (idx < 2 * DEFAULT_BUFFER_SIZE); + + buffer[idx].heap = current_heap; + buffer[idx].stack = current_stack; +-- +1.6.3.3 + |