extern char * g_win32_get_sitelib(const char *pl);
extern char * g_win32_get_vendorlib(const char *pl);
extern char * g_getlogin(void);
-extern int do_spawn2(char *cmd, int exectype);
END_EXTERN_C
class CPerlHost
}
int
-PerlLIOChsize(struct IPerlLIO* piPerl, int handle, long size)
+PerlLIOChsize(struct IPerlLIO* piPerl, int handle, Off_t size)
{
- return chsize(handle, size);
+ return win32_chsize(handle, size);
}
int
}
DIR*
-PerlDirOpen(struct IPerlDir* piPerl, char *filename)
+PerlDirOpen(struct IPerlDir* piPerl, const char *filename)
{
return win32_opendir(filename);
}
PL_curstash = PL_defstash;
if (PL_endav && !PL_minus_c)
call_list(oldscope, PL_endav);
- status = STATUS_NATIVE_EXPORT;
+ status = STATUS_EXIT;
break;
case 3:
if (PL_restartop) {
win32_checkTLS(my_perl);
/* close the std handles to avoid fd leaks */
{
- do_close(gv_fetchpv("STDIN", TRUE, SVt_PVIO), FALSE);
- do_close(gv_fetchpv("STDOUT", TRUE, SVt_PVIO), FALSE);
- do_close(gv_fetchpv("STDERR", TRUE, SVt_PVIO), FALSE);
+ do_close(PL_stdingv, FALSE);
+ do_close(gv_fetchpv("STDOUT", TRUE, SVt_PVIO), FALSE); /* PL_stdoutgv - ISAGN */
+ do_close(PL_stderrgv, FALSE);
}
/* destroy everything (waits for any pseudo-forked children) */
win32_str_os_error(sv, dwErr);
}
-BOOL
-PerlProcDoCmd(struct IPerlProc* piPerl, char *cmd)
-{
- do_spawn2(cmd, EXECF_EXEC);
- return FALSE;
-}
-
-int
-PerlProcSpawn(struct IPerlProc* piPerl, char* cmds)
-{
- return do_spawn2(cmds, EXECF_SPAWN);
-}
-
int
PerlProcSpawnvp(struct IPerlProc* piPerl, int mode, const char *cmdname, const char *const *argv)
{
}
int
-PerlProcASpawn(struct IPerlProc* piPerl, void *vreally, void **vmark, void **vsp)
-{
- return do_aspawn(vreally, vmark, vsp);
-}
-
-int
PerlProcLastHost(struct IPerlProc* piPerl)
{
dTHX;
PerlProcGetpid,
PerlProcDynaLoader,
PerlProcGetOSError,
- PerlProcDoCmd,
- PerlProcSpawn,
PerlProcSpawnvp,
- PerlProcASpawn,
PerlProcLastHost,
PerlProcPopenList,
PerlProcGetTimeOfDay
CPerlHost::~CPerlHost(void)
{
-// Reset();
+ Reset();
InterlockedDecrement(&num_hosts);
delete m_pvDir;
m_pVMemParse->Release();
LPSTR*
CPerlHost::Lookup(LPCSTR lpStr)
{
+ if (!lpStr)
+ return NULL;
return (LPSTR*)bsearch(&lpStr, m_lppEnvList, m_dwEnvCount, sizeof(LPSTR), lookup);
}
// replacing ?
lpPtr = Lookup(szBuffer);
- if(lpPtr != NULL) {
- Renew(*lpPtr, length, char);
+ if (lpPtr != NULL) {
+ // must allocate things via host memory allocation functions
+ // rather than perl's Renew() et al, as the perl interpreter
+ // may either not be initialized enough when we allocate these,
+ // or may already be dead when we go to free these
+ *lpPtr = (char*)Realloc(*lpPtr, length * sizeof(char));
strcpy(*lpPtr, lpStr);
}
else {
- ++m_dwEnvCount;
- Renew(m_lppEnvList, m_dwEnvCount, LPSTR);
- New(1, m_lppEnvList[m_dwEnvCount-1], length, char);
- if(m_lppEnvList[m_dwEnvCount-1] != NULL) {
- strcpy(m_lppEnvList[m_dwEnvCount-1], lpStr);
- qsort(m_lppEnvList, m_dwEnvCount, sizeof(LPSTR), compare);
+ m_lppEnvList = (LPSTR*)Realloc(m_lppEnvList, (m_dwEnvCount+1) * sizeof(LPSTR));
+ if (m_lppEnvList) {
+ m_lppEnvList[m_dwEnvCount] = (char*)Malloc(length * sizeof(char));
+ if (m_lppEnvList[m_dwEnvCount] != NULL) {
+ strcpy(m_lppEnvList[m_dwEnvCount], lpStr);
+ ++m_dwEnvCount;
+ qsort(m_lppEnvList, m_dwEnvCount, sizeof(LPSTR), compare);
+ }
}
- else
- --m_dwEnvCount;
}
}
dTHX;
int length;
char* ptr;
- New(0, ptr, MAX_PATH+1, char);
+ Newx(ptr, MAX_PATH+1, char);
if(ptr) {
m_pvDir->GetCurrentDirectoryA(MAX_PATH+1, ptr);
length = strlen(ptr);
// add the additional space used by changes made to the environment
dwSize += CalculateEnvironmentSpace();
- New(1, lpStr, dwSize, char);
+ Newx(lpStr, dwSize, char);
lpPtr = lpStr;
if(lpStr != NULL) {
// build the local environment
dTHX;
if(m_lppEnvList != NULL) {
for(DWORD index = 0; index < m_dwEnvCount; ++index) {
- Safefree(m_lppEnvList[index]);
+ Free(m_lppEnvList[index]);
m_lppEnvList[index] = NULL;
}
}
m_dwEnvCount = 0;
+ Free(m_lppEnvList);
+ m_lppEnvList = NULL;
}
void