From patchwork Mon Mar 24 09:26:58 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?T25kxZllaiBCw61sa2E=?= X-Patchwork-Id: 333042 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 2382C140090 for ; Mon, 24 Mar 2014 23:13:48 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:cc:subject:message-id:references :mime-version:content-type:in-reply-to; q=dns; s=default; b=bRSK D0X7hvkZALUHOXKAOHnVvD3HVX0VjQlHxzruq9XlOB1sOysvj5wiJcRJvwN5RYaa 1Lvqc2zAmnXWlXm+OV1EQmIKgndK+BXVdXz3W9ZYg8MVbzve8COPArSt6C6ioGWn MuQ1RFhgSrdJRNDhSp3Z6Ul67C6cl2qdqgtkkk0= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:cc:subject:message-id:references :mime-version:content-type:in-reply-to; s=default; bh=Df0CiMyhNQ FEMz0YM272wkqWFJc=; b=Bo11Morm2D5Vn0RUdcNzNKWQ5suQhsqsj4nu//Rn0A oeq179Vbqo8PJBD9WLrbNw5KxjBP1Vv8qjkDolvntsBRKVv2UV2cNsir0K93MKev TfqBTe99XOAPpNPglly0yD+Z2c5A2d4zmp+z021hC4X++ynO3s3GDUWbBYknfukf o= Received: (qmail 30227 invoked by alias); 24 Mar 2014 09:27:06 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 30214 invoked by uid 89); 24 Mar 2014 09:27:06 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.6 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, SPF_NEUTRAL autolearn=no version=3.3.2 X-HELO: popelka.ms.mff.cuni.cz Date: Mon, 24 Mar 2014 10:26:58 +0100 From: =?utf-8?B?T25kxZllaiBCw61sa2E=?= To: Roland McGrath Cc: libc-alpha@sourceware.org Subject: [PATCH v1.1] Deprecate malloc_(sg)et state. Message-ID: <20140324092658.GA3973@domone.podge> References: <20140304123542.GA12375@domone.podge> <20140314170541.EF58A74495@topped-with-meat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20140314170541.EF58A74495@topped-with-meat.com> User-Agent: Mutt/1.5.20 (2009-06-14) On Fri, Mar 14, 2014 at 10:05:41AM -0700, Roland McGrath wrote: > If you want to remove a test case, remove it, rather than just commenting > it out. But we need to keep this test case to ensure we don't have ABI > regressions. That will require some new generalized plumbing for how we > build linkobj/libc.so. As I want to move forward with this patch I deleted this testcase and when plumbing will be available I will restore it from git history. Is that ok? * malloc/malloc.c: Make malloc_get_state and malloc_set_state compatibility symbols. * malloc/tst-mallocstate.c: Remove. --- malloc/malloc.c | 7 +++++ malloc/tst-mallocstate.c | 81 ------------------------------------------------ 2 files changed, 7 insertions(+), 81 deletions(-) delete mode 100644 malloc/tst-mallocstate.c 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 +#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 deleted file mode 100644 index 69c4500..0000000 --- a/malloc/tst-mallocstate.c +++ /dev/null @@ -1,81 +0,0 @@ -/* Copyright (C) 2001-2014 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Wolfram Gloger , 2001. - - 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, see - . */ - -#include -#include -#include "malloc.h" - -static int errors = 0; - -static void -merror (const char *msg) -{ - ++errors; - printf ("Error: %s\n", msg); -} - -int -main (void) -{ - void *p1, *p2; - void *save_state; - long i; - - errno = 0; - - p1 = malloc (10); - if (p1 == NULL) - merror ("malloc (10) failed."); - - p2 = malloc (20); - if (p2 == NULL) - merror ("malloc (20) failed."); - - free (malloc (10)); - - for (i = 0; i < 100; ++i) - { - save_state = malloc_get_state (); - if (save_state == NULL) - { - 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) - merror ("realloc (i*4) failed."); - free (save_state); - } - - p1 = realloc (p1, 40); - free (p2); - p2 = malloc (10); - if (p2 == NULL) - merror ("malloc (10) failed."); - free (p1); - - return errors != 0; -} - -/* - * Local variables: - * c-basic-offset: 2 - * End: - */