Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:52444 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 16769 invoked from network); 18 May 2011 11:13:43 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 May 2011 11:13:43 -0000 Authentication-Results: pb1.pair.com smtp.mail=glopes@nebm.ist.utl.pt; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=glopes@nebm.ist.utl.pt; sender-id=unknown Received-SPF: error (pb1.pair.com: domain nebm.ist.utl.pt from 193.136.128.22 cause and error) X-PHP-List-Original-Sender: glopes@nebm.ist.utl.pt X-Host-Fingerprint: 193.136.128.22 smtp2.ist.utl.pt Linux 2.6 Received: from [193.136.128.22] ([193.136.128.22:51408] helo=smtp2.ist.utl.pt) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 4C/10-15653-5E9A3DD4 for ; Wed, 18 May 2011 07:13:42 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp2.ist.utl.pt (Postfix) with ESMTP id B3A2370003EA for ; Wed, 18 May 2011 12:13:37 +0100 (WEST) X-Virus-Scanned: by amavisd-new-2.6.4 (20090625) (Debian) at ist.utl.pt Received: from smtp2.ist.utl.pt ([127.0.0.1]) by localhost (smtp2.ist.utl.pt [127.0.0.1]) (amavisd-new, port 10025) with LMTP id MuDBbjXhLLj5 for ; Wed, 18 May 2011 12:13:37 +0100 (WEST) Received: from mail2.ist.utl.pt (mail.ist.utl.pt [IPv6:2001:690:2100:1::8]) by smtp2.ist.utl.pt (Postfix) with ESMTP id 79BE97000430 for ; Wed, 18 May 2011 12:13:37 +0100 (WEST) Received: from clk-0081.clk-domain (unknown [85.139.253.17]) (Authenticated sender: ist155741) by mail2.ist.utl.pt (Postfix) with ESMTPSA id 2A4AF200738E for ; Wed, 18 May 2011 12:13:37 +0100 (WEST) Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes To: internals@lists.php.net References: <4DD3A313.7030508@f-ws.de> Date: Wed, 18 May 2011 12:13:36 +0100 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Organization: =?utf-8?Q?N=C3=BAcleo_de_Eng=2E_Biom=C3=A9di?= =?utf-8?Q?ca_do_I=2ES=2ET=2E?= Message-ID: In-Reply-To: <4DD3A313.7030508@f-ws.de> User-Agent: Opera Mail/11.10 (Win32) Subject: Re: [PHP-DEV] Patch - create socket by fd# From: glopes@nebm.ist.utl.pt ("Gustavo Lopes") Em Wed, 18 May 2011 11:44:35 +0100, Florian Wilkemeyer escreveu: > i recently wrote small function that allows the creation of a php-socket > by directly giving the fd# > > this is very useful under linux/unix environments for Ipc. > For example: > getting forked by a webserver as fastcgi / scgi .., the webserver gives > an acceptable socket as fd#0 to the process.. > > I submitted the patch about 3 weeks ago @ pecl-dev list in the fdpass > extension topic. > > It would be nice to see such function in dist php :) > I can commit this, but a few changes are required first: * This doesn't work on Windows, so it should be ifdef'd out on that platform. * The family can be detected * The blocking behavior should be queried, not hardcoded to 1 * This patch is not up-to-date with trunk/5.4 (see php_create_socket) For the two last points, see the implementation of socket_import_stream in http://lxr.php.net/opengrok/xref/PHP_TRUNK/ext/sockets/sockets.c#2434 It would be a good idea to do some refactoring and share code between the two functions. * (remark) "For IPC", the vast majority of use cases would be already covered by php://fd; you would this this only for socket specific functionality. -- Gustavo Lopes