summaryrefslogtreecommitdiff
path: root/win32/win32.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2001-10-26 13:03:01 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2001-10-26 13:03:01 +0000
commitdf3728a2a53a64c63edf08a4429a7a57b76ca4aa (patch)
tree41cb3c77a25414e4bf6259507dfbadcbc2ea463d /win32/win32.c
parent9ece3ee6650e9c2f6d5131c19ae5e80f2a8bfc4a (diff)
downloadperl-df3728a2a53a64c63edf08a4429a7a57b76ca4aa.tar.gz
Integrate maintperl changes #12268 and #12669;
final touches to the audit for statics and thread-unsafe code * make DB_File, ODBM_File thread-safe * remove unnecessary/dangerous statics and protect others from not getting accidentally enabled under threaded perls windows support functions get_childdir() et al aren't exported correctly under vanilla build Testing under win32 appreciated since changes there had to be manually merged and I cannot test how badly did I do. p4raw-link: @12268 on //depot/perlio: bb407f0b8769c638c05e60ebfd157a1e676a6c22 p4raw-id: //depot/perl@12678 p4raw-integrated: from //depot/maint-5.6/perl@12677 'copy in' win32/vmem.h (@5902..) 'merge in' ext/DB_File/DB_File.xs (@8693..) win32/win32iop.h (@8917..) ext/ODBM_File/ODBM_File.xs (@8995..) iperlsys.h (@9154..) scope.c (@9584..) makedef.pl (@11425..) gv.c (@12026..) op.c (@12145..) util.c (@12220..) toke.c (@12550..) ext/B/B.xs ext/File/Glob/Glob.xs ext/Opcode/Opcode.xs ext/re/re.xs (@12653..) mg.c win32/win32.c (@12668..)
Diffstat (limited to 'win32/win32.c')
-rw-r--r--win32/win32.c54
1 files changed, 40 insertions, 14 deletions
diff --git a/win32/win32.c b/win32/win32.c
index 69b7264404..115a66cac7 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -1824,6 +1824,8 @@ FAILED:
return -1;
}
+#ifndef PERL_IMPLICIT_CONTEXT
+
static UINT timerid = 0;
static VOID CALLBACK TimerProc(HWND win, UINT msg, UINT id, DWORD time)
@@ -1834,9 +1836,12 @@ static VOID CALLBACK TimerProc(HWND win, UINT msg, UINT id, DWORD time)
CALL_FPTR(PL_sighandlerp)(14);
}
+#endif /* !PERL_IMPLICIT_CONTEXT */
+
DllExport unsigned int
win32_alarm(unsigned int sec)
{
+#ifndef PERL_IMPLICIT_CONTEXT
/*
* the 'obvious' implentation is SetTimer() with a callback
* which does whatever receiving SIGALRM would do
@@ -1862,6 +1867,7 @@ win32_alarm(unsigned int sec)
}
}
return 0;
+#endif /* !PERL_IMPLICIT_CONTEXT */
}
#ifdef HAVE_DES_FCRYPT
@@ -3271,19 +3277,39 @@ GIVE_UP:
* environment and the current directory to CreateProcess
*/
-void*
-get_childenv(void)
+DllExport void*
+win32_get_childenv(void)
{
return NULL;
}
-void
-free_childenv(void* d)
+DllExport void
+win32_free_childenv(void* d)
{
}
-char*
-get_childdir(void)
+DllExport void
+win32_clearenv(void)
+{
+ char *envv = GetEnvironmentStrings();
+ char *cur = envv;
+ STRLEN len;
+ while (*cur) {
+ char *end = strchr(cur,'=');
+ if (end && end != cur) {
+ *end = '\0';
+ SetEnvironmentVariable(cur, NULL);
+ *end = '=';
+ cur = end + strlen(end+1)+2;
+ }
+ else if ((len = strlen(cur)))
+ cur += len+1;
+ }
+ FreeEnvironmentStrings(envv);
+}
+
+DllExport char*
+win32_get_childdir(void)
{
dTHX;
char* ptr;
@@ -3302,8 +3328,8 @@ get_childdir(void)
return ptr;
}
-void
-free_childdir(char* d)
+DllExport void
+win32_free_childdir(char* d)
{
dTHX;
Safefree(d);
@@ -3556,12 +3582,12 @@ win32_putchar(int c)
#ifndef USE_PERL_SBRK
-static char *committed = NULL;
-static char *base = NULL;
-static char *reserved = NULL;
-static char *brk = NULL;
-static DWORD pagesize = 0;
-static DWORD allocsize = 0;
+static char *committed = NULL; /* XXX threadead */
+static char *base = NULL; /* XXX threadead */
+static char *reserved = NULL; /* XXX threadead */
+static char *brk = NULL; /* XXX threadead */
+static DWORD pagesize = 0; /* XXX threadead */
+static DWORD allocsize = 0; /* XXX threadead */
void *
sbrk(int need)