PHP userland backwards compatibility layer that emulates PHP 5.5+ core functions.

⌈⌋ ⎇ branch:  upgrade.php


Artifact [e8fa440ece]

Artifact e8fa440ece7df619c6629c6b237a158b317ca2a3:

  • File ext/posix.php — part of check-in [39c9fa23ab] at 2010-06-22 17:03:23 on branch trunk — upgradephp-14 (user: mario size: 1111)
  • File ext/unfinished/posix.php — part of check-in [51e3884900] at 2010-06-22 17:03:27 on branch trunk — upgradephp-15 (user: mario size: 1111)

<?php
/*
   POSIX subsystem functions are emulated using regular commandline
   utilities or by invoking Perl.  Of course not the full spectrum
   of features can be simulated this way. You shouldn't rely on the
   emulation here, and just abort on PHP version without POSIX ext.
*/

if (!function_exists("posix_mkfifo") && strlen($_ENV["SHELL"]) && !ini_get("safe_mode")) {

   function posix_mkfifo($pathname, $mode=0400) {
      $cmd = "/usr/bin/mkfifo -m 0" . decoct($mode) . " " . escape_shell_arg($pathname);
      exec($cmd, $uu, $error);
      return(!$error);
   }
   
   function posix_getcwd() {
      return realpath(getcwd());
   }
   
   function posix_kill($pid, $sig) {
      $cmd = "kill -" . ((int)$sig) . " " . ((int)$pid);
      exec($cmd, $uu, $error);
      return(!$error);
   }

   function posix_uname() {
      return array(
         "sysname" => `/bin/uname -s`,
         "nodename" => `/bin/uname -n`,
         "release" => `/bin/uname -r`,
         "version" => `/bin/uname -v`,
         "machine" => `/bin/uname -m`,
         "domainname" => `/bin/domainname`,
      );
   }
}


?>