From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-f169.google.com (mail-lj1-f169.google.com [209.85.208.169]) by sourceware.org (Postfix) with ESMTPS id A52233858D28 for ; Tue, 15 Mar 2022 15:44:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A52233858D28 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=rtems.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lj1-f169.google.com with SMTP id c15so10473218ljr.9 for ; Tue, 15 Mar 2022 08:44:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:reply-to :from:date:message-id:subject:to:cc; bh=kCxYH15/h85G7ScVx9E2C/AFjI0h4NeJKJ/AnEOSeWA=; b=I1642cHowWWpGW4sZduQOX5dNaa4L90V/pmelarKGf6ppnbc1g4TTxFrQQtlkv/TAu w5iwRXHtCz718CliX6xm8N2cnrS2ZWqwQGuoPxBpdChxs3ryuhkGVDLwCRQd5CdEsGvY b+zKDfwOwiqsnMFc+GjDCh9VV3IvwVNBdRiyMHNjQ8d3hfiUIHPdR9q7Oy15lgjsNAMj erFH7JiqzznTdYjFcd6Ad3EQXJMB92nSPnXGFJNqGeXXL9/BUbhZ2vbuEn1t+omAAXCX BwKFHpcxjbq5Ejp5Xb4aOBZ5nHx7GxQ4wl76cV4b2bWGPOXUaNds7CnycvkxjhUClOJq rlyQ== X-Gm-Message-State: AOAM532DwmCGykruIqD99pshI5lhuZYc+LJkFxQX72PiOkXxjN7U9Sy8 nAKG+GN3a8RlGsqtECZea27IwGGXqmwsvA== X-Google-Smtp-Source: ABdhPJz0KFjrXgwcjzNAPNpIaSzVs7arQhSRMqntXysXaGveB1q4NKNMYPSe0By2p8C35LJC+rdP4A== X-Received: by 2002:a2e:b946:0:b0:244:beb1:72b2 with SMTP id 6-20020a2eb946000000b00244beb172b2mr18149533ljs.240.1647359085931; Tue, 15 Mar 2022 08:44:45 -0700 (PDT) Received: from mail-lj1-f180.google.com (mail-lj1-f180.google.com. [209.85.208.180]) by smtp.gmail.com with ESMTPSA id z16-20020a19e210000000b00448837e47a8sm1813618lfg.97.2022.03.15.08.44.45 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 15 Mar 2022 08:44:45 -0700 (PDT) Received: by mail-lj1-f180.google.com with SMTP id c15so10473075ljr.9 for ; Tue, 15 Mar 2022 08:44:45 -0700 (PDT) X-Received: by 2002:a2e:b52f:0:b0:249:3831:6329 with SMTP id z15-20020a2eb52f000000b0024938316329mr6765466ljm.326.1647359085303; Tue, 15 Mar 2022 08:44:45 -0700 (PDT) MIME-Version: 1.0 References: <20220315151644.369-1-joel@rtems.org> In-Reply-To: Reply-To: joel@rtems.org From: Joel Sherrill Date: Tue, 15 Mar 2022 10:44:33 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH newlib] libc/include/malloc.h: Add prototype for GNU extension malloc_usable_size() To: C Howland Cc: Newlib X-Spam-Status: No, score=-3037.6 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, HTML_MESSAGE, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: newlib@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Newlib mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Mar 2022 15:44:50 -0000 On Tue, Mar 15, 2022, 10:38 AM C Howland wrote: > > > > ------------------------------ > > *From:* Newlib on > > behalf of Joel Sherrill > > *Sent:* Tuesday, March 15, 2022 11:16 AM > > *To:* newlib@sourceware.org > > *Subject:* [PATCH newlib] libc/include/malloc.h: Add prototype for GNU > > extension malloc_usable_size() > > > > > > This is not provided by the newlib malloc implementation but may > > be available in external implementations. > > --- > > newlib/libc/include/malloc.h | 4 ++++ > > 1 file changed, 4 insertions(+) > > > > diff --git a/newlib/libc/include/malloc.h b/newlib/libc/include/malloc.h > > index a9dc5bca6..e73095e1e 100644 > > --- a/newlib/libc/include/malloc.h > > +++ b/newlib/libc/include/malloc.h > > @@ -137,6 +137,10 @@ extern void __malloc_lock(struct _reent *); > > > > extern void __malloc_unlock(struct _reent *); > > > > +#if __GNU_VISIBLE > > +extern size_t malloc_usable_size(void *); > > +#endif > > + > > /* A compatibility routine for an earlier version of the allocator. */ > > > > extern void mstats (char *); > > -- > > 2.24.4 > > > > > Sorry, but I fail to see why adding this makes sense. If there's an > application which adds a function they should be editing the header file > when they add it. (There's not even a stub being supplied here.) > Additionally, the Linux man page for the function says "The main use of > this function is for debugging and introspection." That is, it is not even > a general application utility, but of very limited use. Either provide the > function with the prototype or no prototype. > RTEMS provides its own malloc family implementation and we are providing it. I can wrap all that in an RTEMS conditional if you like. I have no experience with the malloc implementation in Newlib or any idea how to implement it. --joel > Craig >