summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKalle Sommer Nielsen <kalle@php.net>2016-11-19 00:32:07 +0100
committerKalle Sommer Nielsen <kalle@php.net>2016-11-19 00:32:07 +0100
commitddf95667c432a3088fc6d176f4d9d719baaca20c (patch)
treeef3333b5845f43fc662eb3a4ff6ae498b8dd1960
parent271ed78a31e9f8c0658f3ba40e82c09b26ccca3a (diff)
downloadphp-git-ddf95667c432a3088fc6d176f4d9d719baaca20c.tar.gz
Remove support for REALTIME_PRIORITY_CLASS in proc_nice() on Windows.
The reasoning for this is because that it requires special permissions and can in the end be dangerous, discovered by Anatol.
-rw-r--r--ext/standard/tests/general_functions/proc_nice_basic-win.phpt4
-rw-r--r--win32/nice.c8
2 files changed, 4 insertions, 8 deletions
diff --git a/ext/standard/tests/general_functions/proc_nice_basic-win.phpt b/ext/standard/tests/general_functions/proc_nice_basic-win.phpt
index 232389fd90..157ad74783 100644
--- a/ext/standard/tests/general_functions/proc_nice_basic-win.phpt
+++ b/ext/standard/tests/general_functions/proc_nice_basic-win.phpt
@@ -75,8 +75,7 @@ $p = [
'Below normal' => [6, 5],
'Normal' => [8, 0],
'Above normal' => [10, -5],
- 'High priority' => [13, -10],
- 'Real time' => [24, -16]
+ 'High priority' => [13, -10]
];
foreach ($p as $test => $data) {
@@ -93,4 +92,3 @@ Testing 'Below normal' (5): Passed
Testing 'Normal' (0): Passed
Testing 'Above normal' (-5): Passed
Testing 'High priority' (-10): Passed
-Testing 'Real time' (-16): Passed
diff --git a/win32/nice.c b/win32/nice.c
index db26cc1aa6..202a4d8e35 100644
--- a/win32/nice.c
+++ b/win32/nice.c
@@ -30,8 +30,6 @@
* +-----------------------+-----------------------------+
* | Expression | Priority type |
* +-----------------------+-----------------------------+
- * | priority < -14 | REALTIME_PRIORITY_CLASS |
- * +-----------------------+-----------------------------+
* | priority < -9 | HIGH_PRIORITY_CLASS |
* +-----------------------+-----------------------------+
* | priority < -4 | ABOVE_NORMAL_PRIORITY_CLASS |
@@ -48,15 +46,15 @@
*
* This is applied to the main process, not per thread, although this could
* be implemented using SetThreadPriority() at one point.
+ *
+ * Note, it is intended that some priority classes are left out.
*/
PHPAPI int nice(zend_long p)
{
DWORD dwFlag = NORMAL_PRIORITY_CLASS;
- if (p < -14) {
- dwFlag = REALTIME_PRIORITY_CLASS;
- } else if (p < -9) {
+ if (p < -9) {
dwFlag = HIGH_PRIORITY_CLASS;
} else if (p < -4) {
dwFlag = ABOVE_NORMAL_PRIORITY_CLASS;