X-Git-Url: http://git.pjr.cc/?p=CBFWR.git;a=blobdiff_plain;f=libcbfwr%2Fcomms.php;h=a11f9b3750bf1db3cc73b56eca82f6d0e6c7663e;hp=db0215e7d6999220cfb16c41412a0573c3285232;hb=0f5458e4a9c18595f7d9501880011369e4e65942;hpb=90e37664d8296ebb5f3aae443b44b09f95826e90 diff --git a/libcbfwr/comms.php b/libcbfwr/comms.php index db0215e..a11f9b3 100644 --- a/libcbfwr/comms.php +++ b/libcbfwr/comms.php @@ -15,23 +15,38 @@ class Comms { $this->msgres = msg_get_queue($MESSAGE_KEY, 0666); } - function getConfig() + function getConfig($type=0) { global $MESSAGE_KEY, $LOCKING_KEY, $STORE_KEY; sem_acquire($this->semres); $shm_space = shm_attach($STORE_KEY, 16*1024*1024); - $config = shm_get_var($shm_space, 0); + $config = shm_get_var($shm_space, $type); sem_release($this->semres); return $config; } - function putConfig($config) + function lockConfigs() + { + sem_acquire($this->semres); + } + + function unlockConfigs() + { + sem_release($this->semres); + } + + + // type = 0 for the fs config + // type = 1 for the boot hardware config + // type = 2 for running config + // type = 3 for web config + function putConfig($config, $type=0) { global $MESSAGE_KEY, $LOCKING_KEY, $STORE_KEY; sem_acquire($this->semres); $shm_space = shm_attach($STORE_KEY, 16*1024*1024); - shm_put_var($shm_space, 0, $config); + shm_put_var($shm_space, $type, $config); sem_release($this->semres); }