* 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
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: open(2) manpage and O_NONBLOCK
2016-03-21 20:23 open(2) manpage and O_NONBLOCK Jörn Engel
@ 2016-03-28 3:58 ` Michael Kerrisk (man-pages)
[not found] ` <CAKgNAkiLsw5c_Q+EknRijgeJGNvQ_R6HxdgA=YhBgcXsbv+mpQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: Michael Kerrisk (man-pages) @ 2016-03-28 3:58 UTC (permalink / raw)
To: Jörn Engel
Cc: linux-man, linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Hello Jörn,
On 22 March 2016 at 09:23, Jörn Engel <joern-BHEL68pLQRGGvPXPguhicg@public.gmane.org> wrote:
> 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);
For how long might this block, though?
> 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.
I think the most obvious userland case that's being covered here is
O_NONBLOCK with FIFOs. The "Wen possible" text is, I imagine, there to
deal with cases such as drivers that do not support O_NONBLOCK.
Cheers,
Michael
--
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ 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)
[not found] ` <CAKgNAkiLsw5c_Q+EknRijgeJGNvQ_R6HxdgA=YhBgcXsbv+mpQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-03-28 4:08 ` Al Viro
[not found] ` <20160328040845.GT17997-3bDd1+5oDREiFSDQTTA3OLVCufUGDwFn@public.gmane.org>
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).