Re: [PATCH] open.2: Clarify different POSIX uses of EOPNOTSUPP and ENXIO

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Aug 27, 2023 at 3:41 PM Florian Weimer <fweimer@xxxxxxxxxx> wrote:
> To what degree is this dependent on the file system?  Does the VFS layer
> restrict these error codes for anything else?  I don't think so.  Maybe
> strictly speaking, the added wording is still accurate, but the
> conclusion that ENXIO means socket would be incorrect draw, I think.

-ENXIO is returned by no_open() in fs/inode.c, which is automatically set
as the ->open() function (by inode_init_always()) for every inode that
isn't a symlink and doesn't set its ->i_fop to something else. As far as I
am aware, every filesystem uses this fallback only for files of socket
type; all non-socket inodes (except for dummy inodes) set either ->i_fop
or ->i_op->read_link().

Note that this doesn't apply only to Unix domain sockets, but to all
sockets, if one attempts to open() them via their links in /proc/pid/fd.
Open sockets in another process can only be duplicated (AFAIK) using
pidfd_getfd() or SCM_RIGHTS.

Of course, some filesystems also return -ENXIO for their own error
conditions, e.g., opening a pipe for writing with O_NONBLOCK when it has no
readers.

Matthew House



[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux