From 9b92d7c09329039287ecc023838684d9af80a541 Mon Sep 17 00:00:00 2001 From: David Carlier Date: Sun, 7 Apr 2024 21:53:58 +0100 Subject: [PATCH] ext/pcntl: getpriority/setpriority `who` default value handling change. 0 refers to the calling process, all across unixes, thus saving one syscall. --- ext/pcntl/pcntl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/pcntl/pcntl.c b/ext/pcntl/pcntl.c index 69b3b1f19acd7..05f88b7a5f3a9 100644 --- a/ext/pcntl/pcntl.c +++ b/ext/pcntl/pcntl.c @@ -1014,7 +1014,7 @@ PHP_FUNCTION(pcntl_getpriority) /* needs to be cleared, since any returned value is valid */ errno = 0; - pid = pid_is_null ? getpid() : pid; + pid = pid_is_null ? 0 : pid; pri = getpriority(who, pid); if (errno) { @@ -1068,7 +1068,7 @@ PHP_FUNCTION(pcntl_setpriority) Z_PARAM_LONG(who) ZEND_PARSE_PARAMETERS_END(); - pid = pid_is_null ? getpid() : pid; + pid = pid_is_null ? 0 : pid; if (setpriority(who, pid, pri)) { PCNTL_G(last_error) = errno;