Patch pcntl_pending_signal_allication.diff for PCNTL related Bug #52784
Patch version 2010-09-06 16:10 UTC
Return to Bug #52784 |
Download this patch
Patch Revisions:
Developer: nick.telford@gmail.com
Index: ext/pcntl/pcntl.c
===================================================================
--- ext/pcntl/pcntl.c (revision 302771)
+++ ext/pcntl/pcntl.c (working copy)
@@ -434,21 +434,9 @@
PHP_RSHUTDOWN_FUNCTION(pcntl)
{
- struct php_pcntl_pending_signal *sig;
-
/* FIXME: if a signal is delivered after this point, things will go pear shaped;
* need to remove signal handlers */
zend_hash_destroy(&PCNTL_G(php_signal_table));
- while (PCNTL_G(head)) {
- sig = PCNTL_G(head);
- PCNTL_G(head) = sig->next;
- efree(sig);
- }
- while (PCNTL_G(spares)) {
- sig = PCNTL_G(spares);
- PCNTL_G(spares) = sig->next;
- efree(sig);
- }
return SUCCESS;
}
@@ -765,10 +753,10 @@
/* since calling malloc() from within a signal handler is not portable,
* pre-allocate a few records for recording signals */
int i;
- for (i = 0; i < 32; i++) {
+ for (i = 0; i < PENDING_SIGNALS_SIZE; i++) {
struct php_pcntl_pending_signal *psig;
- psig = emalloc(sizeof(*psig));
+ psig = &PCNTL_G(pending_signals[i]);
psig->next = PCNTL_G(spares);
PCNTL_G(spares) = psig;
}
Index: ext/pcntl/php_pcntl.h
===================================================================
--- ext/pcntl/php_pcntl.h (revision 302771)
+++ ext/pcntl/php_pcntl.h (working copy)
@@ -62,9 +62,12 @@
long signo;
};
+#define PENDING_SIGNALS_SIZE 32
+
ZEND_BEGIN_MODULE_GLOBALS(pcntl)
HashTable php_signal_table;
int processing_signal_queue;
+ struct php_pcntl_pending_signal pending_signals[PENDING_SIGNALS_SIZE];
struct php_pcntl_pending_signal *head, *tail, *spares;
ZEND_END_MODULE_GLOBALS(pcntl)
|