From: Ori Livneh Date: Wed, 23 Sep 2015 08:53:47 +0000 (-0700) Subject: Compat fix for HHVM on non-Linux OSs X-Git-Tag: 1.31.0-rc.0~9889^2 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/exercices/modifier.php?a=commitdiff_plain;h=602a74af5d4d4da82e51cb174c2a37a02a7f34b8;p=lhc%2Fweb%2Fwiklou.git Compat fix for HHVM on non-Linux OSs RUSAGE_THREAD is not POSIX; it's Linux-specific. HHVM now compiles on OS X, and calling getrusage( 2 ) on OS X explodes with: exception : f_getrusage is not supported: RUSAGE_THREAD is not defined on this sytem [sic] HHVM is being ported to Windows, too, where RUSAGE_THREAD is likewise missing. So check that PHP_OS === 'Linux' before using it. Change-Id: I6eac7d2bb4edfa1e697ae72f89299d0d5ac135f4 --- diff --git a/includes/profiler/ProfilerFunctions.php b/includes/profiler/ProfilerFunctions.php index 6c58453215..50a77ecd9a 100644 --- a/includes/profiler/ProfilerFunctions.php +++ b/includes/profiler/ProfilerFunctions.php @@ -32,7 +32,7 @@ function wfGetRusage() { if ( !function_exists( 'getrusage' ) ) { return false; - } elseif ( defined( 'HHVM_VERSION' ) ) { + } elseif ( defined( 'HHVM_VERSION' ) && PHP_OS === 'Linux' ) { return getrusage( 2 /* RUSAGE_THREAD */ ); } else { return getrusage( 0 /* RUSAGE_SELF */ );