Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:29780 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 89402 invoked by uid 1010); 25 May 2007 22:33:36 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 89387 invoked from network); 25 May 2007 22:33:36 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 May 2007 22:33:36 -0000 Authentication-Results: pb1.pair.com smtp.mail=thetaphi@php.net; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=thetaphi@php.net; sender-id=unknown Received-SPF: error (pb1.pair.com: domain php.net from 80.190.230.99 cause and error) X-PHP-List-Original-Sender: thetaphi@php.net X-Host-Fingerprint: 80.190.230.99 www.troja.net Linux 2.5 (sometimes 2.4) (4) Received: from [80.190.230.99] ([80.190.230.99:57836] helo=mail.troja.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 42/00-23498-C2467564 for ; Fri, 25 May 2007 18:33:25 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.troja.net (Postfix) with ESMTP id 449CD2A503; Sat, 26 May 2007 00:32:39 +0200 (CEST) Received: from mail.troja.net ([127.0.0.1]) by localhost (cyca.troja.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 32285-04; Sat, 26 May 2007 00:32:27 +0200 (CEST) Received: from VEGA (port-83-236-62-78.dynamic.qsc.de [83.236.62.78]) (using SSLv3 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.troja.net (Postfix) with ESMTP id A72B82A4FF; Sat, 26 May 2007 00:32:27 +0200 (CEST) To: "'Rasmus Lerdorf'" Cc: "'Stanislav Malyshev'" , "'PHP Internals'" References: <4657170E.8060701@zend.com> <46571CCC.4030801@zend.com> <46573710.6070800@lerdorf.com> <46573903.2060204@zend.com> <000001c79f12$9b6650b0$0201a8c0@VEGA> <465756D4.1080604@lerdorf.com> <000001c79f19$05a337d0$0201a8c0@VEGA> <46576108.6070300@lerdorf.com> Date: Sat, 26 May 2007 00:32:02 +0200 Message-ID: <000101c79f1c$8499ef90$0201a8c0@VEGA> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 In-Reply-To: <46576108.6070300@lerdorf.com> Thread-Index: AcefGufIgI2Y0b4yQ0+MB23tY5gC0QAAZeNg X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3028 X-Virus-Scanned: amavisd-new at troja.net Subject: RE: [PHP-DEV] TSRM changes broke windows compile From: thetaphi@php.net ("Uwe Schindler") Hi Rasmus, > > This is no longer the case. E.g. when compiling the module for the NSAPI > > webserver (Sun Java System Webserver) there should be a global define > like > > -DNSAPI in the makefiles (not only for nsapi.c) which is not. Because of > > that all SAPIs do not have an effect on the thread implementation. When > > compiling PHP with ZTS you always get an .o file that links to pthreads. > > This must be the case, because without that it would not be possible to > link > > a CLI PHP in parallel to the webserver specific SAPI. > > That's simply not the case. Look at the nsapi code: > > #define NSAPI 1 > > #ifdef HAVE_CONFIG_H > #include "config.h" > #endif > > #include "php.h" > #include "php_variables.h" > #include "ext/standard/info.h" > #include "php_ini.h" > #include "php_globals.h" > #include "SAPI.h" > #include "php_main.h" > #include "php_version.h" > #include "TSRM.h" > #include "ext/standard/php_standard.h" > #include > #include > > It defines NSAPI before including TSRM.h and in TSRM.h we have: > > #elif defined(NSAPI) > # define THREAD_T SYS_THREAD > # define MUTEX_T CRITICAL Butt his is only for nsapi.c. All other PHP modules and the core itself do not know anything about NSAPI. This leads to the fact that if the webservers thread implementation is incompatible to the system default the build .o of nsapi.c is not compatible to the other .o files. This happens here: When compiling TSRM.c with the lines in it: TSRM_API THREAD_T tsrm_thread_id(void) { #ifdef TSRM_WIN32 return GetCurrentThreadId(); #elif defined(GNUPTH) return pth_self(); #elif defined(PTHREADS) return pthread_self(); #elif defined(NSAPI) return systhread_current(); #elif defined(PI3WEB) return PIThread_getCurrent(); #elif defined(TSRM_ST) return st_thread_self(); #elif defined(BETHREADS) return find_thread(NULL); #endif } NSAPI is *not* defined. This is not a problem because the systhread_current()-NSAPI function internally calls pthread_self() but only if the webserver runs in pthreads. On AIX (or was it HP-UX??? I should look into my bug reports) the webserver runs in another thread implementation. This leads to crashes in the webserver because PHP uses pthreads (because of TSRM.c) and all the webserver another one. In the worst case #define THREAD_T SYS_THREAD is also incompatible in size and structure and misbehaves between SAPI code (with define) and PHP (without define). Uwe