Req #53173 [Opn->Fbk]: shm_stat to get total & free

From: Date: Wed, 08 Sep 2021 17:00:51 +0000
Subject: Req #53173 [Opn->Fbk]: shm_stat to get total & free
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-236474@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=53173&edit=1 ID: 53173 Updated by: cmb@php.net Reported by: marc-bennewitz at arcor dot de Summary: shm_stat to get total & free -Status: Open +Status: Feedback Type: Feature/Change Request Package: Semaphore related Operating System: Linux PHP Version: Irrelevant -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: > The patch exists for 9 month ! Checks notes – 10 years now! Consider to submit the patch as pull request[1] for better visibility. [1] <https://github.com/php/php-src/pulls> Previous Comments: ------------------------------------------------------------------------ [2011-08-03 06:15:23] marc-bennewitz at arcor dot de what is the state of this issue ? The patch exists for 9 month ! ------------------------------------------------------------------------ [2010-10-26 21:18:55] marc-bennewitz at arcor dot de Description: ------------ Adding function to get total size of memory and to get free size of memory of the opened shm segment. Test script: --------------- From test script: // test errors var_dump(shm_stat()); var_dump(shm_stat(1)); var_dump(shm_stat("")); // open shm segment $key = ftok(dirname(__FILE__)."/008.phpt", 't'); $shmId = shm_attach($key, 1024); var_dump($shmId); // first stat call var_dump(shm_stat($shmId)); // write data + stat var_dump(shm_put_var($shmId, 10, '10')); var_dump(shm_put_var($shmId, 20, '20')); var_dump(shm_put_var($shmId, 30, '30')); var_dump(shm_stat($shmId)); // remove data + stat var_dump(shm_remove_var($shmId, 20)); var_dump(shm_stat($shmId)); // re-open shm segment with different size + stat var_dump(shm_detach($shmId)); $shmId = shm_attach($key, 10240); var_dump($shmId); var_dump(shm_stat($shmId)); // remove shm segment + stat var_dump(shm_remove($shmId)); var_dump(shm_stat($shmId)); echo "Done\n"; Expected result: ---------------- Warning: shm_stat() expects exactly 1 parameter, 0 given in %s on line %d bool(false) Warning: shm_stat() expects parameter 1 to be resource, integer given in %s on line %d bool(false) Warning: shm_stat() expects parameter 1 to be resource, string given in %s on line %d bool(false) resource(%d) of type (sysvshm) array(2) { ["total"]=> int(1024) ["free"]=> int(%d) } bool(true) bool(true) bool(true) array(2) { ["total"]=> int(1024) ["free"]=> int(%d) } bool(true) array(2) { ["total"]=> int(1024) ["free"]=> int(%d) } bool(true) resource(%d) of type (sysvshm) array(2) { ["total"]=> int(1024) ["free"]=> int(%d) } bool(true) array(2) { ["total"]=> int(1024) ["free"]=> int(%d) } Done ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=53173&edit=1

« previous php.bugs (#236474) next »