linux-man.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matthew House <mattlloydhouse@gmail.com>
To: Florian Weimer <fweimer@redhat.com>
Cc: Christoph Anton Mitterer <calestyo@scientia.org>,
	Alejandro Colomar <alx@kernel.org>,
	linux-man@vger.kernel.org
Subject: Re: [PATCH] open.2: Clarify different POSIX uses of EOPNOTSUPP and ENXIO
Date: Mon, 28 Aug 2023 10:20:25 -0400	[thread overview]
Message-ID: <20230828142038.750693-1-mattlloydhouse@gmail.com> (raw)
In-Reply-To: <87ttsk8e8y.fsf@oldenburg.str.redhat.com>

On Sun, Aug 27, 2023 at 3:41 PM Florian Weimer <fweimer@redhat.com> 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

      parent reply	other threads:[~2023-08-28 14:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-25 20:28 [PATCH] open.2: Clarify different POSIX uses of EOPNOTSUPP and ENXIO Christoph Anton Mitterer
2023-08-27 19:41 ` Florian Weimer
2023-08-27 22:52   ` Christoph Anton Mitterer
2023-08-28 14:20   ` Matthew House [this message]

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=20230828142038.750693-1-mattlloydhouse@gmail.com \
    --to=mattlloydhouse@gmail.com \
    --cc=alx@kernel.org \
    --cc=calestyo@scientia.org \
    --cc=fweimer@redhat.com \
    --cc=linux-man@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 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).