linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* open(2) manpage and O_NONBLOCK
@ 2016-03-21 20:23 Jörn Engel
  2016-03-28  3:58 ` Michael Kerrisk (man-pages)
  0 siblings, 1 reply; 4+ messages in thread
From: Jörn Engel @ 2016-03-21 20:23 UTC (permalink / raw)
  To: Michael Kerrisk (man-pages); +Cc: linux-man, linux-fsdevel

In open(2), we seem to promise more than the kernel can deliver:
       O_NONBLOCK or O_NDELAY
               When possible, the file is opened in nonblocking mode.
	       Neither the open() nor any subsequent operations on the
	       file descriptor which is returned  will  cause  the
	       calling process to wait.

Clearly you can question whether every last device driver correctly
supports O_NONBLOCK in its open routine.  But even if that was the case,
we still cannot guarantee nonblocking behaviour for open().
get_empty_filp() has to be called for every open() and contains a
blocking memory allocation:
        f = kmem_cache_zalloc(filp_cachep, GFP_KERNEL);

As such I would propose to change the documentation and keep the code.
The open() itself may very well block, but subsequent operations should
not.

J�rn

--
Why do musicians compose symphonies and poets write poems?
They do it because life wouldn't have any meaning for them if they didn't.
That's why I draw cartoons.  It's my life.
-- Charles Shultz

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-03-28  5:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-21 20:23 open(2) manpage and O_NONBLOCK Jörn Engel
2016-03-28  3:58 ` Michael Kerrisk (man-pages)
2016-03-28  4:08   ` Al Viro
2016-03-28  5:04     ` Jörn Engel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).