From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-f51.google.com (mail-lf1-f51.google.com [209.85.167.51]) by sourceware.org (Postfix) with ESMTPS id 938923858D20 for ; Tue, 15 Mar 2022 21:14:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 938923858D20 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-lf1-f51.google.com with SMTP id g17so636506lfh.2 for ; Tue, 15 Mar 2022 14:14:45 -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; bh=vntU1dyjZ9GO8P6xaHUSVoDpQYp8OkGYj2B1bmzFqjQ=; b=YREKuV1m3/osk4p3cMRKWUP7qViE+QZmR3Lg576tILCcCvkZIBr5F0kLaUSjUvfJnM qhU3LRGA8G/7mLdRiXMVNi4zC+z0xDqgivjtyIMh0DdGRbgQErouP7EoOXY/QczH3MRh YE4lynSY0re3Bzu4JKIx+yOJTE+KIVEdw6E1S5E0J3ZXJJ2GGSKb2GDkw/DJe3IYmYtZ jNKn0XHHft240/k1Kp3jXCuiW5Oe3vxnWzD/sijWLcDOuqMizhqu0WT/v22xYNS09vFr bZiTWleq/KfqdvRzzpPw97UplDzxC9mkYftc57frpHgLSG0SXfS7OrXxrAsXcmX7buKQ u3Fw== X-Gm-Message-State: AOAM531pIKAfNlEOPC7qF799apdx8/P0PjVIEOtITwaHg0+cpk3Fbs0D ERS79jAJMtw0/8+sZEZkxEJJpblOAyxrxw== X-Google-Smtp-Source: ABdhPJxArTs4trBZgcAYL88/15v3LU282LDG2OTIA0KmCzfe6He4NYTlvfmEVdI7l2oxcm69tJiqqw== X-Received: by 2002:a05:6512:31c2:b0:448:746e:6440 with SMTP id j2-20020a05651231c200b00448746e6440mr13801107lfe.353.1647378884008; Tue, 15 Mar 2022 14:14:44 -0700 (PDT) Received: from mail-lf1-f53.google.com (mail-lf1-f53.google.com. [209.85.167.53]) by smtp.gmail.com with ESMTPSA id x15-20020a2e880f000000b00247fe29d831sm18041ljh.24.2022.03.15.14.14.43 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 15 Mar 2022 14:14:43 -0700 (PDT) Received: by mail-lf1-f53.google.com with SMTP id w27so614324lfa.5 for ; Tue, 15 Mar 2022 14:14:43 -0700 (PDT) X-Received: by 2002:a05:6512:3f1d:b0:443:3c8b:58f5 with SMTP id y29-20020a0565123f1d00b004433c8b58f5mr17900771lfa.669.1647378883366; Tue, 15 Mar 2022 14:14:43 -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 16:14:32 -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: Sebastian Huber , Joel Sherrill , 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 21:14:47 -0000 On Tue, Mar 15, 2022 at 4:04 PM Mike Frysinger wrote: > On 15 Mar 2022 19:42, Sebastian Huber wrote: > > On 15/03/2022 16:47, Mike Frysinger wrote: > > > On 15 Mar 2022 10:16, Joel Sherrill wrote: > > >> 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 > > >> + > > > i'm confused. isn't this prototype already defined in this header file > > > on line 101 above where you added this ? > > > > Yes, and it is implemented by the Newlib malloc. > > while true, we disable malloc in newlib for rtems: > > newlib/configure.host: > # RTEMS supplies its own versions of some routines: > # malloc() (reentrant version) > #... > *-*-rtems*) > ... > newlib_cflags="${newlib_cflags} ... -DMALLOC_PROVIDED ... > We disable their implementation -- not the malloc.h header. > > so i'm not sure what trouble Joel is running into. maybe rtems also > provides > its own malloc.h and that's what is missing this prototype. > I was reviewing the submitted code which added malloc_usable_size to RTEMS. It also added the prototype to an RTEMS internal file. I took it on faith that the prototype was missing and looked at the Linux man page for where the prototype should be. Then I just stupidly missed it. Their code should have include malloc.h and not an internal RTEMS file. Sorry and thanks. --joel -mike >