typedef unsigned long (*LPEnvOsID)(struct IPerlEnv*);
typedef char* (*LPEnvLibPath)(struct IPerlEnv*, char*);
typedef char* (*LPEnvSiteLibPath)(struct IPerlEnv*, char*);
+typedef void (*LPEnvGetChildIO)(struct IPerlEnv*, child_IO_table*);
#endif
struct IPerlEnv
LPEnvOsID pEnvOsID;
LPEnvLibPath pLibPath;
LPEnvSiteLibPath pSiteLibPath;
+ LPEnvGetChildIO pGetChildIO;
#endif
};
(*PL_Env->pLibPath)(PL_Env,(str))
#define PerlEnv_sitelib_path(str) \
(*PL_Env->pSiteLibPath)(PL_Env,(str))
+#define PerlEnv_get_child_IO(ptr) \
+ (*PL_Env->pGetChildIO)(PL_Env, ptr)
#endif
#else /* PERL_IMPLICIT_SYS */
#ifdef WIN32
#define PerlEnv_os_id() win32_os_id()
+#define PerlEnv_get_child_IO(ptr) win32_get_child_IO(ptr)
#endif
#endif /* PERL_IMPLICIT_SYS */
return -1;
}
- EnterCriticalSection(&(_pioinfo(fh)->lock)); /* lock file */
+ /*
+ * If lockinitflag is FALSE, assume fd is device
+ * lockinitflag is set to TRUE by open.
+ */
+ if (_pioinfo(fh)->lockinitflag)
+ EnterCriticalSection(&(_pioinfo(fh)->lock)); /* lock file */
bytes_read = 0; /* nothing read yet */
buffer = (char*)buf;
}
functionexit:
- LeaveCriticalSection(&(_pioinfo(fh)->lock)); /* unlock file */
+ if (_pioinfo(fh)->lockinitflag)
+ LeaveCriticalSection(&(_pioinfo(fh)->lock)); /* unlock file */
return bytes_read;
}
int ret;
void* env;
char* dir;
+ child_IO_table tbl;
STARTUPINFO StartupInfo;
PROCESS_INFORMATION ProcessInformation;
DWORD create = 0;
}
memset(&StartupInfo,0,sizeof(StartupInfo));
StartupInfo.cb = sizeof(StartupInfo);
- StartupInfo.hStdInput = GetStdHandle(STD_INPUT_HANDLE);
- StartupInfo.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE);
- StartupInfo.hStdError = GetStdHandle(STD_ERROR_HANDLE);
+ PerlEnv_get_child_IO(&tbl);
+ StartupInfo.hStdInput = tbl.childStdIn;
+ StartupInfo.hStdOutput = tbl.childStdOut;
+ StartupInfo.hStdError = tbl.childStdErr;
if (StartupInfo.hStdInput != INVALID_HANDLE_VALUE &&
StartupInfo.hStdOutput != INVALID_HANDLE_VALUE &&
StartupInfo.hStdError != INVALID_HANDLE_VALUE)
MALLOC_INIT;
}
+void
+win32_get_child_IO(child_IO_table* ptbl)
+{
+ ptbl->childStdIn = GetStdHandle(STD_INPUT_HANDLE);
+ ptbl->childStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
+ ptbl->childStdErr = GetStdHandle(STD_ERROR_HANDLE);
+}
+
+
#ifdef USE_ITHREADS
# ifdef PERL_OBJECT
DllExport bool SetPerlInterpreter(void* interp);
DllExport void* GetPerlInterpreter(void);
+typedef struct {
+ HANDLE childStdIn;
+ HANDLE childStdOut;
+ HANDLE childStdErr;
+} child_IO_table;
+
+DllExport void win32_get_child_IO(child_IO_table* ptr);
+
#ifndef USE_SOCKETS_AS_HANDLES
extern FILE * my_fdopen(int, char *);
#endif