Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:47283 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 79328 invoked from network); 14 Mar 2010 23:36:43 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Mar 2010 23:36:43 -0000 Authentication-Results: pb1.pair.com header.from=dennis.hotson@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=dennis.hotson@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.42 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: dennis.hotson@gmail.com X-Host-Fingerprint: 74.125.82.42 mail-ww0-f42.google.com Received: from [74.125.82.42] ([74.125.82.42:57632] helo=mail-ww0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 6C/C2-07348-9037D9B4 for ; Sun, 14 Mar 2010 18:36:42 -0500 Received: by wwc33 with SMTP id 33so2004697wwc.29 for ; Sun, 14 Mar 2010 16:36:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=aTW52ffq2+T6KGa7I0TDGv/QjCjpQuvNvT6x/Wk47WE=; b=mIKh4pYvdhBO0/j5EKc0N+z5q6OrMf8+QTIHA29PKsg1rcBXE9m1rocC3SQ6PIi4US kJbXHh4zDFqXPEKWWss4aGuOZVt99Z57Kz9l0HDtteRmRIxqpsHhlhz/o/6byDFkuNkf iywEmqmDnxiVl7IhxzP7X1hZBU3cJ5PoU8Nv0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=ubDlrhxBWXqjGAHEj5PWhOKkyWbj/JkCgLSloOtEDPNU6z5XSvc6wIeWD9gDBqWL8p jZM+XX0up46GcZLMkkoRbsCnQEovNU2f7hl3ZA8Ze7kZS1kI8E9Y2r/gdIanL9Cu9gFV VmR+wVX62d87Y/vYK1Z3kas4a20yWkk2PhJFw= MIME-Version: 1.0 Received: by 10.216.87.67 with SMTP id x45mr596208wee.18.1268609796891; Sun, 14 Mar 2010 16:36:36 -0700 (PDT) In-Reply-To: References: <469956791003132238p4bc841a0sd0c8a09e3ee1b084@mail.gmail.com> <4B9CF2F7.2080905@gmail.com> <1268577545.11885.77436.camel@localhost> Date: Mon, 15 Mar 2010 10:36:36 +1100 Message-ID: <469956791003141636j1a691e00m6b5cab047ebb25cf@mail.gmail.com> To: Pierre Joye Cc: "M." , PHP Developers Mailing List Content-Type: multipart/alternative; boundary=0016e6d99ead4d66a70481cb3cbc Subject: Re: [PHP-DEV] Implementing fdopen in PHP From: dennis.hotson@gmail.com (Dennis Hotson) --0016e6d99ead4d66a70481cb3cbc Content-Type: text/plain; charset=ISO-8859-1 On Mon, Mar 15, 2010 at 1:41 AM, Pierre Joye wrote:> > > When you spawn a new program, you can pass it additionnal descriptors on > > top of stdin/stdout/stderr. > > > > For example look at proc_open(). You can pass more than 3 descriptors, > > and communicate if the program is able to use them. > > > > An alternative on linux is to $fp = fopen("/proc/self/fd/3","r+") > > That's what proc_open does and allows. > So in my case, the erlang server is doing the equivalent of proc_open() to call my PHP program. My PHP program needs a way to access these 'extra' file descriptors. I'm fine with using fopen("/proc/self/fd/3","r") for now, but something like fdopen() would be more appropriate IMHO so that it will work on platforms other than linux. Slightly off topic, but another useful application of fdopen() is for hot swapping a running program. http://nathanwiegand.com/wp/2010/02/hot-swapping-binaries/ I realise this is probably not a priority for PHP, but I actually enjoy writing network servers in PHP and this would be a pretty awesome feature. Regards, Dennis Hotson (PS. Sorry for the dupe Pierre, I forgot to reply to the list.) --0016e6d99ead4d66a70481cb3cbc--