Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 29 Aug 2013 10:42:23 -0600
From:      Eric Blake <eblake@redhat.com>
Cc:        svn-src-head@freebsd.org, libvir-list <libvir-list@redhat.com>, "Daniel P. Berrange" <berrange@redhat.com>, Jason Helfman <jgh@freebsd.org>
Subject:   Re: [libvirt] FreeBSD, no gcc present libvirt build issue
Message-ID:  <521F79EF.5070402@redhat.com>
In-Reply-To: <521F77D0.4010904@redhat.com>
References:  <CAMuy=%2BiG20hs9b%2BD210=TZ50weyaJoPK8NZ8Mgea8s1A2UDQhw@mail.gmail.com> <521F63F4.4020406@redhat.com> <CAMuy=%2BhO15c_0EdjnMQMtL5OGESfQkkvjZ5oUwRGv2%2B0VB6U0w@mail.gmail.com> <CAMuy=%2BhgHARZyAUgiVaf0hdOSpTQOGRubucCY%2BQ6-kzDN8a5Ng@mail.gmail.com> <521F6C0F.9060007@redhat.com> <521F6E54.1070104@redhat.com> <20130829160349.GV14547@redhat.com> <521F77D0.4010904@redhat.com>

next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--PpD6qbvI4rWi4lM3kUox8WWUREXbIH3Hb
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

On 08/29/2013 10:33 AM, Eric Blake wrote:
>> Since gnulib has a working random_r() function can we just make
>> gnulib replace the boneheaded freebsd impl ?
>=20
> Huh - the glibc man pages state that random_r returns RAND_MAX bits.
> random_r is a glibc extension: POSIX only requires rand(), rand_r(), an=
d
> random(); but even with random(), POSIX has no requirements that it be
> related to RAND_MAX - so the fact that glibc equates random()/random_r(=
)
> with RAND_MAX is also a glibc extension.
>=20
> I guess that means we should't be worrying about RAND_MAX in the first
> place, as it is tied to the (potentially algorithmically weaker) rand()=
,
> and need not have any bearing on the fact that we already use gnulib's
> random_r().
>=20
> I'll play around with a patch.

As it is, POSIX recommends the use of drand48() and friends for
multithreaded apps, not random() (where lrand48() would match precisely
with a RAND_MAX of 0x7fffffff); but that's because POSIX lacks
random_r().  But since gnulib lacks [dl]rand48(), I still think libvirt
is still better off sticking with random_r(), and just avoiding the red
herring of a potentially unrelated RAND_MAX.

--=20
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


--PpD6qbvI4rWi4lM3kUox8WWUREXbIH3Hb
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.14 (GNU/Linux)
Comment: Public key at http://people.redhat.com/eblake/eblake.gpg
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBCAAGBQJSH3nvAAoJEKeha0olJ0Nqi48H+gK44w2QBlPnfrQOe0GzHbGt
Tl6q/YEIfXz0+/kAOIONh/TW21+oO2PuYl6sHsAoRDri88prFa1GCnFyH8ZBxYis
tZiteHg6kDnNt7Q24pVebnXjoEgHDR40K7WOJqUj0gXPFKjXqixsALywC7XQduxg
Kb5Xx5uDjidT8x2emeOXq7BkgiI6rGT3S3PHiZ03nXh26Zk7FhEZVIegVBq/MZud
A6s0IamrAvH31k/cCqw8Gik6k3gxwjADzbKHLqJyJ+sIdrrLtA8ONt5GIy17+spy
mgIw7rQkrg5AMaA6UBn4/JbOzOMfWvtfuSnOfT51xLaPG1QHbCI6r3oUGH76IwQ=
=xAUs
-----END PGP SIGNATURE-----

--PpD6qbvI4rWi4lM3kUox8WWUREXbIH3Hb--



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