Re: FreeBSD, no gcc present libvirt build issue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Aug 29, 2013 at 9:42 AM, Eric Blake <eblake@xxxxxxxxxx> wrote:
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 ?
>
> 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(), and
> 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.
>
> 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().
>
> 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.

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


This is outside of my expertise at this point, but here is the discussion thread regarding this on a FreeBSD mailing list:

http://lists.freebsd.org/pipermail/freebsd-current/2013-August/044084.html

Thanks!

-jgh

--
Jason Helfman          | FreeBSD Committer
jgh@xxxxxxxxxxx     | http://people.freebsd.org/~jgh  | The Power to Serve
--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]