delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2016/08/11/10:13:32

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:to:cc:subject:message-id:reply-to
:references:mime-version:content-type:in-reply-to; q=dns; s=
default; b=YhDolR3nOH4gSHhgZKARkZ202C7CSQGeK4js2RaR0CvWX0YmcaUkA
S2d4wwavlxgdQgZLWCa/ohNZviCIKpdzRsW1r98cKWfpwA0A69sNUvJC64bOtF9b
5xc7S40nDiOo67Su1vxuG5IoA6bXHqKNjh853hOglEECdyxBt3ctaQ=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:to:cc:subject:message-id:reply-to
:references:mime-version:content-type:in-reply-to; s=default;
bh=Ps4jVtshVFYmgOzncdG/g5UF/Xo=; b=yQXA+8SMjPqUbIrLHtIQcC5xOUl6
8naXR4vIezdVcO8ToF/DPbIV4eittAawEGaSjGoCOVno0H5Se/LHOOsWORDHMxZw
BApaIr+65rvCIs+N7+TJWMR0UOfWBYZ4bihRnov3U89LYr/Aq4O9dLtntaWJ1V5B
r48kPmEODs6pMsk=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-94.0 required=5.0 tests=AWL,BAYES_40,GOOD_FROM_CORINNA_CYGWIN,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_BRBL_LASTEXT,RCVD_IN_PBL,RCVD_IN_SORBS_DUL,RDNS_DYNAMIC autolearn=ham version=3.3.2 spammy=bray, Bray, laid, sk:newlib-
X-HELO: calimero.vinschen.de
Date: Thu, 11 Aug 2016 16:13:05 +0200
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Cc: Erik Bray <erik DOT m DOT bray AT gmail DOT com>
Subject: Re: 2.5.1: kill(pid, sig) before waitpid() returns -1 for sig != 0
Message-ID: <20160811141305.3em7tpcrxsushraa@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com, Erik Bray <erik DOT m DOT bray AT gmail DOT com>
References: <CAOTD34Yv+namnsv+QNL2F-_c+W1-3ZdxZsgPQP8nxBEPNndcgw AT mail DOT gmail DOT com>
MIME-Version: 1.0
In-Reply-To: <CAOTD34Yv+namnsv+QNL2F-_c+W1-3ZdxZsgPQP8nxBEPNndcgw@mail.gmail.com>
User-Agent: Mutt/1.6.2-neo (2016-07-23)

--tzovjvlf5yvyo2q3
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hi Eric,

On Aug 11 11:51, Erik Bray wrote:
> [...]
> > Existing implementations vary on the result of a kill() with pid indica=
ting an inactive process (a
> > terminated process that has not been waited for by its parent). Some in=
dicate success on such a
> > call (subject to permission checking), while others give an error of [E=
SRCH]. Since the definition
> > of process lifetime in this volume of POSIX.1-2008 covers inactive proc=
esses, the [ESRCH] error
> > as described is inappropriate in this case. In particular, this means t=
hat an application cannot
> > have a parent process check for termination of a particular child with =
kill(). (Usually this is done
> > with the null signal; this can be done reliably with waitpid().)
>=20
> In response to the originally issue, this was fixed *specifically* for
> the case of kill(pid, 0).  But my reading of the above is that kill()
> should return 0 in this case regardless of the signal (modulo
> permissions, etc.).  On Linux, for example, when calling kill with pid
> of a zombie process the kernel will happily deliver the signal to the
> relevant task_struct; it will just never be acted on since the task
> will never run again.

I'm not sure why cgf only fixed that for sig 0 at the time, since, as
you noted, the text from POSIX-1.2008 does not state that this is
*restricted* to sig 0.

> The below (untested) patch demonstrates the change I'm suggesting,
> though I don't know what other code, if any, might be involved in
> this.

The original patch laid the groundwork by making sure that there are
two states, EXITED and REAPED.  Removing the explicit check for 0 is
the right thing to do, afaics, so I tested and applied your patch as is,
see=20
https://cygwin.com/git/?p=3Dnewlib-cygwin.git;a=3Dcommitdiff;h=3D86f79af827=
729f3968d8b3b8f860ac29d200da0d


Thanks,
Corinna

--=20
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

--tzovjvlf5yvyo2q3
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCAAGBQJXrIfwAAoJEPU2Bp2uRE+gPbgQAKZme+ZIz7vAiS0qlBSdkMXn
Jj+LD6SiMLPLFSeTykI3aooqZnO7XAJhVqQYBIROfyK7R/UCCOalD5eMwiU4BmI/
s20yTN6zIDxRL2cbIxF1XmSLHb3vtGLz3RkFKtUx7ZJJ1avu8SAtkHXyKnj1HKki
hEJ3PjI9izV8W+fwM4wd21VDZJrjJsRkIwHAZygkGgVDRomr/bQraIJhZ2CsUALd
Gp1v7PXZo+9vkBb9f45hAMQtxGDhPiQ1XUr6Q4Q+G5gQNxBNp5ZjxvFQ7eFwM4KR
Kof5ujBlGN5bjPIfFVqfktwZ8haMKlnkqnM95xAThHpPgSi5EKocQKTzjQAtY2//
jvc1CQMSMj9Cd3NLFtCo9LLBmJg5p+c4UfP/iEvNMr1ASOMujYM3iAzmFIX2hQrc
Nl/sYIzWF2+c+O+aZ0tf1k2zwkWj4Agv+2yJsbY5/QhrGbdJ6HMW5a6j9sASSEbs
QHAp/Gqhv/UrgUwy2PU+J2LLb/NBLVZaKVKu5B9DD/a3RxNOOdx9GaoNcp4nMPWE
eS/cpyf+qRNQj3XM0/fpWZiaoWqJIrDvOQQsSA7n1mi9DYAFbQoscG5ZZEY6zEHz
T+Q0552J9Fl6ZstgSvGQyftfic6xoXnmb6Gdf062xx22JLH+97cxoU5nllRc+JRE
lNyyeB7oLtbF+wLWdU+e
=PmFE
-----END PGP SIGNATURE-----

--tzovjvlf5yvyo2q3--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019