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


PHP getmygid函数代码示例

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


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

示例1: _execTest

 /**
  * Checks the GID of the PHP process to make sure it is above PHPSECINFO_MIN_SAFE_GID
  *
  * @see PHPSECINFO_MIN_SAFE_GID
  */
 function _execTest()
 {
     if (getmygid() >= PHPSECINFO_MIN_SAFE_GID) {
         return PHPSECINFO_TEST_RESULT_OK;
     }
     return PHPSECINFO_TEST_RESULT_WARN;
 }
开发者ID:rhertzog,项目名称:lcs,代码行数:12,代码来源:gid.php

示例2: sendPHPInfo

 /**
  * @param CommandSender $sender
  */
 public function sendPHPInfo(CommandSender $sender)
 {
     $info = ["CWD" => getcwd(), "GID" => getmygid(), "PID" => getmypid(), "UID" => getmyuid(), "Memory-usage" => memory_get_usage(true), "Memory-peak-usage" => memory_get_peak_usage(true), "PHP-version" => phpversion(), "Zend-version" => zend_version()];
     foreach ($info as $key => $value) {
         $sender->sendMessage($key . ": " . $value);
     }
 }
开发者ID:happyexceed,项目名称:PocketMine-Plugins-1,代码行数:10,代码来源:PHPUtils.php

示例3: mount

 public function mount()
 {
     $this->runCommand("sudo mount -t tmpfs -o size={$this->getSizeMb()}m tmpfs {$this->ram_disk_path}");
     $uid = getmyuid();
     $gid = getmygid();
     $this->runCommand("sudo chown {$uid}:{$gid} {$this->ram_disk_path}");
     $this->runCommand("chmod 0755 {$this->ram_disk_path}");
 }
开发者ID:eileenmcnaughton,项目名称:amp,代码行数:8,代码来源:LinuxRamDisk.php

示例4: sd_pid_notify_with_fds

/**
 * sd_pid_notify_with_fds PHP implementation
 *
 * @param int    $pid FIXME currently not usable!
 * @param bool   $unset_environment
 * @param string $state
 * @param array  $fds
 *
 * @return int
 *
 * @link https://github.com/systemd/systemd/blob/master/src/libsystemd/sd-daemon/sd-daemon.c
 */
function sd_pid_notify_with_fds($pid, $unset_environment, $state, array $fds)
{
    $state = trim($state);
    if ('' === $state) {
        $r = -EINVAL;
        goto finish;
    }
    $e = getenv('NOTIFY_SOCKET');
    if (!$e) {
        return 0;
    }
    /* Must be an abstract socket, or an absolute path */
    if (strlen($e) < 2 || strpos($e, '@') !== 0 && strpos($e, '/') !== 0) {
        $r = -EINVAL;
        goto finish;
    }
    $fd = socket_create(AF_UNIX, SOCK_DGRAM, 0);
    if (!$fd) {
        $r = -1 * socket_last_error();
        goto finish;
    }
    $msghdr = ['name' => ['path' => $e], 'iov' => [$state . "\n"], 'control' => []];
    if (strpos($msghdr['name']['path'], '@') === 0) {
        $msghdr['name'][0] = "";
    }
    $pid = (int) $pid;
    $have_pid = $pid && getmypid() !== $pid;
    if (count($fds) > 0 || $have_pid) {
        if (count($fds)) {
            $msghdr['control'][] = ['level' => SOL_SOCKET, 'type' => SCM_RIGHTS, 'data' => $fds];
        }
        if ($have_pid) {
            $msghdr['control'][] = ['level' => SOL_SOCKET, 'type' => SCM_CREDENTIALS, 'data' => ['pid' => $pid, 'uid' => getmyuid(), 'gid' => getmygid()]];
        }
    }
    /* First try with fake ucred data, as requested */
    if (@socket_sendmsg($fd, $msghdr, MSG_NOSIGNAL) !== false) {
        $r = 1;
        goto finish;
    }
    /* If that failed, try with our own ucred instead */
    if ($have_pid) {
        $msghdr['control'] = [];
        if (@socket_sendmsg($fd, $msghdr, MSG_NOSIGNAL) !== false) {
            $r = 1;
            goto finish;
        }
    }
    $r = -1 * socket_last_error($fd);
    finish:
    if (isset($fd) && $fd) {
        socket_close($fd);
    }
    if ($unset_environment) {
        putenv('NOTIFY_SOCKET');
    }
    return $r;
}
开发者ID:mekras,项目名称:php-systemd,代码行数:70,代码来源:functions.php

