On Wed, Mar 21, 2018 at 3:33 AM, Konstantin Belousov
<kostik...@gmail.com> wrote:
> On Wed, Mar 21, 2018 at 01:15:45AM +0000, Conrad Meyer wrote:
>> +int
>> +getentropy(void *buf, size_t buflen)
>> +{
>> +     ssize_t rd;
>> +
>> +     if (buflen > 256) {
>> +             errno = EIO;
>> +             return (-1);
>> +     }
>> +
>> +     while (buflen > 0) {
>> +             rd = getrandom(buf, buflen, 0);
>> +             if (rd == -1) {
>> +                     if (errno == EINTR)
>> +                             continue;
>> +                     else if (errno == ENOSYS)
>> +                             abort();
> Libraries must not abort the application.
> Esp. libc.

What do you propose instead?  while (1); ?  I don't see that as
obviously better.

>> ...
>> @@ -627,6 +628,8 @@ FBSDprivate_1.0 {
>>       __sys_getppid;
>>       _getpriority;
>>       __sys_getpriority;
>> +     _getrandom;
>> +     __sys_getrandom;
>>       _getresgid;
>>       __sys_getresgid;
>>       _getresuid;
>
> Is there any use planned for _getrandom and for __sys_ ?  If not,
> we do not add private symbols for newer syscalls in recent times.

Nope, just following the pattern.  They can be removed if they are not needed.

Best,
Conrad
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to