[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[dotgnu-pnet-commits] pnet ChangeLog cscc/common/cc_main.c support/sp...
From: |
Gopal.V |
Subject: |
[dotgnu-pnet-commits] pnet ChangeLog cscc/common/cc_main.c support/sp... |
Date: |
Tue, 22 Aug 2006 18:15:41 +0000 |
CVSROOT: /cvsroot/dotgnu-pnet
Module name: pnet
Changes by: Gopal.V <t3rmin4t0r> 06/08/22 18:15:41
Modified files:
. : ChangeLog
cscc/common : cc_main.c
support : spawn.c
Log message:
patch #5321 - mingw patches and ILSpawnProcessWaitForExit for windows
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pnet/ChangeLog?cvsroot=dotgnu-pnet&r1=1.3351&r2=1.3352
http://cvs.savannah.gnu.org/viewcvs/pnet/cscc/common/cc_main.c?cvsroot=dotgnu-pnet&r1=1.34&r2=1.35
http://cvs.savannah.gnu.org/viewcvs/pnet/support/spawn.c?cvsroot=dotgnu-pnet&r1=1.10&r2=1.11
Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/ChangeLog,v
retrieving revision 1.3351
retrieving revision 1.3352
diff -u -b -r1.3351 -r1.3352
--- ChangeLog 21 Aug 2006 20:43:23 -0000 1.3351
+++ ChangeLog 22 Aug 2006 18:15:41 -0000 1.3352
@@ -1,3 +1,10 @@
+
+2006-08-22 Yan Burman <address@hidden>
+
+ * support/spawn.c, cscc/common/cc_main.c: Uses windows "posix" stuff
+ to spawn new process after redirecting its output through a pipe.
+ (patch #5321, Gopal)
+
2006-08-20 Radek Polak <address@hidden>
* engine/debugger.h: expose IsMethodImageWatched() so that coder
@@ -23,7 +30,7 @@
* csant/csant_cscc.c: Change csant to emit csc-style flags in several
cases for mcs. (patch #4720, Klaus)
-2006-02-23 Gopal V <address@hidden>
+2006-08-01 Gopal V <address@hidden>
* engine/debugger.c: Fix debugger build on amd64 (IL_BEST_ALIGNMENT)
for cvm.h.
Index: cscc/common/cc_main.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/common/cc_main.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -b -r1.34 -r1.35
--- cscc/common/cc_main.c 7 Jul 2004 23:47:37 -0000 1.34
+++ cscc/common/cc_main.c 22 Aug 2006 18:15:41 -0000 1.35
@@ -46,6 +46,15 @@
#endif
#include <signal.h>
+#ifdef _WIN32
+#include <process.h>
+#include <io.h>
+#include <fcntl.h>
+#ifndef P_NOWAIT
+#define P_NOWAIT _P_NOWAIT
+#endif
+#endif
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -780,7 +789,70 @@
return file;
}
+#elif defined _WIN32
+ int pipefds[2];
+ FILE *file;
+ int orig_stdout;
+
+ /* Report the command line if verbose mode is enabled */
+ if(verbose_mode == VERBOSE_CMDLINES)
+ {
+ int posn;
+ for(posn = 0; argv[posn] != 0; ++posn)
+ {
+ if(posn != 0)
+ {
+ putc(' ', stderr);
+ }
+ fputs(argv[posn], stderr);
+ }
+ putc('\n', stderr);
+ }
+
+ /* Create a pipe to use to communicate with the child */
+ if(_pipe(pipefds, 512, O_NOINHERIT) < 0)
+ {
+ perror("_pipe");
+ return 0;
+ }
+
+ /* Duplicate the originale stdout descriptor */
+ orig_stdout = _dup(_fileno(stdout));
+
+ /* Duplicate write end of pipe to to stdout */
+ if (_dup2(pipefds[1], _fileno(stdout)))
+ {
+ perror("_dup2");
+ return 0;
+ }
+
+ /* Close original write end of pipe */
+ _close(pipefds[1]);
+
+
+ *pid = _spawnvp(P_NOWAIT, argv[0],
+ (const char* const*)argv);
+
+ /* Duplicate original stdout back */
+ if (_dup2(orig_stdout, _fileno(stdout)))
+ {
+ perror("_dup2");
+ return 0;
+ }
+
+ /* Close the duplicate stdout */
+ _close(orig_stdout);
+
+ file = _fdopen(pipefds[0], "r");
+ if (!file)
+ {
+ perror("_fdopen");
+ return 0;
+ }
+
+ return file;
#else
+
fputs("Don't know how to spawn child processes on this system\n",
stderr);
return 0;
#endif
@@ -813,6 +885,16 @@
{
return 0;
}
+#elif defined _WIN32
+ int status = 1;
+ fclose(file);
+ if (_cwait(NULL, pid, _WAIT_CHILD) == -1)
+ {
+ perror("_cwait");
+ return 0;
+ }
+
+ return (status == 0);
#else
return 0;
#endif
Index: support/spawn.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/support/spawn.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- support/spawn.c 21 Nov 2005 06:19:19 -0000 1.10
+++ support/spawn.c 22 Aug 2006 18:15:41 -0000 1.11
@@ -217,8 +217,13 @@
int ILSpawnProcessWaitForExit(int pid, char *argv[])
{
- /* Not supported */
- return 1;
+ int status = 1;
+ if (_cwait(&status, pid, _WAIT_CHILD) == -1)
+ {
+ return 0;
+ }
+
+ return (status == 0);
}
#else
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [dotgnu-pnet-commits] pnet ChangeLog cscc/common/cc_main.c support/sp...,
Gopal.V <=