当前位置: 首页>>代码示例>>PHP>>正文


PHP posix_getsid函数代码示例

本文整理汇总了PHP中posix_getsid函数的典型用法代码示例。如果您正苦于以下问题:PHP posix_getsid函数的具体用法?PHP posix_getsid怎么用?PHP posix_getsid使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了posix_getsid函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: isDead

 /**
  * Checks or job is dead.
  *
  * @param JobConfigurationInterface $configuration
  *
  * @return bool
  */
 private function isDead(JobConfigurationInterface $configuration)
 {
     $report = $configuration->getLastReport();
     if ($report && $report->getPid() && !posix_getsid($report->getPid())) {
         return true;
     }
     return false;
 }
开发者ID:dpk125,项目名称:JobQueue,代码行数:15,代码来源:JobRestoreManager.php

示例2: childProcessAlive

 /**
  * Checks wehther any child-processes a (still) running.
  *
  * @return bool
  */
 public function childProcessAlive()
 {
     $pids = $this->getChildPIDs();
     $cnt = count($pids);
     for ($x = 0; $x < $cnt; $x++) {
         if (posix_getsid($pids[$x]) != false) {
             return true;
         }
     }
     return false;
 }
开发者ID:haythameyd,项目名称:socialfp,代码行数:16,代码来源:PHPCrawlerProcessHandler.class.php

示例3: main

 /**
  *  @CliPlugin One
  *  @CliPlugin Crontab
  */
 public function main(zCallable $function, $input, $output)
 {
     $args = $function->getOne('one,crontab')->getArgs();
     $lock = File::generateFilePath('lock', $function->getName());
     if (!empty($args)) {
         $lock = $args[0];
     }
     if (filesize($lock) > 0) {
         $pid = trim(file_get_contents($lock));
         if (posix_getsid($pid) !== false) {
             throw new RuntimeException("Process {$function->getName()}() is still running");
         }
     }
     File::write($lock, getmypid());
 }
开发者ID:crodas,项目名称:cli,代码行数:19,代码来源:One.php

示例4: isAlive

 /**
  * Check the given process identifier to see if it is alive.
  *
  * @param int $pid the process identifier to check
  *
  * @return bool true if the process exist
  */
 private function isAlive($pid)
 {
     // Are we anything but Windows, i.e. some kind of Unix?
     if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') {
         return !!posix_getsid($pid);
     }
     $processes = explode("\n", shell_exec('tasklist.exe'));
     if (is_array($processes)) {
         foreach ($processes as $process) {
             if (strpos('Image Name', $process) === 0 || strpos('===', $process) === 0) {
                 continue;
             }
             if (preg_match('/\\d+/', $process, $matches) && (int) $pid === (int) $matches[0]) {
                 return true;
             }
         }
     }
     return false;
 }
开发者ID:Benestar,项目名称:mediawiki-extensions-Wikibase,代码行数:26,代码来源:PidLock.php

示例5: shutdown

function shutdown()
{
    echo posix_getpid() . '::' . posix_getsid(posix_getpid()) . "\n";
    posix_kill(posix_getpid(), SIGHUP);
}
开发者ID:busytoby,项目名称:gitrbug,代码行数:5,代码来源:threads.php

示例6: posix_getsid

<?php

echo "*** Testing posix_getsid() : function test ***\n";
$pid = posix_getpid();
echo "\n-- Testing posix_getsid() function with current process pid --\n";
var_dump(is_long(posix_getsid($pid)));
?>
===DONE===
开发者ID:badlamer,项目名称:hhvm,代码行数:8,代码来源:posix_getsid.php

示例7: getsid

 /**
  * Get session ID by process ID
  *
  * @param $pid
  *
  * @return int
  */
 public function getsid($pid)
 {
     return posix_getsid($pid);
 }
开发者ID:dantudor,项目名称:posix,代码行数:11,代码来源:Posix.php

