BrowserUk has asked for the wisdom of the Perl Monks concerning the following question:

In win32.c there is a function definition

DllExport int win32_open_osfhandle(intptr_t handle, int flags) { #ifdef USE_FIXED_OSFHANDLE if (IsWin95()) return my_open_osfhandle(handle, flags); #endif return _open_osfhandle(handle, flags); }

Which since I'm not using Win95 (is anyone anymore?), suggests I should have an _open_osfhandle() definition somewhere. But a grep of the sources shows no such thing:

\perl\src\perl-5.8.8\lib\CORE\perlhost.h: return win32_open_osfhand +le(osfhandle, flags); \perl\src\perl-5.8.8\lib\CORE\win32.h:/* Define USE_FIXED_OSFHANDLE to + fix MSVCRT's _open_osfhandle() on W95. \perl\src\perl-5.8.8\lib\CORE\win32iop.h:DllExport int win32_ +open_osfhandle(intptr_t handle, int flags); \perl\src\perl-5.8.8\lib\CORE\win32iop.h:#define _open_osfhandle + win32_open_osfhandle \perl\src\perl-5.8.8\makedef.pl: win32_open +_osfhandle \perl\src\perl-5.8.8\makedef.pl: nw_open_osfhan +dle \perl\src\perl-5.8.8\NetWare\nw5.c:nw_open_osfhandle(long handle, int +flags) \perl\src\perl-5.8.8\NetWare\nw5iop.h:int nw_open_osfhan +dle(long handle, int flags); \perl\src\perl-5.8.8\NetWare\nwperlhost.h: return nw_open_osfhandle +(osfhandle, flags); \perl\src\perl-5.8.8\NetWare\nwperlsys.h: return nw_open_osfhandle( +osfhandle, flags); \perl\src\perl-5.8.8\win32\perldll.def: win32_open_osfhandle \perl\src\perl-5.8.8\win32\perlhost.h: return win32_open_osfhandle( +osfhandle, flags); \perl\src\perl-5.8.8\win32\win32.c:*int my_open_osfhandle(intptr_t osf +handle, int flags) - open C Runtime file handle \perl\src\perl-5.8.8\win32\win32.c: int fh = _open_osfhandle((intpt +r_t)hF, 0); \perl\src\perl-5.8.8\win32\win32.c:my_open_osfhandle(intptr_t osfhandl +e, int flags) \perl\src\perl-5.8.8\win32\win32.c: int fd = win32_open +_osfhandle((intptr_t)fh, 0); \perl\src\perl-5.8.8\win32\win32.c:win32_open_osfhandle(intptr_t handl +e, int flags) \perl\src\perl-5.8.8\win32\win32.c: return my_open_osfhandle(handle +, flags); \perl\src\perl-5.8.8\win32\win32.c: return _open_osfhandle(handle, +flags); \perl\src\perl-5.8.8\win32\win32.h:/* Define USE_FIXED_OSFHANDLE to fi +x MSVCRT's _open_osfhandle() on W95. \perl\src\perl-5.8.8\win32\win32io.c: fd = win32_open_osfhandle +((intptr_t) h, PerlIOUnix_oflags(tmode)); \perl\src\perl-5.8.8\win32\win32io.c: int fd = win32_open_osfha +ndle((intptr_t) new, PerlIOUnix_oflags(PerlIO_modestr(o,mode))); \perl\src\perl-5.8.8\win32\win32iop.h:DllExport int win32_ +open_osfhandle(intptr_t handle, int flags); \perl\src\perl-5.8.8\win32\win32iop.h:#define _open_osfhandle + win32_open_osfhandle \perl\src\perl-5.8.8\win32\win32sck.c:# define OPEN_SOCKET(x) win32_ +open_osfhandle(x,O_RDWR|O_BINARY) \perl\src\perl-5.8.8\wince\perlhost.h: return win32_open_osfhandle( +osfhandle, flags); \perl\src\perl-5.8.8\wince\win32.h:/* Define USE_FIXED_OSFHANDLE to fi +x MSVCRT's _open_osfhandle() on W95. \perl\src\perl-5.8.8\wince\win32io.c: fd = win32_open_osfhandle((intp +tr_t) h, PerlIOUnix_oflags(tmode)); \perl\src\perl-5.8.8\wince\win32io.c: int fd = win32_open_osfhandle( +(intptr_t) new, PerlIOUnix_oflags(PerlIO_modestr(o,mode))); \perl\src\perl-5.8.8\wince\win32iop.h:DllExport int win32_ +open_osfhandle(long handle, int flags); \perl\src\perl-5.8.8\wince\win32iop.h:#define _open_osfhandle + win32_open_osfhandle \perl\src\perl-5.8.8\wince\wince.c: int fd = win32_open_os +fhandle((intptr_t)fh, 0); \perl\src\perl-5.8.8\wince\wince.c:win32_open_osfhandle(intptr_t osfha +ndle, int flags) \perl\src\perl-5.8.8\wince\wince.c: Perl_croak_nocontext("win32_ope +n_osfhandle() TBD on this platform");

The only resolution for win32_open_osfhandle() I can see is

\perl\src\perl-5.8.8\win32\win32iop.h:#define _open_osfhandle + win32_open_osfhandle

Which doesn't help much. What am I missing?


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"Too many [] have been sedated by an oppressive environment of political correctness and risk aversion."

Replies are listed 'Best First'.
Re: Perl source diving confusion (MS)
by tye (Sage) on Nov 07, 2007 at 06:40 UTC

    Look in MicroSoft's source code to their C RTL, osfinfo.c.

    - tye