On Thu, Jul 6, 2017 at 10:53 AM, Kalle Sommer Nielsen <ka...@php.net> wrote:
> 2017-07-06 11:12 GMT+02:00 Martijn van Duren <p...@list.imperialat.at>:
>> I have an (exotic) case where I need to be able to get the
>> filedescriptor from a previously opened stream (via stream_socket_pair)
>> to hand over to the child process, which needs to reexecute.
>>
>
"hand over to a child process"
Child as in pcntl_fork()? Or a subprocess via exec() et. al.?

For the former, the variable should (I think) carry over.
For the latter, the stream number is going to be a meaningless value
to the subprocess. ((e.g. stdin (fd=0) for the parent is a different
source than stdin for the child, despite being the same number)).

I'm not sure of your exact use case, but you might be able to use
proc_open to spawn the child and supply the socket in the descriptor
spec which will (I think, iirc) bind the internal socket to a new pipe
between the parent and child.  Though it's possible you'll need to
maintain a proxy loop in the parent.

40% of the above is guesswork and conjecture, but maybe it'll spawn
the right question.

-Sara

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to