[PATCH v3] getrandom system call wrapper [BZ #17252]
Florian Weimer
fweimer@redhat.com
Fri Sep 9 15:14:00 GMT 2016
On 09/09/2016 04:41 PM, Zack Weinberg wrote:
> On Fri, Sep 9, 2016 at 10:28 AM, Florian Weimer <fweimer@redhat.com> wrote:
>> On 09/09/2016 04:21 PM, Torvald Riegel wrote:
>>> On Thu, 2016-09-08 at 13:44 +0200, Florian Weimer wrote:
>>>>
>>>> I have made the system call wrapper a cancellation point. (If we
>>>> implement the simpler getentropy interface, it would not be a
>>>> cancellation point.)
>>>
>>>
>>> Why did you do that?
>>
>> I have to, because it can block indefinitely.
>
> Is it practical to make it a cancellation point if and only if called
> in blocking mode? I suspect that is the behavior basically everyone
> wants. Unlike with file descriptors, blocking/nonblocking is visible
> in the flags passed to the function, so it might not be hard.
The predominant use case is to call getrandom to request blocking (with
flags == 0), without expecting blocking (because the kernel pool is
initialized). This would have to be a cancellation point, only the
obscure GRND_NONBLOCK would not be. So I don't think it's worth the
complexity.
(The current goal is to provide a minimal system call wrapper.)
> (What does Solaris' implementation do? OpenBSD's?)
I don't have access to a Solaris system with a compiler. The manual
page doesn't go into that level of detail.
Does OpenBSD have getrandom? I'm not sure if their cancellation
implementation is comparable, either.
Florian
More information about the Libc-alpha
mailing list