Steve Hay wrote:
Stas Bekman wrote:

Steve Hay wrote:
[...]

Line 2457 of perlio.c sets fd to 1 (which is STDOUT, right?) flags is


still 2, so (flags & PERLIO_DUP_FD) is true and we call PerlLIO_dup() on line 2459. That calls win32_dup(), which calls dup(), which I can't step into ;-). Each of dup(), win32_dup() and PerlLIO_dup() returns 35.


[...]

This f also gets returned from PerlIOBase_dup(), so back in PerlIOUnix_dup() we call PerlIOUnix_setfd() at line 2465 which looks good. f is non-NULL, fd is 35, os->oflags is 0. The PerlLIO_fstat(35, &st) call at line 2348 is ultimately a call to _fstati64(35, ...) at win32/win32sck.c line 500 which returns -1. I wasn't expecting that to have failed (_fstati64() returns 0 for success, -1 for failure) :-s (***)


[...]

You said you have an app, that shows you the opened fds. So was fd 35 open after win32_dup() was called? And was it closed at the stat checkpoint above? If so could you monitor what caused to its closure?


Sadly that app only shows files / devices etc that are open by name - it doesn't relate the open thingies to file descriptors or even Win32 HANDLE's. There are dozens of open thingies at this point, and loads of them have the same name (like \Device\Tcp and \Device\Afd\Endpoint). I don't know how a dup() of STDOUT would even show up in the list, and I can't see anything that looks like it might be it.

Could you look at that list just before the dup and then after it and see what was added? You could probably patch perl to tell you that info, though I don't know what function does that in the win32 land. It should be in one of the perl io functions.


Also I thought win32 doesn't work with fds, but its own HANDLE thingy. Is that not true?


Win32 has FILE * filehandles and int file descriptors just like other OS's do, but also has a lower level HANDLE thing of its own too. The MS STD C runtime library implements all the stdio (fopen et al) and lowio (open et al) functions in terms of calls to Win32 API functions (CreateFile et al); it is those API functions that use HANDLE's.

Thanks. Apache/apr are now exclusively using HANDLEs bypassing FILE*.



__________________________________________________________________ Stas Bekman JAm_pH ------> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to