Just another Perl shrine | |
PerlMonks |
Re^2: Win32API::File not setting HANDLE_FLAG_PROTECT_FROM_CLOSE (sources)by Yary (Pilgrim) |
on Dec 01, 2012 at 01:23 UTC ( [id://1006550]=note: print w/replies, xml ) | Need Help?? |
I'm even curious to know why a flag like _PROTECT_FROM_CLOSE was created in the first place. :)Sometimes two processes need to communicate via file descriptors and std* is not enough- Unix example I know of is UCSPI (ooks-pie) UNIX Client-Server Program Interface which qmail uses. In a case like that, you need to keep non-STD* filehandles from closing when you exec a new process, otherwise the child tries using FD 3 (or FDs 6 and 7, etc) and finds it is closed. Unix has no problem with this, it uses fcntl($fh, F_SETFD, ~FD_CLOEXEC) and all is well. But those POSIX macros are not implemented in Win32-land, at least not in ActiveState's Perl. Hence my desire to try _PROTECT_FROM_CLOSE on FD 3. I was all over the web looking for insight, tried other tricks like setting $^F=3 (never even glanced at that perlvar before) but no luck. The best I found was a terse comment that said "Can't be done. OS limitation." which gave me the courage to give up! Thanks for looking into it, and confirming that I'm not alone.
edit: My idea was to write a wrapper in perl that would allow communicating with a sub-program using those higher-number, user-defined file descriptors in Win32.
In Section
Seekers of Perl Wisdom
|
|