summaryrefslogtreecommitdiff
path: root/win32/perlhost.h
Commit message (Collapse)AuthorAgeFilesLines
* win32: fix argumentless sleep()Tomasz Konojacki2018-08-011-1/+1
| | | | | | | | | | | | | | Before this commit, pause() was implemented as a macro calling win32_sleep((32767L << 16) + 32767), which was causing the following problems with argumentless sleep(): - it was sleeping for 4262198 seconds (~50 days) instead of forever - it was triggering "sleep(2147450879) too large" warning This commit implements pause() as a proper function which calls win32_msgwait() with an INFINITE timeout. [perl #133376]
* (perl #131665) avoid a buffer overflow in a buffer we didn't needTony Cook2017-09-101-8/+2
| | | | | | | since Lookup() treats its argument as NUL or '=' terminated. Previously environment variable names longer than the size of the buffer would result in a buffer overflow.
* Add support for VS2015 (VC++ 14.0)Steve Hay2017-02-191-3/+3
| | | | | | | | | | | | | | | Due to the rewritten CRT in this version of Visual C++ it is no longer possible (or at least not at all easy) to make use of the ioinfo struct, which commit b47a847f62 (re-)introduced in order to fix RT#120091/118059. Therefore, we effectively revert commit b47a847f62 for VS2015 onwards on the basis that being able to build with VS2015 onwards is more important than the RT#120091/118059 bug fix. This does unfortunately mean that perls built with <=VS2013 will not be compatible with perls built with >=VS2015, but they may well not have been compatible anyway because of the CRT rewrite, and certainly wouldn't be compatible if perl builds with VS2015 were not supported! See RT#125714 for more discussion about this.
* const vtables in win32/perlhost.hDaniel Dragan2015-10-201-9/+9
| | | | | | | This allows some more memory to be shared between 2 perl processes since it is const. VC 2013 32b build, before Virtual Size of perl523.dll sections, .rdata 0x3DE00 bytes .data 0x1B90, after .rdata 0x3E140 .data 0x18B0.
* add Win32 USE_NO_REGISTRY build optionDaniel Dragan2015-10-121-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | -the first arg of win32_get_privlib is not used if the registry is not queried, create a macro to allow the arg to drop out on WIN32_NO_REGISTRY builds for efficiency and not to have unused C litteral strings in the binary -This patch changes the ABI of PerlEnv_lib_path/PerlEnvLibPath/win32_get_privlib between USE_NO_REGISTRY and no USE_NO_REGISTRY. Since win32_get_privlib is not exported from perl523.dll, assume it and PerlEnv_lib_path are not public API, note technically PerlEnv_lib_path will be callable only on PERL_IMPLICIT_SYS builds, on no PERL_IMPLICIT_SYS builds it will fail at link time since win32_get_privlib isnt exported. Therefore place it in non-[affecting]-binary compatibility even though it does affect binary compatibility. -delay load advapi32.dll to save startup time (loading the DLL and the DLL calling its initializers in DllMain) and one 4 KB memory page for advapi32's .data section (doing "perl -E"sleep 100" on WinXP shows advapi32 has a 20KB long .data section, first 4 KB are unique to the process, the remaining 16KB are COW shared between processes according to vmmap tool), putting a DebugBreak() in pp_getlogin and doing a "nmake all" shows miniperl never calls getlogin during the build process. An nmake test shows only ext/POSIX/t/wrappers.t and lib/warnings.t execute pp_getlogin. Keeping advapi32.dll out of the perl process requires removing comctl32.dll, since comctrl32.dll loads advapi32.dll, from perl which I always do as a custom patch. filed as [perl #123658] XXXXXXXXXXXXXXXXXXXXXXX
* refactor win32_get_*lib() funcs to match rest of PERL_IMPLICIT_SYS APIDaniel Dragan2015-06-031-6/+3
| | | | | | | | | | | | | | | | | | The front end of PERL_IMPLICIT_SYS is PerlEnv_*/PerlSock_*/PerlProc_*/etc macros. These are either macroed to C vtable calls when PERL_IMPLICIT_SYS is on, or to the backend raw win32_*() functions when PERL_IMPLICIT_SYS is off. win32_get_*() were not following this convention. All this code looks like a hack as if someone didn't have perms to edit perl.c, but they did have perms to edit /win32, so they devise a scheme of hooking "unhooked" win32_get_*() functions with win32.h macros for win32_get_*() to call the Perl*() virutalization macros, and rename the original function bodies in win32.c to g_win32_get_*() as to not make a macro loop. Undo all of this hack by having perl.c call correct PerlEnv_* macro. This refactoring will be useful for a future patch in #123658 to disable win32 registry lookups.
* Properly set the phase for END blocks run at the end of a pseudo-forkVincent Pit2014-09-281-1/+3
|
* remove various redundant dTHXesDaniel Dragan2012-11-081-0/+2
| | | | | Remove either unused dTHXes, or remove dTHXes where a nocontext func can be used instead. Smaller/faster machine code is the result.
* remove unused dTHXes in /win32/*Daniel Dragan2012-11-081-10/+0
| | | | | | Remove dTHXes in win32 perl funcs where they were not used, or could be replaced with nocontext croaks/warns. Since Perl_get_context is a function it is not optimized away by the compiler.
* create aTHXa, some unused dTHXs removed in /win32/*Daniel Dragan2012-11-081-1/+1
| | | | | | | | | dTHXes that were unused, or because Newx/Safefree were the only things called were removed. In some places the dTHX turned into dTHXa and aTHXa so the context is not fetched until it is actually used (locality/frees a C stack slot or frees a non-volatile register). Also see http://www.nntp.perl.org/group/perl.perl5.porters/2012/10/msg194414.html and http://www.nntp.perl.org/group/perl.perl5.porters/2012/10/msg194861.html
* "func not implemented" croaks optimizations in /win32/*Daniel Dragan2012-11-081-3/+2
| | | | | | | | | This commit removes a number of "* not implemented" strings from the image. A win32_croak_not_implemented wrapper is created to reduce machine code by not putting the format string on the C stack many times. embed.fnc was used to declare win32_croak_not_implemented for proper cross compiler support of noreturn (noreturn on GCC and VC ok). Tailcalling and noreturn optimizations of the C compiler are heavily used in this commit.
* add PERL_CALLCONV_NO_RET to perlhost.h's PerlProcExit and PerlProc_ExitDaniel Dragan2012-10-171-2/+2
| | | | This gives noreturn to the 2 functions on Visual C Perl.
* Add extern "C" to definitions of four win32_ functionsSteve Hay2012-10-101-5/+4
| | | | | This makes them match their declarations in perlhost.h, which fixes linker errors when linking perl5XX.dll in a C++ build with VC.
* Use GetEnvironmentStringsW(..) instead of GetEnvironmentStringsA(..).Karthik Rajagopalan2012-06-151-4/+4
| | | | | | | | GetEnvironmentStringsA(..) return strings in the OEM code page. This can actually mangle the environment strings if it contain special characters. A better approach would be to get the utf-16 strings through GetEnvironmentStringsW(..) and convert them to ANSI code page. This is now done by win32_getenvironmentstrings(..). To free the block, you can use win32_freeenvironmentstrings(..).
* [perl #101486] Make PL_curstash refcountedFather Chrysostomos2011-10-221-0/+4
| | | | | | | | | | This stops PL_curstash from pointing to a freed-and-reused scalar in cases like ‘package Foo; BEGIN {*Foo:: = *Bar::}’. In such cases, another BEGIN block, or any subroutine definition, would cause a crash. Now it just happily proceeds. newATTRSUB and newXS have been modified not to call mro_method_changed_in in such cases, as it doesn’t make sense.
* The Borland Chainsaw MassacreSteve Hay2011-09-101-16/+0
| | | | | Remove support for the Borland C++ compiler on Win32, as agreed here: http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2011-09/msg00034.html
* In win32_start_child(), remove tmpgv, unused since 0e21945565eb4664.Nicholas Clark2011-07-081-1/+0
|
* Turn $$ into a magical readonly variable that always fetches getpid() ↵Max Maischein2011-05-221-7/+0
| | | | | | | | | | | instead of caching it The intent is that by not caching $$, we eliminate one opportunity for bugs: If one embeds Perl or uses XS and calls fork(3) from C, Perls notion of $$ may go out of sync with what getpid() returns. By always fetching the value of $$ via getpid(), this bug opportunity is eliminated. The overhead of always fetching $$ should be small and is likely only used for tempfile creation, which should be dwarfed by file system accesses.
* Hang on to child handle after signalling SIGTERMJan Dubois2011-03-151-0/+1
| | | | | | | This is a refinement of commit 3aa0ac5aa. We still want to hang on to the mapping between pseudo-process and thread handle, so that we can still waitpid() after signalling SIGTERM. We just don't want to wait implicitly on the signalled process anymore.
* Windows 95 Chainsaw MassacreJan Dubois2010-12-021-10/+0
| | | | | Remove all supporting code for Windows 9x and Windows NT. The minimum supported version is Windows 2000 now.
* Update PerlStdIOGets() signatureJan Dubois2010-04-211-1/+1
| | | | | | Brings it in line with the rest of the PerlStdIO* functions that accept parameters in the same order as the corresponding PerlSIO_* macros. See also commit ecc880cc.
* Fix PerlSIO_fputc() and PerlSIO_fputs() signaturesJan Dubois2010-04-211-2/+2
| | | | | | | | | They should have the same prototype as in stdio. This "proper fix" replaces the 5.12.0 compatible fix in commit 634b482, but cannot be integrated into 5.12.1 because it breaks binary compatibility. See also http://rt.perl.org/rt3/Public/Bug/Display.html?id=72704
* Implement win32_isatty()Jan Dubois2009-12-171-16/+1
| | | | | | | | Commit 827da6a38 added a custom isatty() implementation in win32/perlhost.h, but that code will only be used when perl is compiled with -DPERL_IMPLICIT_SYS. This change makes sure that the custom implementation will be used on Windows for all choices of build options.
* -t should only return TRUE for file handles connected to a TTYJan Dubois2009-12-161-1/+16
| | | | | | | | | The Microsoft C version of isatty() returns TRUE for all character mode devices, including the /dev/null style "nul" device and printers like "lpt1". The included test has only been tested on Windows and Linux; the device names for OS/2 and VMS are just best guesses...
* Throw away uncleanable scopes when exiting a pseudo-forked process.Jan Dubois2009-12-071-2/+7
| | | | | | | | Commit adab9969 tried to clean up those additional scopes, but failed because some of the memory was allocated from a different pool. To avoid triggering the assert() in perl_destruct() this change instead moves the one remaining scope back to the root of the stack, effectively discarding the additional frames without any further processing.
* Cleanup all scopes before exiting a pseudo-forked process.Jan Dubois2009-12-021-0/+5
| | | | | | perl_destruct() contains an assertion that the scope stack is empty. The remaining scopes are due to fork() being called from within a BEGIN block.
* Make win32_start_child responsible for cleaning all the scopes.Gerard Goossen2009-11-121-1/+1
|
* Add mingw64 supportSisyphus2009-11-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Hi, Using the attached patch to the blead source (as of a few hours ago), I can build perl with the following OS/compiler/make combos. On 32-bit XP: MSVC++ 7.0 / dmake (uses win32/makefile.mk) MSVC++ 7.0 / nmake (uses win32/Makefile) Borland C++ 5.5.1 / dmake mingw.org's gcc-4.3.0 / dmake mingw.org's gcc-3.4.5 / dmake mingw-w64.sf's 32-bit gcc-4.4.3 / dmake (There's a bug with that last compiler on XP. The perl it builds on XP hangs on XP, but runs ok if copied across to Vista. I think this is unrelated to the patches - probably even unrelated to perl. Without these patches perl will not even build using that last compiler.) On 64-bit Vista: 32-bit MSVC++ 7.0 / nmake (uses win32/Makefile) 32-bit MSVC++ 7.0 / dmake (uses win32/makfile.mk) 32-bit Borland C++ 5.5.1 / dmake mingw.org's 32-bit gcc-4.4.0 / dmake mingw.org's 32-bit gcc-3.4.5 / dmake mingw-w64.sf's 32-bit gcc-4.4.3 / dmake mingw-w64.sf's 64-bit gcc-4.4.3 / dmake mingw-w64.sf's 64-bit x86_64-w64-mingw32-gcc-4.4.3 / dmake 64-bit MicrosoftPlatform SDK for Windows Server 2003 R2 / dmake (uses win32/makefile.mk) 64-bit MicrosoftPlatform SDK for Windows Server 2003 R2 / nmake (uses win32/Makefile) Not all of those builds pass all tests - but where the removal of the patches still permits perl to build, the same tests still fail. That is, *nothing* is lost by including these patches - but there are significant gains. Each of the above builds was done according to the normal win32 configuration parameters - ie multi-threaded, non debug. No unusual config settings were applied. (I did build one debug perl on Vista using mingw-w64.sf's 32-bit gcc-4.4.3 and it built fine.) Please feel free to apply these patches (with or without modification) - and, yes, you're more than welcome to blame me if they cause any breakages ;-) Of course, some of those compilers (Borland, Microsoft, and the compilers from mingw.org) already build perl *without* having to apply any patches. It's just the other compilers that need the patches. The purpose of testing with Borland, Microsoft, and the mingw.org compilers is just to check that these patches don't break them. As a final check, I've done a build on my aging linux (mandrake-9.1) box, gcc-3.2.2. I built with '-des -Duselongdouble -Duse64bitint -Dusedevel'. No problem with that, either. If there's additional testing requirements please let me know, and I'll try to oblige. I believe the patch applied successfully for me - see below my sig for the output. Cheers, Rob Rob@desktop2 ~/GIT/blead $ patch -p0 <blead_diff.diff patching file dist/threads/threads.xs patching file handy.h patching file cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Win32.pm patching file op.c Hunk #1 succeeded at 5774 (offset 47 lines). patching file pp_pack.c patching file util.c Hunk #1 succeeded at 5366 (offset -28 lines). patching file win32/makefile.mk patching file win32/perlhost.h patching file win32/win32.c patching file win32/win32.h patching file README.win32 patching file XSUB.h
* Revert "add CLONEf_KEEP_PTR_TABLE to win fork emulation."David Mitchell2009-08-051-2/+1
| | | | | | This reverts commit 240bfeb992996de28603a7f9e3ee34ecc6e3f286. (its now fixed in a better way in 136e7e597c0d85149921561591710bc54123b221)
* add CLONEf_KEEP_PTR_TABLE to win fork emulation.David Mitchell2009-08-051-1/+2
| | | | | | | | | This keeps the ptr-table table around after the thread has been created. This has been on for user threads for a while now, but not for Windows forks. Turns out that Variable::Magic relies on the table still being there, so crashes under windows forks. This increases memory usage per fork, but stops things crashing. Sigh. [perl #66158]
* win32/perlhost.h: use symbolic constantDavid Mitchell2009-08-051-1/+2
| | | | CLONEf_COPY_STACKS rather than 1
* Add a parameter to win32_get_{priv,site,vendor}lib(), to return the length,Nicholas Clark2009-02-201-9/+11
| | | | | as we already know it, and use it in S_init_perllib() to save a strlen() in S_incpush_use_sep().
* Silence Borland compiler warnings (except for warnings from zlib) here:Steve Hay2008-02-251-3/+3
| | | | | http://www.nntp.perl.org/group/perl.daily-build.reports/2008/02/msg53937.html p4raw-id: //depot/perl@33370
* Eliminate use of Nullop in the core code. Dual life uses remain.Nicholas Clark2008-02-101-2/+2
| | | p4raw-id: //depot/perl@33269
* Nullch and others were still alive and well in some of the operatingSteve Peters2007-12-231-2/+2
| | | | | | system specific directories. I think I've chainsawed all of them now, but I can't guarantee that it compiles anywhere from win32. p4raw-id: //depot/perl@32713
* Change #31426 should also be applied to the PERL_IMPLICIT_SYSSteve Hay2007-06-201-1/+8
| | | | | version of ioctl() p4raw-id: //depot/perl@31428
* [PATCH] Use short pathnames in $^X and @INC if the long form cannot be ↵Jan Dubois2007-01-031-35/+2
| | | | | | | | | | | | | represented in the current codepage Date: Thu, 28 Dec 2006 18:59:40 -0800 Message-ID: <vq09p2p09k6rcu6c9t0mab3vnc335ghg9m@4ax.com> Subject: Re: [PATCH] Use short pathnames in $^X and @INC if the long form cannot be represented in the current codepage From: Jan Dubois <jand@ActiveState.com> Date: Wed, 03 Jan 2007 08:12:35 -0800 Message-ID: <orknp2pj17265modfosjkp2qtt4bdgtgjp@4ax.com> p4raw-id: //depot/perl@29675
* Implement killpg() for MSWin32Jan Dubois2006-12-211-3/+1
| | | | | Message-ID: <m8hjo2pasv3hdbhd1sj9sasen7tm38hrhp@4ax.com> p4raw-id: //depot/perl@29605
* Update cwd() to return the "short" pathname if the long one doesn't fit the ↵Jan Dubois2006-12-201-9/+45
| | | | | | | codepage Message-ID: <3rteo219or8hqr511e4vg1fnsgvgemb4sh@4ax.com> p4raw-id: //depot/perl@29598
* Merge WinCE and Win32 directories -- Initial patchYves Orton2006-04-281-0/+12
| | | | | Message-ID: <9b18b3110604271430k4de84685jec6535ded195ed94@mail.gmail.com> p4raw-id: //depot/perl@28003
* Make Borland and MinGW happy with change 26379Steve Hay2006-01-041-1/+1
| | | | | | (They both complain "invalid conversion from `void*' to `HWND__*'" otherwise) p4raw-id: //depot/perl@26637
* RE: PeekMessage() call in win32\win32.c win32_async_checkJan Dubois2005-12-161-0/+12
| | | | | | | Message-ID: <015901c60207$abd64210$d563a8c0@candy> (Without the proposed alarm.t test) p4raw-id: //depot/perl@26379
* Remove unused USING_WIDE code from win32 and wince branchesJan Dubois2005-11-081-7/+1
| | | | | | From: "Jan Dubois" <jand@ActiveState.com> Message-ID: <078001c5e41e$585c4140$6401a8c0@candy> p4raw-id: //depot/perl@26041
* Make PerlLIOUtime()'s filename constSteve Hay2005-11-011-1/+1
| | | | | | | | | Fixes a warning brought about by change #25941 (which made the filename argument const). The various implementations of PerlLIOUtime() (in NetWare/, win32/ and wince/) already take a const filename. p4raw-link: @25941 on //depot/perl: e96b369dc61077fe31b75895167f55dbce4d7519 p4raw-id: //depot/perl@25945
* Win32 fix for change #25850. I don't know if this define will everSteve Peters2005-10-271-0/+2
| | | | | | be used on Win32, but it does fix the problem at hand. p4raw-link: @25850 on //depot/perl: ca0c25f67f45e5dccb746852d8545d7ae29ed067 p4raw-id: //depot/perl@25859
* Re: $^CHILD_ERROR_NATIVE issues (with attachment)Gisle Aas2005-10-041-1/+1
| | | | | Message-ID: <lrd5ml7i8s.fsf@caliper.activestate.com> p4raw-id: //depot/perl@25688
* Re: janitorial work ? [patch]Jim Cromie2005-07-081-2/+2
| | | | | | | | Message-ID: <42CC3CE9.5050606@divsol.com> (reverted all dual-lived modules since they must work with older perls too so must wait for a new Devel::PPPort) p4raw-id: //depot/perl@25101
* Make opendir() filename const in Win32-land & friendsSteve Hay2005-06-241-1/+1
| | | | | | | | That fact that it wasn't const already was highlighted by a warning from pp_open_dir() generated by change 24743. Rather than undo the const change in pp_open_dir(), this seems to make more sense. Hope I haven't broken Netware or WinCE. p4raw-id: //depot/perl@24974
* windows: fix memory leak in %ENV handling (shows up as aGurusamy Sarathy2003-06-091-12/+20
| | | | | | leak even in the simplest fork() loop, because perl_construct() now does the equivalent of %ENV assignments using mg_set()) p4raw-id: //depot/perl@19717
* Use PL_{argv,stdin,stdout}gv to avoid unnecessary gv_fetch calls.Chip Salzenberg2003-02-241-3/+3
| | | p4raw-id: //depot/perl@18763