static void _zend_is_inconsistent(const HashTable *ht, const char *file, int line) { if (ht->inconsistent == HT_OK) { return; } switch (ht->inconsistent) { case HT_IS_DESTROYING: zend_output_debug_string(1, "%s(%d) : ht=%p is being destroyed", file, line, ht); break; case HT_DESTROYED: zend_output_debug_string( 1, "%s(%d) : ht=%p is already destroyed", file, line, ht); break; case HT_CLEANING: zend_output_debug_string(1, "%s(%d) : ht=%p is being cleaned", file, line, ht); break; default: zend_output_debug_string(1, "%s(%d) : ht=%p is inconsistent", file, line, ht); break; } zend_bailout(); }
/* {{{ zend_signal_handler_defer * Blocks signals if in critical section */ void zend_signal_handler_defer(int signo, siginfo_t *siginfo, void *context) { int errno_save = errno; zend_signal_queue_t *queue, *qtmp; TSRMLS_FETCH(); if (SIGG(active)) { if (SIGG(depth) == 0) { /* try to handle signal */ if (SIGG(blocked) != -1) { /* inverse */ SIGG(blocked) = -1; /* signal is not blocked */ } if (SIGG(running) == 0) { SIGG(running) = 1; zend_signal_handler(signo, siginfo, context TSRMLS_CC); queue = SIGG(phead); SIGG(phead) = NULL; while (queue) { zend_signal_handler(queue->zend_signal.signo, queue->zend_signal.siginfo, queue->zend_signal.context TSRMLS_CC); qtmp = queue->next; queue->next = SIGG(pavail); queue->zend_signal.signo = 0; SIGG(pavail) = queue; queue = qtmp; } SIGG(running) = 0; } } else { /* delay signal handling */ SIGG(blocked) = 0; /* signal is blocked */ if ((queue = SIGG(pavail))) { /* if none available it's simply forgotton */ SIGG(pavail) = queue->next; queue->zend_signal.signo = signo; queue->zend_signal.siginfo = siginfo; queue->zend_signal.context = context; queue->next = NULL; if (SIGG(phead) && SIGG(ptail)) { SIGG(ptail)->next = queue; } else { SIGG(phead) = queue; } SIGG(ptail) = queue; } #if ZEND_DEBUG else { /* this may not be safe to do, but could work and be useful */ zend_output_debug_string(0, "zend_signal: not enough queue storage, lost signal (%d)", signo); } #endif } } else { /* need to just run handler if we're inactive and getting a signal */ zend_signal_handler(signo, siginfo, context TSRMLS_CC); } errno = errno_save; } /* }}} */
ZEND_API ZEND_COLD void _zend_bailout(char *filename, uint lineno) /* {{{ */ { if (!EG(bailout)) { zend_output_debug_string(1, "%s(%d) : Bailed out without a bailout address!", filename, lineno); exit(-1); } CG(unclean_shutdown) = 1; CG(active_class_entry) = NULL; CG(in_compilation) = 0; EG(current_execute_data) = NULL; LONGJMP(*EG(bailout), FAILURE); }
void zend_hash_display(const HashTable *ht) { Bucket *p; uint i; if (UNEXPECTED(ht->nNumOfElements == 0)) { zend_output_debug_string(0, "The hash is empty"); return; } for (i = 0; i < ht->nNumOfElements; i++) { p = ht->arBuckets[i]; while (p != NULL) { zend_output_debug_string(0, "%s <==> 0x%lX\n", p->arKey, p->h); p = p->pNext; } } p = ht->pListTail; while (p != NULL) { zend_output_debug_string(0, "%s <==> 0x%lX\n", p->arKey, p->h); p = p->pListLast; } }