Re: [PATCH newlib] libc/include/malloc.h: Add prototype for GNU extension malloc_usable_size()

Mike Frysinger <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <YjD4zB5ajXrAuwae@vapier>
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 ...

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.
-mike
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEuQK1JxMl+JKsJRrUQWM7n+g39YEFAmIw+MwACgkQQWM7n+g3
9YHFthAAnowEjjFe8mYqdOGNsp2MhNKzFNIPUo5Vrpx2Oly/SZeImulm2WlWYIsB
RG/pzDg6+MXw06fWSb2L6Y35cYntShKooNj1pmCwm9bhTcHg8HNZ9rWU3G1ipWLj
vlqqeMsWAFm1fUzw0DkipmgQ1nIqJphcmgpVapdOnomUiwq5+JPOiWvI42JrHNEX
K9figtTVwooX1+2l3fGplvEo3kvRyk7ZY96ANYV9K9txarpkqy9sP45kO3rOhYFg
i8gaeevKgsqhYe2QXraaD0OBx9OBAxl38End8B9DWPv7Vxu965uRYJIVrUB/BYlC
FeHmn11bDFllJ3EYZkjd4TMOqKlocWMr0iu703kVbVOVEVXK58jv04WnS/sn30SB
w/bJj8MqbKwQuCB6yR1ndRr0y40B12yeK3z4mVUH8ChsOsA2aCzSyl/jK29/zAtT
YWr2kuAeUCt/c9zBRlygne7mUxC9t/gy6DyTViLhMWH1Jb440nu6IfSb7PRw1eK+
ESQrTyy9+qkEjsaRirqd7jVBD8JDLvZAyIOGsMBHIAAF4Dx212Cbe+wPBmNSIusg
C+TUN4gQ78adl7Rmt05tdViEdVoDbdSDbxKhBjcfVxcG9iNtJiHEsWsxj7Zn58KH
cI+ov3ULeWOaVOjLIcN9EhqiU+TnzH+bhoMt18/IEwA+lmmM2Fc=
=04MS
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.