[PATCH v2] stdlib: Consolidate getentropy and adapt to POSIX 2024 semantics

Andreas Schwab schwab@suse.de
Mon Mar 31 07:50:34 GMT 2025


On Mär 28 2025, Mark Harris wrote:

> On Thu, Mar 27, 2025, Adhemerval Zanella Netto wrote:
>> On 27/03/25 11:29, Andreas Schwab wrote:
>> > On Mär 27 2025, Adhemerval Zanella wrote:
>> >
>> >>   2. There is no defined error if no entropy could be obtained.
>> >>      It means that the function should not fail.
>> >
>> > The standard says:
>> >
>> >         The getentropy() function may fail if:
>> >
>> >         [ENOSYS]
>> >                 The system does not provide the necessary source of entropy.
>> >
>>
>> The code still returns ENOSYS if getrandom() is not supported.  The question
>> is how to handle unexpected getrandom() issues (which should be possible
>> in theory).  Should I change to just return ENOSYS in this case?
>
> POSIX does not restrict errors to those specifically listed.

And for errors it does list, the implementation is required to use it
for the described error situation.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."


More information about the Libc-alpha mailing list