X-Git-Url: http://git.pjr.cc/?p=CBFWR.git;a=blobdiff_plain;f=libcbfwr%2Fcomms.php;h=7486150c20e711ab26badd75912673e26b5875c3;hp=610959e04d0482fe69d40541f9db5dd458a34038;hb=cb45585d92144a65ff25bc1109cde4cbf60913de;hpb=175dadf56670772f8d889276df67471354a36f21 diff --git a/libcbfwr/comms.php b/libcbfwr/comms.php index 610959e..7486150 100644 --- a/libcbfwr/comms.php +++ b/libcbfwr/comms.php @@ -1,11 +1,12 @@ semres); - $shm_space = shm_attach($STORE_KEY, 16*1024*1024); + $shm_space = shm_attach($STORE_KEY, $CONF_STORE_SIZE); $config = shm_get_var($shm_space, $type); sem_release($this->semres); return $config; } + function lockConfigs() + { + sem_acquire($this->semres); + } + + function unlockConfigs() + { + sem_release($this->semres); + } - // type = 0 for the main config + function deleteConfig($type) + { + global $MESSAGE_KEY, $LOCKING_KEY, $STORE_KEY, $CONF_STORE_SIZE; + $shm_space = shm_attach($STORE_KEY, $CONF_STORE_SIZE); + + shm_remove_var($shm_space, $type); + } + + // type = 0 for the fs config // type = 1 for the boot hardware config + // type = 2 for running config + // type = 3 for web config + + // type = 4 for merged running config cache + // type = 5 for merged web config cache + + // type = 6 for "messages" that appear on the pages function putConfig($config, $type=0) { - global $MESSAGE_KEY, $LOCKING_KEY, $STORE_KEY; + global $MESSAGE_KEY, $LOCKING_KEY, $STORE_KEY, $CONF_STORE_SIZE; sem_acquire($this->semres); - $shm_space = shm_attach($STORE_KEY, 16*1024*1024); + $shm_space = shm_attach($STORE_KEY, $CONF_STORE_SIZE); shm_put_var($shm_space, $type, $config); sem_release($this->semres); }