All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Kirby <sim@netnation.com>
To: linux-kernel@vger.kernel.org
Subject: O_NONBLOCK on files
Date: Tue, 18 Sep 2001 23:46:48 -0700	[thread overview]
Message-ID: <20010918234648.A21010@netnation.com> (raw)

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?

I see even TUX has to have I/O worker threads to work around this
limitation, which seems a bit silly.

Simon-

[  Stormix Technologies Inc.  ][  NetNation Communications Inc. ]
[       sim@stormix.com       ][       sim@netnation.com        ]
[ Opinions expressed are not necessarily those of my employers. ]

             reply	other threads:[~2001-09-19  6:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-09-19  6:46 Simon Kirby [this message]
2001-09-19  7:05 ` O_NONBLOCK on files Eric W. Biederman
2001-09-19  7:24   ` Simon Kirby
2001-09-24 20:47     ` Matti Aarnio
2001-09-24 21:05       ` Simon Kirby
2001-09-24 21:30         ` Benjamin LaHaise
2001-09-19  8:52   ` Erik Andersen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20010918234648.A21010@netnation.com \
    --to=sim@netnation.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.