[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: non-blocking I/O
From: |
Paolo Bonzini |
Subject: |
Re: non-blocking I/O |
Date: |
Thu, 31 Mar 2011 08:44:36 +0200 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101209 Fedora/3.1.7-0.35.b3pre.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.7 |
On 03/30/2011 07:46 PM, Eric Blake wrote:
I'm not sure whether block and character
special devices can usefully be set non-blocking
I believe at least /dev/random supports it:
#include <stdlib.h>
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
int main()
{
char buf[256];
int fd = open ("/dev/random", O_RDONLY | O_NONBLOCK);
if (fd == -1) {
perror ("/dev/random");
exit (1);
}
alarm (5);
while (read (fd, buf, 256) != -1 || errno != EAGAIN)
;
puts ("works");
exit (0);
}
Paolo
Re: non-blocking I/O, Bruno Haible, 2011/03/29
Re: non-blocking I/O, Eric Blake, 2011/03/30
Re: non-blocking I/O, Eric Blake, 2011/03/30
Re: non-blocking I/O,
Paolo Bonzini <=
Re: non-blocking I/O, Bruno Haible, 2011/03/31
[PATCH] nonblocking: new module, Eric Blake, 2011/03/31
Re: [PATCH] nonblocking: new module, Bruno Haible, 2011/03/31