Allow package to be build on any architecture (not just i386).
[php5-apc.git] / apc_signal.c
index 406fc47..7db2ef9 100644 (file)
@@ -2,7 +2,7 @@
   +----------------------------------------------------------------------+
   | APC                                                                  |
   +----------------------------------------------------------------------+
-  | Copyright (c) 2006 The PHP Group                                     |
+  | Copyright (c) 2008 The PHP Group                                     |
   +----------------------------------------------------------------------+
   | This source file is subject to version 3.01 of the PHP license,      |
   | that is bundled with this package in the file LICENSE, and is        |
@@ -24,7 +24,7 @@
    All other licensing and usage conditions are those of the PHP Group.
  */
 
- /* $Id: apc_signal.c,v 1.2 2007/12/26 22:38:43 rasmus Exp $ */
+ /* $Id: apc_signal.c,v 1.2.2.3 2008/05/11 18:57:00 rasmus Exp $ */
 
  /* Allows apc to install signal handlers and maintain signalling
     to already registered handlers. Registers all signals that
@@ -88,7 +88,7 @@ static void apc_rehandle_signal(int signo, siginfo_t *siginfo, void *context)
 static int apc_register_signal(int signo, void (*handler)(int, siginfo_t*, void*))
 {
 #if HAVE_SIGACTION
-    struct sigaction sa = {0};
+    struct sigaction sa = {{0}};
     apc_signal_entry_t p_sig = {0};
 
     if (sigaction(signo, NULL, &sa) == 0) {
@@ -168,6 +168,20 @@ void apc_set_signals(TSRMLS_D)
     }
 } /* }}} */
 
+/* {{{ apc_set_signals
+ *  cleanup signals for shutdown */
+void apc_shutdown_signals() 
+{
+    int i=0;
+    if (apc_signal_info.installed > 0) {
+        for (i=0;  (i < apc_signal_info.installed);  i++) {
+            apc_efree(apc_signal_info.prev[i]);
+        }
+        apc_efree(apc_signal_info.prev);
+        apc_signal_info.installed = 0; /* just in case */
+    }
+}
+
 /*
  * Local variables:
  * tab-width: 4