Re: cvs: php-src(PHP_5_1) / configure.in/ext/standard basic_functions.c basic_functions.h
| From: | Steph Fox | Date: | Fri, 17 Feb 2006 20:08:07 +0000 |
| Subject: | Re: cvs: php-src(PHP_5_1) / configure.in/ext/standard basic_functions.c basic_functions.h | ||
| References: | 1 2 3 4 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-36904@lists.php.net to get a copy of this message | ||
The function's called from only one place in phpweb (phpweb/include/loadavg.inc) & fails sweetly where getloadavg() doesn't exist, so updating the function on the server shouldn't cause any major disasters in the short term. It's just a case of remembering to update that script at the same time.
----- Original Message ----- From: "Andi Gutmans" <andi@zend.com>
To: "Wez Furlong" <wez@thebrainroom.com>
Cc: <php-cvs@lists.php.net>
Sent: Friday, February 17, 2006 9:41 PM
Subject: Re: [PHP-CVS] cvs: php-src(PHP_5_1) / configure.in/ext/standard basic_functions.c basic_functions.h
Yep, but once it's mainstream then the general public is more important than phpweb :) At 11:52 PM 2/16/2006, Wez Furlong wrote:I'm fine with the name being changed, but keep in mind that phpweb has been using this function with this name for a couple of years, so any change in the name here needs to be matched in phpweb. --Wez. Andi Gutmans wrote:Hey Wez, We should stick to coding standards for new functions. How about sys_getloadavg()? Andi At 02:49 PM 2/16/2006, Wez Furlong wrote:http://cvs.php.net/viewcvs.cgi/php-src/configure.in?r1=1.579.2.36&r2=1.579.2.37&diff_format=uwez Thu Feb 16 22:49:13 2006 UTCModified files: (Branch: PHP_5_1) /php-src configure.in /php-src/ext/standard basic_functions.c basic_functions.hLog: add getloadavg() function that has been running in production on rs1.php.net for a couple of years.http://cvs.php.net/viewcvs.cgi/php-src/ext/standard/basic_functions.c?r1=1.725.2.20&r2=1.725.2.21&diff_format=uIndex: php-src/configure.in diff -u php-src/configure.in:1.579.2.36 php-src/configure.in:1.579.2.37--- php-src/configure.in:1.579.2.36 Thu Jan 12 15:24:10 2006 +++ php-src/configure.in Thu Feb 16 22:49:13 2006@@ -1,4 +1,4 @@ - ## $Id: configure.in,v 1.579.2.36 2006/01/12 15:24:10 iliaa Exp $ -*- autoconf -*- + ## $Id: configure.in,v 1.579.2.37 2006/02/16 22:49:13 wez 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/viewcvs.cgi/php-src/ext/standard/basic_functions.h?r1=1.139.2.2&r2=1.139.2.3&diff_format=uIndex: php-src/ext/standard/basic_functions.c diff -u php-src/ext/standard/basic_functions.c:1.725.2.20 php-src/ext/standard/basic_functions.c:1.725.2.21 --- php-src/ext/standard/basic_functions.c:1.725.2.20 Thu Feb 16 10:13:52 2006+++ php-src/ext/standard/basic_functions.c Thu Feb 16 22:49:13 2006@@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: basic_functions.c,v 1.725.2.20 2006/02/16 10:13:52 tony2001 Exp $ */ +/* $Id: basic_functions.c,v 1.725.2.21 2006/02/16 22:49:13 wez Exp $ */ #include "php.h" #include "php_streams.h" @@ -425,7 +425,9 @@ #ifdef HAVE_GETOPTPHP_FE(getopt,NULL) #endif - +#ifdef HAVE_GETLOADAVG+ PHP_FE(getloadavg,NULL) +#endif #ifdef HAVE_GETTIMEOFDAYPHP_FE(microtime,NULL)PHP_FE(gettimeofday, NULL)@@ -3344,6 +3346,23 @@ } /* }}} */ +#ifdef HAVE_GETLOADAVG +PHP_FUNCTION(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: 4Index: php-src/ext/standard/basic_functions.h diff -u php-src/ext/standard/basic_functions.h:1.139.2.2 php-src/ext/standard/basic_functions.h:1.139.2.3--- php-src/ext/standard/basic_functions.h:1.139.2.2 Sat Jan 2806:14:34 2006+++ php-src/ext/standard/basic_functions.h Thu Feb 16 22:49:13 2006@@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: basic_functions.h,v 1.139.2.2 2006/01/28 06:14:34 fmk Exp $ */ +/* $Id: basic_functions.h,v 1.139.2.3 2006/02/16 22:49:13 wez 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(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-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __________ NOD32 1.1380 (20060125) Information __________ This message was checked by NOD32 antivirus system. http://www.eset.com