示例5: randomBytes

function randomBytes($length = 16, $secure = true, $raw = true, $startEntropy = "", &$rounds = 0, &$drop = 0)
{
    static $lastRandom = "";
    $output = "";
    $length = abs((int) $length);
    $secureValue = "";
    $rounds = 0;
    $drop = 0;
    while (!isset($output[$length - 1])) {
        //some entropy, but works ^^
        $weakEntropy = array(is_array($startEntropy) ? implode($startEntropy) : $startEntropy, serialize(stat(__FILE__)), __DIR__, PHP_OS, microtime(), (string) lcg_value(), (string) PHP_MAXPATHLEN, PHP_SAPI, (string) PHP_INT_MAX . "." . PHP_INT_SIZE, serialize($_SERVER), serialize(get_defined_constants()), get_current_user(), serialize(ini_get_all()), (string) memory_get_usage() . "." . memory_get_peak_usage(), php_uname(), phpversion(), extension_loaded("gmp") ? gmp_strval(gmp_random(4)) : microtime(), zend_version(), (string) getmypid(), (string) getmyuid(), (string) mt_rand(), (string) getmyinode(), (string) getmygid(), (string) rand(), function_exists("zend_thread_id") ? (string) zend_thread_id() : microtime(), var_export(@get_browser(), true), function_exists("getrusage") ? @implode(getrusage()) : microtime(), function_exists("sys_getloadavg") ? @implode(sys_getloadavg()) : microtime(), serialize(get_loaded_extensions()), sys_get_temp_dir(), (string) disk_free_space("."), (string) disk_total_space("."), uniqid(microtime(), true), file_exists("/proc/cpuinfo") ? file_get_contents("/proc/cpuinfo") : microtime());
        shuffle($weakEntropy);
        $value = hash("sha512", implode($weakEntropy), true);
        $lastRandom .= $value;
        foreach ($weakEntropy as $k => $c) {
            //mixing entropy values with XOR and hash randomness extractor
            $value ^= hash("sha256", $c . microtime() . $k, true) . hash("sha256", mt_rand() . microtime() . $k . $c, true);
            $value ^= hash("sha512", (string) lcg_value() . $c . microtime() . $k, true);
        }
        unset($weakEntropy);
        if ($secure === true) {
            $strongEntropyValues = array(is_array($startEntropy) ? hash("sha512", $startEntropy[($rounds + $drop) % count($startEntropy)], true) : hash("sha512", $startEntropy, true), file_exists("/dev/urandom") ? fread(fopen("/dev/urandom", "rb"), 64) : str_repeat("", 64), (function_exists("openssl_random_pseudo_bytes") and version_compare(PHP_VERSION, "5.3.4", ">=")) ? openssl_random_pseudo_bytes(64) : str_repeat("", 64), function_exists("mcrypt_create_iv") ? mcrypt_create_iv(64, MCRYPT_DEV_URANDOM) : str_repeat("", 64), $value);
            $strongEntropy = array_pop($strongEntropyValues);
            foreach ($strongEntropyValues as $value) {
                $strongEntropy = $strongEntropy ^ $value;
            }
            $value = "";
            //Von Neumann randomness extractor, increases entropy
            $bitcnt = 0;
            for ($j = 0; $j < 64; ++$j) {
                $a = ord($strongEntropy[$j]);
                for ($i = 0; $i < 8; $i += 2) {
                    $b = ($a & 1 << $i) > 0 ? 1 : 0;
                    if ($b != (($a & 1 << $i + 1) > 0 ? 1 : 0)) {
                        $secureValue |= $b << $bitcnt;
                        if ($bitcnt == 7) {
                            $value .= chr($secureValue);
                            $secureValue = 0;
                            $bitcnt = 0;
                        } else {
                            ++$bitcnt;
                        }
                        ++$drop;
                    } else {
                        $drop += 2;
                    }
                }
            }
        }
        $output .= substr($value, 0, min($length - strlen($output), $length));
        unset($value);
        ++$rounds;
    }
    $lastRandom = hash("sha512", $lastRandom, true);
    return $raw === false ? bin2hex($output) : $output;
}
开发者ID:Kengaming1st,项目名称:Secure-PHP-Random-Bytes,代码行数:56,代码来源:randomBytes.php

