From owner-freebsd-current Fri Jun 28 11:25:43 2002 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3701137B400 for ; Fri, 28 Jun 2002 11:25:36 -0700 (PDT) Received: from rootlabs.com (root.org [67.118.192.226]) by mx1.FreeBSD.org (Postfix) with SMTP id C2D5243E09 for ; Fri, 28 Jun 2002 11:25:30 -0700 (PDT) (envelope-from nate@rootlabs.com) Received: (qmail 25622 invoked by uid 1000); 28 Jun 2002 18:55:48 -0000 Date: Fri, 28 Jun 2002 11:55:48 -0700 (PDT) From: Nate Lawson To: current@freebsd.org Cc: Andreas Gustafsson Subject: Re: kern/38527: /dev/random does not obey O_NONBLOCK flag (fwd) Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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 To: Nate Lawson 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