Email List: Xaustin-group-lX
[All Lists]

Re: wait* status definition

To: Ulrich Drepper <drepper@xxxxxxxxxx>
Subject: Re: wait* status definition
From: Michael Kerrisk <mtk.lists@xxxxxxxxx>
Date: Tue, 10 Jun 2008 07:02:42 +0200
Cc: "austin-group-l@xxxxxxxxxxxxx" <austin-group-l@xxxxxxxxxxxxx>
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=n3UdV2ola9bq//DhG8Jy8cWqgh0WPK4oyjtDrN1Sbac=; b=qfaihCeg5/tZ5x8zqukb0PCG9lP6UdC52+R+/RbvVdzS7MgNI+gW5pE1BEL13bxW7H iP+P2FYh2AqjqiaReVHgVhU5MLi8YUUD5gT1dXdA5MGVrEW/PY/FeEGUCNvykd3NnSPi aTeihr7ZEeHZrERVftC0zUU8wYx9nGDu9L26E=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; b=wolLCk+0eVoi6gwXGlrHwg9V2L78rBYuV9Tx3I8e+f1VlMgirCzbJfuJ+1HDVTv8jY YX2ZC22O4+XkS7DQNtXi0gAPVqmb93HWYPaqAS3K7REdH0yL4qmTdrsJTlRBUJCIEsI2 RcCLHEG/V+AQZcopRHDpxRurJjzp/iQiCrCb0=
References: <484DF33E.7050303@redhat.com>
Ulrich Drepper wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I got asked a question to which I cannot give a definitive answer.


Assume process A waits for process B (waitpid, waitid, ...)

Process B is stopped (by itself or a third process)

Process A wakes up and is signalled WIFSTOPPED

Now process A calls wait* again.


What is this call supposed to do? There are two possible
interpretations of the standard:

- - status information is the change from running to stopped. This
information has been communicated in the first wait* call and
therefore the second call will block

- - the status of the child is still stopped and therefore the call
will immediately return and signal WIFSTOPPED again


I think the former is right and the next status to return is
WIFCONTINUED.
Agreed.

> Why else should there by WIFCONTINUED.
But:

- - WIFCONTINUED is an XSI option

- - the exact description for WIFSTOPPED is

           True if child is currently stopped

  This seems to imply that the state information is sticky and should
  be re-reported.


I guess the final answer depends on historic practice.  Linux does the
latter, it returns immediately.
I just tested waitpid() and waitid() on Linux. I don't see the behavior you're talking about. Did you have some code that demonstrates the phenomenon?

Cheers,

Michael

<Prev in Thread] Current Thread [Next in Thread>