For Programmers: Free Programming Magazines  


Home > Archive > PHP Zend Engine > July 2004 > Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend_ini.c









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend_ini.c
Andi Gutmans

2004-07-29, 3:55 pm

Hey,

I don't quite understand this patch. dl() is not supported under ZTS (gives
an error message IIRC), so why would you have to fix this?

At 10:56 PM 7/28/2004 +0000, Wez Furlong wrote:
>wez Wed Jul 28 18:56:01 2004 EDT
>
> Modified files:
> /ZendEngine2 zend_ini.c
> Log:
> Fix: ini entries for dl()'d modules now work under ZTS
> Side-effect: avoid possible crashes when multiple threads load/unload
> modules and mess with the global hash table.
>
>
>http://cvs.php.net/diff.php/ZendEng...33&r2=1.34&ty=u
>Index: ZendEngine2/zend_ini.c
>diff -u ZendEngine2/zend_ini.c:1.33 ZendEngine2/zend_ini.c:1.34
>--- ZendEngine2/zend_ini.c:1.33 Mon Apr 12 08:22:26 2004
>+++ ZendEngine2/zend_ini.c Wed Jul 28 18:56:01 2004
>@@ -16,7 +16,7 @@
> +----------------------------------------------------------------------+
> */
>
>-/* $Id: zend_ini.c,v 1.33 2004/04/12 12:22:26 andi Exp $ */
>+/* $Id: zend_ini.c,v 1.34 2004/07/28 22:56:01 wez Exp $ */
>
> #include "zend.h"
> #include "zend_qsort.h"
>@@ -147,10 +147,25 @@
> zend_ini_entry *p = ini_entry;
> zend_ini_entry *hashed_ini_entry;
> zval default_value;
>+ HashTable *directives = registered_zend_ini_directives;
>+
>+#ifdef ZTS
>+ /* if we are called during the request, eg: from dl(),
>+ * then we should not touch the global directives table,
>+ * and should update the per-(request|thread) version instead.
>+ * This solves two problems: one is that ini entries for dl()'d
>+ * extensions will now work, and the second is that updating the
>+ * global hash here from dl() is not mutex protected and can
>+ * lead to death.
>+ */
>+ if (directives != EG(ini_directives)) {
>+ directives = EG(ini_directives);
>+ }
>+#endif
>
> while (p->name) {
> p->module_number = module_number;
>- if (zend_hash_add(registered_zend_ini_direc
tives, p->name,
>p->name_length, p, sizeof(zend_ini_entry), (void **)
>&hashed_ini_entry)==FAILURE) {
>+ if (zend_hash_add(directives, p->name, p->name_length, p,
>sizeof(zend_ini_entry), (void **) &hashed_ini_entry)==FAILURE) {
> zend_unregister_ini_entries(module_numbe
r TSRMLS_CC);
> return FAILURE;
> }
>
>--
>Zend Engine CVS Mailing List (http://cvs.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php

Wez Furlong

2004-07-29, 3:55 pm

CGI, CLI and embed SAPI are excluded from the zts check and, prior to
the patch, would not set up ini entries correctly.

--Wez.

On Thu, 29 Jul 2004 08:28:44 -0700, Andi Gutmans <andi@zend.com> wrote:[color=darkred]
> Hey,
>
> I don't quite understand this patch. dl() is not supported under ZTS (gives
> an error message IIRC), so why would you have to fix this?
>
>
>
> At 10:56 PM 7/28/2004 +0000, Wez Furlong wrote:
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com