bjori           Mon Jun 26 20:28:31 2006 UTC

  Modified files:              
    /php-src    configure.in 
    /php-src/ext/standard       basic_functions.c basic_functions.h 
  Log:
  MFB: sys_getloadavg()
  
  
http://cvs.php.net/viewvc.cgi/php-src/configure.in?r1=1.604&r2=1.605&diff_format=u
Index: php-src/configure.in
diff -u php-src/configure.in:1.604 php-src/configure.in:1.605
--- php-src/configure.in:1.604  Sat Jun 17 11:14:21 2006
+++ php-src/configure.in        Mon Jun 26 20:28:30 2006
@@ -1,4 +1,4 @@
- ## $Id: configure.in,v 1.604 2006/06/17 11:14:21 nlopess Exp $ -*- autoconf 
-*-
+ ## $Id: configure.in,v 1.605 2006/06/26 20:28:30 bjori Exp $ -*- autoconf -*-
 dnl ## Process this file with autoconf to produce a configure script.
 
 divert(1)
@@ -466,6 +466,7 @@
 funopen \
 gai_strerror \
 gcvt \
+getloadavg \
 getlogin \
 getprotobyname \
 getprotobynumber \
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/basic_functions.c?r1=1.782&r2=1.783&diff_format=u
Index: php-src/ext/standard/basic_functions.c
diff -u php-src/ext/standard/basic_functions.c:1.782 
php-src/ext/standard/basic_functions.c:1.783
--- php-src/ext/standard/basic_functions.c:1.782        Mon Jun 26 13:10:31 2006
+++ php-src/ext/standard/basic_functions.c      Mon Jun 26 20:28:30 2006
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: basic_functions.c,v 1.782 2006/06/26 13:10:31 rasmus Exp $ */
+/* $Id: basic_functions.c,v 1.783 2006/06/26 20:28:30 bjori Exp $ */
 
 #include "php.h"
 #include "php_streams.h"
@@ -3343,7 +3343,9 @@
 #ifdef HAVE_GETOPT
        PHP_FE(getopt,                                                          
                                                        arginfo_getopt)
 #endif
-
+#ifdef HAVE_GETLOADAVG
+       PHP_FE(sys_getloadavg,                                                  
                                                NULL)
+#endif
 #ifdef HAVE_GETTIMEOFDAY
        PHP_FE(microtime,                                                       
                                                        arginfo_microtime)
        PHP_FE(gettimeofday,                                                    
                                                arginfo_gettimeofday)
@@ -6199,6 +6201,23 @@
 }
 /* }}} */
 
+#ifdef HAVE_GETLOADAVG
+PHP_FUNCTION(sys_getloadavg)
+{
+       double load[3];
+
+       if (getloadavg(load, 3) == -1) {
+               RETURN_FALSE;
+       } else {
+               array_init(return_value);
+               add_index_double(return_value, 0, load[0]);
+               add_index_double(return_value, 1, load[1]);
+               add_index_double(return_value, 2, load[2]);
+       }
+}
+#endif
+
+
 /*
  * Local variables:
  * tab-width: 4
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/basic_functions.h?r1=1.145&r2=1.146&diff_format=u
Index: php-src/ext/standard/basic_functions.h
diff -u php-src/ext/standard/basic_functions.h:1.145 
php-src/ext/standard/basic_functions.h:1.146
--- php-src/ext/standard/basic_functions.h:1.145        Wed Mar  8 14:41:45 2006
+++ php-src/ext/standard/basic_functions.h      Mon Jun 26 20:28:30 2006
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: basic_functions.h,v 1.145 2006/03/08 14:41:45 iliaa Exp $ */
+/* $Id: basic_functions.h,v 1.146 2006/06/26 20:28:30 bjori Exp $ */
 
 #ifndef BASIC_FUNCTIONS_H
 #define BASIC_FUNCTIONS_H
@@ -116,6 +116,9 @@
 
 PHP_FUNCTION(register_tick_function);
 PHP_FUNCTION(unregister_tick_function);
+#ifdef HAVE_GETLOADAVG
+PHP_FUNCTION(sys_getloadavg);
+#endif
 
 PHP_FUNCTION(is_uploaded_file);
 PHP_FUNCTION(move_uploaded_file);

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to