[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] CVS: pnet/engine lib_task.c,1.8,1.9
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] CVS: pnet/engine lib_task.c,1.8,1.9 |
Date: |
Sun, 20 Jul 2003 23:50:38 -0400 |
Update of /cvsroot/dotgnu-pnet/pnet/engine
In directory subversions:/tmp/cvs-serv17416/engine
Modified Files:
lib_task.c
Log Message:
Create Win32 pipes using the file descriptor functions, to be consistent
with the routines in "file.c".
Index: lib_task.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/lib_task.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** lib_task.c 21 Jul 2003 03:20:33 -0000 1.8
--- lib_task.c 21 Jul 2003 03:50:35 -0000 1.9
***************
*** 26,29 ****
--- 26,34 ----
#ifdef IL_WIN32_PLATFORM
#include <windows.h>
+ #include <io.h>
+ #include <fcntl.h>
+ #ifdef IL_WIN32_CYGWIN
+ #include <unistd.h>
+ #endif
#else
#ifdef HAVE_SYS_TYPES_H
***************
*** 433,436 ****
--- 438,449 ----
#ifdef IL_WIN32_PLATFORM
+ #ifdef IL_WIN32_CYGWIN
+ #define GET_OSF(fd) ((HANDLE)(get_osfhandle((fd))))
+ #define MAKE_PIPE(fds) (pipe((fds)))
+ #else
+ #define GET_OSF(fd) ((HANDLE)(_get_osfhandle((fd))))
+ #define MAKE_PIPE(fds) (_pipe((fds), 0, _O_BINARY))
+ #endif
+
const char *fname;
char *args;
***************
*** 439,446 ****
char *env = 0;
ILBool result;
! HANDLE readSide, writeSide;
! HANDLE cleanups[8];
int numCleanups = 0;
! HANDLE closeAfterFork[8];
int numCloseAfterFork = 0;
int index;
--- 452,459 ----
char *env = 0;
ILBool result;
! int pipefds[2];
! int cleanups[8];
int numCleanups = 0;
! int closeAfterFork[8];
int numCloseAfterFork = 0;
int index;
***************
*** 473,518 ****
if((flags & ProcessStart_RedirectStdin) != 0)
{
! CreatePipe(&readSide, &writeSide, NULL, 0);
! *stdinHandle = (ILNativeInt)writeSide;
! SetHandleInformation(readSide, HANDLE_FLAG_INHERIT,
!
HANDLE_FLAG_INHERIT);
! startupInfo.hStdInput = readSide;
! cleanups[numCleanups++] = readSide;
! cleanups[numCleanups++] = writeSide;
! closeAfterFork[numCloseAfterFork++] = readSide;
}
else
{
! startupInfo.hStdInput = GetStdHandle(STD_INPUT_HANDLE);
}
if((flags & ProcessStart_RedirectStdout) != 0)
{
! CreatePipe(&readSide, &writeSide, NULL, 0);
! *stdoutHandle = (ILNativeInt)readSide;
! SetHandleInformation(writeSide, HANDLE_FLAG_INHERIT,
!
HANDLE_FLAG_INHERIT);
! startupInfo.hStdOutput = writeSide;
! cleanups[numCleanups++] = readSide;
! cleanups[numCleanups++] = writeSide;
! closeAfterFork[numCloseAfterFork++] = writeSide;
}
else
{
! startupInfo.hStdOutput =
GetStdHandle(STD_OUTPUT_HANDLE);
}
if((flags & ProcessStart_RedirectStderr) != 0)
{
! CreatePipe(&readSide, &writeSide, NULL, 0);
! *stderrHandle = (ILNativeInt)readSide;
! SetHandleInformation(writeSide, HANDLE_FLAG_INHERIT,
!
HANDLE_FLAG_INHERIT);
! startupInfo.hStdError = writeSide;
! cleanups[numCleanups++] = readSide;
! cleanups[numCleanups++] = writeSide;
! closeAfterFork[numCloseAfterFork++] = writeSide;
}
else
{
! startupInfo.hStdError = GetStdHandle(STD_ERROR_HANDLE);
}
}
--- 486,531 ----
if((flags & ProcessStart_RedirectStdin) != 0)
{
! MAKE_PIPE(pipefds);
! *stdinHandle = (ILNativeInt)(pipefds[1]);
! SetHandleInformation(GET_OSF(pipefds[1]),
!
HANDLE_FLAG_INHERIT, 0);
! startupInfo.hStdInput = GET_OSF(pipefds[0]);
! cleanups[numCleanups++] = pipefds[0];
! cleanups[numCleanups++] = pipefds[1];
! closeAfterFork[numCloseAfterFork++] = pipefds[0];
}
else
{
! startupInfo.hStdInput = GET_OSF(0);
}
if((flags & ProcessStart_RedirectStdout) != 0)
{
! MAKE_PIPE(pipefds);
! *stdoutHandle = (ILNativeInt)(pipefds[0]);
! SetHandleInformation(GET_OSF(pipefds[0]),
!
HANDLE_FLAG_INHERIT, 0);
! startupInfo.hStdOutput = GET_OSF(pipefds[1]);
! cleanups[numCleanups++] = pipefds[0];
! cleanups[numCleanups++] = pipefds[1];
! closeAfterFork[numCloseAfterFork++] = pipefds[1];
}
else
{
! startupInfo.hStdOutput = GET_OSF(1);
}
if((flags & ProcessStart_RedirectStderr) != 0)
{
! MAKE_PIPE(pipefds);
! *stderrHandle = (ILNativeInt)(pipefds[0]);
! SetHandleInformation(GET_OSF(pipefds[0]),
!
HANDLE_FLAG_INHERIT, 0);
! startupInfo.hStdError = GET_OSF(pipefds[1]);
! cleanups[numCleanups++] = pipefds[0];
! cleanups[numCleanups++] = pipefds[1];
! closeAfterFork[numCloseAfterFork++] = pipefds[1];
}
else
{
! startupInfo.hStdError = GET_OSF(2);
}
}
***************
*** 541,545 ****
for(index = 0; index < numCloseAfterFork; ++index)
{
! CloseHandle(closeAfterFork[index]);
}
}
--- 554,558 ----
for(index = 0; index < numCloseAfterFork; ++index)
{
! close(closeAfterFork[index]);
}
}
***************
*** 548,552 ****
for(index = 0; index < numCleanups; ++index)
{
! CloseHandle(cleanups[index]);
}
}
--- 561,565 ----
for(index = 0; index < numCleanups; ++index)
{
! close(cleanups[index]);
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] CVS: pnet/engine lib_task.c,1.8,1.9,
Rhys Weatherley <address@hidden> <=
- Prev by Date:
[Dotgnu-pnet-commits] CVS: pnet ChangeLog,1.2587,1.2588
- Next by Date:
[Dotgnu-pnet-commits] CVS: pnet/engine cvmc_setup.c, 1.34, 1.35 ilrun.c, 1.37, 1.38
- Previous by thread:
[Dotgnu-pnet-commits] CVS: pnet ChangeLog,1.2587,1.2588
- Next by thread:
[Dotgnu-pnet-commits] CVS: pnet/engine cvmc_setup.c, 1.34, 1.35 ilrun.c, 1.37, 1.38
- Index(es):