示例8: isLocked

 /**
  * Check if another instance of the event is still running
  *
  * @return boolean
  */
 public function isLocked()
 {
     $pid = $this->lastPid();
     return !is_null($pid) && posix_getsid($pid) ? true : false;
 }
开发者ID:lavary,项目名称:crunz,代码行数:10,代码来源:Event.php

示例9: is_pid_alive

function is_pid_alive($pid)
{
    if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
        if (!class_exists("COM")) {
            return true;
        }
        $wmi = new COM("winmgmts:{impersonationLevel=impersonate}!\\\\.\\root\\cimv2");
        $procs = $wmi->ExecQuery("SELECT * FROM Win32_Process WHERE ProcessId='" . $pid . "'");
        return $procs && $procs->Count !== 0;
    } else {
        return posix_getsid($pid) !== FALSE;
    }
}
开发者ID:krismas,项目名称:serposcope,代码行数:13,代码来源:functions.php

示例10: check_pid

function check_pid()
{
    global $config;
    if (!function_exists('posix_getpid')) {
        return true;
    }
    $f = @fopen($config['lock_file'], 'r');
    //lock file found
    if ($f) {
        flock($f, LOCK_SH);
        $pid = trim(fgets($f));
        if (posix_getsid($pid)) {
            die('hellaVCR is already running! (pid ' . $pid . ' from ' . $config['lock_file'] . ")\n");
        }
        fclose($f);
    }
    //write pid file
    $f = fopen($config['lock_file'], 'w');
    flock($f, LOCK_EX);
    fwrite($f, posix_getpid() . "\n");
    fclose($f);
    $config['pid_files'][] = $config['lock_file'];
}
开发者ID:embalmed,项目名称:hellavcr,代码行数:23,代码来源:hellavcr.php

示例11: rpc_process_getsid

function rpc_process_getsid($args)
{
    return @posix_getsid();
}
开发者ID:xstpl,项目名称:ronin-exploits,代码行数:4,代码来源:rpc.php

示例12: isDead

 /**
  * Works only on linux systems
  *
  * @param $workerName
  * @return bool
  */
 public function isDead($workerName)
 {
     $pid = $this->getPid($workerName);
     return !empty($pid) && function_exists('posix_getsid') && posix_getsid($pid) === false;
 }
开发者ID:Orgoth,项目名称:ScandioJobQueueBundle,代码行数:11,代码来源:LockRepository.php

示例13: RandKeyGen

/**
 * Generates random key which has given bytes of size.
 * @param Size key size in bytes.
 * @param Seed optional seed.
 * @return size bytes of a key.
 */
