public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
To: Florian Weimer <fweimer@redhat.com>
Cc: libc-alpha@sourceware.org
Subject: Re: [glibc] posix: Add terminal control setting support for posix_spawn
Date: Thu, 27 Jan 2022 09:02:11 -0300	[thread overview]
Message-ID: <080dfb07-9a33-4cd2-e745-1e49c99624b4@linaro.org> (raw)
In-Reply-To: <87bkzxo0g2.fsf@oldenburg.str.redhat.com>



On 27/01/2022 08:57, Florian Weimer wrote:
> * Adhemerval Zanella:
> 
>> I did not considered the closefrom in conjunction with closefrom file
>> action and making a file action does make sense indeed.  Maybe a better
>> approach would be to remove posix_spawnattr_tcsetpgrp_np and
>> posix_spawnattr_tcsetpgrp_np and add:
>>
>>   int posix_spawn_file_actions_tcsetgrp_np (posix_spawn_file_actions_t *,
>> 					    int fd);
>>
>> Similar to posix_spawn_file_actions_addfchdir_np.
>>
>> So to create a process and set the controlling terminal, one can use the
>> following sequence:
>>
>>   int tcfd = open (_PATH_TTY, O_RDONLY, 0600);
>>
>>   posix_spawnattr_t attr;
>>   posix_spawnattr_init (&attr);
>>   posix_spawnattr_setflags (&attr, POSIX_SPAWN_TCSETPGROUP);
> 
> Why is POSIX_SPAWN_TCSETPGROUP needed?
The idea would so caller can check if the action would take, but it does not
make sense with a file action.

> 
>>   posix_spawn_file_actions_t actions;
>>   posix_spawn_file_actions_init (&actions);
>>   posix_spawn_file_actions_tcsetgrp_np (&actions, tcfd);

In fact I think it should be posix_spawn_file_actions_addtcsetgrp_np
to follow other file action naming convention.

>>
>> So users would be able to add a posix_spawn_file_actions_addclose or
>> posix_spawn_file_actions_addclosefrom_np. 
> 
> This would address my concern, yes.
> 
> Thanks,
> Florian
> 

  reply	other threads:[~2022-01-27 12:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20220125180124.B88AC3857C70@sourceware.org>
2022-01-27 10:49 ` Florian Weimer
2022-01-27 11:38   ` Adhemerval Zanella
2022-01-27 11:57     ` Florian Weimer
2022-01-27 12:02       ` Adhemerval Zanella [this message]
2022-01-27 12:15         ` Florian Weimer

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=080dfb07-9a33-4cd2-e745-1e49c99624b4@linaro.org \
    --to=adhemerval.zanella@linaro.org \
    --cc=fweimer@redhat.com \
    --cc=libc-alpha@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).