DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 561HIK433411561 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 561HIK433411561 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=jBDfQYxD X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0D1E63854816 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1751390300; bh=X1ntpgqzpKQkZp0S8d/knXpJYN90yRw5NNBhPCXx6gA=; h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=jBDfQYxDbYYP32JbH7yit5NKMSWUkjgWyIl5nzkzUsVqv1zhe5491nglEQYIvo0R4 UHvtQQqLA8AHFhHG1BltzSXSAfHIPz7xNsNUF8Wtx5irR01w1m35exuH10LTcgh0B8 mDStkbDcxZ0B6gqdCBrrTuFa6gZqBaDX18Lej5XM= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B2EDE385C6FE ARC-Filter: OpenARC Filter v1.0.0 sourceware.org B2EDE385C6FE ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1751390231; cv=none; b=mbWs3cLKDP7TAgiw5JHcd8H9SDRR1IXOcz+AuSKSSm1DkDna8Qnr5WZ4dHDXn6GOJ91916PBtYiqrpoC9DSL/+MAJZcFWZTOwARmQmbV1R0bzsHxuDF7iuEerG53WM78zPuud265lGUgdSM2vbrr7UgZdLvB7mfKaSdqQ5KFjGs= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1751390231; c=relaxed/simple; bh=O68fT/K+GVZ154AI/AqDl6RyxE1JTrPcFQZyWd7o/TE=; h=Message-ID:Date:MIME-Version:From:Subject:To:DKIM-Signature; b=MI9WC0kCjlQsDlGBWiLUpHhiPNfq2Asgt5CF6e40ucdHQ0jtgdZKFkVV8zm1XVuVME2n56k6ErGaXXX78vERYiBkMY1UB7JKCFsgb6pS78GCY7TQD2EVKDRp8JDrEMAGudkQ5fxtknwPlmWhpaLY8CenjSCdnOkPkz/Gbh3F8Rk= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B2EDE385C6FE Message-ID: <3b667ff0-7778-4b48-866f-1dd112317c84@SystematicSW.ab.ca> Date: Tue, 1 Jul 2025 11:17:08 -0600 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: setpgid non-compliance with POSIX? Content-Language: en-CA To: cygwin AT cygwin DOT com References: <3391453b-7914-a319-fad8-4729610558ea AT jdrake DOT com> Organization: Systematic Software In-Reply-To: X-Rspamd-Queue-Id: CEC802000E X-Stat-Signature: 6h88dop5rd5rgzu4xewxkdwr598oers8 X-Rspamd-Server: rspamout06 X-Session-Marker: 427269616E2E496E676C69734053797374656D6174696353572E61622E6361 X-Session-ID: U2FsdGVkX1+/zJEiAuVaPsMY1rDk4qINghp2m37beSE= X-HE-Tag: 1751390229-536855 X-HE-Meta: U2FsdGVkX1/uQZl2Z1+zXMHE4ASkBsj3zyYsnKjmRAKE2Ne8DZSi28DZnpOndZTzxVomoVgb86sx+BPr0oe7znB5QjvULl+890z/XmVoOD0F0XFTnhUBrBVb2wLyNAOACIYFW6XoluQNrIVe+yHXy+Iw8URDtxaO31ATvSBiSGYVGmvEeU2+iBlC0HqdL9EFr4LMaC8qum6pXm+YP7LjBVKh/FBT1mQJhU4cWqiXUUiRjcIJLpGo3wjzESy2r6E4718/zWHtLdTQUbndBFC2zXZGlaiaG1nUx0tq0Iw1I0njLbVaFOS9xf7uLD8z0tOueTnzV2OodBD+LA263ZFiBwZi/9FS6WrD7Gd3t1d6ZtDP0Vrbncw2V0xHB7PreexhVz/cBnQAIyBtjovsJEIvbXgDZNqge0Dhv2QtFhL6sXppBrUT5/rxjg== 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: Brian Inglis via Cygwin Reply-To: cygwin AT cygwin DOT com Cc: Brian Inglis Content-Type: text/plain; charset="utf-8"; Format="flowed" Errors-To: cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com Sender: "Cygwin" Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 561HIK433411561 On 2025-06-30 13:07, Jeremy Drake via Cygwin wrote: > On Mon, 30 Jun 2025, Corinna Vinschen via Cygwin wrote: > >> On Jun 28 12:32, Jeremy Drake via Cygwin wrote: >>> I was looking at setpgid yesterday, and it seems deficient with respect to >>> the errors required to be returned by the POSIX docs in >>> https://pubs.opengroup.org/onlinepubs/9799919799/functions/setpgid.html >>> >>> Basically, it seems that setpgid allows any arbitrary positive integer to >>> be set as pgid, rather than restricting to setting it to either the >>> process's pid or to an existing pgid in the same session (sid). >> >> Yeah, error checking in setpgid is a bit on the lacking side. With only >> minor changes, the function is basically 25 years old :} > > The POSIX docs metioned that an old BSD allowed setting arbitrary pgid > >> 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. 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. Try head /proc/self/*id & and head /proc/$$/*id as demos. Does any of that help? ;^> -- Take care. Thanks, Brian Inglis Calgary, Alberta, Canada La perfection est atteinte Perfection is achieved non pas lorsqu'il n'y a plus rien à ajouter not when there is no more to add mais lorsqu'il n'y a plus rien à retrancher but when there is no more to cut -- Antoine de Saint-Exupéry -- 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