]> granicus.if.org Git - python/commit
py_getrandom(): getrandom() *can* return EINTR
authorVictor Stinner <victor.stinner@gmail.com>
Thu, 30 Jul 2015 08:13:52 +0000 (10:13 +0200)
committerVictor Stinner <victor.stinner@gmail.com>
Thu, 30 Jul 2015 08:13:52 +0000 (10:13 +0200)
commit61d5aab9b9fc81ca8801d94af8032414f745b8c2
tree1b94e864ba97b202276a527f3bdf44049dc29602
parent707deb9df447a635571a85612832c1f9a0d7c801
py_getrandom(): getrandom() *can* return EINTR

See the latest version of getrandom() manual page:
http://man7.org/linux/man-pages/man2/getrandom.2.html#NOTES

    The behavior when a call to getrandom() that is blocked while reading from
    /dev/urandom is interrupted by a signal handler depends on the
    initialization state of the entropy buffer and on the request size, buflen.
    If the entropy is not yet initialized, then the call will fail with the
    EINTR error.  If the entropy pool has been initialized and the request size
    is large (buflen > 256), the call either succeeds, returning a partially
    filled buffer, or fails with the error EINTR.  If the entropy pool has been
    initialized and the request size is small (buflen <= 256), then getrandom()
    will not fail with EINTR.  Instead, it will return all of the bytes that
    have been requested.

Note: py_getrandom() calls getrandom() with flags=0.
Python/random.c