Merge pull request #1991 from esdrubal/seq_test_fix
[mono.git] / mono / metadata / process.c
index ad42828aee8ff493b5648ddc1de52d035a0e4eea..d547e867fe6751c94ee5e48f5fd32790b4967f36 100644 (file)
@@ -20,6 +20,7 @@
 #include <mono/metadata/image.h>
 #include <mono/metadata/cil-coff.h>
 #include <mono/metadata/exception.h>
+#include <mono/metadata/threadpool-ms-io.h>
 #include <mono/utils/strenc.h>
 #include <mono/utils/mono-proclib.h>
 #include <mono/io-layer/io-layer.h>
@@ -53,11 +54,11 @@ ves_icall_System_Diagnostics_Process_GetPid_internal (void)
        return mono_process_current_pid ();
 }
 
-void ves_icall_System_Diagnostics_Process_Process_free_internal (MonoObject *this,
+void ves_icall_System_Diagnostics_Process_Process_free_internal (MonoObject *this_obj,
                                                                 HANDLE process)
 {
 #ifdef THREAD_DEBUG
-       g_message ("%s: Closing process %p, handle %p", __func__, this, process);
+       g_message ("%s: Closing process %p, handle %p", __func__, this_obj, process);
 #endif
 
 #if defined(TARGET_WIN32) || defined(HOST_WIN32)
@@ -67,9 +68,9 @@ void ves_icall_System_Diagnostics_Process_Process_free_internal (MonoObject *thi
 #endif
 }
 
-#define STASH_SYS_ASS(this) \
+#define STASH_SYS_ASS(this_obj) \
        if(system_assembly == NULL) { \
-               system_assembly=this->vtable->klass->image; \
+               system_assembly=this_obj->vtable->klass->image; \
        }
 
 static MonoImage *system_assembly=NULL;
@@ -469,7 +470,7 @@ static GPtrArray* get_domain_assemblies (MonoDomain *domain)
 }
 
 /* Returns an array of System.Diagnostics.ProcessModule */
-MonoArray *ves_icall_System_Diagnostics_Process_GetModules_internal (MonoObject *this, HANDLE process)
+MonoArray *ves_icall_System_Diagnostics_Process_GetModules_internal (MonoObject *this_obj, HANDLE process)
 {
        MonoArray *temp_arr = NULL;
        MonoArray *arr;
@@ -488,7 +489,7 @@ MonoArray *ves_icall_System_Diagnostics_Process_GetModules_internal (MonoObject
                current_process = ves_icall_System_Diagnostics_Process_GetProcess_internal (pid);
        }
 
-       STASH_SYS_ASS (this);
+       STASH_SYS_ASS (this_obj);
 
        if (process == current_process) {
                assemblies = get_domain_assemblies (mono_domain_get ());
@@ -546,12 +547,12 @@ MonoArray *ves_icall_System_Diagnostics_Process_GetModules_internal (MonoObject
        return arr;
 }
 
-void ves_icall_System_Diagnostics_FileVersionInfo_GetVersionInfo_internal (MonoObject *this, MonoString *filename)
+void ves_icall_System_Diagnostics_FileVersionInfo_GetVersionInfo_internal (MonoObject *this_obj, MonoString *filename)
 {
-       STASH_SYS_ASS (this);
+       STASH_SYS_ASS (this_obj);
        
-       process_get_fileversion (this, mono_string_chars (filename));
-       process_set_field_string (this, "filename",
+       process_get_fileversion (this_obj, mono_string_chars (filename));
+       process_set_field_string (this_obj, "filename",
                                  mono_string_chars (filename),
                                  mono_string_length (filename));
 }
@@ -662,10 +663,7 @@ MonoBoolean ves_icall_System_Diagnostics_Process_ShellExecuteEx_internal (MonoPr
        } else {
                process_info->process_handle = shellex.hProcess;
                process_info->thread_handle = NULL;
-               /* It appears that there's no way to get the pid from a
-                * process handle before windows xp.  Really.
-                */
-#if defined(HAVE_GETPROCESSID) && !defined(MONO_CROSS_COMPILE)
+#if !defined(MONO_CROSS_COMPILE)
                process_info->pid = GetProcessId (shellex.hProcess);
 #else
                process_info->pid = 0;
@@ -802,18 +800,18 @@ MonoBoolean ves_icall_System_Diagnostics_Process_CreateProcess_internal (MonoPro
        return(ret);
 }
 
-MonoBoolean ves_icall_System_Diagnostics_Process_WaitForExit_internal (MonoObject *this, HANDLE process, gint32 ms)
+MonoBoolean ves_icall_System_Diagnostics_Process_WaitForExit_internal (MonoObject *this_obj, HANDLE process, gint32 ms)
 {
        guint32 ret;
        
-       MONO_PREPARE_BLOCKING
+       MONO_PREPARE_BLOCKING;
        if(ms<0) {
                /* Wait forever */
                ret=WaitForSingleObjectEx (process, INFINITE, TRUE);
        } else {
                ret=WaitForSingleObjectEx (process, ms, TRUE);
        }
-       MONO_FINISH_BLOCKING
+       MONO_FINISH_BLOCKING;
 
        if(ret==WAIT_OBJECT_0) {
                return(TRUE);
@@ -822,7 +820,7 @@ MonoBoolean ves_icall_System_Diagnostics_Process_WaitForExit_internal (MonoObjec
        }
 }
 
-MonoBoolean ves_icall_System_Diagnostics_Process_WaitForInputIdle_internal (MonoObject *this, HANDLE process, gint32 ms)
+MonoBoolean ves_icall_System_Diagnostics_Process_WaitForInputIdle_internal (MonoObject *this_obj, HANDLE process, gint32 ms)
 {
        guint32 ret;
        
@@ -1076,3 +1074,9 @@ ves_icall_System_Diagnostics_Process_GetProcessData (int pid, gint32 data_type,
        return res;
 }
 
+void
+ves_icall_System_Diagnostics_Process_ProcessAsyncReader_RemoveFromIOThreadPool (HANDLE handle)
+{
+       mono_threadpool_ms_io_remove_socket (GPOINTER_TO_INT (handle));
+}
+