Date: Sat, 4 Apr 2020 10:40:11 -0600 From: Warner Losh <imp@bsdimp.com> To: Konstantin Belousov <kostikbel@gmail.com> Cc: Jan Beich <jbeich@freebsd.org>, Steve Wills <swills@freebsd.org>, "freebsd-arch@freebsd.org" <freebsd-arch@freebsd.org> Subject: Re: Time to svn rm include/malloc.h Message-ID: <CANCZdfpiVg0PBBgUwi2K8L-vNPJLyTfBG2Zyg%2B%2B3EwS6NK88tg@mail.gmail.com> In-Reply-To: <20200404142804.GP1992@kib.kiev.ua> References: <CANCZdfr19HgeMLc=XwZPCGecSV0pwMw52SrbgXnKYO9vAHfLyg@mail.gmail.com> <6dbfb7cd-b4c8-dea8-8fc5-43e2b89e352d@FreeBSD.org> <20200331210258.GJ1992@kib.kiev.ua> <CANCZdfq9KTM9ob74ad20gn6wEMteZdSgBV26y4-=7KDPfGs7BA@mail.gmail.com> <20200402113442.GL1992@kib.kiev.ua> <h7y0-yr8m-wny@FreeBSD.org> <20200404142804.GP1992@kib.kiev.ua>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Apr 4, 2020, 8:28 AM Konstantin Belousov <kostikbel@gmail.com> wrote: > On Sat, Apr 04, 2020 at 03:27:53AM +0200, Jan Beich wrote: > > Konstantin Belousov <kostikbel@gmail.com> writes: > > > > > On Tue, Mar 31, 2020 at 03:48:54PM -0600, Warner Losh wrote: > > > > > >> On Tue, Mar 31, 2020 at 3:03 PM Konstantin Belousov < > kostikbel@gmail.com> > > >> wrote: > > >> > > >> > On Tue, Mar 31, 2020 at 04:01:23PM -0400, Steve Wills wrote: > > >> > > Yeah, a lot of ports have things like: > > >> > > > > >> > > sed -e 's/malloc.h/stdlib.h/' *.[ch] > > >> > > > > >> > > because they have autotools that check for malloc.h existence and > > >> > include it > > >> > > if it exists, so you end up with things like: > > >> > > > > >> > > ... > > >> > > #include <stdlib.h> > > >> > > ... > > >> > > #if HAVE_MALLOC_H > > >> > > #include <stdlib.h> > > >> > > #endif > > >> > > ... > > >> > > > > >> > > which ends up harmless, but sub-optimal. > > >> > > > > >> > So wouldn't it be more useful to remove warning and either include > > >> > stdlib.h or provide some parts of malloc-related defines, esp. the > > >> > non-portable bits from jemalloc ? > > >> > > > >> > > >> We've provided an error for the past 20 years. And a warning for the > last > > >> 24 years. Nobody is usefully using it today. In fact, it is getting > in the > > >> way, which is why we should just remove it entirely. > > > The file is not useful as provided by us today, sure. But other OSes, > > > namely LInux, do use it for allocator extensions features, and newer > > > Linux-only software tends to include it unconditionally. > > > > Maybe rename <malloc_np.h> to <malloc.h>. Other BSDs don't have > > <malloc_np.h> while GNU libc defines malloc_usable_size in <malloc.h>. > > malloc_usable_size is quite popular e.g., used by Firefox, sqlite3, etc. > > I think the following should be the easiest approach > > diff --git a/include/malloc.h b/include/malloc.h > index 5d7d7e8396d..2ec7e550334 100644 > --- a/include/malloc.h > +++ b/include/malloc.h > @@ -1,6 +1,3 @@ > /* $FreeBSD$ */ > -#if __STDC__ > -#error "<malloc.h> has been replaced by <stdlib.h>" > -#else > #include <stdlib.h> > -#endif > +#include <malloc_np.h> > Yes. NetBSD did something similar about a year ago. Warner >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfpiVg0PBBgUwi2K8L-vNPJLyTfBG2Zyg%2B%2B3EwS6NK88tg>