[llvm-commits] [llvm] r156240 - /llvm/trunk/lib/Support/Process.cpp

Joerg Sonnenberger joerg at britannica.bec.de
Tue May 8 14:00:26 PDT 2012


On Tue, May 08, 2012 at 11:27:03AM -0700, Chandler Carruth wrote:
> > That said, why is using the OS API so much better than using a well
> > seeded RNG? I'm not familiar with the Linux implementation.
> >
> 
> AFAIK, it actually resolves conflicts, and may be cheaper than getting a
> well seeded RNG. that said, I've not read the implementation in detail, it
> just seems that the reliable way is to fall back on OS interfaces rather
> than rolling our own....

What do you mean with "resolves conflicts"? The typical mk(s)temp(3)
implementation will loop until the entry either doesn't exist or can be
created with O_EXCL, depending on the function call. Seeding the RNG on
the BSDs is cheap, when using arc4random(). Normally, it doesn't even
add a system call. Not sure what the recommented method on Linux, OSX or
Windows is.

Joerg



More information about the llvm-commits mailing list