Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 11 Jul 2000 23:41:08 -0700 (PDT)
From:      marka@nominum.com
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   kern/19863: Non-blocking IO not supported on /dev/random
Message-ID:  <20000712064108.BE05037BA01@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help

>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 <fcntl.h>
#include <stdio.h>
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000712064108.BE05037BA01>