DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 561IHOBr3431695 Authentication-Results: delorie.com; dmarc=pass (p=none dis=none) header.from=cygwin.com Authentication-Results: delorie.com; spf=pass smtp.mailfrom=cygwin.com DKIM-Filter: OpenDKIM Filter v2.11.0 delorie.com 561IHOBr3431695 Authentication-Results: delorie.com; dkim=pass (1024-bit key, unprotected) header.d=cygwin.com header.i=@cygwin.com header.a=rsa-sha256 header.s=default header.b=UnHUOKNx X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2E523385C6D1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1751393842; bh=ECjat1jf9N2JbJS0LwzAf3fWD4QS+DmATsLrbK72YgE=; h=Date:To:Subject:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=UnHUOKNxpolMF3v1k7OTd0QJ3BgG9qArFEA+kYHaWsPtoXCFRNJifq4xRNzSpN3Em MyMv5TSz7itkGWlXzNdxauQ87yYymINH2oaYpqGWx7ylln0/qwNe5ANmJfbLvTqOv+ /Hx47FbVR8fBkxqurXjYaH/3gAa2xPDMqpUToc/4= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6A0863857B9B ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 6A0863857B9B ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1751393811; cv=none; b=pIKSd+9+XJtZGo4t8igIxUxUAZ7Tb9nPra2HZTDGm9/52DdZbvCmzfj9zbzTy2N+CNkvvMs2t/CfKMIHldAcFZcJbi6CL08ACFHoyRLRm9Fz1s5L8eOmHmetY+fo8i+4nOB2b0YnwkrcRVGZ0fs8Nrd65R3JiJ6P0jOchP+FrVY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1751393811; c=relaxed/simple; bh=Q6mXGAk27TDYQCQaOFCwdx8pKGhLVSZWcos3/nhseUU=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=Ni7q5ALIxf6vjqH01geAdoc+oYTESCGhwUMXQxxF8ZC1TS6WjFAsPpD9NYPGKfh9TbSrrUjHmc/n8Zdsiu0mOUbN5WpoXj7oWWSYmn67hXm10XootZhmjnqIjwGm3zQdaUn0K9TJTt8ESWQAsgI0nRmB8rg7mamVYjFX5Bn55nQ= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6A0863857B9B Date: Tue, 1 Jul 2025 11:16:50 -0700 (PDT) X-X-Sender: jeremyd AT resin DOT csoft DOT net To: Brian Inglis via Cygwin Subject: Re: setpgid non-compliance with POSIX? In-Reply-To: <3b667ff0-7778-4b48-866f-1dd112317c84@SystematicSW.ab.ca> Message-ID: References: <3391453b-7914-a319-fad8-4729610558ea AT jdrake DOT com> <3b667ff0-7778-4b48-866f-1dd112317c84 AT SystematicSW DOT ab DOT ca> MIME-Version: 1.0 X-BeenThere: cygwin AT cygwin DOT com X-Mailman-Version: 2.1.30 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Jeremy Drake via Cygwin Reply-To: Jeremy Drake Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com Sender: "Cygwin" On Tue, 1 Jul 2025, Brian Inglis via Cygwin wrote: > On 2025-06-30 13:07, Jeremy Drake via Cygwin wrote: > > On Mon, 30 Jun 2025, Corinna Vinschen via Cygwin wrote: > > > >> Off the top of my head I don't know how to check the pgid already exists. > >> Do you? > > > > I think it'd have to iterate all processes and check pgid and sid members > > of pinfo until it found a match. > > Shouldn't need to - pgid is the pid of a process spawned by init, or pid of a > login shell, and sid is that pgid or that of the parent process, or pgid is > that > of a job shell or of the parent process. In practice, perhaps, but in theory it could get more complicated than that. > So each process sid also pgid is either its pid or that of its parent process: > they are only set either to the process pid or inherited. Not just parent, but could be inherited any level of ancestor, including ancestors that then terminate, leaving the process adopted by init. Also, the restrictions given by POSIX seem to allow setting pgid to a sibling/cousin/aunt/uncle as long as they have created a pgid (by setting it to their pid) and are in the same sid. > Try head /proc/self/*id & and head /proc/$$/*id as demos. > > Does any of that help? ;^> > Not really :P I hope I don't have to write more test cases for some of the complicated scenarios I envision being legal under the POSIX docs, I feel like I've caused enough trouble already with the test cases I've written trying to exercise posix_spawn :) -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple