cvs: php4(PHP_4_3) /ext/ircg ircg.c
| From: | Sascha Schumann | Date: | Tue, 13 May 2003 19:12:00 +0000 |
| Subject: | cvs: php4(PHP_4_3) /ext/ircg ircg.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-20862@lists.php.net to get a copy of this message | ||
sas Tue May 13 15:12:00 2003 EDT
Modified files: (Branch: PHP_4_3)
/php4/ext/ircg ircg.c
Log:
Provide some information regarding fd use; should make fd leaks obvious
Index: php4/ext/ircg/ircg.c
diff -u php4/ext/ircg/ircg.c:1.137.2.4 php4/ext/ircg/ircg.c:1.137.2.5
--- php4/ext/ircg/ircg.c:1.137.2.4 Sun Apr 13 16:50:36 2003
+++ php4/ext/ircg/ircg.c Tue May 13 15:12:00 2003
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: ircg.c,v 1.137.2.4 2003/04/13 20:50:36 sas Exp $ */
+/* $Id: ircg.c,v 1.137.2.5 2003/05/13 19:12:00 sas Exp $ */
/* {{{ includes */
@@ -69,6 +69,10 @@
static unsigned long irc_connects, irc_set_currents, irc_quit_handlers,
exec_fmt_msgs, exec_token_compiler;
+static int highest_fd;
+
+#define SEEN_FD(fd) do { if ((fd) > highest_fd) highest_fd = (fd); } while (0)
+
/* }}} */
/* {{{ Format string numbers */
@@ -1357,6 +1361,7 @@
close(conn->file_fd);
conn->file_fd = open(Z_STRVAL_PP(p2), O_WRONLY | O_CREAT | O_TRUNC | O_APPEND, 0644);
+ SEEN_FD(conn->file_fd);
if (conn->file_fd == -1) {
RETURN_FALSE;
}
@@ -1415,6 +1420,7 @@
thttpd_register_on_close(http_closed_connection);
thttpd_set_dont_close();
conn->fd = thttpd_get_fd();
+ SEEN_FD(conn->fd);
if (fcntl(conn->fd, F_GETFL) == -1) {
zend_hash_index_del(&h_irconn, Z_LVAL_PP(p1));
php_error(E_WARNING, "current fd is not valid");
@@ -2352,6 +2358,12 @@
php_info_print_table_start();
php_info_print_table_header(2, "ircg support", "enabled");
+
+ sprintf(buf, "%lu", getdtablesize());
+ php_info_print_table_row(2, "Maximum number of open fds", buf);
+ sprintf(buf, "%lu", highest_fd);
+ php_info_print_table_row(2, "Highest encountered fd", buf);
+
sprintf(buf, "%lu", cache_hits);
php_info_print_table_row(2, "scanner result cache hits", buf);
sprintf(buf, "%lu", cache_misses);