Esempio n. 1
0
 public function __construct($msgQid, $queueDepth, $maxMsgSize, $bUseShmQ = false)
 {
     $this->msgQid = $msgQid;
     $lockFile = LsSys::GetEcosphereIpcLockFile(LsSys::ECO_IPC_QUEUE_ID);
     //
     // Just use SVR4 IPC message queues if it's defined.
     //
     if (@function_exists(msg_get_queue) && $bUseShmQ == false) {
         $this->mQ = msg_get_queue($msgQid);
     } else {
         $this->bIsShmQ = true;
         $this->mQ = LsShmQueue::Factory($msgQid, $queueDepth, $queueDepth * $maxMsgSize, $lockFile);
     }
 }
Esempio n. 2
0
 public function __construct($keyId, $cacheSize = 0)
 {
     //
     // This means we're just instancing the basics to communicate with
     // the lock file and the catalog.  The actual size of the objects
     // will be discovered.
     //
     $this->pageSize = LsTinyCache::PAGE_SIZE;
     if ($cacheSize == 0) {
         $this->discoveryMode = LsTinyCache::AUTO;
         $this->cacheSize = 0;
         $this->numPages = 0;
     } else {
         $this->cacheSize = LsRoundUp($cacheSize, $this->pageSize);
         $this->numPages = $this->cacheSize / $this->pageSize;
     }
     $this->catalogShmKey = $keyId;
     $this->cacheShmKey = $keyId + 4096;
     $this->lockFileName = LsSys::GetEcosphereIpcLockFile($keyId);
 }
Esempio n. 3
0
 /**
  *********************************************************************************************
  * @param String $filename This may be a filename under the default logdir
  * or it may be an explicit filename which is flagged by the $bCreateUnderDefaultLogDir param.
  * @param Integer $priority Specified from the class constants of the KLogger class.
  * @param KLogger $pLogger Reference to the logger instance we create here.
  * @param Boolean $bCreateUnderDefaultLogDir 'true' if you want to use the default-Company log dir
  * and false if you want to specify your own specific filename as the $filename param.
  * @return errno -- EOK if no error.
  *                   EPERM if we can't create the filename.
  */
 public function CreateLoggerInstance($loggerKeyName, $filename, $priority, &$pLogger, $bCreateUnderDefaultLogDir = true)
 {
     //
     // Check to see if this logger already exists.
     //
     if (isset($this->loggers[$loggerKeyName])) {
         return EEXIST;
     }
     //
     // Check to see if the caller wants to use the default log file location.
     //
     if ($bCreateUnderDefaultLogDir == true) {
         if (!file_exists(LsSys::GetRootLogPath())) {
             // Owner:  RW
             // Group:  RW
             // Others: R
             mkdir(LsSys::GetRootLogPath(), 0664, true);
         }
         $logFile = LsSys::GetRootLogPath() . "/" . $filename;
     } else {
         //
         // In this case we're creating a specific logfile.
         //
         $logFile = $filename;
     }
     //
     // Create the logger instance in the reference provided.
     //
     $pLogger = new KLogger($logFile, $priority);
     if ($pLogger->Log_Status != KLogger::LOG_OPEN) {
         echo "Failure to create logger {$logFile}\n";
         return EPERM;
     }
     //
     // Store the logger on the sysinfo structure.
     //
     $this->loggers[$loggerKeyName] = $pLogger;
     $this->logFileNames[$loggerKeyName] = $filename;
     return EOK;
 }
Esempio n. 4
0
 public function __construct()
 {
     //
     // Set the server name and ip address.
     //
     $this->hostname = gethostname();
     $this->hostIpAddr = gethostbyname($this->hostname);
     $this->portNumber = $this->GetMainListeningPortNumber();
     //
     // Set the operating system
     //
     $this->operatingSystem = LsSys::GetOS();
     //
     // Create the listening and worker threads.
     //
     $this->listenThread = $this->AddThread();
     $this->listenThread->Name("ListeningThread");
     $this->listenThread->SetRunFunction($this, 'ThreadEntryPoint');
 }