示例6: url_stat

 public function url_stat($path)
 {
     $mode = 0666;
     $uid = 0;
     $gid = 0;
     $len = strlen('fiemulate://');
     $type = substr($path, $len, 1);
     switch (substr($path, $len, 1)) {
         case 'u':
             $uid = getmyuid();
             $gid = getmygid() + 1;
             switch (substr($path, $len + 2)) {
                 case 'not_readable':
                     $mode &= ~0400;
                     break;
                 case 'not_writable':
                     $mode &= ~0200;
                     break;
             }
             break;
         case 'g':
             $uid = getmyuid() + 1;
             $gid = getmygid();
             switch (substr($path, $len + 2)) {
                 case 'not_readable':
                     $mode &= ~0440;
                     break;
                 case 'not_writable':
                     $mode &= ~0220;
                     break;
             }
             break;
         case 'o':
             $uid = getmyuid() + 1;
             $gid = getmygid() + 1;
             switch (substr($path, $len + 2)) {
                 case 'not_readable':
                     $mode &= ~0444;
                     break;
                 case 'not_writable':
                     $mode &= ~0222;
                     break;
             }
             break;
         case 'a':
             $uid = getmyuid();
             $gid = getmygid();
             break;
     }
     $keys = array('dev', 'ino', 'mode', 'nlink', 'uid', 'gid', 'rdev', 'size', 'atime', 'mtime', 'ctime', 'blksize', 'blocks');
     $values = array(0, 0, $mode, 0, $uid, $gid, 0, 0, 0, 0, 0, 0, 0);
     foreach ($keys as $index => $key) {
         $values[$key] = $values[$index];
     }
     return $values;
 }
开发者ID:kylekatarnls,项目名称:sbp,代码行数:56,代码来源:utilsTest.php

示例7: matchingLetter

 public static function matchingLetter($file)
 {
     if (fileowner($file) === getmyuid()) {
         return 'u';
     }
     if (filegroup($file) === getmygid()) {
         return 'g';
     }
     return 'o';
 }
开发者ID:kylekatarnls,项目名称:sbp,代码行数:10,代码来源:FileHelper.php

示例8: state

 /**
  * @param null $value
  *
  * @return bool
  */
 public static function state($value = null)
 {
     $stateFile = sprintf("/tmp/sonata_behat_test_%s.state", getmygid());
     if (!is_file($stateFile)) {
         file_put_contents($stateFile, "0");
     }
     if ($value === null) {
         return file_get_contents($stateFile) === "0" ? false : true;
     }
     file_put_contents($stateFile, $value === true ? "1" : "0");
 }
开发者ID:plusteams,项目名称:xxxx,代码行数:16,代码来源:CiHelper.php

示例9: pull_project

 public function pull_project()
 {
     if (!is_cli()) {
         echo 'This controller must run from command line interface only.' . PHP_EOL;
         return;
     }
     exec('git pull');
     exec('chown ' . getmyuid() . ':' . getmygid() . ' ' . FCPATH . '.. -R');
     exec('chmod 0777 ' . APPPATH . 'cache');
     exec('chmod 0777 ' . APPPATH . 'logs');
 }
开发者ID:paranic,项目名称:codeigniter-skeleton,代码行数:11,代码来源:Shell.php

示例10: isWritable

 /**
  * Check if path is writable.
  *
  * @param string $path
  * @return bool
  */
 public static function isWritable($path)
 {
     if (!is_writable($path)) {
         return false;
     }
     if (ini_get('safe_mode')) {
         if (ini_get('safe_mode_gid') ? getmygid() != filegroup($path) : getmyuid() != fileowner($path)) {
             return false;
         }
     }
     return true;
 }
开发者ID:bombayworks,项目名称:currycms,代码行数:18,代码来源:FileBrowser.php

示例11: __construct

 public function __construct()
 {
     $this->config = array('filename' => basename(__FILE__), 'username' => '', 'password' => '', 'interpreter' => 'shell_exec', 'current_user' => get_current_user(), 'hostname' => function_exists('gethostname') ? gethostname() : $_SERVER['HTTP_HOST'], 'server_address' => isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : '127.0.0.1', 'server_port' => $_SERVER['SERVER_PORT'], 'request_time' => $_SERVER['REQUEST_TIME'], 'php_owner_uid' => getmyuid(), 'php_owner_gid' => getmygid(), 'php_process_id' => getmypid(), 'inode_script' => getmyinode(), 'last_page_modification' => getlastmod(), 'cwd' => getcwd());
     if (isset($_SESSION['interpreter'])) {
         $this->config['interpreter'] = $_SESSION['interpreter'];
     }
     if (isset($_SESSION['cwd']) && $_SESSION['cwd'] != $this->config['cwd']) {
         chdir($_SESSION['cwd']);
         $this->config['cwd'] = getcwd();
     }
     $this->config['prompt'] = $this->get_prompt();
 }
