Skip to content

pcntl_wait / pcntl_waitpid: Document the rusage parameter (fixes #861) - #4917

Open
AllenJB wants to merge 5 commits into
php:masterfrom
AllenJB:pcntl_wait_rusage
Open

pcntl_wait / pcntl_waitpid: Document the rusage parameter (fixes #861)#4917
AllenJB wants to merge 5 commits into
php:masterfrom
AllenJB:pcntl_wait_rusage

Conversation

@AllenJB

@AllenJB AllenJB commented Oct 11, 2025

Copy link
Copy Markdown
Contributor

No description provided.

@TimWolla TimWolla left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pcntl_waitid already has the parameter documented. Can you align the explanation: https://www.php.net/manual/en/function.pcntl-waitid.php?

Comment thread reference/pcntl/functions/pcntl-wait.xml Outdated
) (remove duplicate example; align parameter descriptions)
) (remove duplicate example; align parameter descriptions)
) (remove duplicate example; align parameter descriptions)
@AllenJB

AllenJB commented Oct 28, 2025

Copy link
Copy Markdown
Contributor Author

pcntl_waitid already has the parameter documented. Can you align the explanation: https://www.php.net/manual/en/function.pcntl-waitid.php?

Done

@AllenJB
AllenJB requested a review from TimWolla October 28, 2025 16:07

@TimWolla TimWolla left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Except for the example this LGTM. Perhaps it makes sense to split the example off in another PR?

print "PARENT pcntl_waitpid: No exited children.\n";
} else {
print "PARENT pcntl_waitpid: Child PID {$deadPid} exited with status: "
. pcntl_wexitstatus($status) ."\n";

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation for wexitstatus says:

This function is only useful if pcntl_wifexited() returned true.

So, is a wifexited call missing here? Looking more carefully at the example, it uses quite a few functions from the pcntl extension. It might make sense to include it in https://www.php.net/manual/en/pcntl.example.php instead.

Comment on lines +161 to +163
&reftitle.examples;
<para>
<example>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Useless wrapping para tag

Comment on lines +89 to +102
<varlistentry>
<term><parameter>resource_usage</parameter></term>
<listitem>
<para>
The <parameter>resource_usage</parameter> parameter is set to an
associative <type>array</type> containing resource usage statistics
from the child process.

This is supported either if the wait6 system call is available
(e.g. on FreeBSD), or on Linux through the raw waitid system call. For
information on the contents see <function>getrusage</function>.
</para>
</listitem>
</varlistentry>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Considering how often this is repeated, an XInclude or XML entity to have consistent wording would be better

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants