public inbox for libc-help@sourceware.org
 help / color / mirror / Atom feed
From: Godmar Back <godmar@gmail.com>
To: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Cc: Libc-help <libc-help@sourceware.org>
Subject: Re: supporting terminal ownership assignment (tcsetpgrp()) in posix_spawn
Date: Wed, 9 Jun 2021 09:12:46 -0400	[thread overview]
Message-ID: <CAB4+JYLyWuS-iyEWV+TYXKNbizKOxxLW_tGiE3aBj8i=2xuAeg@mail.gmail.com> (raw)
In-Reply-To: <4429f842-e9c7-b907-3374-6b48c6fc089e@linaro.org>

On Wed, Jun 9, 2021 at 8:00 AM Adhemerval Zanella <
adhemerval.zanella@linaro.org> wrote:

>
> The libc interface should be as generic possible to cover most users cases,
> I really don't want to add a posix_spawnattr_tcsetpgrp_np that uses the
> groupid implicit from POSIX_SPAWN_SETPGROUP to someone ask for a
> posix_spawnattr_tcsetpgrp_np_ex so one can set the groupid.
>
> Also, requiring POSIX_SPAWN_SETPGROUP for posix_spawnattr_tcsetpgrp_np is
> not really a good API, it adds subtle semantics (should it use a default
> value set by posix_spawnattr_init or should we fail with EINVAL), and adds
> complexity in the error path (we will need to either pre validate the
> posix_spawnattr_t input before start the process creation or handle a
> possible invalid combination on the helper process itself).
>
> That's why I am more inclined to follow the tcsetpgrp on the posix_spawn
> extension and let the caller set the required groups.
>
>
I just checked and I don't think this will even work.  The caller cannot
provide the process group id because the caller can't know it yet.
A typical sequence in the first child of a pipeline is "setpgid(0, 0);
tcsetpgrp(fd, getpgrp());" and AFAIK tcsetpgrp doesn't accept '0' to stand
for the
current process's process group.

  reply	other threads:[~2021-06-09 13:12 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-03 13:58 Godmar Back
2021-06-07 21:04 ` Adhemerval Zanella
2021-06-07 21:23   ` Godmar Back
2021-06-07 21:36     ` Adhemerval Zanella
2021-06-07 23:57       ` Godmar Back
2021-06-08 13:50         ` Adhemerval Zanella
2021-06-08 14:37           ` Godmar Back
2021-06-08 16:42             ` Adhemerval Zanella
2021-06-08 22:11               ` Godmar Back
2021-06-09  6:41                 ` Florian Weimer
2021-06-09 12:00                 ` Adhemerval Zanella
2021-06-09 13:12                   ` Godmar Back [this message]
2021-06-11 13:45                     ` Adhemerval Zanella
2021-06-11 23:58                       ` Godmar Back

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='CAB4+JYLyWuS-iyEWV+TYXKNbizKOxxLW_tGiE3aBj8i=2xuAeg@mail.gmail.com' \
    --to=godmar@gmail.com \
    --cc=adhemerval.zanella@linaro.org \
    --cc=libc-help@sourceware.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).