Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Feb 2006 11:12:32 -0800
From:      Brooks Davis <brooks@one-eyed-alien.net>
To:        pfgshield-freebsd@yahoo.com
Cc:        freebsd-standards@freebsd.org
Subject:   Re: malloc.h is still legitimate after all
Message-ID:  <20060221191232.GC31112@odin.ac.hmc.edu>
In-Reply-To: <20060221184948.9554.qmail@web32906.mail.mud.yahoo.com>
References:  <20060221184948.9554.qmail@web32906.mail.mud.yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--KDt/GgjP6HVcx58l
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Tue, Feb 21, 2006 at 07:49:48PM +0100, pfgshield-freebsd@yahoo.com wrote:
> Hi;
> I was porting some parts of COIN-OR (some Operations Research packages
> opensourced by IBM a while ago), and when I was happily suggesting that a=
ll
> occurences of malloc.h should be removed and/or replaced with stdlib.h I =
got
> this reply:

The author is wrong.  He's unconditionally including a non-standard
header file in order to obtain a non-standard structure.  Specificaly,
there is no mallinfo structure on FreeBSD so he can apply what ever
conditional he uses around that code around the include of malloc.h.
You can verify the lock of mallinfo struct with this command:

find /usr/include -type f | xargs grep mallinfo

-- Brooks

> ______________
> Pedro,=20
>=20
> The mallinfo struct that ReportMemory uses is defined in malloc.h, and not
> brought in by stdlib.h.=20
>=20
> I'm testing on AIXv5.1, __STDC__ is defined, and "struct mallinfo" is unk=
nown
> if I don't include malloc.h.=20
>=20
> I don't know enough about the different flavors of UNIX (System V, POSIX,=
 BSD?)
> to know what to do that satisfies all.=20
>=20
> The AIX docs say=20
>=20
>   "The mallopt and mallinfo subroutines are provided for source-level
> compatibility with the System V malloc subroutine "=20
>=20
> The gnu gcc docs say=20
>=20
> "This function and its associated data type are declared in `malloc.h'; t=
hey
> are an extension of the standard SVID/XPG version."=20
> ...
> ___________
>=20
> So malloc.h will no be removed from the package but rather it will be und=
ef'd
> __FreeBSD__ and the package will still work on FreeBSD. I doubt we will e=
ver
> add these extensions, but there's also a glibc port for FreeBSD now so ma=
ybe
> __FreeBSD__ is not the correct variable here.
>=20
> I personally think the FreeBSD port's people have contributed greatly to =
clean
> inappropiate uses of malloc.h in the software world, but perhaps an error=
 is
> too drastic and we should fall back to a warning.
>=20
> cheers,
>=20
>     Pedro.
>=20
>=20
> ---
>      Pedro F. Giffuni
>      M. Sc. Industrial Eng. University of Pittsburgh
>      Mech. Eng.      Universidad Nacional de Colombia
> ---
> Yahoo is powered by FreeBSD    http://www.FreeBSD.org/
>=20
>=20
> =09
>=20
> =09
> 	=09
> ___________________________________=20
> Yahoo! Mail: gratis 1GB per i messaggi e allegati da 10MB=20
> http://mail.yahoo.it
> _______________________________________________
> freebsd-standards@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-standards
> To unsubscribe, send any mail to "freebsd-standards-unsubscribe@freebsd.o=
rg"
--=20
Any statement of the form "X is the one, true Y" is FALSE.
PGP fingerprint 655D 519C 26A7 82E7 2529  9BF0 5D8E 8BE9 F238 1AD4

--KDt/GgjP6HVcx58l
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQFD+2YfXY6L6fI4GtQRAmZpAJ4k9I1diaqOJ2+TiidtlypqZEXvaACgwELA
jj5unmTrARfPurNlcvY9wr8=
=GqIM
-----END PGP SIGNATURE-----

--KDt/GgjP6HVcx58l--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060221191232.GC31112>