Re: [PATCH mh/lockfile-retry] lockfile: replace random() by rand()

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

 



On Thu, Jun 4, 2015 at 4:42 AM, Michael Haggerty <mhagger@xxxxxxxxxxxx> wrote:
> On 06/04/2015 10:40 AM, Johannes Sixt wrote:
> We *certainly* don't require high-quality random numbers for this
> application. Regarding portability, there is one definite point in favor
> of rand() (it's available on Windows) vs. Junio's recollection that
> random() might have portability advantages, presumably on other platforms.

I agree that anything is OK in this codepath. I just suspected that whichever
one we pick, there would be somebody who says "oh, my system lacks it",
and we will end up adding one of compat/{rand,random}.c to emulate.

And when I anticipated that future, my inclination was to prefer random(),
not rand(), used in the code, not the other way around. Yes, both are in
POSIX, but I was getting the impression that rand() is on its way out
(and rand_r() is already marked as obsolete).

> Maybe the easiest thing would be to switch to using rand() and see if
> the OS/2 and VMS users complain ;-)

We can certainly go that route and I am fine with that as the solution for
today, as long as somebody will remember this discussion when that
complaint comes, and make compat/random.c, and switch the
in-code use to random(), instead of sticking to use of rand() in code.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]