Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:52445 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 19006 invoked from network); 18 May 2011 11:27:20 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 May 2011 11:27:20 -0000 Authentication-Results: pb1.pair.com smtp.mail=fw@f-ws.de; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=fw@f-ws.de; sender-id=pass Received-SPF: pass (pb1.pair.com: domain f-ws.de designates 209.85.161.42 as permitted sender) X-PHP-List-Original-Sender: fw@f-ws.de X-Host-Fingerprint: 209.85.161.42 mail-fx0-f42.google.com Received: from [209.85.161.42] ([209.85.161.42:35805] helo=mail-fx0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 65/80-15653-51DA3DD4 for ; Wed, 18 May 2011 07:27:19 -0400 Received: by fxm1 with SMTP id 1so1275501fxm.29 for ; Wed, 18 May 2011 04:27:15 -0700 (PDT) Received: by 10.223.6.11 with SMTP id 11mr2240654fax.100.1305718034889; Wed, 18 May 2011 04:27:14 -0700 (PDT) Received: from [172.16.7.25] ([212.48.107.10]) by mx.google.com with ESMTPS id c22sm585592fat.14.2011.05.18.04.27.13 (version=SSLv3 cipher=OTHER); Wed, 18 May 2011 04:27:13 -0700 (PDT) Message-ID: <4DD3AD12.5010705@f-ws.de> Date: Wed, 18 May 2011 13:27:14 +0200 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; de; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10 MIME-Version: 1.0 To: internals@lists.php.net References: <4DD3A313.7030508@f-ws.de> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Patch - create socket by fd# From: fw@f-ws.de (Florian Wilkemeyer) Am 18.05.2011 13:13, schrieb 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. > > Okay, #1 it's already #2 & 3 no problem #4 i'll checkout 5_4 today and port it to the version / see what can be shared i'll resubmit the fixed / changed patch, when i've applied the changes Thanks, Florian