Date:        Mon, 10 Jun 2024 07:41:27 -0400
    From:        Zachary Santer <zsan...@gmail.com>
    Message-ID:  
<cabklju+es5qo8i-fa-7nkeqjsaymxlrba3315ry52mczq+b...@mail.gmail.com>

  | I assume the coproc fd behavior of
  | being closed after most forks is not handled through a system fd flag,
  | though if there is a system fd flag that would cause an fd to
  | automatically be closed in any forked child process,

The next POSIX will include O_CLOFORK and FD_CLOFORK (or names
similar to those) for open (etc) and fcntl(FDFLAGS)) - that is
analogs of O_CLOEXEC and FD_CLOEXEC but applying to fork() rather
than exec*().

The primary motivation is for handling cases where in a multi-threaded
application, one thread is opening a temporary use (private) fd, just
at the same time another is forking.   The nature of fork() in multi-
threaded applications means that without something like this there
are unavoidable races which more or less guarantee fd leakage of
the temporary fd (which other threads don't even know exists) into
the newly forked process.

Whether bash is already making use of this new pair of flags (which
don't exist on all that many systems yet) I have no idea.

kre

            • ... Chet Ramey
            • ... Carl Edquist via Bug reports for the GNU Bourne Again SHell
            • ... Chet Ramey
            • ... Carl Edquist
            • ... Chet Ramey
            • ... Carl Edquist
            • ... Chet Ramey
            • ... Robert Elz
            • ... Martin D Kealey
            • ... Zachary Santer
            • ... Robert Elz
            • ... Zachary Santer
      • Re: E... Chet Ramey
        • R... Carl Edquist via Bug reports for the GNU Bourne Again SHell
          • ... Chet Ramey
            • ... Carl Edquist
            • ... Chet Ramey
  • Re: Examples o... Chet Ramey

Reply via email to