From owner-freebsd-bugs Tue Jul 11 23:50:11 2000 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id 51AB337BC62 for ; Tue, 11 Jul 2000 23:50:03 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id XAA69406; Tue, 11 Jul 2000 23:50:03 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: by hub.freebsd.org (Postfix, from userid 32767) id BE05037BA01; Tue, 11 Jul 2000 23:41:08 -0700 (PDT) Message-Id: <20000712064108.BE05037BA01@hub.freebsd.org> Date: Tue, 11 Jul 2000 23:41:08 -0700 (PDT) From: marka@nominum.com To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-1.0 Subject: kern/19863: Non-blocking IO not supported on /dev/random Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 19863 >Category: kern >Synopsis: Non-blocking IO not supported on /dev/random >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue Jul 11 23:50:03 PDT 2000 >Closed-Date: >Last-Modified: >Originator: Mark Andrews >Release: 4.0-stable >Organization: Nominum >Environment: FreeBSD drugs.dv.isc.org 4.0-STABLE FreeBSD 4.0-STABLE #1: Sat Jul 1 00:10:47 EST 2000 root@drugs.dv.isc.org:/usr/src/sys/compile/DRUGS i386 >Description: It is not possible to set /dev/random into non-blocking mode using fcntl. This make it impossible to use /dev/random in a application that requires IO not to block. >How-To-Repeat: #include #include int main(int argc, char **argv) { int fd; int flags; if ((fd = open("/dev/random", O_RDONLY, 0)) == -1) { perror("open"); exit(1); } if ((flags = fcntl(fd, F_GETFL, 0)) == -1) { perror("fcntl: F_GETFL"); exit(1); } flags |= O_NONBLOCK; if (fcntl(fd, F_SETFL, flags) == -1) { perror("fcntl: F_SETFL"); exit(1); } close(fd); exit(0); } >Fix: >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message