Message267982
| Author |
lemburg |
| Recipients |
Lukasa, Theodore Tso, christian.heimes, dstufft, larry, lemburg, martin.panter, ncoghlan, vstinner |
| Date |
2016年06月09日.08:11:37 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<575924B1.1030602@egenix.com> |
| In-reply-to |
<1465459075.04.0.420296303967.issue27266@psf.upfronthosting.co.za> |
| Content |
On 09.06.2016 09:57, STINNER Victor wrote:
>
> STINNER Victor added the comment:
>
> I played with select() on Linux on a VM:
>
> * /dev/random: it works as expected
> * /dev/urandom: the device is already seen as readable even before the urandom entropy pool is initialized. It is not really surprising since, yes, read() does not block in practice
>
> To test Python before urandom is initialized, I used the init=/path/to/python trick in the boot loader.
It's best to look at the code for this in Linux:
http://lxr.free-electrons.com/source/drivers/char/random.c
getrandom() is implemented directly on top of the two
devices:
http://lxr.free-electrons.com/source/drivers/char/random.c#L1601
> By the way, I confirm that getrandom(GRND_NONBLOCK) fails with EAGAIN before urandom is initialized.
Right, and that's good, since it's better to let the application
control what to do than to simply block.
Here's a good reading on getrandom():
https://lwn.net/Articles/606141/ |
|