SOURCES: php4-fcgi-graceful.patch (NEW) - based on php-fcgi-gracef...
glen
glen at pld-linux.org
Sat Nov 10 15:44:17 CET 2007
Author: glen Date: Sat Nov 10 14:44:17 2007 GMT
Module: SOURCES Tag: HEAD
---- Log message:
- based on php-fcgi-graceful.patch
---- Files affected:
SOURCES:
php4-fcgi-graceful.patch (NONE -> 1.1) (NEW)
---- Diffs:
================================================================
Index: SOURCES/php4-fcgi-graceful.patch
diff -u /dev/null SOURCES/php4-fcgi-graceful.patch:1.1
--- /dev/null Sat Nov 10 15:44:17 2007
+++ SOURCES/php4-fcgi-graceful.patch Sat Nov 10 15:44:12 2007
@@ -0,0 +1,64 @@
+--- php-4.4.7/sapi/cgi/cgi_main.c 2007-02-16 13:47:20.000000000 +0200
++++ php-4.4.7-gracefup/sapi/cgi/cgi_main.c 2007-11-09 17:19:32.722741559 +0200
+@@ -105,6 +105,11 @@
+ */
+ static int parent = 1;
+
++#if PHP_FASTCGI
++/* Socket we are listening on incoming FastCGI connections */
++static int fcgi_fd = 0;
++#endif
++
+ /**
+ * Process group
+ */
+@@ -952,6 +957,22 @@
+ }
+ #endif
+
++#if PHP_FASTCGI
++/**
++ * Graceful shutdown. Close listening sockets.
++ */
++void fastcgi_graceful_shutdown(int signal)
++{
++#ifdef DEBUG_FASTCGI
++ fprintf(stderr, "FastCGI graceful shutdown, pid %d\n", getpid());
++#endif
++
++ /* Close the listening socket so new processes can reuse the same port */
++ closesocket(fcgi_fd);
++ fcgi_fd = 0;
++}
++#endif
++
+ /* {{{ main
+ */
+ int main(int argc, char *argv[])
+@@ -990,7 +1011,6 @@
+ #ifndef PHP_WIN32
+ char *bindpath = NULL;
+ #endif
+- int fcgi_fd = 0;
+ FCGX_Request request;
+ #ifdef PHP_WIN32
+ long impersonate = 0;
+@@ -1238,9 +1258,17 @@
+ parent = 0;
+
+ /* don't catch our signals */
+- sigaction( SIGTERM, &old_term, 0 );
+ sigaction( SIGQUIT, &old_quit, 0 );
+ sigaction( SIGINT, &old_int, 0 );
++#if PHP_FASTCGI
++
++ /* call graceful shutdown handler for SIGTERM */
++ act.sa_flags = 0;
++ act.sa_handler = fastcgi_graceful_shutdown;
++ sigaction(SIGTERM, &act, &old_term);
++#else
++ sigaction(SIGTERM, &old_term, 0);
++#endif
+ break;
+ case -1:
+ perror( "php (pre-forking)" );
================================================================
More information about the pld-cvs-commit
mailing list