[fpc-devel] Re: inheriting handles using TProcess in unix
Marco van de Voort
marcov at stack.nl
Thu Jan 27 14:35:01 CET 2011
In our previous episode, Seth Grover said:
> > Michael.
> My current thought is to use FindFirst/FindNext in the context of the
> child process after the fork but before the exec to enumerate the
> contents of /proc/[pid]/fd/ and close all the descriptors greater than
> 2. I don't have experience in all different flavors of UNIX, but from
> what I've read procfs is standard in UNIX.
It is not in all flavours, and many BSDs can turn it off.
But that is more theoretical. The more practical problem is that while /proc
might usually exist, its contents and permissions vary. (and that also goes
for Linux, specially on embedded variants)
If this really is an huge problem, I would add the possibility to trigger an
event on the moment this is required. This allows for system specific
operations by users, without unnecessarily complicating TProcess (and
differentiate its default functionality per target, leading to
documentation, maintenance and support issues)
More information about the fpc-devel