note 126009 added to function.proc-nice

From: Date: Thu, 15 Apr 2021 01:43:54 +0000
Subject: note 126009 added to function.proc-nice
Groups: php.notes 
Request: Send a blank email to php-notes+get-216283@lists.php.net to get a copy of this message
It is important to note that this is a relative change. I didn't read the description properly and couldn't figure out why setting proc_nice(0) didn't take the forked children back to 0! For example if you run: <?php proc_nice(-5); proc_nice(0); // will have no effect proc_nice(5); // will take the niceness back to 0 ?> In PHP CLI under Debian (and probably many other Linux flavours) you can read the 'niceness' from the proc filesystem. (There may be a PHP command that gives this info but there doesn't seem to be a link to it on this page.) E.g <?php $Current_Niceness_Value = intval(explode(" ",file_get_contents("/proc/".getmypid()."/stat"))[18]); // Note: Older versions of Linux return an unsigned integer which has to be converted to a signed integer. $Current_Niceness_Value = unpack("l",pack("L",intval(explode(" ",file_get_contents("/proc/".getmypid()."/stat"))[18])))[1]; ?> ---- Server IP: 45.112.84.4 Probable Submitter: 45.112.85.242 (proxied: 220.240.153.76) ---- Manual Page -- https://php.net/manual/en/function.proc-nice.php Edit -- https://main.php.net/note/edit/126009 Del: integrated -- https://main.php.net/note/delete/126009/integrated Del: useless -- https://main.php.net/note/delete/126009/useless Del: bad code -- https://main.php.net/note/delete/126009/bad+code Del: spam -- https://main.php.net/note/delete/126009/spam Del: non-english -- https://main.php.net/note/delete/126009/non-english Del: in docs -- https://main.php.net/note/delete/126009/in+docs Del: other reasons-- https://main.php.net/note/delete/126009 Reject -- https://main.php.net/note/reject/126009 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#216283) next »