This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PING][PATCH] Deprecate malloc_(sg)et state.
- From: OndÅej BÃlka <neleai at seznam dot cz>
- To: libc-alpha at sourceware dot org
- Date: Fri, 14 Mar 2014 14:54:58 +0100
- Subject: [PING][PATCH] Deprecate malloc_(sg)et state.
- Authentication-results: sourceware.org; auth=none
- References: <20140304123542 dot GA12375 at domone dot podge>
ping
On Tue, Mar 04, 2014 at 01:35:42PM +0100, OndÅej BÃlka wrote:
> Hi,
>
> I asked at emacs-devel how much are these needed.
>
> It turned out that there is already a configure check to use alternative
> when malloc_set_state is not available. Replacement is bit slower but
> there was agreement that improving malloc has higher priority.
>
> See following thread:
>
> http://lists.gnu.org/archive/html/emacs-devel/2014-02/msg00541.html
>
>
> What needs to be added to following patch? A test for malloc_set_state
> naturaly cannot compile so how link that? Also what write to NEWS?
>
> * malloc/malloc.c: Make malloc_get_state and malloc_set_state
> compatibility symbols.
> * malloc/tst-mallocstate.c: Disable test.
>
> diff --git a/malloc/malloc.c b/malloc/malloc.c
> index 9a45707..36d94e2 100644
> --- a/malloc/malloc.c
> +++ b/malloc/malloc.c
> @@ -5180,6 +5180,13 @@ weak_alias (__malloc_trim, malloc_trim)
> weak_alias (__malloc_get_state, malloc_get_state)
> weak_alias (__malloc_set_state, malloc_set_state)
>
> +#include <shlib-compat.h>
> +#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_20)
> +
> +compat_symbol (libc, malloc_get_state, malloc_get_state, GLIBC_2_0);
> +compat_symbol (libc, malloc_set_state, malloc_set_state, GLIBC_2_0);
> +
> +#endif
>
> /* ------------------------------------------------------------
> History:
> diff --git a/malloc/tst-mallocstate.c b/malloc/tst-mallocstate.c
> index 69c4500..eec2e5a 100644
> --- a/malloc/tst-mallocstate.c
> +++ b/malloc/tst-mallocstate.c
> @@ -32,6 +32,7 @@ merror (const char *msg)
> int
> main (void)
> {
> +/*
> void *p1, *p2;
> void *save_state;
> long i;
> @@ -56,7 +57,9 @@ main (void)
> merror ("malloc_get_state () failed.");
> break;
> }
> + */
> /*free (malloc (10)); This could change the top chunk! */
> + /*
> malloc_set_state (save_state);
> p1 = realloc (p1, i * 4 + 4);
> if (p1 == NULL)
> @@ -72,6 +75,7 @@ main (void)
> free (p1);
>
> return errors != 0;
> +*/
> }
>
> /*
--
TCP/IP UDP alarm threshold is set too low.