[lkml]   [2001]   [Sep]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: O_NONBLOCK on files
Simon Kirby <> writes:

> I've always wondered why it's not possible to do this:
> fd = open("an_actual_file",O_RDONLY);
> fcntl(fd,F_SETFL,O_NONBLOCK);
> r = read(fd,buf,4096);
> And actually have read return -1 and errno == EWOULDBLOCK/EAGAIN if the
> block requested is not already cached.
> Wouldn't this be the ideal interface for daemons of all types that want
> to stay single-threaded and still offer useful performance when the
> working set doesn't fit in cache? It works with sockets, so why not
> with files?

Besides the SUS or the POSIX specs...
What would cause the data to be read in if read just checks the caches?
With sockets the other side is clearing pushing or pulling the data. With
files there is no other side...

This is resolveable just not currently implemented.


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:03    [W:0.263 / U:0.464 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site