X-Git-Url: http://git.pld-linux.org/?a=blobdiff_plain;f=php-fpm.patch;h=2d8e385d94f5be7b334a0f9aae8b6d586c18fb12;hb=af4314eeabe0790cf4322969f5c50658ac0f5cf5;hp=568bb670b6b4bd23824bced4ae64563341589e00;hpb=633983a3999767ff93751a49cec9b3b4e4d0c013;p=packages%2Fphp.git diff --git a/php-fpm.patch b/php-fpm.patch index 568bb67..2d8e385 100644 --- a/php-fpm.patch +++ b/php-fpm.patch @@ -1,8 +1,10 @@ -diff -Nru php-5.2.6.vanilla/configure php-5.2.6.fpm/configure -diff -Nru php-5.2.6.vanilla/configure.in php-5.2.6.fpm/configure.in ---- php-5.2.6.vanilla/configure.in 2008-04-30 22:27:55.000000000 +0400 -+++ php-5.2.6.fpm/configure.in 2008-05-01 20:42:05.000000000 +0400 -@@ -267,6 +267,12 @@ +diff --git a/configure b/configure +index 2d88ed7..c490abf 100755 +diff --git a/configure.in b/configure.in +index e181ac9..4424930 100644 +--- a/configure.in ++++ b/configure.in +@@ -295,6 +295,12 @@ if test "$enable_maintainer_zts" = "yes"; then PTHREADS_FLAGS fi @@ -15,7 +17,7 @@ diff -Nru php-5.2.6.vanilla/configure.in php-5.2.6.fpm/configure.in divert(3) dnl ## In diversion 3 we check for compile-time options to the PHP -@@ -476,6 +482,7 @@ +@@ -511,6 +517,7 @@ AC_CHECK_FUNCS( alphasort \ asctime_r \ chroot \ @@ -23,7 +25,7 @@ diff -Nru php-5.2.6.vanilla/configure.in php-5.2.6.fpm/configure.in ctime_r \ cuserid \ crypt \ -@@ -1197,6 +1204,8 @@ +@@ -1253,6 +1260,8 @@ PHP_SUBST_OLD(EXTENSION_DIR) PHP_SUBST_OLD(EXTRA_LDFLAGS) PHP_SUBST_OLD(EXTRA_LDFLAGS_PROGRAM) PHP_SUBST_OLD(EXTRA_LIBS) @@ -32,7 +34,7 @@ diff -Nru php-5.2.6.vanilla/configure.in php-5.2.6.fpm/configure.in PHP_SUBST_OLD(ZEND_EXTRA_LIBS) PHP_SUBST_OLD(INCLUDES) PHP_SUBST_OLD(EXTRA_INCLUDES) -@@ -1285,7 +1294,7 @@ +@@ -1364,7 +1373,7 @@ case $PHP_SAPI in install_targets="$PHP_INSTALL_CLI_TARGET $install_targets" ;; *) @@ -41,46 +43,132 @@ diff -Nru php-5.2.6.vanilla/configure.in php-5.2.6.fpm/configure.in ;; esac -diff -Nru php-5.2.6.vanilla/libevent/aclocal.m4 php-5.2.6.fpm/libevent/aclocal.m4 -diff -Nru php-5.2.6.vanilla/libevent/autogen.sh php-5.2.6.fpm/libevent/autogen.sh -diff -Nru php-5.2.6.vanilla/libevent/ChangeLog php-5.2.6.fpm/libevent/ChangeLog -diff -Nru php-5.2.6.vanilla/libevent/compat/sys/queue.h php-5.2.6.fpm/libevent/compat/sys/queue.h -diff -Nru php-5.2.6.vanilla/libevent/compat/sys/_time.h php-5.2.6.fpm/libevent/compat/sys/_time.h -diff -Nru php-5.2.6.vanilla/libevent/config.guess php-5.2.6.fpm/libevent/config.guess -diff -Nru php-5.2.6.vanilla/libevent/config.h.in php-5.2.6.fpm/libevent/config.h.in -diff -Nru php-5.2.6.vanilla/libevent/config.sub php-5.2.6.fpm/libevent/config.sub -diff -Nru php-5.2.6.vanilla/libevent/configure php-5.2.6.fpm/libevent/configure -diff -Nru php-5.2.6.vanilla/libevent/configure.in php-5.2.6.fpm/libevent/configure.in -diff -Nru php-5.2.6.vanilla/libevent/depcomp php-5.2.6.fpm/libevent/depcomp -diff -Nru php-5.2.6.vanilla/libevent/devpoll.c php-5.2.6.fpm/libevent/devpoll.c -diff -Nru php-5.2.6.vanilla/libevent/epoll.c php-5.2.6.fpm/libevent/epoll.c -diff -Nru php-5.2.6.vanilla/libevent/epoll_sub.c php-5.2.6.fpm/libevent/epoll_sub.c -diff -Nru php-5.2.6.vanilla/libevent/event.3 php-5.2.6.fpm/libevent/event.3 -diff -Nru php-5.2.6.vanilla/libevent/event.c php-5.2.6.fpm/libevent/event.c -diff -Nru php-5.2.6.vanilla/libevent/event-config.h php-5.2.6.fpm/libevent/event-config.h -diff -Nru php-5.2.6.vanilla/libevent/event-fpm.h php-5.2.6.fpm/libevent/event-fpm.h -diff -Nru php-5.2.6.vanilla/libevent/event.h php-5.2.6.fpm/libevent/event.h -diff -Nru php-5.2.6.vanilla/libevent/event-internal.h php-5.2.6.fpm/libevent/event-internal.h -diff -Nru php-5.2.6.vanilla/libevent/evport.c php-5.2.6.fpm/libevent/evport.c -diff -Nru php-5.2.6.vanilla/libevent/evsignal.h php-5.2.6.fpm/libevent/evsignal.h -diff -Nru php-5.2.6.vanilla/libevent/evutil.c php-5.2.6.fpm/libevent/evutil.c -diff -Nru php-5.2.6.vanilla/libevent/evutil.h php-5.2.6.fpm/libevent/evutil.h -diff -Nru php-5.2.6.vanilla/libevent/install-sh php-5.2.6.fpm/libevent/install-sh -diff -Nru php-5.2.6.vanilla/libevent/kqueue.c php-5.2.6.fpm/libevent/kqueue.c -diff -Nru php-5.2.6.vanilla/libevent/log.c php-5.2.6.fpm/libevent/log.c -diff -Nru php-5.2.6.vanilla/libevent/log.h php-5.2.6.fpm/libevent/log.h -diff -Nru php-5.2.6.vanilla/libevent/Makefile.am php-5.2.6.fpm/libevent/Makefile.am -diff -Nru php-5.2.6.vanilla/libevent/Makefile.in php-5.2.6.fpm/libevent/Makefile.in -diff -Nru php-5.2.6.vanilla/libevent/min_heap.h php-5.2.6.fpm/libevent/min_heap.h -diff -Nru php-5.2.6.vanilla/libevent/missing php-5.2.6.fpm/libevent/missing -diff -Nru php-5.2.6.vanilla/libevent/mkinstalldirs php-5.2.6.fpm/libevent/mkinstalldirs -diff -Nru php-5.2.6.vanilla/libevent/poll.c php-5.2.6.fpm/libevent/poll.c -diff -Nru php-5.2.6.vanilla/libevent/README php-5.2.6.fpm/libevent/README -diff -Nru php-5.2.6.vanilla/libevent/select.c php-5.2.6.fpm/libevent/select.c -diff -Nru php-5.2.6.vanilla/libevent/signal.c php-5.2.6.fpm/libevent/signal.c -diff -Nru php-5.2.6.vanilla/main/php_config.h.in php-5.2.6.fpm/main/php_config.h.in ---- php-5.2.6.vanilla/main/php_config.h.in 2008-04-30 22:37:39.000000000 +0400 -+++ php-5.2.6.fpm/main/php_config.h.in 2008-09-21 17:37:45.000000000 +0400 +diff --git a/libevent/ChangeLog b/libevent/ChangeLog +new file mode 100644 +index 0000000..c592139 +diff --git a/libevent/Makefile.am b/libevent/Makefile.am +new file mode 100644 +index 0000000..5ccfd2c +diff --git a/libevent/Makefile.in b/libevent/Makefile.in +new file mode 100644 +index 0000000..0600dcc +diff --git a/libevent/README b/libevent/README +new file mode 100644 +index 0000000..b065039 +diff --git a/libevent/aclocal.m4 b/libevent/aclocal.m4 +new file mode 100644 +index 0000000..74de4a1 +diff --git a/libevent/autogen.sh b/libevent/autogen.sh +new file mode 100644 +index 0000000..218dbf4 +diff --git a/libevent/buffer.c b/libevent/buffer.c +new file mode 100644 +index 0000000..e66080f +diff --git a/libevent/compat/sys/_time.h b/libevent/compat/sys/_time.h +new file mode 100644 +index 0000000..8cabb0d +diff --git a/libevent/compat/sys/queue.h b/libevent/compat/sys/queue.h +new file mode 100644 +index 0000000..c0956dd +diff --git a/libevent/config.h.in b/libevent/config.h.in +new file mode 100644 +index 0000000..d151f87 +diff --git a/libevent/configure b/libevent/configure +new file mode 100644 +index 0000000..0a74aec +diff --git a/libevent/configure.in b/libevent/configure.in +new file mode 100644 +index 0000000..852d3c5 +diff --git a/libevent/depcomp b/libevent/depcomp +new file mode 100644 +index 0000000..ffcd540 +diff --git a/libevent/devpoll.c b/libevent/devpoll.c +new file mode 100644 +index 0000000..cbd2730 +diff --git a/libevent/epoll.c b/libevent/epoll.c +new file mode 100644 +index 0000000..cf3c859 +diff --git a/libevent/epoll_sub.c b/libevent/epoll_sub.c +new file mode 100644 +index 0000000..431970c +diff --git a/libevent/evbuffer.c b/libevent/evbuffer.c +new file mode 100644 +index 0000000..f2179a5 +diff --git a/libevent/event-config.h b/libevent/event-config.h +new file mode 100644 +index 0000000..0a278b3 +diff --git a/libevent/event-fpm.h b/libevent/event-fpm.h +new file mode 100644 +index 0000000..8625ca5 +diff --git a/libevent/event-internal.h b/libevent/event-internal.h +new file mode 100644 +index 0000000..7485f21 +diff --git a/libevent/event.3 b/libevent/event.3 +new file mode 100644 +index 0000000..5b33ec6 +diff --git a/libevent/event.c b/libevent/event.c +new file mode 100644 +index 0000000..826b7db +diff --git a/libevent/event.h b/libevent/event.h +new file mode 100644 +index 0000000..d67ecb5 +diff --git a/libevent/evhttp.h b/libevent/evhttp.h +new file mode 100644 +index 0000000..0d35f9e +diff --git a/libevent/evport.c b/libevent/evport.c +new file mode 100644 +index 0000000..31523b4 +diff --git a/libevent/evsignal.h b/libevent/evsignal.h +new file mode 100644 +index 0000000..8be9cbd +diff --git a/libevent/evutil.c b/libevent/evutil.c +new file mode 100644 +index 0000000..86205b2 +diff --git a/libevent/evutil.h b/libevent/evutil.h +new file mode 100644 +index 0000000..0a018b8 +diff --git a/libevent/http-internal.h b/libevent/http-internal.h +new file mode 100644 +index 0000000..bc9a1ed +diff --git a/libevent/http.c b/libevent/http.c +new file mode 100644 +index 0000000..1d60fc5 +diff --git a/libevent/install-sh b/libevent/install-sh +new file mode 100644 +index 0000000..1a83534 +diff --git a/libevent/kqueue.c b/libevent/kqueue.c +new file mode 100644 +index 0000000..38a1819 +diff --git a/libevent/log.c b/libevent/log.c +new file mode 100644 +index 0000000..b62a619 +diff --git a/libevent/log.h b/libevent/log.h +new file mode 100644 +index 0000000..7bc6632 +diff --git a/libevent/min_heap.h b/libevent/min_heap.h +new file mode 100644 +index 0000000..d47e563 +diff --git a/libevent/missing b/libevent/missing +new file mode 100644 +index 0000000..09edd88 +diff --git a/libevent/poll.c b/libevent/poll.c +new file mode 100644 +index 0000000..b67c6ff +diff --git a/libevent/select.c b/libevent/select.c +new file mode 100644 +index 0000000..7faafe4 +diff --git a/libevent/signal.c b/libevent/signal.c +new file mode 100644 +index 0000000..bcaa3f9 +diff --git a/libevent/strlcpy-internal.h b/libevent/strlcpy-internal.h +new file mode 100644 +index 0000000..22b5f61 +diff --git a/libevent/strlcpy.c b/libevent/strlcpy.c +new file mode 100644 +index 0000000..a1a413d +diff --git a/main/php_config.h.in b/main/php_config.h.in +--- a/main/php_config.h.in ++++ b/main/php_config.h.in @@ -170,6 +170,9 @@ /* Define if you have the chroot function. */ #undef HAVE_CHROOT @@ -91,7 +179,7 @@ diff -Nru php-5.2.6.vanilla/main/php_config.h.in php-5.2.6.fpm/main/php_config.h /* Define if you have the crypt function. */ #undef HAVE_CRYPT -@@ -929,6 +932,9 @@ +@@ -935,6 +938,9 @@ /* */ #undef PHP_FASTCGI @@ -101,7 +189,7 @@ diff -Nru php-5.2.6.vanilla/main/php_config.h.in php-5.2.6.fpm/main/php_config.h /* */ #undef FORCE_CGI_REDIRECT -@@ -938,6 +944,27 @@ +@@ -944,6 +950,27 @@ /* */ #undef ENABLE_PATHINFO_CHECK @@ -129,8 +217,15 @@ diff -Nru php-5.2.6.vanilla/main/php_config.h.in php-5.2.6.fpm/main/php_config.h /* Define if system uses EBCDIC */ #undef CHARSET_EBCDIC ---- php-5.2.6.fpm/sapi/cgi/cgi_main.c 2008-07-22 01:50:58.000000000 +0400 -+++ php-5.2.6/sapi/cgi/cgi_main.c 2008-11-03 20:21:40.431760373 +0200 +--- php-5.2.17/sapi/cgi/Makefile.frag~ 2012-02-27 14:44:23.000000000 +0200 ++++ php-5.2.17/sapi/cgi/Makefile.frag 2012-02-27 14:46:13.037731342 +0200 +@@ -1,2 +1,2 @@ +-$(SAPI_CGI_PATH): libphp_common.la $(PHP_SAPI_OBJS) ++$(SAPI_CGI_PATH): libphp_common.la $(PHP_SAPI_OBJS) $(SAPI_EXTRA_DEPS) + $(BUILD_CGI) +diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c +--- a/sapi/cgi/cgi_main.c ++++ b/sapi/cgi/cgi_main.c @@ -55,6 +55,9 @@ #if HAVE_SYS_WAIT_H #include @@ -141,7 +236,7 @@ diff -Nru php-5.2.6.vanilla/main/php_config.h.in php-5.2.6.fpm/main/php_config.h #include "zend.h" #include "zend_extensions.h" #include "php_ini.h" -@@ -83,6 +86,11 @@ +@@ -83,6 +86,11 @@ int __riscosify_control = __RISCOSIFY_STRICT_UNIX_SPECS; #if PHP_FASTCGI #include "fastcgi.h" @@ -153,7 +248,7 @@ diff -Nru php-5.2.6.vanilla/main/php_config.h.in php-5.2.6.fpm/main/php_config.h #ifndef PHP_WIN32 /* XXX this will need to change later when threaded fastcgi is implemented. shane */ -@@ -109,8 +117,12 @@ +@@ -115,8 +123,12 @@ static int parent_waiting = 0; static pid_t pgroup; #endif @@ -166,7 +261,7 @@ diff -Nru php-5.2.6.vanilla/main/php_config.h.in php-5.2.6.fpm/main/php_config.h #define PHP_MODE_STANDARD 1 #define PHP_MODE_HIGHLIGHT 2 #define PHP_MODE_INDENT 3 -@@ -140,6 +152,10 @@ +@@ -146,6 +158,10 @@ static const opt_struct OPTIONS[] = { {'w', 0, "strip"}, {'?', 0, "usage"},/* help alias (both '?' and 'usage') */ {'v', 0, "version"}, @@ -177,7 +272,7 @@ diff -Nru php-5.2.6.vanilla/main/php_config.h.in php-5.2.6.fpm/main/php_config.h {'z', 1, "zend-extension"}, #if PHP_FASTCGI {'T', 1, "timing"}, -@@ -164,6 +180,7 @@ +@@ -170,6 +186,7 @@ typedef struct _php_cgi_globals_struct { zend_bool impersonate; # endif #endif @@ -185,7 +280,7 @@ diff -Nru php-5.2.6.vanilla/main/php_config.h.in php-5.2.6.fpm/main/php_config.h } php_cgi_globals_struct; #ifdef ZTS -@@ -444,7 +461,28 @@ +@@ -474,7 +491,28 @@ static int sapi_cgi_read_post(char *buffer, uint count_bytes TSRMLS_DC) #if PHP_FASTCGI if (fcgi_is_fastcgi()) { fcgi_request *request = (fcgi_request*) SG(server_context); @@ -213,9 +308,9 @@ diff -Nru php-5.2.6.vanilla/main/php_config.h.in php-5.2.6.fpm/main/php_config.h + tmp_read_bytes = read(request_body_fd, buffer + read_bytes, count_bytes - read_bytes); + } } else { - tmp_read_bytes = read(0, buffer + read_bytes, count_bytes - read_bytes); + tmp_read_bytes = read(STDIN_FILENO, buffer + read_bytes, count_bytes - read_bytes); } -@@ -756,7 +794,12 @@ +@@ -786,7 +824,12 @@ static void php_cgi_usage(char *argv0) " -s Display colour syntax highlighted source.\n" " -v Version number\n" " -w Display source with stripped comments and whitespace.\n" @@ -229,7 +324,7 @@ diff -Nru php-5.2.6.vanilla/main/php_config.h.in php-5.2.6.fpm/main/php_config.h #if PHP_FASTCGI " -T Measure execution time of script repeated times.\n" #endif -@@ -1173,6 +1216,7 @@ +@@ -1236,6 +1279,7 @@ PHP_INI_BEGIN() # ifdef PHP_WIN32 STD_PHP_INI_ENTRY("fastcgi.impersonate", "0", PHP_INI_SYSTEM, OnUpdateBool, impersonate, php_cgi_globals_struct, php_cgi_globals) # endif @@ -237,7 +332,7 @@ diff -Nru php-5.2.6.vanilla/main/php_config.h.in php-5.2.6.fpm/main/php_config.h #endif PHP_INI_END() -@@ -1195,6 +1239,7 @@ +@@ -1258,6 +1302,7 @@ static void php_cgi_globals_ctor(php_cgi_globals_struct *php_cgi_globals TSRMLS_ # ifdef PHP_WIN32 php_cgi_globals->impersonate = 0; # endif @@ -245,7 +340,7 @@ diff -Nru php-5.2.6.vanilla/main/php_config.h.in php-5.2.6.fpm/main/php_config.h #endif } /* }}} */ -@@ -1227,9 +1272,47 @@ +@@ -1290,9 +1335,47 @@ static PHP_MSHUTDOWN_FUNCTION(cgi) static PHP_MINFO_FUNCTION(cgi) { DISPLAY_INI_ENTRIES(); @@ -293,7 +388,7 @@ diff -Nru php-5.2.6.vanilla/main/php_config.h.in php-5.2.6.fpm/main/php_config.h static zend_module_entry cgi_module_entry = { STANDARD_MODULE_HEADER, #if PHP_FASTCGI -@@ -1237,7 +1320,7 @@ +@@ -1300,7 +1383,7 @@ static zend_module_entry cgi_module_entry = { #else "cgi", #endif @@ -302,7 +397,7 @@ diff -Nru php-5.2.6.vanilla/main/php_config.h.in php-5.2.6.fpm/main/php_config.h PHP_MINIT(cgi), PHP_MSHUTDOWN(cgi), NULL, -@@ -1277,6 +1360,7 @@ +@@ -1340,6 +1423,7 @@ int main(int argc, char *argv[]) char *bindpath = NULL; int fcgi_fd = 0; fcgi_request request; @@ -310,7 +405,7 @@ diff -Nru php-5.2.6.vanilla/main/php_config.h.in php-5.2.6.fpm/main/php_config.h int repeats = 1; int benchmark = 0; #if HAVE_GETTIMEOFDAY -@@ -1397,6 +1481,14 @@ +@@ -1460,6 +1544,14 @@ int main(int argc, char *argv[]) case 's': /* generate highlighted HTML from source */ behavior = PHP_MODE_HIGHLIGHT; break; @@ -325,7 +420,7 @@ diff -Nru php-5.2.6.vanilla/main/php_config.h.in php-5.2.6.fpm/main/php_config.h } -@@ -1459,6 +1551,19 @@ +@@ -1524,6 +1616,19 @@ consult the installation file that came with this distribution, or visit \n\ #endif /* FORCE_CGI_REDIRECT */ #if PHP_FASTCGI @@ -345,33 +440,27 @@ diff -Nru php-5.2.6.vanilla/main/php_config.h.in php-5.2.6.fpm/main/php_config.h if (bindpath) { fcgi_fd = fcgi_listen(bindpath, 128); if (fcgi_fd < 0) { -@@ -1625,7 +1625,11 @@ +@@ -1538,6 +1643,9 @@ consult the installation file that came with this distribution, or visit \n\ if (fastcgi) { /* How many times to run PHP scripts before dying */ -- if (getenv("PHP_FCGI_MAX_REQUESTS")) { -+ if ( +#if PHP_FASTCGI_PM -+ !fpm && ++ if (!fpm) +#endif -+ getenv("PHP_FCGI_MAX_REQUESTS")) { + if (getenv("PHP_FCGI_MAX_REQUESTS")) { max_requests = atoi(getenv("PHP_FCGI_MAX_REQUESTS")); if (max_requests < 0) { - fprintf(stderr, "PHP_FCGI_MAX_REQUESTS is not valid\n"); -@@ -1677,7 +1677,11 @@ +@@ -1555,6 +1663,9 @@ consult the installation file that came with this distribution, or visit \n\ #ifndef PHP_WIN32 /* Pre-fork, if required */ -- if (getenv("PHP_FCGI_CHILDREN")) { -+ if ( +#if PHP_FASTCGI_PM -+ !fpm && ++ if (!fpm) +#endif -+ getenv("PHP_FCGI_CHILDREN")) { + if (getenv("PHP_FCGI_CHILDREN")) { char * children_str = getenv("PHP_FCGI_CHILDREN"); children = atoi(children_str); - if (children < 0) { -@@ -1616,6 +1729,8 @@ +@@ -1704,6 +1815,8 @@ consult the installation file that came with this distribution, or visit \n\ #endif #if PHP_FASTCGI @@ -380,7 +469,7 @@ diff -Nru php-5.2.6.vanilla/main/php_config.h.in php-5.2.6.fpm/main/php_config.h SG(server_context) = (void *) &request; #else SG(server_context) = (void *) 1; /* avoid server_context==NULL checks */ -@@ -1623,6 +1730,10 @@ +@@ -1711,6 +1824,10 @@ consult the installation file that came with this distribution, or visit \n\ init_request_info(TSRMLS_C); CG(interactive) = 0; @@ -391,7 +480,7 @@ diff -Nru php-5.2.6.vanilla/main/php_config.h.in php-5.2.6.fpm/main/php_config.h if (!cgi #if PHP_FASTCGI && !fastcgi -@@ -1914,6 +2025,10 @@ +@@ -1994,6 +2111,10 @@ consult the installation file that came with this distribution, or visit \n\ } } @@ -402,7 +491,7 @@ diff -Nru php-5.2.6.vanilla/main/php_config.h.in php-5.2.6.fpm/main/php_config.h switch (behavior) { case PHP_MODE_STANDARD: php_execute_script(&file_handle TSRMLS_CC); -@@ -1966,6 +2081,10 @@ +@@ -2046,6 +2167,10 @@ consult the installation file that came with this distribution, or visit \n\ #if PHP_FASTCGI fastcgi_request_done: @@ -413,7 +502,7 @@ diff -Nru php-5.2.6.vanilla/main/php_config.h.in php-5.2.6.fpm/main/php_config.h #endif { char *path_translated; -@@ -1979,6 +2098,16 @@ +@@ -2059,6 +2184,16 @@ fastcgi_request_done: SG(request_info).path_translated = path_translated; } @@ -430,7 +519,7 @@ diff -Nru php-5.2.6.vanilla/main/php_config.h.in php-5.2.6.fpm/main/php_config.h php_request_shutdown((void *) 0); if (exit_status == 0) { exit_status = EG(exit_status); -@@ -2016,15 +2145,20 @@ +@@ -2096,15 +2231,20 @@ fastcgi_request_done: if (bindpath) { free(bindpath); } @@ -455,10 +544,9 @@ diff -Nru php-5.2.6.vanilla/main/php_config.h.in php-5.2.6.fpm/main/php_config.h #endif if (cgi_sapi_module.php_ini_path_override) { -diff -Nru php-5.2.6.vanilla/sapi/cgi/config9.m4 php-5.2.6.fpm/sapi/cgi/config9.m4 ---- php-5.2.6.vanilla/sapi/cgi/config9.m4 2007-07-12 03:20:36.000000000 +0400 -+++ php-5.2.6.fpm/sapi/cgi/config9.m4 2008-07-20 20:46:41.000000000 +0400 -@@ -22,6 +22,10 @@ +--- php-5.2.17/sapi/cgi/config9.m4~ 2012-02-27 14:44:23.000000000 +0200 ++++ php-5.2.17/sapi/cgi/config9.m4 2012-02-27 14:48:07.279580606 +0200 +@@ -22,6 +22,10 @@ PHP_ARG_ENABLE(path-info-check,, [ --disable-path-info-check CGI: If this is disabled, paths such as /info.php/test?a=b will fail to work], yes, no) @@ -469,7 +557,7 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/config9.m4 php-5.2.6.fpm/sapi/cgi/config9.m dnl dnl CGI setup dnl -@@ -54,6 +58,20 @@ +@@ -54,6 +58,20 @@ if test "$PHP_SAPI" = "default"; then AC_DEFINE_UNQUOTED(PHP_FASTCGI, $PHP_ENABLE_FASTCGI, [ ]) AC_MSG_RESULT($PHP_FASTCGI) @@ -490,26 +578,22 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/config9.m4 php-5.2.6.fpm/sapi/cgi/config9.m dnl --enable-force-cgi-redirect AC_MSG_CHECKING(whether to force Apache CGI redirect) if test "$PHP_FORCE_CGI_REDIRECT" = "yes"; then -@@ -108,13 +108,13 @@ - - case $host_alias in - *aix*) -- BUILD_CGI="echo '\#! .' > php.sym && echo >>php.sym && nm -BCpg \`echo \$(PHP_GLOBAL_OBJS) \$(PHP_SAPI_OBJS) | sed 's/\([A-Za-z0-9_]*\)\.lo/\1.o/g'\` | \$(AWK) '{ if (((\$\$2 == \"T\") || (\$\$2 == \"D\") || (\$\$2 == \"B\")) && (substr(\$\$3,1,1) != \".\")) { print \$\$3 } }' | sort -u >> php.sym && \$(LIBTOOL) --mode=link \$(CC) -export-dynamic \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) -Wl,-brtl -Wl,-bE:php.sym \$(PHP_RPATHS) \$(PHP_GLOBAL_OBJS) \$(PHP_SAPI_OBJS) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_CGI_PATH)" -+ BUILD_CGI="echo '\#! .' > php.sym && echo >>php.sym && nm -BCpg \`echo \$(PHP_GLOBAL_OBJS) \$(PHP_SAPI_OBJS) | sed 's/\([A-Za-z0-9_]*\)\.lo/\1.o/g'\` | \$(AWK) '{ if (((\$\$2 == \"T\") || (\$\$2 == \"D\") || (\$\$2 == \"B\")) && (substr(\$\$3,1,1) != \".\")) { print \$\$3 } }' | sort -u >> php.sym && \$(LIBTOOL) --mode=link \$(CC) -export-dynamic \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) -Wl,-brtl -Wl,-bE:php.sym \$(PHP_RPATHS) \$(PHP_GLOBAL_OBJS) \$(PHP_SAPI_OBJS) \$(EXTRA_LIBS) \$(SAPI_EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_CGI_PATH)" +@@ -111,10 +111,10 @@ + BUILD_CGI="echo '\#! .' > php.sym && echo >>php.sym && nm -BCpg \`echo \$(PHP_GLOBAL_OBJS) \$(PHP_SAPI_OBJS) | sed 's/\([A-Za-z0-9_]*\)\.lo/\1.o/g'\` | \$(AWK) '{ if (((\$\$2 == \"T\") || (\$\$2 == \"D\") || (\$\$2 == \"B\")) && (substr(\$\$3,1,1) != \".\")) { print \$\$3 } }' | sort -u >> php.sym && \$(LIBTOOL) --mode=link \$(CC) -export-dynamic \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) -Wl,-brtl -Wl,-bE:php.sym \$(PHP_RPATHS) \$(PHP_GLOBAL_OBJS) \$(PHP_SAPI_OBJS) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_CGI_PATH)" ;; *darwin*) -- BUILD_CGI="\$(CC) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) \$(NATIVE_RPATHS) \$(PHP_GLOBAL_OBJS:.lo=.o) \$(PHP_SAPI_OBJS:.lo=.o) \$(PHP_FRAMEWORKS) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_CGI_PATH)" -+ BUILD_CGI="\$(CC) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) \$(NATIVE_RPATHS) \$(PHP_GLOBAL_OBJS:.lo=.o) \$(PHP_SAPI_OBJS:.lo=.o) \$(PHP_FRAMEWORKS) \$(EXTRA_LIBS) \$(SAPI_EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_CGI_PATH)" +- BUILD_CGI="\$(CC) \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) \$(NATIVE_RPATHS) \$(PHP_GLOBAL_OBJS:.lo=.o) \$(PHP_SAPI_OBJS:.lo=.o) \$(PHP_FRAMEWORKS) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_CGI_PATH)" ++ BUILD_CGI="\$(CC) \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) \$(NATIVE_RPATHS) \$(PHP_GLOBAL_OBJS:.lo=.o) \$(PHP_SAPI_OBJS:.lo=.o) \$(PHP_FRAMEWORKS) \$(EXTRA_LIBS) \$(SAPI_EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_CGI_PATH)" ;; *) -- BUILD_CGI="\$(LIBTOOL) --mode=link \$(CC) -export-dynamic \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) \$(PHP_RPATHS) libphp_common.la \$(PHP_SAPI_OBJS) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_CGI_PATH)" -+ BUILD_CGI="\$(LIBTOOL) --mode=link \$(CC) -export-dynamic \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) \$(PHP_RPATHS) libphp_common.la \$(PHP_SAPI_OBJS) \$(EXTRA_LIBS) \$(SAPI_EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_CGI_PATH)" +- BUILD_CGI="\$(LIBTOOL) --mode=link \$(CC) -export-dynamic \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) \$(PHP_RPATHS) libphp_common.la \$(PHP_SAPI_OBJS) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_CGI_PATH)" ++ BUILD_CGI="\$(LIBTOOL) --mode=link \$(CC) -export-dynamic \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) \$(PHP_RPATHS) libphp_common.la \$(PHP_SAPI_OBJS) \$(EXTRA_LIBS) \$(SAPI_EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_CGI_PATH)" ;; esac -diff -Nru php-5.2.6.vanilla/sapi/cgi/fastcgi.c php-5.2.6.fpm/sapi/cgi/fastcgi.c ---- php-5.2.6.vanilla/sapi/cgi/fastcgi.c 2008-04-03 14:24:44.000000000 +0400 -+++ php-5.2.6.fpm/sapi/cgi/fastcgi.c 2008-05-15 23:37:01.000000000 +0400 +diff --git a/sapi/cgi/fastcgi.c b/sapi/cgi/fastcgi.c +--- a/sapi/cgi/fastcgi.c ++++ b/sapi/cgi/fastcgi.c @@ -27,6 +27,11 @@ #include #include @@ -522,7 +606,7 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fastcgi.c php-5.2.6.fpm/sapi/cgi/fastcgi.c #ifdef _WIN32 #include -@@ -240,6 +245,8 @@ +@@ -234,6 +239,8 @@ int fcgi_init(void) } else { return is_fastcgi = 0; } @@ -531,7 +615,7 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fastcgi.c php-5.2.6.fpm/sapi/cgi/fastcgi.c #endif } return is_fastcgi; -@@ -256,11 +256,27 @@ +@@ -249,14 +256,26 @@ int fcgi_is_fastcgi(void) } } @@ -550,16 +634,15 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fastcgi.c php-5.2.6.fpm/sapi/cgi/fastcgi.c if (is_initialized) { zend_hash_destroy(&fcgi_mgmt_vars); } -+ -+ if (allowed_clients) { -+ free(allowed_clients); -+ allowed_clients = 0; -+ } -+ is_fastcgi = 0; ++ + if (allowed_clients) { + free(allowed_clients); ++ allowed_clients = 0; + } } -@@ -330,6 +352,41 @@ +@@ -330,6 +349,41 @@ out_fail: } #endif @@ -601,46 +684,46 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fastcgi.c php-5.2.6.fpm/sapi/cgi/fastcgi.c static int is_port_number(const char *bindpath) { while (*bindpath) { -@@ -458,38 +515,6 @@ +@@ -458,38 +512,6 @@ int fcgi_listen(const char *path, int backlog) if (!tcp) { chmod(path, 0777); - } else { -- char *ip = getenv("FCGI_WEB_SERVER_ADDRS"); -- char *cur, *end; -- int n; -- -- if (ip) { -- ip = strdup(ip); -- cur = ip; -- n = 0; -- while (*cur) { -- if (*cur == ',') n++; -- cur++; -- } -- allowed_clients = malloc(sizeof(in_addr_t) * (n+2)); -- n = 0; -- cur = ip; -- while (cur) { -- end = strchr(cur, ','); -- if (end) { -- *end = 0; -- end++; -- } -- allowed_clients[n] = inet_addr(cur); -- if (allowed_clients[n] == INADDR_NONE) { +- char *ip = getenv("FCGI_WEB_SERVER_ADDRS"); +- char *cur, *end; +- int n; +- +- if (ip) { +- ip = strdup(ip); +- cur = ip; +- n = 0; +- while (*cur) { +- if (*cur == ',') n++; +- cur++; +- } +- allowed_clients = malloc(sizeof(in_addr_t) * (n+2)); +- n = 0; +- cur = ip; +- while (cur) { +- end = strchr(cur, ','); +- if (end) { +- *end = 0; +- end++; +- } +- allowed_clients[n] = inet_addr(cur); +- if (allowed_clients[n] == INADDR_NONE) { - fprintf(stderr, "Wrong IP address '%s' in FCGI_WEB_SERVER_ADDRS\n", cur); -- } -- n++; -- cur = end; -- } -- allowed_clients[n] = INADDR_NONE; +- } +- n++; +- cur = end; +- } +- allowed_clients[n] = INADDR_NONE; - free(ip); - } } if (!is_initialized) { -@@ -829,7 +854,7 @@ +@@ -866,7 +888,7 @@ int fcgi_read(fcgi_request *req, char *str, int len) return n; } @@ -649,7 +732,7 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fastcgi.c php-5.2.6.fpm/sapi/cgi/fastcgi.c { if (destroy) { zend_hash_destroy(&req->env); -@@ -869,6 +894,10 @@ +@@ -906,6 +928,10 @@ static inline void fcgi_close(fcgi_request *req, int force, int destroy) close(req->fd); #endif req->fd = -1; @@ -660,7 +743,7 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fastcgi.c php-5.2.6.fpm/sapi/cgi/fastcgi.c } } -@@ -916,6 +945,10 @@ +@@ -953,6 +979,10 @@ int fcgi_accept_request(fcgi_request *req) sa_t sa; socklen_t len = sizeof(sa); @@ -671,7 +754,7 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fastcgi.c php-5.2.6.fpm/sapi/cgi/fastcgi.c FCGI_LOCK(req->listen_socket); req->fd = accept(listen_socket, (struct sockaddr *)&sa, &len); FCGI_UNLOCK(req->listen_socket); -@@ -951,6 +984,11 @@ +@@ -988,6 +1018,11 @@ int fcgi_accept_request(fcgi_request *req) break; #else if (req->fd >= 0) { @@ -683,10 +766,10 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fastcgi.c php-5.2.6.fpm/sapi/cgi/fastcgi.c #if defined(HAVE_SYS_POLL_H) && defined(HAVE_POLL) struct pollfd fds; int ret; -diff -Nru php-5.2.6.vanilla/sapi/cgi/fastcgi.h php-5.2.6.fpm/sapi/cgi/fastcgi.h ---- php-5.2.6.vanilla/sapi/cgi/fastcgi.h 2007-12-31 10:20:16.000000000 +0300 -+++ php-5.2.6.fpm/sapi/cgi/fastcgi.h 2008-05-01 20:42:06.000000000 +0400 -@@ -114,6 +114,9 @@ +diff --git a/sapi/cgi/fastcgi.h b/sapi/cgi/fastcgi.h +--- a/sapi/cgi/fastcgi.h ++++ b/sapi/cgi/fastcgi.h +@@ -114,6 +114,9 @@ typedef struct _fcgi_request { int fcgi_init(void); void fcgi_shutdown(void); int fcgi_is_fastcgi(void); @@ -696,7 +779,7 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fastcgi.h php-5.2.6.fpm/sapi/cgi/fastcgi.h int fcgi_in_shutdown(void); int fcgi_listen(const char *path, int backlog); void fcgi_init_request(fcgi_request *req, int listen_socket); -@@ -128,6 +131,8 @@ +@@ -128,6 +131,8 @@ int fcgi_read(fcgi_request *req, char *str, int len); int fcgi_write(fcgi_request *req, fcgi_request_type type, const char *str, int len); int fcgi_flush(fcgi_request *req, int close); @@ -705,10 +788,37 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fastcgi.h php-5.2.6.fpm/sapi/cgi/fastcgi.h #ifdef PHP_WIN32 void fcgi_impersonate(void); #endif -diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/acinclude.m4 php-5.2.6.fpm/sapi/cgi/fpm/acinclude.m4 ---- php-5.2.6.vanilla/sapi/cgi/fpm/acinclude.m4 1970-01-01 03:00:00.000000000 +0300 -+++ php-5.2.6.fpm/sapi/cgi/fpm/acinclude.m4 2008-07-21 06:39:38.000000000 +0400 -@@ -0,0 +1,383 @@ +diff --git a/sapi/cgi/fpm/Makefile.frag b/sapi/cgi/fpm/Makefile.frag +new file mode 100644 +--- /dev/null ++++ b/sapi/cgi/fpm/Makefile.frag +@@ -0,0 +1,21 @@ ++ ++install-fpm: sapi/cgi/fpm/php-fpm.conf sapi/cgi/fpm/php-fpm ++ @echo "Installing FPM config: $(INSTALL_ROOT)$(php_fpm_conf_path)" ++ -@$(mkinstalldirs) \ ++ $(INSTALL_ROOT)$(prefix)/sbin \ ++ `dirname "$(INSTALL_ROOT)$(php_fpm_conf_path)"` \ ++ `dirname "$(INSTALL_ROOT)$(php_fpm_log_path)"` \ ++ `dirname "$(INSTALL_ROOT)$(php_fpm_pid_path)"` ++ -@if test -r "$(INSTALL_ROOT)$(php_fpm_conf_path)" ; then \ ++ dest=`basename "$(php_fpm_conf_path)"`.default ; \ ++ echo " (installing as $$dest)" ; \ ++ else \ ++ dest=`basename "$(php_fpm_conf_path)"` ; \ ++ fi ; \ ++ $(INSTALL_DATA) $(top_builddir)/sapi/cgi/fpm/php-fpm.conf $(INSTALL_ROOT)`dirname "$(php_fpm_conf_path)"`/$$dest ++ @echo "Installing init.d script: $(INSTALL_ROOT)$(prefix)/sbin/php-fpm" ++ -@$(INSTALL) -m 0755 $(top_builddir)/sapi/cgi/fpm/php-fpm $(INSTALL_ROOT)$(prefix)/sbin/php-fpm ++ ++$(top_builddir)/libevent/libevent.a: $(top_builddir)/libevent/Makefile ++ cd $(top_builddir)/libevent && $(MAKE) libevent.a ++ +diff --git a/sapi/cgi/fpm/acinclude.m4 b/sapi/cgi/fpm/acinclude.m4 +new file mode 100644 +--- /dev/null ++++ b/sapi/cgi/fpm/acinclude.m4 +@@ -0,0 +1,377 @@ + +AC_DEFUN([AC_FPM_CHECK_FUNC], +[ @@ -830,7 +940,7 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/acinclude.m4 php-5.2.6.fpm/sapi/cgi/fpm + + AC_MSG_CHECKING([for clock_gettime]) + -+ AC_TRY_COMPILE([ #include ], [struct timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts);], [ ++ AC_TRY_LINK([ #include ], [struct timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts);], [ + have_clock_gettime=yes + AC_MSG_RESULT([yes]) + ], [ @@ -843,7 +953,7 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/acinclude.m4 php-5.2.6.fpm/sapi/cgi/fpm + SAVED_LIBS="$LIBS" + LIBS="$LIBS -lrt" + -+ AC_TRY_COMPILE([ #include ], [struct timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts);], [ ++ AC_TRY_LINK([ #include ], [struct timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts);], [ + have_clock_gettime=yes + AC_MSG_RESULT([yes]) + ], [ @@ -1065,18 +1175,12 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/acinclude.m4 php-5.2.6.fpm/sapi/cgi/fpm + AC_DEFINE_UNQUOTED([PROC_MEM_FILE], "$proc_mem_file", [/proc/pid/mem interface]) + fi + -+ FPM_TRACE_SRCS="" -+ + if test "$have_ptrace" = "yes"; then -+ FPM_TRACE_SRCS="fpm_trace_ptrace.c" ++ FPM_SOURCES="$FPM_SOURCES fpm_trace.c fpm_trace_ptrace.c" + elif test -n "$proc_mem_file"; then -+ FPM_TRACE_SRCS="fpm_trace_pread.c" ++ FPM_SOURCES="$FPM_SOURCES fpm_trace.c fpm_trace_pread.c" + elif test "$have_mach_vm_read" = "yes" ; then -+ FPM_TRACE_SRCS="fpm_trace_mach.c" -+ fi -+ -+ if test -n "$FPM_TRACE_SRCS"; then -+ FPM_TRACE_SRCS="fpm_trace.c $FPM_TRACE_SRCS" ++ FPM_SOURCES="$FPM_SOURCES fpm_trace.c fpm_trace_mach.c" + fi + +]) @@ -1092,9 +1196,10 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/acinclude.m4 php-5.2.6.fpm/sapi/cgi/fpm + AC_MSG_RESULT([no]) + ]) +]) -diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/conf/php-fpm.conf.in php-5.2.6.fpm/sapi/cgi/fpm/conf/php-fpm.conf.in ---- php-5.2.6.vanilla/sapi/cgi/fpm/conf/php-fpm.conf.in 1970-01-01 03:00:00.000000000 +0300 -+++ php-5.2.6.fpm/sapi/cgi/fpm/conf/php-fpm.conf.in 2008-05-23 00:53:15.000000000 +0400 +diff --git a/sapi/cgi/fpm/conf/php-fpm.conf.in b/sapi/cgi/fpm/conf/php-fpm.conf.in +new file mode 100644 +--- /dev/null ++++ b/sapi/cgi/fpm/conf/php-fpm.conf.in @@ -0,0 +1,156 @@ + + @@ -1252,11 +1357,13 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/conf/php-fpm.conf.in php-5.2.6.fpm/sapi + + + ---- php-5.2.6.fpm/sapi/cgi/fpm/config.m4 2008-09-19 05:22:37.000000000 +0400 -+++ php-5.2.6.fpm/sapi/cgi/fpm/config.m4 2008-09-19 05:22:37.000000000 +0400 -@@ -0,0 +1,118 @@ +diff --git a/sapi/cgi/fpm/config.m4 b/sapi/cgi/fpm/config.m4 +new file mode 100644 +--- /dev/null ++++ b/sapi/cgi/fpm/config.m4 +@@ -0,0 +1,117 @@ + -+FPM_VERSION="0.5.9" ++FPM_VERSION="0.5.14" + +PHP_ARG_WITH(fpm-conf, for php-fpm config file path, +[ --with-fpm-conf=PATH Set the path for php-fpm configuration file [PREFIX/etc/php-fpm.conf]], \$prefix/etc/php-fpm.conf, no) @@ -1267,18 +1374,6 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/conf/php-fpm.conf.in php-5.2.6.fpm/sapi +PHP_ARG_WITH(fpm-pid, for php-fpm pid file path, +[ --with-fpm-pid=PATH Set the path for php-fpm pid file [PREFIX/logs/php-fpm.pid]], \$prefix/logs/php-fpm.pid, no) + -+dnl AC_FPM_LIBEVENT -+AC_FPM_LIBXML -+AC_FPM_PRCTL -+AC_FPM_CLOCK -+AC_FPM_TRACE -+dnl AC_FPM_JUDY -+ -+LIBEVENT_CFLAGS="" -+LIBEVENT_LIBS="-levent" -+ -+SAPI_EXTRA_DEPS="$LIBEVENT_LIBS" -+ +FPM_SOURCES="fpm.c \ + fpm_conf.c \ + fpm_signals.c \ @@ -1292,7 +1387,6 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/conf/php-fpm.conf.in php-5.2.6.fpm/sapi + fpm_events.c \ + fpm_php.c \ + fpm_php_trace.c \ -+ $FPM_TRACE_SRCS \ + fpm_process_ctl.c \ + fpm_request.c \ + fpm_clock.c \ @@ -1301,6 +1395,18 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/conf/php-fpm.conf.in php-5.2.6.fpm/sapi + xml_config.c \ + zlog.c" + ++dnl AC_FPM_LIBEVENT ++AC_FPM_LIBXML ++AC_FPM_PRCTL ++AC_FPM_CLOCK ++AC_FPM_TRACE ++dnl AC_FPM_JUDY ++ ++LIBEVENT_CFLAGS="" ++LIBEVENT_LIBS="-levent" ++ ++SAPI_EXTRA_DEPS="$LIBEVENT_LIBS" ++ +FPM_CFLAGS="$LIBEVENT_CFLAGS $LIBXML_CFLAGS $JUDY_CFLAGS" + +dnl FPM_CFLAGS="$FPM_CFLAGS -DJUDYERROR_NOTEST" # for Judy @@ -1373,9 +1479,135 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/conf/php-fpm.conf.in php-5.2.6.fpm/sapi +PHP_OUTPUT(sapi/cgi/fpm/fpm_autoconf.h) +PHP_OUTPUT(sapi/cgi/fpm/php-fpm.conf:sapi/cgi/fpm/conf/php-fpm.conf.in) +PHP_OUTPUT(sapi/cgi/fpm/php-fpm:sapi/cgi/fpm/init.d/php-fpm.in) -diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_arrays.h php-5.2.6.fpm/sapi/cgi/fpm/fpm_arrays.h ---- php-5.2.6.vanilla/sapi/cgi/fpm/fpm_arrays.h 1970-01-01 03:00:00.000000000 +0300 -+++ php-5.2.6.fpm/sapi/cgi/fpm/fpm_arrays.h 2008-05-24 21:38:47.000000000 +0400 +diff --git a/sapi/cgi/fpm/fpm.c b/sapi/cgi/fpm/fpm.c +new file mode 100644 +index 0000000..9db2c9b +--- /dev/null ++++ b/sapi/cgi/fpm/fpm.c +@@ -0,0 +1,84 @@ ++ ++ /* $Id$ */ ++ /* (c) 2007,2008 Andrei Nigmatulin */ ++ ++#include "fpm_config.h" ++ ++#include /* for exit */ ++ ++#include "fpm.h" ++#include "fpm_children.h" ++#include "fpm_signals.h" ++#include "fpm_env.h" ++#include "fpm_events.h" ++#include "fpm_cleanup.h" ++#include "fpm_php.h" ++#include "fpm_sockets.h" ++#include "fpm_unix.h" ++#include "fpm_process_ctl.h" ++#include "fpm_conf.h" ++#include "fpm_worker_pool.h" ++#include "fpm_stdio.h" ++#include "zlog.h" ++ ++int fpm; ++ ++struct fpm_globals_s fpm_globals; ++ ++int fpm_init(int argc, char **argv, char *config) ++{ ++ fpm_globals.argc = argc; ++ fpm_globals.argv = argv; ++ fpm_globals.config = config; ++ ++ if (0 > fpm_php_init_main() || ++ 0 > fpm_stdio_init_main() || ++ 0 > fpm_conf_init_main() || ++ 0 > fpm_unix_init_main() || ++ 0 > fpm_env_init_main() || ++ 0 > fpm_signals_init_main() || ++ 0 > fpm_pctl_init_main() || ++ 0 > fpm_children_init_main() || ++ 0 > fpm_sockets_init_main() || ++ 0 > fpm_worker_pool_init_main() || ++ 0 > fpm_event_init_main()) { ++ return -1; ++ } ++ ++ if (0 > fpm_conf_write_pid()) { ++ return -1; ++ } ++ ++ zlog(ZLOG_STUFF, ZLOG_NOTICE, "fpm is running, pid %d", (int) fpm_globals.parent_pid); ++ ++ return 0; ++} ++ ++/* children: return listening socket ++ parent: never return */ ++int fpm_run(int *max_requests) ++{ ++ struct fpm_worker_pool_s *wp; ++ ++ /* create initial children in all pools */ ++ for (wp = fpm_worker_all_pools; wp; wp = wp->next) { ++ int is_parent; ++ ++ is_parent = fpm_children_create_initial(wp); ++ ++ if (!is_parent) { ++ goto run_child; ++ } ++ } ++ ++ /* run event loop forever */ ++ fpm_event_loop(); ++ ++run_child: /* only workers reach this point */ ++ ++ fpm_cleanups_run(FPM_CLEANUP_CHILD); ++ ++ *max_requests = fpm_globals.max_requests; ++ return fpm_globals.listening_socket; ++} ++ +diff --git a/sapi/cgi/fpm/fpm.h b/sapi/cgi/fpm/fpm.h +new file mode 100644 +--- /dev/null ++++ b/sapi/cgi/fpm/fpm.h +@@ -0,0 +1,30 @@ ++ ++ /* $Id$ */ ++ /* (c) 2007,2008 Andrei Nigmatulin */ ++ ++#ifndef FPM_H ++#define FPM_H 1 ++ ++#include ++ ++int fpm_run(int *max_requests); ++int fpm_init(int argc, char **argv, char *config); ++ ++struct fpm_globals_s { ++ pid_t parent_pid; ++ int argc; ++ char **argv; ++ char *config; ++ int running_children; ++ int error_log_fd; ++ int log_level; ++ int listening_socket; /* for this child */ ++ int max_requests; /* for this child */ ++ int is_child; ++}; ++ ++extern struct fpm_globals_s fpm_globals; ++ ++extern int fpm; ++ ++#endif +diff --git a/sapi/cgi/fpm/fpm_arrays.h b/sapi/cgi/fpm/fpm_arrays.h +new file mode 100644 +--- /dev/null ++++ b/sapi/cgi/fpm/fpm_arrays.h @@ -0,0 +1,110 @@ + + /* $Id$ */ @@ -1487,9 +1719,10 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_arrays.h php-5.2.6.fpm/sapi/cgi/fpm +} + +#endif -diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_atomic.h php-5.2.6.fpm/sapi/cgi/fpm/fpm_atomic.h ---- php-5.2.6.vanilla/sapi/cgi/fpm/fpm_atomic.h 1970-01-01 03:00:00.000000000 +0300 -+++ php-5.2.6.fpm/sapi/cgi/fpm/fpm_atomic.h 2008-09-19 03:34:11.000000000 +0400 +diff --git a/sapi/cgi/fpm/fpm_atomic.h b/sapi/cgi/fpm/fpm_atomic.h +new file mode 100644 +--- /dev/null ++++ b/sapi/cgi/fpm/fpm_atomic.h @@ -0,0 +1,85 @@ + + /* $Id$ */ @@ -1576,9 +1809,10 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_atomic.h php-5.2.6.fpm/sapi/cgi/fpm + +#endif + -diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_autoconf.h.in php-5.2.6.fpm/sapi/cgi/fpm/fpm_autoconf.h.in ---- php-5.2.6.vanilla/sapi/cgi/fpm/fpm_autoconf.h.in 1970-01-01 03:00:00.000000000 +0300 -+++ php-5.2.6.fpm/sapi/cgi/fpm/fpm_autoconf.h.in 2008-05-24 21:38:47.000000000 +0400 +diff --git a/sapi/cgi/fpm/fpm_autoconf.h.in b/sapi/cgi/fpm/fpm_autoconf.h.in +new file mode 100644 +--- /dev/null ++++ b/sapi/cgi/fpm/fpm_autoconf.h.in @@ -0,0 +1,9 @@ + + /* $Id$ */ @@ -1589,98 +1823,11 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_autoconf.h.in php-5.2.6.fpm/sapi/cg +#define PHP_FPM_LOG_PATH "@php_fpm_log_path@" +#define PHP_FPM_PID_PATH "@php_fpm_pid_path@" + -diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm.c php-5.2.6.fpm/sapi/cgi/fpm/fpm.c ---- php-5.2.6.vanilla/sapi/cgi/fpm/fpm.c 1970-01-01 03:00:00.000000000 +0300 -+++ php-5.2.6.fpm/sapi/cgi/fpm/fpm.c 2008-07-20 20:38:31.000000000 +0400 -@@ -0,0 +1,84 @@ -+ -+ /* $Id$ */ -+ /* (c) 2007,2008 Andrei Nigmatulin */ -+ -+#include "fpm_config.h" -+ -+#include /* for exit */ -+ -+#include "fpm.h" -+#include "fpm_children.h" -+#include "fpm_signals.h" -+#include "fpm_env.h" -+#include "fpm_events.h" -+#include "fpm_cleanup.h" -+#include "fpm_php.h" -+#include "fpm_sockets.h" -+#include "fpm_unix.h" -+#include "fpm_process_ctl.h" -+#include "fpm_conf.h" -+#include "fpm_worker_pool.h" -+#include "fpm_stdio.h" -+#include "zlog.h" -+ -+int fpm; -+ -+struct fpm_globals_s fpm_globals; -+ -+int fpm_init(int argc, char **argv, char *config) -+{ -+ fpm_globals.argc = argc; -+ fpm_globals.argv = argv; -+ fpm_globals.config = config; -+ -+ if (0 > fpm_php_init_main() || -+ 0 > fpm_stdio_init_main() || -+ 0 > fpm_conf_init_main() || -+ 0 > fpm_unix_init_main() || -+ 0 > fpm_env_init_main() || -+ 0 > fpm_signals_init_main() || -+ 0 > fpm_pctl_init_main() || -+ 0 > fpm_children_init_main() || -+ 0 > fpm_sockets_init_main() || -+ 0 > fpm_worker_pool_init_main() || -+ 0 > fpm_event_init_main()) { -+ return -1; -+ } -+ -+ if (0 > fpm_conf_write_pid()) { -+ return -1; -+ } -+ -+ zlog(ZLOG_STUFF, ZLOG_NOTICE, "fpm is running, pid %d", (int) fpm_globals.parent_pid); -+ -+ return 0; -+} -+ -+/* children: return listening socket -+ parent: never return */ -+int fpm_run(int *max_requests) -+{ -+ struct fpm_worker_pool_s *wp; -+ -+ /* create initial children in all pools */ -+ for (wp = fpm_worker_all_pools; wp; wp = wp->next) { -+ int is_parent; -+ -+ is_parent = fpm_children_create_initial(wp); -+ -+ if (!is_parent) { -+ goto run_child; -+ } -+ } -+ -+ /* run event loop forever */ -+ fpm_event_loop(); -+ -+run_child: /* only workers reach this point */ -+ -+ fpm_cleanups_run(FPM_CLEANUP_CHILD); -+ -+ *max_requests = fpm_globals.max_requests; -+ return fpm_globals.listening_socket; -+} -+ -diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_children.c php-5.2.6.fpm/sapi/cgi/fpm/fpm_children.c ---- php-5.2.6.vanilla/sapi/cgi/fpm/fpm_children.c 1970-01-01 03:00:00.000000000 +0300 -+++ php-5.2.6.fpm/sapi/cgi/fpm/fpm_children.c 2008-08-26 19:09:15.000000000 +0400 -@@ -0,0 +1,383 @@ +diff --git a/sapi/cgi/fpm/fpm_children.c b/sapi/cgi/fpm/fpm_children.c +new file mode 100644 +--- /dev/null ++++ b/sapi/cgi/fpm/fpm_children.c +@@ -0,0 +1,385 @@ + + /* $Id$ */ + /* (c) 2007,2008 Andrei Nigmatulin */ @@ -1909,12 +2056,12 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_children.c php-5.2.6.fpm/sapi/cgi/f + + last_faults[fault++] = now; + -+ if (fault == fpm_global_options.emergency_restart_threshold) { ++ if (fault == fpm_global_config.emergency_restart_threshold) { + fault = 0; + } + -+ for (i = 0; i < fpm_global_options.emergency_restart_threshold; i++) { -+ if (now - last_faults[i] > fpm_global_options.emergency_restart_interval) { ++ for (i = 0; i < fpm_global_config.emergency_restart_threshold; i++) { ++ if (now - last_faults[i] > fpm_global_config.emergency_restart_interval) { + restart_condition = 0; + break; + } @@ -1923,7 +2070,7 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_children.c php-5.2.6.fpm/sapi/cgi/f + if (restart_condition) { + + zlog(ZLOG_STUFF, ZLOG_WARNING, "failed processes threshold (%d in %d sec) is reached, initiating reload", -+ fpm_global_options.emergency_restart_threshold, fpm_global_options.emergency_restart_interval); ++ fpm_global_config.emergency_restart_threshold, fpm_global_config.emergency_restart_interval); + + fpm_pctl(FPM_PCTL_STATE_RELOADING, FPM_PCTL_ACTION_SET); + } @@ -2047,26 +2194,29 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_children.c php-5.2.6.fpm/sapi/cgi/f + +int fpm_children_init_main() +{ -+ if (fpm_global_options.emergency_restart_threshold && -+ fpm_global_options.emergency_restart_interval) { ++ if (fpm_global_config.emergency_restart_threshold && ++ fpm_global_config.emergency_restart_interval) { + -+ last_faults = malloc(sizeof(time_t) * fpm_global_options.emergency_restart_threshold); ++ last_faults = malloc(sizeof(time_t) * fpm_global_config.emergency_restart_threshold); + + if (!last_faults) { + return -1; + } + -+ memset(last_faults, 0, sizeof(time_t) * fpm_global_options.emergency_restart_threshold); ++ memset(last_faults, 0, sizeof(time_t) * fpm_global_config.emergency_restart_threshold); + } + -+ fpm_cleanup_add(FPM_CLEANUP_ALL, fpm_children_cleanup, 0); ++ if (0 > fpm_cleanup_add(FPM_CLEANUP_ALL, fpm_children_cleanup, 0)) { ++ return -1; ++ } + + return 0; +} + -diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_children.h php-5.2.6.fpm/sapi/cgi/fpm/fpm_children.h ---- php-5.2.6.vanilla/sapi/cgi/fpm/fpm_children.h 1970-01-01 03:00:00.000000000 +0300 -+++ php-5.2.6.fpm/sapi/cgi/fpm/fpm_children.h 2008-05-24 21:38:47.000000000 +0400 +diff --git a/sapi/cgi/fpm/fpm_children.h b/sapi/cgi/fpm/fpm_children.h +new file mode 100644 +--- /dev/null ++++ b/sapi/cgi/fpm/fpm_children.h @@ -0,0 +1,33 @@ + + /* $Id$ */ @@ -2101,9 +2251,10 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_children.h php-5.2.6.fpm/sapi/cgi/f +}; + +#endif -diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_cleanup.c php-5.2.6.fpm/sapi/cgi/fpm/fpm_cleanup.c ---- php-5.2.6.vanilla/sapi/cgi/fpm/fpm_cleanup.c 1970-01-01 03:00:00.000000000 +0300 -+++ php-5.2.6.fpm/sapi/cgi/fpm/fpm_cleanup.c 2008-05-24 21:38:47.000000000 +0400 +diff --git a/sapi/cgi/fpm/fpm_cleanup.c b/sapi/cgi/fpm/fpm_cleanup.c +new file mode 100644 +--- /dev/null ++++ b/sapi/cgi/fpm/fpm_cleanup.c @@ -0,0 +1,51 @@ + + /* $Id$ */ @@ -2156,9 +2307,10 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_cleanup.c php-5.2.6.fpm/sapi/cgi/fp + fpm_array_free(&cleanups); +} + -diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_cleanup.h php-5.2.6.fpm/sapi/cgi/fpm/fpm_cleanup.h ---- php-5.2.6.vanilla/sapi/cgi/fpm/fpm_cleanup.h 1970-01-01 03:00:00.000000000 +0300 -+++ php-5.2.6.fpm/sapi/cgi/fpm/fpm_cleanup.h 2008-05-24 21:38:47.000000000 +0400 +diff --git a/sapi/cgi/fpm/fpm_cleanup.h b/sapi/cgi/fpm/fpm_cleanup.h +new file mode 100644 +--- /dev/null ++++ b/sapi/cgi/fpm/fpm_cleanup.h @@ -0,0 +1,21 @@ + + /* $Id$ */ @@ -2181,9 +2333,10 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_cleanup.h php-5.2.6.fpm/sapi/cgi/fp + +#endif + -diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_clock.c php-5.2.6.fpm/sapi/cgi/fpm/fpm_clock.c ---- php-5.2.6.vanilla/sapi/cgi/fpm/fpm_clock.c 1970-01-01 03:00:00.000000000 +0300 -+++ php-5.2.6.fpm/sapi/cgi/fpm/fpm_clock.c 2008-09-19 03:19:59.000000000 +0400 +diff --git a/sapi/cgi/fpm/fpm_clock.c b/sapi/cgi/fpm/fpm_clock.c +new file mode 100644 +--- /dev/null ++++ b/sapi/cgi/fpm/fpm_clock.c @@ -0,0 +1,115 @@ + + /* $Id$ */ @@ -2300,9 +2453,10 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_clock.c php-5.2.6.fpm/sapi/cgi/fpm/ +} + +#endif -diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_clock.h php-5.2.6.fpm/sapi/cgi/fpm/fpm_clock.h ---- php-5.2.6.vanilla/sapi/cgi/fpm/fpm_clock.h 1970-01-01 03:00:00.000000000 +0300 -+++ php-5.2.6.fpm/sapi/cgi/fpm/fpm_clock.h 2008-05-24 21:38:47.000000000 +0400 +diff --git a/sapi/cgi/fpm/fpm_clock.h b/sapi/cgi/fpm/fpm_clock.h +new file mode 100644 +--- /dev/null ++++ b/sapi/cgi/fpm/fpm_clock.h @@ -0,0 +1,13 @@ + + /* $Id$ */ @@ -2317,10 +2471,11 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_clock.h php-5.2.6.fpm/sapi/cgi/fpm/ +int fpm_clock_get(struct timeval *tv); + +#endif -diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_conf.c php-5.2.6.fpm/sapi/cgi/fpm/fpm_conf.c ---- php-5.2.6.vanilla/sapi/cgi/fpm/fpm_conf.c 1970-01-01 03:00:00.000000000 +0300 -+++ php-5.2.6.fpm/sapi/cgi/fpm/fpm_conf.c 2008-09-19 04:54:15.000000000 +0400 -@@ -0,0 +1,530 @@ +diff --git a/sapi/cgi/fpm/fpm_conf.c b/sapi/cgi/fpm/fpm_conf.c +new file mode 100644 +--- /dev/null ++++ b/sapi/cgi/fpm/fpm_conf.c +@@ -0,0 +1,532 @@ + + /* $Id$ */ + /* (c) 2007,2008 Andrei Nigmatulin */ @@ -2348,11 +2503,11 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_conf.c php-5.2.6.fpm/sapi/cgi/fpm/f +#include "zlog.h" + + -+struct fpm_options_s fpm_global_options; ++struct fpm_global_config_s fpm_global_config; + -+static void *fpm_global_options_ptr() ++static void *fpm_global_config_ptr() +{ -+ return &fpm_global_options; ++ return &fpm_global_config; +} + +static char *fpm_conf_set_log_level(void **conf, char *name, void *vv, intptr_t offset) @@ -2382,15 +2537,15 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_conf.c php-5.2.6.fpm/sapi/cgi/fpm/f +} + +static struct xml_conf_section xml_section_fpm_global_options = { -+ .conf = &fpm_global_options_ptr, ++ .conf = &fpm_global_config_ptr, + .path = "/configuration/global_options", + .parsers = (struct xml_value_parser []) { -+ { XML_CONF_SCALAR, "emergency_restart_threshold", &xml_conf_set_slot_integer, offsetof(struct fpm_options_s, emergency_restart_threshold) }, -+ { XML_CONF_SCALAR, "emergency_restart_interval", &xml_conf_set_slot_time, offsetof(struct fpm_options_s, emergency_restart_interval) }, -+ { XML_CONF_SCALAR, "process_control_timeout", &xml_conf_set_slot_time, offsetof(struct fpm_options_s, process_control_timeout) }, -+ { XML_CONF_SCALAR, "daemonize", &xml_conf_set_slot_boolean, offsetof(struct fpm_options_s, daemonize) }, -+ { XML_CONF_SCALAR, "pid_file", &xml_conf_set_slot_string, offsetof(struct fpm_options_s, pid_file) }, -+ { XML_CONF_SCALAR, "error_log", &xml_conf_set_slot_string, offsetof(struct fpm_options_s, error_log) }, ++ { XML_CONF_SCALAR, "emergency_restart_threshold", &xml_conf_set_slot_integer, offsetof(struct fpm_global_config_s, emergency_restart_threshold) }, ++ { XML_CONF_SCALAR, "emergency_restart_interval", &xml_conf_set_slot_time, offsetof(struct fpm_global_config_s, emergency_restart_interval) }, ++ { XML_CONF_SCALAR, "process_control_timeout", &xml_conf_set_slot_time, offsetof(struct fpm_global_config_s, process_control_timeout) }, ++ { XML_CONF_SCALAR, "daemonize", &xml_conf_set_slot_boolean, offsetof(struct fpm_global_config_s, daemonize) }, ++ { XML_CONF_SCALAR, "pid_file", &xml_conf_set_slot_string, offsetof(struct fpm_global_config_s, pid_file) }, ++ { XML_CONF_SCALAR, "error_log", &xml_conf_set_slot_string, offsetof(struct fpm_global_config_s, error_log) }, + { XML_CONF_SCALAR, "log_level", &fpm_conf_set_log_level, 0 }, + { 0, 0, 0, 0 } + } @@ -2752,10 +2907,10 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_conf.c php-5.2.6.fpm/sapi/cgi/fpm/f + +int fpm_conf_unlink_pid() +{ -+ if (fpm_global_options.pid_file) { ++ if (fpm_global_config.pid_file) { + -+ if (0 > unlink(fpm_global_options.pid_file)) { -+ zlog(ZLOG_STUFF, ZLOG_SYSERROR, "unlink(\"%s\") failed", fpm_global_options.pid_file); ++ if (0 > unlink(fpm_global_config.pid_file)) { ++ zlog(ZLOG_STUFF, ZLOG_SYSERROR, "unlink(\"%s\") failed", fpm_global_config.pid_file); + return -1; + } + @@ -2768,16 +2923,16 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_conf.c php-5.2.6.fpm/sapi/cgi/fpm/f +{ + int fd; + -+ if (fpm_global_options.pid_file) { ++ if (fpm_global_config.pid_file) { + char buf[64]; + int len; + -+ unlink(fpm_global_options.pid_file); ++ unlink(fpm_global_config.pid_file); + -+ fd = creat(fpm_global_options.pid_file, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); ++ fd = creat(fpm_global_config.pid_file, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); + + if (fd < 0) { -+ zlog(ZLOG_STUFF, ZLOG_SYSERROR, "creat(\"%s\") failed", fpm_global_options.pid_file); ++ zlog(ZLOG_STUFF, ZLOG_SYSERROR, "creat(\"%s\") failed", fpm_global_config.pid_file); + return -1; + } + @@ -2796,15 +2951,15 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_conf.c php-5.2.6.fpm/sapi/cgi/fpm/f + +static int fpm_conf_post_process() +{ -+ if (fpm_global_options.pid_file) { -+ fpm_evaluate_full_path(&fpm_global_options.pid_file); ++ if (fpm_global_config.pid_file) { ++ fpm_evaluate_full_path(&fpm_global_config.pid_file); + } + -+ if (!fpm_global_options.error_log) { -+ fpm_global_options.error_log = strdup(PHP_FPM_LOG_PATH); ++ if (!fpm_global_config.error_log) { ++ fpm_global_config.error_log = strdup(PHP_FPM_LOG_PATH); + } + -+ fpm_evaluate_full_path(&fpm_global_options.error_log); ++ fpm_evaluate_full_path(&fpm_global_config.error_log); + + if (0 > fpm_stdio_open_error_log(0)) { + return -1; @@ -2815,10 +2970,10 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_conf.c php-5.2.6.fpm/sapi/cgi/fpm/f + +static void fpm_conf_cleanup(int which, void *arg) +{ -+ free(fpm_global_options.pid_file); -+ free(fpm_global_options.error_log); -+ fpm_global_options.pid_file = 0; -+ fpm_global_options.error_log = 0; ++ free(fpm_global_config.pid_file); ++ free(fpm_global_config.error_log); ++ fpm_global_config.pid_file = 0; ++ fpm_global_config.error_log = 0; +} + +int fpm_conf_init_main() @@ -2847,13 +3002,16 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_conf.c php-5.2.6.fpm/sapi/cgi/fpm/f + + xml_conf_clean(); + -+ fpm_cleanup_add(FPM_CLEANUP_ALL, fpm_conf_cleanup, 0); ++ if (0 > fpm_cleanup_add(FPM_CLEANUP_ALL, fpm_conf_cleanup, 0)) { ++ return -1; ++ } + + return 0; +} -diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_conf.h php-5.2.6.fpm/sapi/cgi/fpm/fpm_conf.h ---- php-5.2.6.vanilla/sapi/cgi/fpm/fpm_conf.h 1970-01-01 03:00:00.000000000 +0300 -+++ php-5.2.6.fpm/sapi/cgi/fpm/fpm_conf.h 2008-08-26 19:09:15.000000000 +0400 +diff --git a/sapi/cgi/fpm/fpm_conf.h b/sapi/cgi/fpm/fpm_conf.h +new file mode 100644 +--- /dev/null ++++ b/sapi/cgi/fpm/fpm_conf.h @@ -0,0 +1,73 @@ + + /* $Id$ */ @@ -2870,7 +3028,7 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_conf.h php-5.2.6.fpm/sapi/cgi/fpm/f + char *value; +}; + -+struct fpm_options_s { ++struct fpm_global_config_s { + int emergency_restart_threshold; + int emergency_restart_interval; + int process_control_timeout; @@ -2879,7 +3037,7 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_conf.h php-5.2.6.fpm/sapi/cgi/fpm/f + char *error_log; +}; + -+extern struct fpm_options_s fpm_global_options; ++extern struct fpm_global_config_s fpm_global_config; + +struct fpm_pm_s { + int style; @@ -2928,9 +3086,10 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_conf.h php-5.2.6.fpm/sapi/cgi/fpm/f + +#endif + -diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_config.h php-5.2.6.fpm/sapi/cgi/fpm/fpm_config.h ---- php-5.2.6.vanilla/sapi/cgi/fpm/fpm_config.h 1970-01-01 03:00:00.000000000 +0300 -+++ php-5.2.6.fpm/sapi/cgi/fpm/fpm_config.h 2008-05-25 04:30:43.000000000 +0400 +diff --git a/sapi/cgi/fpm/fpm_config.h b/sapi/cgi/fpm/fpm_config.h +new file mode 100644 +--- /dev/null ++++ b/sapi/cgi/fpm/fpm_config.h @@ -0,0 +1,39 @@ + + /* $Id$ */ @@ -2971,9 +3130,10 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_config.h php-5.2.6.fpm/sapi/cgi/fpm +#define HAVE_FPM_TRACE 0 +#endif + -diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_env.c php-5.2.6.fpm/sapi/cgi/fpm/fpm_env.c ---- php-5.2.6.vanilla/sapi/cgi/fpm/fpm_env.c 1970-01-01 03:00:00.000000000 +0300 -+++ php-5.2.6.fpm/sapi/cgi/fpm/fpm_env.c 2008-09-19 03:19:59.000000000 +0400 +diff --git a/sapi/cgi/fpm/fpm_env.c b/sapi/cgi/fpm/fpm_env.c +new file mode 100644 +--- /dev/null ++++ b/sapi/cgi/fpm/fpm_env.c @@ -0,0 +1,125 @@ + + /* $Id$ */ @@ -3100,9 +3260,10 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_env.c php-5.2.6.fpm/sapi/cgi/fpm/fp + + return 0; +} -diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_env.h php-5.2.6.fpm/sapi/cgi/fpm/fpm_env.h ---- php-5.2.6.vanilla/sapi/cgi/fpm/fpm_env.h 1970-01-01 03:00:00.000000000 +0300 -+++ php-5.2.6.fpm/sapi/cgi/fpm/fpm_env.h 2008-09-19 03:19:59.000000000 +0400 +diff --git a/sapi/cgi/fpm/fpm_env.h b/sapi/cgi/fpm/fpm_env.h +new file mode 100644 +--- /dev/null ++++ b/sapi/cgi/fpm/fpm_env.h @@ -0,0 +1,24 @@ + + /* $Id$ */ @@ -3128,10 +3289,11 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_env.h php-5.2.6.fpm/sapi/cgi/fpm/fp + +#endif + -diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_events.c php-5.2.6.fpm/sapi/cgi/fpm/fpm_events.c ---- php-5.2.6.vanilla/sapi/cgi/fpm/fpm_events.c 1970-01-01 03:00:00.000000000 +0300 -+++ php-5.2.6.fpm/sapi/cgi/fpm/fpm_events.c 2008-08-26 19:09:15.000000000 +0400 -@@ -0,0 +1,133 @@ +diff --git a/sapi/cgi/fpm/fpm_events.c b/sapi/cgi/fpm/fpm_events.c +new file mode 100644 +--- /dev/null ++++ b/sapi/cgi/fpm/fpm_events.c +@@ -0,0 +1,135 @@ + + /* $Id$ */ + /* (c) 2007,2008 Andrei Nigmatulin */ @@ -3221,7 +3383,9 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_events.c php-5.2.6.fpm/sapi/cgi/fpm + + zlog(ZLOG_STUFF, ZLOG_NOTICE, "libevent: using %s", event_get_method()); + -+ fpm_cleanup_add(FPM_CLEANUP_ALL, fpm_event_cleanup, 0); ++ if (0 > fpm_cleanup_add(FPM_CLEANUP_ALL, fpm_event_cleanup, 0)) { ++ return -1; ++ } + + return 0; +} @@ -3257,7 +3421,7 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_events.c php-5.2.6.fpm/sapi/cgi/fpm + +void fpm_event_exit_loop() +{ -+ event_loopexit(0); ++ event_loopbreak(); +} + +void fpm_event_fire(struct event *ev) @@ -3265,9 +3429,10 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_events.c php-5.2.6.fpm/sapi/cgi/fpm + (*ev->ev_callback)( (int) ev->ev_fd, (short) ev->ev_res, ev->ev_arg); +} + -diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_events.h php-5.2.6.fpm/sapi/cgi/fpm/fpm_events.h ---- php-5.2.6.vanilla/sapi/cgi/fpm/fpm_events.h 1970-01-01 03:00:00.000000000 +0300 -+++ php-5.2.6.fpm/sapi/cgi/fpm/fpm_events.h 2008-05-24 21:38:47.000000000 +0400 +diff --git a/sapi/cgi/fpm/fpm_events.h b/sapi/cgi/fpm/fpm_events.h +new file mode 100644 +--- /dev/null ++++ b/sapi/cgi/fpm/fpm_events.h @@ -0,0 +1,16 @@ + + /* $Id$ */ @@ -3285,44 +3450,11 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_events.h php-5.2.6.fpm/sapi/cgi/fpm + + +#endif -diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm.h php-5.2.6.fpm/sapi/cgi/fpm/fpm.h ---- php-5.2.6.vanilla/sapi/cgi/fpm/fpm.h 1970-01-01 03:00:00.000000000 +0300 -+++ php-5.2.6.fpm/sapi/cgi/fpm/fpm.h 2008-05-24 21:38:47.000000000 +0400 -@@ -0,0 +1,30 @@ -+ -+ /* $Id$ */ -+ /* (c) 2007,2008 Andrei Nigmatulin */ -+ -+#ifndef FPM_H -+#define FPM_H 1 -+ -+#include -+ -+int fpm_run(int *max_requests); -+int fpm_init(int argc, char **argv, char *config); -+ -+struct fpm_globals_s { -+ pid_t parent_pid; -+ int argc; -+ char **argv; -+ char *config; -+ int running_children; -+ int error_log_fd; -+ int log_level; -+ int listening_socket; /* for this child */ -+ int max_requests; /* for this child */ -+ int is_child; -+}; -+ -+extern struct fpm_globals_s fpm_globals; -+ -+extern int fpm; -+ -+#endif -diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_php.c php-5.2.6.fpm/sapi/cgi/fpm/fpm_php.c ---- php-5.2.6.vanilla/sapi/cgi/fpm/fpm_php.c 1970-01-01 03:00:00.000000000 +0300 -+++ php-5.2.6.fpm/sapi/cgi/fpm/fpm_php.c 2008-07-20 20:16:28.000000000 +0400 -@@ -0,0 +1,171 @@ +diff --git a/sapi/cgi/fpm/fpm_php.c b/sapi/cgi/fpm/fpm_php.c +new file mode 100644 +--- /dev/null ++++ b/sapi/cgi/fpm/fpm_php.c +@@ -0,0 +1,190 @@ + + /* $Id$ */ + /* (c) 2007,2008 Andrei Nigmatulin */ @@ -3331,6 +3463,7 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_php.c php-5.2.6.fpm/sapi/cgi/fpm/fp + +#include +#include ++#include + +#include "php.h" +#include "php_main.h" @@ -3344,7 +3477,7 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_php.c php-5.2.6.fpm/sapi/cgi/fpm/fp +#include "fpm_cleanup.h" +#include "fpm_worker_pool.h" + -+static int zend_ini_alter_master(char *name, int name_length, char *new_value, int new_value_length, int stage) ++static int zend_ini_alter_master(char *name, int name_length, char *new_value, int new_value_length, int stage TSRMLS_DC) +{ + zend_ini_entry *ini_entry; + char *duplicate; @@ -3357,7 +3490,7 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_php.c php-5.2.6.fpm/sapi/cgi/fpm/fp + + if (!ini_entry->on_modify + || ini_entry->on_modify(ini_entry, duplicate, new_value_length, -+ ini_entry->mh_arg1, ini_entry->mh_arg2, ini_entry->mh_arg3, stage) == SUCCESS) { ++ ini_entry->mh_arg1, ini_entry->mh_arg2, ini_entry->mh_arg3, stage TSRMLS_CC) == SUCCESS) { + ini_entry->value = duplicate; + ini_entry->value_length = new_value_length; + } else { @@ -3367,7 +3500,7 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_php.c php-5.2.6.fpm/sapi/cgi/fpm/fp + return SUCCESS; +} + -+static void fpm_php_disable(char *value, int (*zend_disable)(char *, uint)) ++static void fpm_php_disable(char *value, int (*zend_disable)(char *, uint TSRMLS_DC) TSRMLS_DC) +{ + char *s = 0, *e = value; + @@ -3377,7 +3510,7 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_php.c php-5.2.6.fpm/sapi/cgi/fpm/fp + case ',': + if (s) { + *e = '\0'; -+ zend_disable(s, e - s); ++ zend_disable(s, e - s TSRMLS_CC); + s = 0; + } + break; @@ -3391,12 +3524,13 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_php.c php-5.2.6.fpm/sapi/cgi/fpm/fp + } + + if (s) { -+ zend_disable(s, e - s); ++ zend_disable(s, e - s TSRMLS_CC); + } +} + +static int fpm_php_apply_defines(struct fpm_worker_pool_s *wp) +{ ++ TSRMLS_FETCH(); + struct key_value_s *kv; + + for (kv = wp->config->php_defines; kv; kv = kv->next) { @@ -3409,34 +3543,34 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_php.c php-5.2.6.fpm/sapi/cgi/fpm/fp + zval zv; + +#if defined(PHP_VERSION_ID) && (PHP_VERSION_ID >= 50300) -+ php_dl(value, MODULE_PERSISTENT, &zv, 1); ++ php_dl(value, MODULE_PERSISTENT, &zv, 1 TSRMLS_CC); +#else + zval filename; + ZVAL_STRINGL(&filename, value, value_len, 0); +#if (PHP_MAJOR_VERSION >= 5) -+ php_dl(&filename, MODULE_PERSISTENT, &zv, 1); ++ php_dl(&filename, MODULE_PERSISTENT, &zv, 1 TSRMLS_CC); +#else -+ php_dl(&filename, MODULE_PERSISTENT, &zv); ++ php_dl(&filename, MODULE_PERSISTENT, &zv TSRMLS_CC); +#endif +#endif + continue; + } + -+ zend_ini_alter_master(name, name_len + 1, value, value_len, PHP_INI_STAGE_ACTIVATE); ++ zend_ini_alter_master(name, name_len + 1, value, value_len, PHP_INI_STAGE_ACTIVATE TSRMLS_CC); + + if (!strcmp(name, "disable_functions") && *value) { + char *v = strdup(value); +#if (PHP_MAJOR_VERSION >= 5) + PG(disable_functions) = v; +#endif -+ fpm_php_disable(v, zend_disable_function); ++ fpm_php_disable(v, zend_disable_function TSRMLS_CC); + } + else if (!strcmp(name, "disable_classes") && *value) { + char *v = strdup(value); +#if (PHP_MAJOR_VERSION >= 5) + PG(disable_classes) = v; +#endif -+ fpm_php_disable(v, zend_disable_class); ++ fpm_php_disable(v, zend_disable_class TSRMLS_CC); + } + } + @@ -3452,24 +3586,38 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_php.c php-5.2.6.fpm/sapi/cgi/fpm/fp + return 0; +} + -+char *fpm_php_script_filename() ++static int fpm_php_set_fcgi_mgmt_vars(struct fpm_worker_pool_s *wp) ++{ ++ char max_workers[10 + 1]; /* 4294967295 */ ++ int len; ++ ++ len = sprintf(max_workers, "%u", (unsigned int) wp->config->pm->max_children); ++ ++ fcgi_set_mgmt_var("FCGI_MAX_CONNS", sizeof("FCGI_MAX_CONNS")-1, max_workers, len); ++ fcgi_set_mgmt_var("FCGI_MAX_REQS", sizeof("FCGI_MAX_REQS")-1, max_workers, len); ++ ++ return 0; ++} ++ ++char *fpm_php_script_filename(TSRMLS_D) +{ + return SG(request_info).path_translated; +} + -+char *fpm_php_request_method() ++char *fpm_php_request_method(TSRMLS_D) +{ + return (char *) SG(request_info).request_method; +} + -+size_t fpm_php_content_length() ++size_t fpm_php_content_length(TSRMLS_D) +{ + return SG(request_info).content_length; +} + +static void fpm_php_cleanup(int which, void *arg) +{ -+ php_module_shutdown(); ++ TSRMLS_FETCH(); ++ php_module_shutdown(TSRMLS_C); + sapi_shutdown(); +} + @@ -3480,7 +3628,9 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_php.c php-5.2.6.fpm/sapi/cgi/fpm/fp + +int fpm_php_init_main() +{ -+ fpm_cleanup_add(FPM_CLEANUP_PARENT, fpm_php_cleanup, 0); ++ if (0 > fpm_cleanup_add(FPM_CLEANUP_PARENT, fpm_php_cleanup, 0)) { ++ return -1; ++ } + + return 0; +} @@ -3488,16 +3638,18 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_php.c php-5.2.6.fpm/sapi/cgi/fpm/fp +int fpm_php_init_child(struct fpm_worker_pool_s *wp) +{ + if (0 > fpm_php_apply_defines(wp) || -+ 0 > fpm_php_set_allowed_clients(wp)) { ++ 0 > fpm_php_set_allowed_clients(wp) || ++ 0 > fpm_php_set_fcgi_mgmt_vars(wp)) { + return -1; + } + + return 0; +} -diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_php.h php-5.2.6.fpm/sapi/cgi/fpm/fpm_php.h ---- php-5.2.6.vanilla/sapi/cgi/fpm/fpm_php.h 1970-01-01 03:00:00.000000000 +0300 -+++ php-5.2.6.fpm/sapi/cgi/fpm/fpm_php.h 2008-05-24 21:38:47.000000000 +0400 -@@ -0,0 +1,20 @@ +diff --git a/sapi/cgi/fpm/fpm_php.h b/sapi/cgi/fpm/fpm_php.h +new file mode 100644 +--- /dev/null ++++ b/sapi/cgi/fpm/fpm_php.h +@@ -0,0 +1,22 @@ + + /* $Id$ */ + /* (c) 2007,2008 Andrei Nigmatulin */ @@ -3505,23 +3657,26 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_php.h php-5.2.6.fpm/sapi/cgi/fpm/fp +#ifndef FPM_PHP_H +#define FPM_PHP_H 1 + -+#include "fpm_worker_pool.h" ++#include + +#include "build-defs.h" /* for PHP_ defines */ + ++struct fpm_worker_pool_s; ++ +int fpm_php_init_child(struct fpm_worker_pool_s *wp); -+char *fpm_php_script_filename(); -+char *fpm_php_request_method(); -+size_t fpm_php_content_length(); ++char *fpm_php_script_filename(TSRMLS_D); ++char *fpm_php_request_method(TSRMLS_D); ++size_t fpm_php_content_length(TSRMLS_D); +void fpm_php_soft_quit(); +int fpm_php_init_main(); + +#endif + -diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_php_trace.c php-5.2.6.fpm/sapi/cgi/fpm/fpm_php_trace.c ---- php-5.2.6.vanilla/sapi/cgi/fpm/fpm_php_trace.c 1970-01-01 03:00:00.000000000 +0300 -+++ php-5.2.6.fpm/sapi/cgi/fpm/fpm_php_trace.c 2008-08-26 19:09:15.000000000 +0400 -@@ -0,0 +1,170 @@ +diff --git a/sapi/cgi/fpm/fpm_php_trace.c b/sapi/cgi/fpm/fpm_php_trace.c +new file mode 100644 +--- /dev/null ++++ b/sapi/cgi/fpm/fpm_php_trace.c +@@ -0,0 +1,171 @@ + + /* $Id$ */ + /* (c) 2007,2008 Andrei Nigmatulin */ @@ -3559,7 +3714,7 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_php_trace.c php-5.2.6.fpm/sapi/cgi/ +#endif + + -+static int fpm_php_trace_dump(struct fpm_child_s *child, FILE *slowlog) ++static int fpm_php_trace_dump(struct fpm_child_s *child, FILE *slowlog TSRMLS_DC) +{ + int callers_limit = 20; + pid_t pid = child->pid; @@ -3657,6 +3812,7 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_php_trace.c php-5.2.6.fpm/sapi/cgi/ + +void fpm_php_trace(struct fpm_child_s *child) +{ ++ TSRMLS_FETCH(); + FILE *slowlog; + + zlog(ZLOG_STUFF, ZLOG_NOTICE, "about to trace %d", (int) child->pid); @@ -3672,7 +3828,7 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_php_trace.c php-5.2.6.fpm/sapi/cgi/ + goto done1; + } + -+ if (0 > fpm_php_trace_dump(child, slowlog)) { ++ if (0 > fpm_php_trace_dump(child, slowlog TSRMLS_CC)) { + fprintf(slowlog, "+++ dump failed\n"); + } + @@ -3692,9 +3848,10 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_php_trace.c php-5.2.6.fpm/sapi/cgi/ + +#endif + -diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_php_trace.h php-5.2.6.fpm/sapi/cgi/fpm/fpm_php_trace.h ---- php-5.2.6.vanilla/sapi/cgi/fpm/fpm_php_trace.h 1970-01-01 03:00:00.000000000 +0300 -+++ php-5.2.6.fpm/sapi/cgi/fpm/fpm_php_trace.h 2008-05-24 21:38:47.000000000 +0400 +diff --git a/sapi/cgi/fpm/fpm_php_trace.h b/sapi/cgi/fpm/fpm_php_trace.h +new file mode 100644 +--- /dev/null ++++ b/sapi/cgi/fpm/fpm_php_trace.h @@ -0,0 +1,13 @@ + + /* $Id$ */ @@ -3709,10 +3866,11 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_php_trace.h php-5.2.6.fpm/sapi/cgi/ + +#endif + -diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_process_ctl.c php-5.2.6.fpm/sapi/cgi/fpm/fpm_process_ctl.c ---- php-5.2.6.vanilla/sapi/cgi/fpm/fpm_process_ctl.c 1970-01-01 03:00:00.000000000 +0300 -+++ php-5.2.6.fpm/sapi/cgi/fpm/fpm_process_ctl.c 2008-07-21 17:13:44.000000000 +0400 -@@ -0,0 +1,352 @@ +diff --git a/sapi/cgi/fpm/fpm_process_ctl.c b/sapi/cgi/fpm/fpm_process_ctl.c +new file mode 100644 +--- /dev/null ++++ b/sapi/cgi/fpm/fpm_process_ctl.c +@@ -0,0 +1,354 @@ + + /* $Id$ */ + /* (c) 2007,2008 Andrei Nigmatulin */ @@ -3910,7 +4068,7 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_process_ctl.c php-5.2.6.fpm/sapi/cg + else { + sig = SIGQUIT; + } -+ timeout = fpm_global_options.process_control_timeout; ++ timeout = fpm_global_config.process_control_timeout; + } + else { + if (fpm_signal_sent == SIGQUIT) { @@ -4025,7 +4183,9 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_process_ctl.c php-5.2.6.fpm/sapi/cg + + saved_argv[i] = 0; + -+ fpm_cleanup_add(FPM_CLEANUP_ALL, fpm_pctl_cleanup, 0); ++ if (0 > fpm_cleanup_add(FPM_CLEANUP_ALL, fpm_pctl_cleanup, 0)) { ++ return -1; ++ } + + return 0; +} @@ -4065,9 +4225,10 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_process_ctl.c php-5.2.6.fpm/sapi/cg + evtimer_add(&heartbeat, &tv); +} + -diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_process_ctl.h php-5.2.6.fpm/sapi/cgi/fpm/fpm_process_ctl.h ---- php-5.2.6.vanilla/sapi/cgi/fpm/fpm_process_ctl.h 1970-01-01 03:00:00.000000000 +0300 -+++ php-5.2.6.fpm/sapi/cgi/fpm/fpm_process_ctl.h 2008-07-21 01:33:10.000000000 +0400 +diff --git a/sapi/cgi/fpm/fpm_process_ctl.h b/sapi/cgi/fpm/fpm_process_ctl.h +new file mode 100644 +--- /dev/null ++++ b/sapi/cgi/fpm/fpm_process_ctl.h @@ -0,0 +1,39 @@ + + /* $Id$ */ @@ -4108,10 +4269,11 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_process_ctl.h php-5.2.6.fpm/sapi/cg + +#endif + -diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_request.c php-5.2.6.fpm/sapi/cgi/fpm/fpm_request.c ---- php-5.2.6.vanilla/sapi/cgi/fpm/fpm_request.c 1970-01-01 03:00:00.000000000 +0300 -+++ php-5.2.6.fpm/sapi/cgi/fpm/fpm_request.c 2008-09-01 03:34:36.000000000 +0400 -@@ -0,0 +1,163 @@ +diff --git a/sapi/cgi/fpm/fpm_request.c b/sapi/cgi/fpm/fpm_request.c +new file mode 100644 +--- /dev/null ++++ b/sapi/cgi/fpm/fpm_request.c +@@ -0,0 +1,164 @@ + + /* $Id$ */ + /* (c) 2007,2008 Andrei Nigmatulin */ @@ -4163,9 +4325,10 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_request.c php-5.2.6.fpm/sapi/cgi/fp + +void fpm_request_info() +{ ++ TSRMLS_FETCH(); + struct fpm_shm_slot_s *slot; -+ char *request_method = fpm_php_request_method(); -+ char *script_filename = fpm_php_script_filename(); ++ char *request_method = fpm_php_request_method(TSRMLS_C); ++ char *script_filename = fpm_php_script_filename(TSRMLS_C); + + slot = fpm_shm_slots_acquire(0, 0); + @@ -4177,7 +4340,7 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_request.c php-5.2.6.fpm/sapi/cgi/fp + cpystrn(slot->request_method, request_method, sizeof(slot->request_method)); + } + -+ slot->content_length = fpm_php_content_length(); ++ slot->content_length = fpm_php_content_length(TSRMLS_C); + + /* if cgi.fix_pathinfo is set to "1" and script cannot be found (404) + the sapi_globals.request_info.path_translated is set to NULL */ @@ -4275,9 +4438,10 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_request.c php-5.2.6.fpm/sapi/cgi/fp + +} + -diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_request.h php-5.2.6.fpm/sapi/cgi/fpm/fpm_request.h ---- php-5.2.6.vanilla/sapi/cgi/fpm/fpm_request.h 1970-01-01 03:00:00.000000000 +0300 -+++ php-5.2.6.fpm/sapi/cgi/fpm/fpm_request.h 2008-07-20 05:47:16.000000000 +0400 +diff --git a/sapi/cgi/fpm/fpm_request.h b/sapi/cgi/fpm/fpm_request.h +new file mode 100644 +--- /dev/null ++++ b/sapi/cgi/fpm/fpm_request.h @@ -0,0 +1,27 @@ + + /* $Id$ */ @@ -4306,9 +4470,10 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_request.h php-5.2.6.fpm/sapi/cgi/fp +}; + +#endif -diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_shm.c php-5.2.6.fpm/sapi/cgi/fpm/fpm_shm.c ---- php-5.2.6.vanilla/sapi/cgi/fpm/fpm_shm.c 1970-01-01 03:00:00.000000000 +0300 -+++ php-5.2.6.fpm/sapi/cgi/fpm/fpm_shm.c 2008-05-24 21:38:47.000000000 +0400 +diff --git a/sapi/cgi/fpm/fpm_shm.c b/sapi/cgi/fpm/fpm_shm.c +new file mode 100644 +--- /dev/null ++++ b/sapi/cgi/fpm/fpm_shm.c @@ -0,0 +1,100 @@ + + /* $Id$ */ @@ -4410,9 +4575,10 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_shm.c php-5.2.6.fpm/sapi/cgi/fpm/fp + return ret; +} + -diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_shm.h php-5.2.6.fpm/sapi/cgi/fpm/fpm_shm.h ---- php-5.2.6.vanilla/sapi/cgi/fpm/fpm_shm.h 1970-01-01 03:00:00.000000000 +0300 -+++ php-5.2.6.fpm/sapi/cgi/fpm/fpm_shm.h 2008-05-24 21:38:47.000000000 +0400 +diff --git a/sapi/cgi/fpm/fpm_shm.h b/sapi/cgi/fpm/fpm_shm.h +new file mode 100644 +--- /dev/null ++++ b/sapi/cgi/fpm/fpm_shm.h @@ -0,0 +1,22 @@ + + /* $Id$ */ @@ -4436,9 +4602,10 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_shm.h php-5.2.6.fpm/sapi/cgi/fpm/fp + +#endif + -diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_shm_slots.c php-5.2.6.fpm/sapi/cgi/fpm/fpm_shm_slots.c ---- php-5.2.6.vanilla/sapi/cgi/fpm/fpm_shm_slots.c 1970-01-01 03:00:00.000000000 +0300 -+++ php-5.2.6.fpm/sapi/cgi/fpm/fpm_shm_slots.c 2008-05-24 21:38:47.000000000 +0400 +diff --git a/sapi/cgi/fpm/fpm_shm_slots.c b/sapi/cgi/fpm/fpm_shm_slots.c +new file mode 100644 +--- /dev/null ++++ b/sapi/cgi/fpm/fpm_shm_slots.c @@ -0,0 +1,127 @@ + + /* $Id$ */ @@ -4567,9 +4734,10 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_shm_slots.c php-5.2.6.fpm/sapi/cgi/ + s->lock = 0; +} + -diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_shm_slots.h php-5.2.6.fpm/sapi/cgi/fpm/fpm_shm_slots.h ---- php-5.2.6.vanilla/sapi/cgi/fpm/fpm_shm_slots.h 1970-01-01 03:00:00.000000000 +0300 -+++ php-5.2.6.fpm/sapi/cgi/fpm/fpm_shm_slots.h 2008-05-24 21:38:47.000000000 +0400 +diff --git a/sapi/cgi/fpm/fpm_shm_slots.h b/sapi/cgi/fpm/fpm_shm_slots.h +new file mode 100644 +--- /dev/null ++++ b/sapi/cgi/fpm/fpm_shm_slots.h @@ -0,0 +1,43 @@ + + /* $Id$ */ @@ -4614,9 +4782,10 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_shm_slots.h php-5.2.6.fpm/sapi/cgi/ + +#endif + -diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_signals.c php-5.2.6.fpm/sapi/cgi/fpm/fpm_signals.c ---- php-5.2.6.vanilla/sapi/cgi/fpm/fpm_signals.c 1970-01-01 03:00:00.000000000 +0300 -+++ php-5.2.6.fpm/sapi/cgi/fpm/fpm_signals.c 2008-08-26 19:09:15.000000000 +0400 +diff --git a/sapi/cgi/fpm/fpm_signals.c b/sapi/cgi/fpm/fpm_signals.c +new file mode 100644 +--- /dev/null ++++ b/sapi/cgi/fpm/fpm_signals.c @@ -0,0 +1,252 @@ + + /* $Id$ */ @@ -4870,9 +5039,10 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_signals.c php-5.2.6.fpm/sapi/cgi/fp +{ + return sp[0]; +} -diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_signals.h php-5.2.6.fpm/sapi/cgi/fpm/fpm_signals.h ---- php-5.2.6.vanilla/sapi/cgi/fpm/fpm_signals.h 1970-01-01 03:00:00.000000000 +0300 -+++ php-5.2.6.fpm/sapi/cgi/fpm/fpm_signals.h 2008-05-24 21:38:47.000000000 +0400 +diff --git a/sapi/cgi/fpm/fpm_signals.h b/sapi/cgi/fpm/fpm_signals.h +new file mode 100644 +--- /dev/null ++++ b/sapi/cgi/fpm/fpm_signals.h @@ -0,0 +1,16 @@ + + /* $Id$ */ @@ -4890,10 +5060,11 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_signals.h php-5.2.6.fpm/sapi/cgi/fp +extern const char *fpm_signal_names[NSIG + 1]; + +#endif -diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_sockets.c php-5.2.6.fpm/sapi/cgi/fpm/fpm_sockets.c ---- php-5.2.6.vanilla/sapi/cgi/fpm/fpm_sockets.c 1970-01-01 03:00:00.000000000 +0300 -+++ php-5.2.6.fpm/sapi/cgi/fpm/fpm_sockets.c 2008-08-26 19:09:15.000000000 +0400 -@@ -0,0 +1,425 @@ +diff --git a/sapi/cgi/fpm/fpm_sockets.c b/sapi/cgi/fpm/fpm_sockets.c +new file mode 100644 +--- /dev/null ++++ b/sapi/cgi/fpm/fpm_sockets.c +@@ -0,0 +1,427 @@ + + /* $Id$ */ + /* (c) 2007,2008 Andrei Nigmatulin */ @@ -5315,13 +5486,16 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_sockets.c php-5.2.6.fpm/sapi/cgi/fp + } + } + -+ fpm_cleanup_add(FPM_CLEANUP_ALL, fpm_sockets_cleanup, 0); ++ if (0 > fpm_cleanup_add(FPM_CLEANUP_ALL, fpm_sockets_cleanup, 0)) { ++ return -1; ++ } + + return 0; +} -diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_sockets.h php-5.2.6.fpm/sapi/cgi/fpm/fpm_sockets.h ---- php-5.2.6.vanilla/sapi/cgi/fpm/fpm_sockets.h 1970-01-01 03:00:00.000000000 +0300 -+++ php-5.2.6.fpm/sapi/cgi/fpm/fpm_sockets.h 2008-08-26 19:09:15.000000000 +0400 +diff --git a/sapi/cgi/fpm/fpm_sockets.h b/sapi/cgi/fpm/fpm_sockets.h +new file mode 100644 +--- /dev/null ++++ b/sapi/cgi/fpm/fpm_sockets.h @@ -0,0 +1,37 @@ + + /* $Id$ */ @@ -5360,10 +5534,11 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_sockets.h php-5.2.6.fpm/sapi/cgi/fp + (unsigned int) ((unsigned char *) &(sin_addr)->s_addr)[3] + +#endif -diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_stdio.c php-5.2.6.fpm/sapi/cgi/fpm/fpm_stdio.c ---- php-5.2.6.vanilla/sapi/cgi/fpm/fpm_stdio.c 1970-01-01 03:00:00.000000000 +0300 -+++ php-5.2.6.fpm/sapi/cgi/fpm/fpm_stdio.c 2008-05-24 21:38:47.000000000 +0400 -@@ -0,0 +1,277 @@ +diff --git a/sapi/cgi/fpm/fpm_stdio.c b/sapi/cgi/fpm/fpm_stdio.c +new file mode 100644 +--- /dev/null ++++ b/sapi/cgi/fpm/fpm_stdio.c +@@ -0,0 +1,286 @@ + + /* $Id$ */ + /* (c) 2007,2008 Andrei Nigmatulin */ @@ -5396,8 +5571,11 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_stdio.c php-5.2.6.fpm/sapi/cgi/fpm/ + return -1; + } + -+ dup2(fd, STDIN_FILENO); -+ dup2(fd, STDOUT_FILENO); ++ if (0 > dup2(fd, STDIN_FILENO) || 0 > dup2(fd, STDOUT_FILENO)) { ++ zlog(ZLOG_STUFF, ZLOG_SYSERROR, "dup2() failed"); ++ return -1; ++ } ++ + close(fd); + + return 0; @@ -5405,11 +5583,14 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_stdio.c php-5.2.6.fpm/sapi/cgi/fpm/ + +int fpm_stdio_init_final() +{ -+ if (fpm_global_options.daemonize) { ++ if (fpm_global_config.daemonize) { + + if (fpm_globals.error_log_fd != STDERR_FILENO) { + /* there might be messages to stderr from libevent, we need to log them all */ -+ dup2(fpm_globals.error_log_fd, STDERR_FILENO); ++ if (0 > dup2(fpm_globals.error_log_fd, STDERR_FILENO)) { ++ zlog(ZLOG_STUFF, ZLOG_SYSERROR, "dup2() failed"); ++ return -1; ++ } + } + + zlog_set_level(fpm_globals.log_level); @@ -5427,7 +5608,10 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_stdio.c php-5.2.6.fpm/sapi/cgi/fpm/ + zlog_set_fd(-1); + + if (wp->listening_socket != STDIN_FILENO) { -+ dup2(wp->listening_socket, STDIN_FILENO); ++ if (0 > dup2(wp->listening_socket, STDIN_FILENO)) { ++ zlog(ZLOG_STUFF, ZLOG_SYSERROR, "dup2() failed"); ++ return -1; ++ } + } + + return 0; @@ -5617,15 +5801,15 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_stdio.c php-5.2.6.fpm/sapi/cgi/fpm/ +{ + int fd; + -+ fd = open(fpm_global_options.error_log, O_WRONLY | O_APPEND | O_CREAT, S_IRUSR | S_IWUSR); ++ fd = open(fpm_global_config.error_log, O_WRONLY | O_APPEND | O_CREAT, S_IRUSR | S_IWUSR); + + if (0 > fd) { -+ zlog(ZLOG_STUFF, ZLOG_SYSERROR, "open(\"%s\") failed", fpm_global_options.error_log); ++ zlog(ZLOG_STUFF, ZLOG_SYSERROR, "open(\"%s\") failed", fpm_global_config.error_log); + return -1; + } + + if (reopen) { -+ if (fpm_global_options.daemonize) { ++ if (fpm_global_config.daemonize) { + dup2(fd, STDERR_FILENO); + } + @@ -5641,9 +5825,10 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_stdio.c php-5.2.6.fpm/sapi/cgi/fpm/ + + return 0; +} -diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_stdio.h php-5.2.6.fpm/sapi/cgi/fpm/fpm_stdio.h ---- php-5.2.6.vanilla/sapi/cgi/fpm/fpm_stdio.h 1970-01-01 03:00:00.000000000 +0300 -+++ php-5.2.6.fpm/sapi/cgi/fpm/fpm_stdio.h 2008-05-24 21:38:47.000000000 +0400 +diff --git a/sapi/cgi/fpm/fpm_stdio.h b/sapi/cgi/fpm/fpm_stdio.h +new file mode 100644 +--- /dev/null ++++ b/sapi/cgi/fpm/fpm_stdio.h @@ -0,0 +1,20 @@ + + /* $Id$ */ @@ -5665,9 +5850,10 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_stdio.h php-5.2.6.fpm/sapi/cgi/fpm/ + +#endif + -diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_str.h php-5.2.6.fpm/sapi/cgi/fpm/fpm_str.h ---- php-5.2.6.vanilla/sapi/cgi/fpm/fpm_str.h 1970-01-01 03:00:00.000000000 +0300 -+++ php-5.2.6.fpm/sapi/cgi/fpm/fpm_str.h 2008-05-24 21:38:47.000000000 +0400 +diff --git a/sapi/cgi/fpm/fpm_str.h b/sapi/cgi/fpm/fpm_str.h +new file mode 100644 +--- /dev/null ++++ b/sapi/cgi/fpm/fpm_str.h @@ -0,0 +1,49 @@ + + /* $Id$ */ @@ -5718,9 +5904,10 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_str.h php-5.2.6.fpm/sapi/cgi/fpm/fp +} + +#endif -diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_trace.c php-5.2.6.fpm/sapi/cgi/fpm/fpm_trace.c ---- php-5.2.6.vanilla/sapi/cgi/fpm/fpm_trace.c 1970-01-01 03:00:00.000000000 +0300 -+++ php-5.2.6.fpm/sapi/cgi/fpm/fpm_trace.c 2008-07-21 00:59:00.000000000 +0400 +diff --git a/sapi/cgi/fpm/fpm_trace.c b/sapi/cgi/fpm/fpm_trace.c +new file mode 100644 +--- /dev/null ++++ b/sapi/cgi/fpm/fpm_trace.c @@ -0,0 +1,46 @@ + + /* $Id$ */ @@ -5768,9 +5955,10 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_trace.c php-5.2.6.fpm/sapi/cgi/fpm/ + } +} + -diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_trace.h php-5.2.6.fpm/sapi/cgi/fpm/fpm_trace.h ---- php-5.2.6.vanilla/sapi/cgi/fpm/fpm_trace.h 1970-01-01 03:00:00.000000000 +0300 -+++ php-5.2.6.fpm/sapi/cgi/fpm/fpm_trace.h 2008-07-21 07:04:25.000000000 +0400 +diff --git a/sapi/cgi/fpm/fpm_trace.h b/sapi/cgi/fpm/fpm_trace.h +new file mode 100644 +--- /dev/null ++++ b/sapi/cgi/fpm/fpm_trace.h @@ -0,0 +1,17 @@ + + /* $Id$ */ @@ -5789,9 +5977,10 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_trace.h php-5.2.6.fpm/sapi/cgi/fpm/ + +#endif + -diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_trace_mach.c php-5.2.6.fpm/sapi/cgi/fpm/fpm_trace_mach.c ---- php-5.2.6.vanilla/sapi/cgi/fpm/fpm_trace_mach.c 1970-01-01 03:00:00.000000000 +0300 -+++ php-5.2.6.fpm/sapi/cgi/fpm/fpm_trace_mach.c 2008-08-26 19:09:15.000000000 +0400 +diff --git a/sapi/cgi/fpm/fpm_trace_mach.c b/sapi/cgi/fpm/fpm_trace_mach.c +new file mode 100644 +--- /dev/null ++++ b/sapi/cgi/fpm/fpm_trace_mach.c @@ -0,0 +1,102 @@ + + /* $Id$ */ @@ -5895,9 +6084,10 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_trace_mach.c php-5.2.6.fpm/sapi/cgi + return 0; +} + -diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_trace_pread.c php-5.2.6.fpm/sapi/cgi/fpm/fpm_trace_pread.c ---- php-5.2.6.vanilla/sapi/cgi/fpm/fpm_trace_pread.c 1970-01-01 03:00:00.000000000 +0300 -+++ php-5.2.6.fpm/sapi/cgi/fpm/fpm_trace_pread.c 2008-08-26 19:09:15.000000000 +0400 +diff --git a/sapi/cgi/fpm/fpm_trace_pread.c b/sapi/cgi/fpm/fpm_trace_pread.c +new file mode 100644 +--- /dev/null ++++ b/sapi/cgi/fpm/fpm_trace_pread.c @@ -0,0 +1,67 @@ + + /* $Id$ */ @@ -5966,9 +6156,10 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_trace_pread.c php-5.2.6.fpm/sapi/cg + return 0; +} + -diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_trace_ptrace.c php-5.2.6.fpm/sapi/cgi/fpm/fpm_trace_ptrace.c ---- php-5.2.6.vanilla/sapi/cgi/fpm/fpm_trace_ptrace.c 1970-01-01 03:00:00.000000000 +0300 -+++ php-5.2.6.fpm/sapi/cgi/fpm/fpm_trace_ptrace.c 2008-09-19 03:34:11.000000000 +0400 +diff --git a/sapi/cgi/fpm/fpm_trace_ptrace.c b/sapi/cgi/fpm/fpm_trace_ptrace.c +new file mode 100644 +--- /dev/null ++++ b/sapi/cgi/fpm/fpm_trace_ptrace.c @@ -0,0 +1,85 @@ + + /* $Id$ */ @@ -6055,9 +6246,10 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_trace_ptrace.c php-5.2.6.fpm/sapi/c + return 0; +} + -diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_unix.c php-5.2.6.fpm/sapi/cgi/fpm/fpm_unix.c ---- php-5.2.6.vanilla/sapi/cgi/fpm/fpm_unix.c 1970-01-01 03:00:00.000000000 +0300 -+++ php-5.2.6.fpm/sapi/cgi/fpm/fpm_unix.c 2008-09-19 03:19:59.000000000 +0400 +diff --git a/sapi/cgi/fpm/fpm_unix.c b/sapi/cgi/fpm/fpm_unix.c +new file mode 100644 +--- /dev/null ++++ b/sapi/cgi/fpm/fpm_unix.c @@ -0,0 +1,289 @@ + + /* $Id$ */ @@ -6224,7 +6416,7 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_unix.c php-5.2.6.fpm/sapi/cgi/fpm/f + getrlimit(RLIMIT_NOFILE, &r); + + r.rlim_cur = (rlim_t) wp->config->rlimit_files; -+ ++ r.rlim_max = r.rlim_cur; + if (0 > setrlimit(RLIMIT_NOFILE, &r)) { + zlog(ZLOG_STUFF, ZLOG_SYSERROR, "setrlimit(RLIMIT_NOFILE) failed"); + } @@ -6236,7 +6428,7 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_unix.c php-5.2.6.fpm/sapi/cgi/fpm/f + getrlimit(RLIMIT_CORE, &r); + + r.rlim_cur = wp->config->rlimit_core == -1 ? (rlim_t) RLIM_INFINITY : (rlim_t) wp->config->rlimit_core; -+ ++ r.rlim_max = r.rlim_cur; + if (0 > setrlimit(RLIMIT_CORE, &r)) { + zlog(ZLOG_STUFF, ZLOG_SYSERROR, "setrlimit(RLIMIT_CORE) failed"); + } @@ -6298,7 +6490,7 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_unix.c php-5.2.6.fpm/sapi/cgi/fpm/f + + fpm_pagesize = getpagesize(); + -+ if (fpm_global_options.daemonize) { ++ if (fpm_global_config.daemonize) { + + switch (fork()) { + @@ -6348,9 +6540,10 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_unix.c php-5.2.6.fpm/sapi/cgi/fpm/f + + return 0; +} -diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_unix.h php-5.2.6.fpm/sapi/cgi/fpm/fpm_unix.h ---- php-5.2.6.vanilla/sapi/cgi/fpm/fpm_unix.h 1970-01-01 03:00:00.000000000 +0300 -+++ php-5.2.6.fpm/sapi/cgi/fpm/fpm_unix.h 2008-05-25 17:21:13.000000000 +0400 +diff --git a/sapi/cgi/fpm/fpm_unix.h b/sapi/cgi/fpm/fpm_unix.h +new file mode 100644 +--- /dev/null ++++ b/sapi/cgi/fpm/fpm_unix.h @@ -0,0 +1,17 @@ + + /* $Id$ */ @@ -6369,10 +6562,11 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_unix.h php-5.2.6.fpm/sapi/cgi/fpm/f + +#endif + -diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_worker_pool.c php-5.2.6.fpm/sapi/cgi/fpm/fpm_worker_pool.c ---- php-5.2.6.vanilla/sapi/cgi/fpm/fpm_worker_pool.c 1970-01-01 03:00:00.000000000 +0300 -+++ php-5.2.6.fpm/sapi/cgi/fpm/fpm_worker_pool.c 2008-08-26 19:09:15.000000000 +0400 -@@ -0,0 +1,67 @@ +diff --git a/sapi/cgi/fpm/fpm_worker_pool.c b/sapi/cgi/fpm/fpm_worker_pool.c +new file mode 100644 +--- /dev/null ++++ b/sapi/cgi/fpm/fpm_worker_pool.c +@@ -0,0 +1,69 @@ + + /* $Id$ */ + /* (c) 2007,2008 Andrei Nigmatulin */ @@ -6436,13 +6630,16 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_worker_pool.c php-5.2.6.fpm/sapi/cg + +int fpm_worker_pool_init_main() +{ -+ fpm_cleanup_add(FPM_CLEANUP_ALL, fpm_worker_pool_cleanup, 0); ++ if (0 > fpm_cleanup_add(FPM_CLEANUP_ALL, fpm_worker_pool_cleanup, 0)) { ++ return -1; ++ } + + return 0; +} -diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_worker_pool.h php-5.2.6.fpm/sapi/cgi/fpm/fpm_worker_pool.h ---- php-5.2.6.vanilla/sapi/cgi/fpm/fpm_worker_pool.h 1970-01-01 03:00:00.000000000 +0300 -+++ php-5.2.6.fpm/sapi/cgi/fpm/fpm_worker_pool.h 2008-08-26 19:09:15.000000000 +0400 +diff --git a/sapi/cgi/fpm/fpm_worker_pool.h b/sapi/cgi/fpm/fpm_worker_pool.h +new file mode 100644 +--- /dev/null ++++ b/sapi/cgi/fpm/fpm_worker_pool.h @@ -0,0 +1,46 @@ + + /* $Id$ */ @@ -6490,9 +6687,10 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/fpm_worker_pool.h php-5.2.6.fpm/sapi/cg + +#endif + -diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/init.d/php-fpm.in php-5.2.6.fpm/sapi/cgi/fpm/init.d/php-fpm.in ---- php-5.2.6.vanilla/sapi/cgi/fpm/init.d/php-fpm.in 1970-01-01 03:00:00.000000000 +0300 -+++ php-5.2.6.fpm/sapi/cgi/fpm/init.d/php-fpm.in 2008-08-05 20:31:27.000000000 +0400 +diff --git a/sapi/cgi/fpm/init.d/php-fpm.in b/sapi/cgi/fpm/init.d/php-fpm.in +new file mode 100644 +--- /dev/null ++++ b/sapi/cgi/fpm/init.d/php-fpm.in @@ -0,0 +1,139 @@ +#! /bin/sh + @@ -6633,34 +6831,10 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/init.d/php-fpm.in php-5.2.6.fpm/sapi/cg + ;; + +esac -diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/Makefile.frag php-5.2.6.fpm/sapi/cgi/fpm/Makefile.frag ---- php-5.2.6.vanilla/sapi/cgi/fpm/Makefile.frag 1970-01-01 03:00:00.000000000 +0300 -+++ php-5.2.6.fpm/sapi/cgi/fpm/Makefile.frag 2008-03-28 16:51:22.000000000 +0300 -@@ -0,0 +1,21 @@ -+ -+install-fpm: sapi/cgi/fpm/php-fpm.conf sapi/cgi/fpm/php-fpm -+ @echo "Installing FPM config: $(INSTALL_ROOT)$(php_fpm_conf_path)" -+ -@$(mkinstalldirs) \ -+ $(INSTALL_ROOT)$(prefix)/sbin \ -+ `dirname "$(INSTALL_ROOT)$(php_fpm_conf_path)"` \ -+ `dirname "$(INSTALL_ROOT)$(php_fpm_log_path)"` \ -+ `dirname "$(INSTALL_ROOT)$(php_fpm_pid_path)"` -+ -@if test -r "$(INSTALL_ROOT)$(php_fpm_conf_path)" ; then \ -+ dest=`basename "$(php_fpm_conf_path)"`.default ; \ -+ echo " (installing as $$dest)" ; \ -+ else \ -+ dest=`basename "$(php_fpm_conf_path)"` ; \ -+ fi ; \ -+ $(INSTALL_DATA) $(top_builddir)/sapi/cgi/fpm/php-fpm.conf $(INSTALL_ROOT)`dirname "$(php_fpm_conf_path)"`/$$dest -+ @echo "Installing init.d script: $(INSTALL_ROOT)$(prefix)/sbin/php-fpm" -+ -@$(INSTALL) -m 0755 $(top_builddir)/sapi/cgi/fpm/php-fpm $(INSTALL_ROOT)$(prefix)/sbin/php-fpm -+ -+$(top_builddir)/libevent/libevent.a: $(top_builddir)/libevent/Makefile -+ cd $(top_builddir)/libevent && $(MAKE) libevent.a -+ -diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/xml_config.c php-5.2.6.fpm/sapi/cgi/fpm/xml_config.c ---- php-5.2.6.vanilla/sapi/cgi/fpm/xml_config.c 1970-01-01 03:00:00.000000000 +0300 -+++ php-5.2.6.fpm/sapi/cgi/fpm/xml_config.c 2008-08-26 19:09:15.000000000 +0400 +diff --git a/sapi/cgi/fpm/xml_config.c b/sapi/cgi/fpm/xml_config.c +new file mode 100644 +--- /dev/null ++++ b/sapi/cgi/fpm/xml_config.c @@ -0,0 +1,278 @@ + + /* $Id$ */ @@ -6940,9 +7114,10 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/xml_config.c php-5.2.6.fpm/sapi/cgi/fpm + return 0; +} + -diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/xml_config.h php-5.2.6.fpm/sapi/cgi/fpm/xml_config.h ---- php-5.2.6.vanilla/sapi/cgi/fpm/xml_config.h 1970-01-01 03:00:00.000000000 +0300 -+++ php-5.2.6.fpm/sapi/cgi/fpm/xml_config.h 2008-09-19 03:02:58.000000000 +0400 +diff --git a/sapi/cgi/fpm/xml_config.h b/sapi/cgi/fpm/xml_config.h +new file mode 100644 +--- /dev/null ++++ b/sapi/cgi/fpm/xml_config.h @@ -0,0 +1,43 @@ + + /* $Id$ */ @@ -6987,9 +7162,10 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/xml_config.h php-5.2.6.fpm/sapi/cgi/fpm +enum { XML_CONF_SCALAR = 1, XML_CONF_SUBSECTION = 2 }; + +#endif -diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/zlog.c php-5.2.6.fpm/sapi/cgi/fpm/zlog.c ---- php-5.2.6.vanilla/sapi/cgi/fpm/zlog.c 1970-01-01 03:00:00.000000000 +0300 -+++ php-5.2.6.fpm/sapi/cgi/fpm/zlog.c 2008-05-23 01:08:32.000000000 +0400 +diff --git a/sapi/cgi/fpm/zlog.c b/sapi/cgi/fpm/zlog.c +new file mode 100644 +--- /dev/null ++++ b/sapi/cgi/fpm/zlog.c @@ -0,0 +1,113 @@ + + /* $Id$ */ @@ -7104,9 +7280,10 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/zlog.c php-5.2.6.fpm/sapi/cgi/fpm/zlog. + + write(zlog_fd > -1 ? zlog_fd : STDERR_FILENO, buf, len); +} -diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/zlog.h php-5.2.6.fpm/sapi/cgi/fpm/zlog.h ---- php-5.2.6.vanilla/sapi/cgi/fpm/zlog.h 1970-01-01 03:00:00.000000000 +0300 -+++ php-5.2.6.fpm/sapi/cgi/fpm/zlog.h 2008-05-23 01:08:32.000000000 +0400 +diff --git a/sapi/cgi/fpm/zlog.h b/sapi/cgi/fpm/zlog.h +new file mode 100644 +--- /dev/null ++++ b/sapi/cgi/fpm/zlog.h @@ -0,0 +1,34 @@ + + /* $Id$ */ @@ -7142,9 +7319,3 @@ diff -Nru php-5.2.6.vanilla/sapi/cgi/fpm/zlog.h php-5.2.6.fpm/sapi/cgi/fpm/zlog. +#define ZLOG_SYSERROR (ZLOG_ERROR | ZLOG_HAVE_ERRNO) + +#endif ---- php-5.2.6/sapi/cgi/Makefile.frag~ 2008-11-03 19:29:12.000000000 +0200 -+++ php-5.2.6/sapi/cgi/Makefile.frag 2008-11-03 19:31:19.361921087 +0200 -@@ -1,2 +1,2 @@ --$(SAPI_CGI_PATH): libphp_common.la $(PHP_SAPI_OBJS) -+$(SAPI_CGI_PATH): libphp_common.la $(PHP_SAPI_OBJS) $(SAPI_EXTRA_DEPS) - $(BUILD_CGI)