Bug#360243: manpages-dev: open.2: incorrect explanation of O_NONBLOCK
Michael Kerrisk <mtk-manpages <at> gmx.net>
2006-03-31 23:26:45 GMT
> Michael Kerrisk wrote:
> > > Von: "ROBERTOJIMENOCA <at> terra.es" <ROBERTOJIMENOCA <at> terra.es>
> > > /usr/share/man/man2/open.2.gz has (under O_NONBLOCK):
> > > "This mode need not have any effect on files other than FIFOs."
> > >
> > > I'm almost sure that statement is false.
> > > O_NONBLOCK prevents blocking on any filehandle (files, sockets,
> > > fifos, devices, ...).
> > Justin is on the right track in mentioning the "standard"
> > behavior of O_NONBLOCK. And you haven't got things quite
> > right -- for example, O_NONBLOCK can't be used for open() with
> > sockets, because we can't open() a socket, and O_NONBLOCK has
> > no meaning for regular files (it is just silently ignored).
> Yes, the de jure standard as susv3 may say is that, but the de facto
> standard as _any_ modern UNIX does is the same for every type of file.
> > But I agree that the man page is a bit misleading. One might
> > get the impression that, for example, O_NONBLOCK can't be used
> > for sockets, although we can enable O_NONBLOCK on a socket using
> > fcntl(). And O_NONBLOCK does have meaning for some devices,
> > and sometimes has an effect for regular files.
> O_NONBLOCK _always_ has an effect for regular files, it prevents
> blocking on read or write operations (as an example think in NFS or slow
I'm not sure of the details for NFS, and probably I don't need to
worry about them anyway, as far as this page is concerned. But
what do you mean by a "slow disk"?
> > I have made the following changes:
> > * Removed that sentence from open.2 .
> > * Added a sentence noting that the effect of O_NONBLOCK
> > for file locks and leases is described in fcntl.2.
> > * Somewhat expanded the discussion of mandatory locking in
> > fcntl.2.
> > The changes will appear in upstream 2.29.
> You may always want to attach the patch or an URL for review.
2.29 should be out in a week or so, and I'll send a mail when it
is released; could you let me know then if anything still needs
fixing in your opinion.
> Thanks for these changes. I already knew they were misleading to many
maintainer of Linux man pages Sections 2, 3, 4, 5, and 7
Want to help with man page maintenance?
Grab the latest tarball at
read the HOWTOHELP file and grep the source
files for 'FIXME'.