From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oi1-x235.google.com (mail-oi1-x235.google.com [IPv6:2607:f8b0:4864:20::235]) by sourceware.org (Postfix) with ESMTPS id 496A5394742F for ; Thu, 27 Jan 2022 12:02:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 496A5394742F Received: by mail-oi1-x235.google.com with SMTP id w133so5398718oie.7 for ; Thu, 27 Jan 2022 04:02:14 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=F0V4XI0yJZaYsnAVi2eBiIj4VP1CxJU6AmfLc6PG9uQ=; b=hiMn9OoCQzLgQKrdNWbAnwLDfA9eVLpSbCr3jHs50JvEfnT2TPmNyTAh2WHiO5WKwx awsalxu03IPBwrG1rmkWUlrsNcghlkgQeWwWv9cJlx+W1hhY79JLjszEiR3bqsTPcaQD 63tQCw5ehGlCL5I2uqVFMezc2C192kT/oU8+cRfeBeQVzy+T+UpW8fX1qdbQTCLMtr5V l3hXp7OgQ9gTM2y4iFPkof997lwyf1zIbpOx9k9FEojivOGpQNoB5XlxxvKpdPIi9Z2o yVCsugnsmxjz8evSYJ8kstl+CPE4ugtnpmnoz5UwgqyIV79mTOIRg80ndKaVhwkI0MU4 824A== X-Gm-Message-State: AOAM530gFopatFjeZ1qQv6a6h2ygO9PgqTYWUMtV3tlpw9I6V32b5LPI Sp2GqoEV3/3cg355FWttTtE5TxnWofpeIg== X-Google-Smtp-Source: ABdhPJwUkTvZecZcjcDw7Z7cl0vilEIEGAsLYSvUqiY5xpgYF1N4MeOTTrr9s2kCllv5FETogO+iYA== X-Received: by 2002:aca:3d09:: with SMTP id k9mr1935284oia.290.1643284933635; Thu, 27 Jan 2022 04:02:13 -0800 (PST) Received: from ?IPV6:2804:431:c7cb:27f8:865d:8f66:952e:4ca2? ([2804:431:c7cb:27f8:865d:8f66:952e:4ca2]) by smtp.gmail.com with ESMTPSA id y15sm2803999oof.37.2022.01.27.04.02.12 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 27 Jan 2022 04:02:13 -0800 (PST) Message-ID: <080dfb07-9a33-4cd2-e745-1e49c99624b4@linaro.org> Date: Thu, 27 Jan 2022 09:02:11 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.1 Subject: Re: [glibc] posix: Add terminal control setting support for posix_spawn Content-Language: en-US To: Florian Weimer Cc: libc-alpha@sourceware.org References: <20220125180124.B88AC3857C70@sourceware.org> <87bkzxpi6q.fsf@oldenburg.str.redhat.com> <87bkzxo0g2.fsf@oldenburg.str.redhat.com> From: Adhemerval Zanella In-Reply-To: <87bkzxo0g2.fsf@oldenburg.str.redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jan 2022 12:02:15 -0000 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 >