From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qv1-xf29.google.com (mail-qv1-xf29.google.com [IPv6:2607:f8b0:4864:20::f29]) by sourceware.org (Postfix) with ESMTPS id 3FCE63858D20 for ; Tue, 15 Mar 2022 15:54:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3FCE63858D20 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-qv1-xf29.google.com with SMTP id gm1so15295047qvb.7 for ; Tue, 15 Mar 2022 08:54:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=jwC7VmBTHWqD2Xq6mwKfXFoNof+0XF9NMHvsGZffGfg=; b=NvuP0gQG8OUnfeW8RKfpN7R2qhw8E8mrI8BnAHrzr2pYExt/01ow2bxCCBpnycBmRs e3ZDcPfB25d6LJZk6+aGMkyn84ROL3ri6S9N8k3rblLeY0dqM04xFqaZeBOMGhRR1jgd rKCuuQD69IA3EAKlx7Na5hwgtmckyh7ehb26tOE/MGTKyTqpwMO728AEm0fytc/IBjKI Qrh1zogrpHxG0iT2IEgbyHMDcxCM76282+U2HFwF7RzPJD1mBbgGGCYv1zCHSw9SNQ4I 8qiM4h84MLX2jiKAaKvmPdDgDVHyfdYilfBuadaAV76BJDp0pGFCq6aPlPYYRHhpHWDM 0A3Q== 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:from:date :message-id:subject:to; bh=jwC7VmBTHWqD2Xq6mwKfXFoNof+0XF9NMHvsGZffGfg=; b=FITTsO69R5DCUHo9QFgfNZgRhAZQ6HCBOYB0SitoqKauSRAApwUvihXT30PLReCAo/ L3B00MJu2CdyNuCXFsR48utPGMh+VQX4A4Q+fPseq1LAMevIA5d4qRW6G3s+zvPeu0Df /aNkMC7YE5eXaryUgbxnVaLtqAE/3/OrwMxsLdV6V86VxmeHNgf9EhLtF70Xd0Ckxnk9 DK2jgUF+BgyQGcDHk2UnOoU1g/NF/1V8rUmtEDxkqmhwYSXD+8lpmsCXjR/bH22BMrFE dWt9RISxQmQF/4bEGIXC4UDzUTyGjt0GvREg3MLqR2ty+qFEl+gBDxgPEplxKaNSpldc juew== X-Gm-Message-State: AOAM531R4w5TwH2iulzX6mDbrQy+E/AhEh1xwSOa+9bq6riGnYi5F8yq 9jym7m+yTLXfsluriN6qsXJX1zNlMqXhQ4m2B3m4TSkgyA== X-Google-Smtp-Source: ABdhPJwB8vxJ4Z+6WTV75yBiMBq0xBMXBWFzpxSWRZKSobm0rt29CUEE+r8oZ74VQo/fYg/wz/2bdEXMPsbidarKfac= X-Received: by 2002:a05:6214:d05:b0:435:b3bb:37fe with SMTP id 5-20020a0562140d0500b00435b3bb37femr21885242qvh.111.1647359691483; Tue, 15 Mar 2022 08:54:51 -0700 (PDT) MIME-Version: 1.0 References: <20220315151644.369-1-joel@rtems.org> In-Reply-To: From: C Howland Date: Tue, 15 Mar 2022 11:54:39 -0400 Message-ID: Subject: Re: [PATCH newlib] libc/include/malloc.h: Add prototype for GNU extension malloc_usable_size() To: newlib@sourceware.org X-Spam-Status: No, score=-8.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, HTML_MESSAGE, RCVD_IN_DNSWL_NONE, 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:54:54 -0000 On Tue, 15 Mar 2022 at 11:44, Joel Sherrill wrote: > > > 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 > RTEMS wrapper is good. (Sorry, but you didn't mention you were providing it in RTEMS, although in hindsight I should have assumed so when wording my response.) No reason to try to retrofit it to the Newlib implementation. Craig