[Haskell-cafe] How can I avoid buffered reads?

Brandon Allbery allbery.b at gmail.com
Thu Dec 6 23:23:11 CET 2012


On Thu, Dec 6, 2012 at 5:14 PM, Donn Cave <donn at avvanta.com> wrote:

> While I guess /dev/urandom isn't supposed to block, so it would look
> about the same to select(2) either way, /dev/random is select-able, true?
>

Both should be cdevs, not files, so they do not go through the normal
filesystem I/O pathway in the kernel and should support select()/poll().
 ("ls -l", the first character should be "c" instead of "-" indicating
character-mode device nodes.)  If ghc is not detecting that, then *that* is
indeed an I/O manager issue.  More generally, anything which is not a
regular file according to stat() (in practice this means block devices,
character devices, and fifos; directories, sockets, doors, Xenix name
files, and other exotics in the filesystem namespace are not generally
accessible via standard I/O routines and should probably be failed on open
--- in fact, you may have a kernel bug if the system does not fail them on
open) should go through the I/O manager.

-- 
brandon s allbery kf8nh                               sine nomine associates
allbery.b at gmail.com                                  ballbery at sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20121206/b2466d45/attachment.htm>


More information about the Haskell-Cafe mailing list