Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 28 Jun 2002 11:55:48 -0700 (PDT)
From:      Nate Lawson <nate@root.org>
To:        current@freebsd.org
Cc:        Andreas Gustafsson <gson@nominum.com>
Subject:   Re: kern/38527: /dev/random does not obey O_NONBLOCK flag (fwd)
Message-ID:  <Pine.BSF.4.21.0206281152560.25620-100000@root.org>

next in thread | raw e-mail | index | archive | help
I assume this change was made so devices that were booting without a
keyboard didn't hang indefinitely.  But I agree with Andreas -- shouldn't
the usermode programs be changed, not the kernel interface?

If someone has better reasons for this, please let us know and close the
PR (as well as document it somewhere).

-Nate

---------- Forwarded message ----------
Date: Fri, 28 Jun 2002 11:02:45 -0700 (PDT)
From: Andreas Gustafsson <gson@nominum.com>
To: Nate Lawson <nate@root.org>
Cc: freebsd-gnats-submit@FreeBSD.org
Subject: Re: kern/38527: /dev/random does not obey O_NONBLOCK flag

Nate Lawson writes:
> This behavior is intentional and was changed some time ago.  If you want
> to block on /dev/random waiting for bytes to be available, use
> select/poll.

You've got to be kidding.  Why would you intentionally implement a
behaviour that is

 a) gratuitously different from every other implementation of
    /dev/random

 b) gratuitously different from every other character 
    device in the history of Unix by being nonblocking
    by default,

 c) not even correctly nonblocking, because when no data
    is available, read() on a nonblocking device is supposed
    to return -1 with errno=EWOULDBLOCK, but in the case
    of /dev/random, read() returns 0,

and

 d) undocumented?

-- 
Andreas Gustafsson, gson@nominum.com


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0206281152560.25620-100000>