lkml.org 
[lkml]   [2005]   [Jan]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: short read from /dev/urandom
On Sat, Jan 15, 2005 at 07:58:23PM -0800, Ulrich Drepper wrote:
> Matt Mackall wrote:
> >_Neither_ case mentions signals and the "and will return as many bytes
> >as requested" is clearly just a restatement of "does not have this
> >limit". Whoever copied this comment to the manpage was a bit sloppy
> >and dropped the first clause rather than the second:
>
> It still means the documented API says there are no short reads.

I maintain that it's ambiguous. And read(2) makes it clear that short
reads can happen any time, any where. Further, your interpretation
makes for a nonsensical API as it implies being uninterruptible for
arbitrary lengths of time.

Changing the longstanding, sensible code to match a silly and highly
non-standard interpretation of the documentation doesn't fix the
problem in apps either. Presumably they'll still be running on kernels
older than 2.6.11 and I believe most *BSDs have /dev/urandom as well.

> >So anyone doing a read() can expect a short read regardless of the fd
> >and is quite clear that reads can be interrupted by signals. "It is
> >not an error". Ever.
>
> Of course are signal interruptions wrong if the signal uses SA_RESTART.

That's a separate problem. I'll take a look at fixing that.

--
Mathematics is the supreme nostalgia of our time.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:09    [W:0.083 / U:0.332 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site