Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:18788 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 96555 invoked by uid 1010); 12 Sep 2005 04:02:54 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 96540 invoked from network); 12 Sep 2005 04:02:54 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Sep 2005 04:02:54 -0000 X-Host-Fingerprint: 69.12.155.130 69-12-155-130.dsl.static.sonic.net Linux 2.4/2.6 Received: from ([69.12.155.130:4739] helo=pigeon.alphaweb.net) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 0E/FD-27924-DEDF4234 for ; Mon, 12 Sep 2005 00:02:53 -0400 Received: from localhost ([127.0.0.1] helo=lighthammer) by pigeon.alphaweb.net with smtp (Exim 4.10) id 1EEeru-0007M7-00; Sun, 11 Sep 2005 20:20:30 -0700 Message-ID: <003e01c5b74e$d6a05110$6c051fac@lighthammer> To: "RG" Cc: References: <4e89b426050911135030c1aebe@mail.gmail.com><000e01c5b720$59856cc0$6401a8c0@p4> <4e89b4260509111626ccfcf2b@mail.gmail.com> <41.A9.27924.033C4234@pb1.pair.com> Date: Sun, 11 Sep 2005 21:01:50 -0700 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 Subject: Re: [PHP-DEV] Zend resources From: pollita@php.net ("Sara Golemon") > Is there any way of getting the resource id without modifying sockets? > ZEND_API int zend_fetch_list_dtor_id(char *type_name); As an implementation: In *your* socketi.c: static int le_socket = -1; PHP_RINIT(socketi) { if (le_socket == -1) { le_socket = zend_fetch_list_dtor_id("Socket"); } return (le_socket == -1) ? FAILURE : SUCCESS; } By doing it in RINIT you avoid the potential problem of having socketi loaded before socket (which could happen if they're both shared). Once the first request has retreived it, later requests won't have to try because it'll be persistently known from then on. The one pitfall to this method is that *IF* another ext defines a resource named "Socket" (case-sensitive), you could pick up the wrong lde ID. Fairly left-field chance, but technically not impossible. -Sara