Re: [PHP4BETA] Questions on sem_* and shm_* functions
| From: | Stanislav Malyshev | Date: | Sun, 18 Jun 2000 07:41:52 +0000 |
| Subject: | Re: [PHP4BETA] Questions on sem_* and shm_* functions | ||
| References: | 1 | Groups: | php.dev php.version4 |
| Request: | Send a blank email to php-version4+get-16312@lists.php.net to get a copy of this message | ||
SB>> - What is the perm argument of sem_get() and shm_attach() for? Is
SB>> this, too, needed to be emulated?
For shmget that's permissions. Manual says this:
mode_flags (lowest 9 bits)
specifying the permissions granted to the
owner, group, and world. Presently, the exe-
cute permissions are not used by the system.
SB>> - What does shm_attach() return if for some reason the creation or
SB>> opening of a shared memory segment fails? Although it is unlikely
SB>> that this may happen with nmy fake shared memory implementation, as
SB>> the variables are held in a SQL table instead of RAM.
From the code I see it returns false on failure.
SB>> - Is it true that shm_detach() only removes the shm_identifier for a
SB>> shared memory segment from some sort of list but doesn't remove the
SB>> stored variables of that segement?
Not exactly. If reference count for this segment for the script reaches 0,
it calls shmdt, detaching this segment.
SB>> - How do the functions shm_get_var() and shm_remove_var() behave if
SB>> the given shared memory segment and / or variable doesn't exist?
They return false and issue warning.
SB>> - How do the functions shm_detach() and shm_remove() behave if
SB>> the given shared memory segment doesn't exist?
shm_detach have no checks. _remove returns false on error.
SB>> - How do the functions sem_acquire() and sem_release() behave if the
SB>> given semaphore doesn't exist?
They return false and print warning if something bad happens.
--
Stanislav Malyshev stas@zend.com
+972-3-6139665