[Proposal] Add method to shmop ext to retrieve OS shmid

From: Date: Sat, 18 May 2013 14:50:17 +0000
Subject: [Proposal] Add method to shmop ext to retrieve OS shmid
Groups: php.internals 
Request: Send a blank email to internals+get-67450@lists.php.net to get a copy of this message
This grew out of a question I answered on StackOverflow.com: http://stackoverflow.com/questions/16501707/working-with-shared-memory-in-php/ The gist is that a user was converting a C program to PHP and wanted the shmid as reported by ipcs. The user assumed that the id returned by shmop_open would be the shmid, and was confused by the shmop resource identifier. (I explained to him what the return actually was) I suggested he use his own unique key to be able to identify the shared memory created for his script, but he said that it had to be 0x0. I've added a function to retrieve shmop->shmid in my own fork of PHP. You can see the changes here and the commit message contains a quick usage/test script: https://github.com/nedwidek/php-src/commit/832e77fce15de926b562b6dcc28d1864bb7c348b So I guess the questions are: Is there a particular reason that the shmid is hidden from PHP scripts? Is there any reason not to move this to a formal RFC? Should similar methods be added to the sysv* extensions where applicable? Assuming this is an acceptable change to consider, anyone have a better function name than shmop_sys_shmid? Regards, Erik Nedwidek

« previous php.internals (#67450) next »