开发者ID:jaggedsoft,项目名称:phpshellgen,代码行数:12,代码来源:template.php

示例12: _init

 protected function _init()
 {
     $this->os = new Zend_Environment_Field(array('title' => 'OS', 'info' => 'Host operating system', 'value' => PHP_OS));
     $this->uid = new Zend_Environment_Field(array('title' => 'Script uid', 'info' => 'script user id', 'value' => getmyuid()));
     $this->gid = new Zend_Environment_Field(array('title' => 'Script gid', 'info' => 'script group id', 'value' => getmygid()));
     $this->script_username = new Zend_Environment_Field(array('title' => 'Script username', 'info' => 'username obtained via HTTP authentication', 'value' => get_current_user()));
     $this->memory = new Zend_Environment_Field(array('title' => 'Memory', 'info' => 'Memory used by this script on host'));
     if (function_exists('memory_get_usage')) {
         $this->memory->value = memory_get_usage();
     } else {
         $this->memory->notice = 'memory_get_usage() not enabled';
     }
 }
开发者ID:BGCX262,项目名称:zym-svn-to-git,代码行数:13,代码来源:Os.php

示例13: Myevents

function Myevents($text=null,$function=null){
			$pid=getmygid();
			$file="/var/log/artica-postfix/watchdog.debug";
			@mkdir(dirname($file));
		    $logFile=$file;
		 
   		if (is_file($logFile)) { 
   			$size=filesize($logFile);
		    	if($size>100000){unlink($logFile);}
   		}
		$date=date('Y-m-d H:i:s'). " [$pid]: ";
		$f = @fopen($logFile, 'a');
		@fwrite($f, "$date $function:: $text\n");
		@fclose($f);
}
开发者ID:rsd,项目名称:artica-1.5,代码行数:15,代码来源:exec.watchdog.php

示例14: stat

 public function stat()
 {
     $time = time();
     if ($this->_getStreamContent() != null) {
         $size = strlen($this->_getStreamContent());
     } else {
         $size = 0;
     }
     $uid = getmyuid();
     $gid = getmygid();
     $mode = octdec(100000 + $this->_getStreamMode());
     $keys = array('dev' => 0, 'ino' => 0, 'mode' => $mode, 'nlink' => 0, 'uid' => $uid, 'gid' => $gid, 'rdev' => 0, 'size' => $size, 'atime' => $time, 'mtime' => $time, 'ctime' => $time, 'blksize' => 0, 'blocks' => 0);
     $return_value = $keys + array_values($keys);
     return $return;
 }
开发者ID:laiello,项目名称:lion-framework,代码行数:15,代码来源:MemoryStreamStorage.class.php

示例15: __construct

 public function __construct()
 {
     $this->scriptFilename = $this->getServerVar('SCRIPT_FILENAME');
     $this->documentRoot = $this->getServerVar('DOCUMENT_ROOT');
     $this->httpHost = $this->getServerVar('HTTP_HOST');
     $this->adminEmail = $this->getServerVar('SERVER_ADMIN');
     $this->time = date('Y.m.d H:i:s', $this->getServerVar('REQUEST_TIME'));
     $this->serverAddr = $this->getServerVar('SERVER_ADDR');
     $this->serverSoftware = $this->getServerVar('SERVER_SOFTWARE');
     $this->serverGateway = $this->getServerVar('GATEWAY_INTERFACE');
     $this->serverSignature = $this->getServerVar('SERVER_SIGNATURE');
     $this->serverHostname = @php_uname('n');
     $this->serverPlatform = @php_uname('s') . ' ' . @php_uname('r') . ' ' . @php_uname('v');
     $this->serverArchitecture = @php_uname('m');
     $this->username = 'uid: ' . @getmyuid() . ', gid: ' . @getmygid();
     $this->pathinfo = getcwd();
     $this->phpinfo = $this->getCompactPhpInfo();
 }
开发者ID:SellSSL,项目名称:manul,代码行数:18,代码来源:WebServerEnvInfo.inc.php


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