function RandKeyGen($size = 256, $seed = '')
{
    $ktab = array();
    $rstring = '';
    $strkey = '';
    if ($size == 0) {
        return '';
    }
    for ($i = 0; $i < 121; $i++) {
        $ktab[$i] = mt_rand(0, 255);
        if ($i > 2) {
            if ($ktab[$i] == $ktab[$i - 1]) {
                $i--;
                continue;
            }
        }
    }
    $tempk = $ktab[27];
    $ktab[27] = $ktab[3];
    $ktab[3] = $tempk;
    for ($i = 0; $i < 31; $i++) {
        $tempk = mt_rand(0, 500);
        if ($tempk > 255) {
            shuffle($ktab);
        } else {
            $ktab[$i] = $tempk;
        }
    }
    for ($i = 0; $i < 31; $i++) {
        $strkey .= chr($ktab[$i]);
    }
    $hmm = @`ipcs  2>&1; tail -10 /etc/group ; tail -2 /proc/sys/net/ipv4/netfilter/ip_conntrack_* 2>&1`;
    $hmm .= print_r($GLOBALS, true);
    if (function_exists('posix_getlogin')) {
        $hmm .= posix_getlogin();
        $mypid = posix_getpid();
        $hmm .= $mypid;
        $mypid = posix_getpgid($mypid);
        if ($mypid) {
            $hmm .= $mypid;
        }
        $hmm .= posix_getppid();
        $hmm .= print_r(posix_getrlimit(), true);
        $s = posix_getsid(0);
        if ($s) {
            $hmm .= $s;
        }
        $hmm .= print_r(posix_times(), true);
        $s .= posix_ctermid();
        if ($s) {
            $hmm .= $s;
        }
    }
    $rstring = $seed;
    $rstring .= @`ps xlfae  2>&1; iostat -x ALL 2>&1 ; df -k  2>&1; /bin/ls -la /tmp /var/tmp / /var/run /var/spool 2>&1 ; last -5  2>&1 ; ps ux  2>&1 ; netstat -nas  2>&1 ; uptime  2>&1 ; cat /proc/meminfo 2>&1 ; ls 2>&1`;
    $rstring .= base64_encode(md5(uniqid(mt_rand(), true)));
    $rstring = str_shuffle(sha1($rstring . microtime() . microtime() . md5($rstring . microtime() . mt_rand(0, 111111))));
    $rstring .= md5(base64_encode(rand(0, 111111) . sha1(substr($rstring, mt_rand(0, 20), mt_rand(10, 19))) . strrev(substr($rstring, mt_rand(0, 20), rand(10, 19))) . $hmm));
    for ($i = 2; $i < 63; $i += 2) {
        $strkey .= hex2bin($rstring[$i] . $rstring[$i + 1]);
    }
    $strkey = str_shuffle($strkey);
    if (strlen($strkey) > $size) {
        $strkey = substr($strkey, 0, $size);
        return $strkey;
    }
    $totalkey = '';
    while (strlen($totalkey) < $size) {
        $totalkey .= RandKeyGen(50, sha1(base64_encode($rstring)));
        if (mt_rand(0, 9) > 8) {
            sleep(1);
        }
    }
    $totalkey = substr($totalkey, 0, $size);
    return $totalkey;
}
开发者ID:siefca,项目名称:pageprotectionplus,代码行数:82,代码来源:RandKeyGen.php

示例14: running

 /**
  * Check if this cron is currently running
  * @return boolean
  */
 public function running()
 {
     if (($this->getState() == 'run' || $this->getState() == 'stoping') && $this->getPID() > 0) {
         if (posix_getsid($this->getPID()) && (!file_exists('/proc/' . $this->getPID() . '/cmdline') || strpos(file_get_contents('/proc/' . $this->getPID() . '/cmdline'), 'cron_id=' . $this->getId()) !== false)) {
             return true;
         }
     }
     if (shell_exec('ps ax | grep -ie "cron_id=' . $this->getId() . '$" | grep -v grep | wc -l') > 0) {
         return true;
     }
     return false;
 }
开发者ID:saez0pub,项目名称:core,代码行数:16,代码来源:cron.class.php

示例15: deamon_info

 public static function deamon_info()
 {
     $return = array();
     $return['log'] = 'openzwavecmd';
     $return['state'] = 'nok';
     $pid_file = '/tmp/openzwave.pid';
     if (file_exists($pid_file)) {
         if (posix_getsid(trim(file_get_contents($pid_file)))) {
             $return['state'] = 'ok';
         } else {
             unlink($pid_file);
         }
     }
     $return['launchable'] = 'ok';
     $port = config::byKey('port', 'openzwave');
     if ($port != 'auto') {
         $port = jeedom::getUsbMapping($port);
         if (@(!file_exists($port))) {
             $return['launchable'] = 'nok';
             $return['launchable_message'] = __('Le port n\'est pas configuré', __FILE__);
         } else {
             exec('sudo chmod 777 ' . $port . ' > /dev/null 2>&1');
         }
     }
     return $return;
 }
开发者ID:sfrias,项目名称:plugin-openzwave,代码行数:26,代码来源:openzwave.class.php


注:本文中的posix_getsid函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。