From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qk1-x733.google.com (mail-qk1-x733.google.com [IPv6:2607:f8b0:4864:20::733]) by sourceware.org (Postfix) with ESMTPS id 1536B388C02E for ; Mon, 7 Jun 2021 21:04:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1536B388C02E Received: by mail-qk1-x733.google.com with SMTP id i68so14567834qke.3 for ; Mon, 07 Jun 2021 14:04:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=iqcLO44LU+fgpyg7BtxqU7wOPw7axM8H6DOTCtN3ees=; b=lC+5FwAfa6QhPba0Bt6sRmg5ZHC8qCkt+65ar5L5lDuVa1L2zWSrDHHi+kowCdN6tP 9SEuMK97lN1XTyT2NTdgNUP7yYAdxbDCxJYkwRO0FgXQl/Pr4tZM80rnyuGMm152z9JW 47LncTxuPZWdBw0RhKRWAT2VWvg7nLVXNeCDiGRO6o3xic/FPFCPfULFR/bPhT4GFCVp abpvX+lH/xtqq/R1BeEbreD1jwx8TFIbxf8/a8+HzzvBq8bVvKRxzrKv9ZJU5UD0Hcle /iukK6BN+9KWxnh/6OktEObBvp6hXgNY1YChUEUaNRThWZWmwGa8xZTXcr90mS8IETgT eUhA== X-Gm-Message-State: AOAM533FgDnKLPf5StaF2KNctttx5cmyd6mlt1zEtsVIuz7C1s2LRZ7d Iz3LPBhOMTbHGd/EAdnC8QvzQNRml8TVUQ== X-Google-Smtp-Source: ABdhPJxF0RYkZx3A7GFUdAm8zHGgK8hSjcwwaDkW0EV6BUlPPNSJFR1Bb/f4oYlgCAW6PhoYIIr2Eg== X-Received: by 2002:a37:7c02:: with SMTP id x2mr18554126qkc.483.1623099886975; Mon, 07 Jun 2021 14:04:46 -0700 (PDT) Received: from [192.168.1.4] ([177.194.59.218]) by smtp.gmail.com with ESMTPSA id l5sm9403981qkf.55.2021.06.07.14.04.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 07 Jun 2021 14:04:46 -0700 (PDT) Subject: Re: supporting terminal ownership assignment (tcsetpgrp()) in posix_spawn To: Godmar Back , Libc-help References: From: Adhemerval Zanella Message-ID: <7298cb72-becb-80bb-b2df-d97bdb201e95@linaro.org> Date: Mon, 7 Jun 2021 18:04:44 -0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.5 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.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-help@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-help mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Jun 2021 21:04:49 -0000 On 03/06/2021 10:58, Godmar Back via Libc-help wrote: > I've recently been playing with posix_spawn() and noticed that it lacks > support for assigning terminal ownership (as would be done via > tcsetpgrp()). As a consequence, it cannot be used for job control shells > when starting jobs in the foreground [1]. > > IBM's implementation of spawn [2] for zOS supports SPAWN_SETTCPGRP for this > reason. > > Even though the POSIX spec states "Future Directions: None" I came across > this Austin group issue [3] which proposes to add a way to set the child > process's session id, and which appears to have been accepted in 2016. This > is an example of evolution of posix_spawn. > > Is anyone aware of efforts to add something similar to POSIX, and more > specifically, to Linux? > > If the current implementation of posix_spawn is library based (I'm guessing > it is) then there would be nothing to prevent Linux from adding additional > flags, just like QNX or Blackberry have already done ([3]). Other OS might provide a syscall for posix_spawn (I know MacOSX does and I think maybe Solaris as well), but for Linux is done on top of clone syscall. And glibc alread supports POSIX_SPAWN_SETSID since 2.26, so why can't you use it along with with tcsetpgrp() called from the parent?