public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Sergey Bugaev <bugaevc@gmail.com>
To: Samuel Thibault <samuel.thibault@gnu.org>
Cc: libc-alpha@sourceware.org, bug-hurd@gnu.org,
	 Emilio Pozuelo Monfort <pochu27@gmail.com>
Subject: Re: [PATCH 1/4] hurd: Don't pass fd flags in CMSG_DATA
Date: Fri, 21 Apr 2023 00:47:43 +0300	[thread overview]
Message-ID: <CAN9u=HcFmKQ6Wnh6+-T4hTy_wrR=LjZburF84tk=E0woDT+KWA@mail.gmail.com> (raw)
In-Reply-To: <20230420211405.i7uwo3ocpjudfx45@begin>

On Fri, Apr 21, 2023 at 12:14 AM Samuel Thibault
<samuel.thibault@gnu.org> wrote:
> Sergey Bugaev, le lun. 17 avril 2023 16:38:59 +0300, a ecrit:
> > The only valid flag defined here is FD_CLOEXEC. It is of no concern to
> > the receiving process whether or not the sender process wants to close
> > its copy of sent file descriptor upon exec,
>
> Ok, but couldn't there be some flags that we could want to transfer, in
> the future?

Unlikely -- it's been years (I don't know how old FD_CLOEXEC is
exactly, but it surely predates O_CLOEXEC by many years) and AFAIK
nobody came up with any ideas for more fd flags, other than
FD_CLOFORK, but that wouldn't be transferable either.

And the whole idea of fd flags (as opposed to flags applied to the
open file itself, the peropen in Hurd terms, like O_NONBLOCK and
O_ASYNC) is that they apply to that single file descriptor, and are
not carried over when it's dup'ed. sendmsg+recvmsg is like a remote
dup in this sense.

> I'd better keep the infrastructure, even if it is not
> actually useful for now. So that people who end up needing something see
> that passing it is already supported.

I understand, but also it's not like there's a lot of infrastructure
that I'm removing here. You could think of it that way: the
infrastructure for passing an integer value along with the port is
still there, but currently no valid flags for it are defined, and so 0
is always used. We could spell it as

fds[i] = descriptor->flags & ~FD_CLOEXEC;

if you would prefer; but that would still always evaluate to 0 (but
the compiler wouldn't be aware and would generate the extra
instructions).

Sergey

  reply	other threads:[~2023-04-20 21:47 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-17 13:38 Sergey Bugaev
2023-04-17 13:39 ` [PATCH 2/4] hurd: Implement MSG_CMSG_CLOEXEC Sergey Bugaev
2023-04-17 13:39 ` [PATCH 3/4] hurd: Only deallocate addrport when it's valid Sergey Bugaev
2023-04-17 13:39 ` [RFC PATCH 4/4] socket: Add a test for MSG_CMSG_CLOEXEC Sergey Bugaev
2023-04-17 22:14   ` [RFC PATCH v2 " Sergey Bugaev
2023-04-18 12:13   ` [RFC PATCH " Adhemerval Zanella Netto
2023-04-18 15:37     ` Sergey Bugaev
2023-04-18 16:50       ` Adhemerval Zanella Netto
2023-04-20 21:14 ` [PATCH 1/4] hurd: Don't pass fd flags in CMSG_DATA Samuel Thibault
2023-04-20 21:47   ` Sergey Bugaev [this message]
2023-04-21  0:56     ` Samuel Thibault

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='CAN9u=HcFmKQ6Wnh6+-T4hTy_wrR=LjZburF84tk=E0woDT+KWA@mail.gmail.com' \
    --to=bugaevc@gmail.com \
    --cc=bug-hurd@gnu.org \
    --cc=libc-alpha@sourceware.org \
    --cc=pochu27@gmail.com \
    --cc=samuel.thibault@gnu.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 read-only IMAP folder(s) and NNTP newsgroup(s).