[reflection] Use coop handles for MonoMethod icalls (#4272)
[mono.git] / mono / metadata / file-io.h
index fa98eaa9105a39878974bad2ec5de98c70ecd8e6..b7b7320debbf641c1f9946a9bd3ec2b0e00025a0 100644 (file)
@@ -7,6 +7,7 @@
  *
  * (C) 2001 Ximian, Inc.
  * Copyright 2012 Xamarin Inc (http://www.xamarin.com)
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
  */
 
 #ifndef _MONO_METADATA_FILEIO_H_
@@ -16,7 +17,6 @@
 #include <glib.h>
 
 #include <mono/metadata/object-internals.h>
-#include <mono/io-layer/io-layer.h>
 #include <mono/utils/mono-compiler.h>
 
 G_BEGIN_DECLS
@@ -114,149 +114,164 @@ typedef struct _MonoFSAsyncResult {
 /* System.IO.MonoIO */
 
 extern MonoBoolean
-ves_icall_System_IO_MonoIO_CreateDirectory (MonoString *path, gint32 *error) MONO_INTERNAL;
+ves_icall_System_IO_MonoIO_CreateDirectory (MonoString *path, gint32 *error);
 
 extern MonoBoolean
-ves_icall_System_IO_MonoIO_RemoveDirectory (MonoString *path, gint32 *error) MONO_INTERNAL;
+ves_icall_System_IO_MonoIO_RemoveDirectory (MonoString *path, gint32 *error);
 
 MonoArray *
 ves_icall_System_IO_MonoIO_GetFileSystemEntries (MonoString *path,
                                                 MonoString *path_with_pattern,
                                                 gint mask, gint attrs,
-                                                gint32 *error) MONO_INTERNAL;
+                                                gint32 *error);
+
+extern gpointer
+ves_icall_System_IO_MonoIO_FindFirstFile (MonoString *path_with_pattern,
+                                               MonoString **file_name,
+                                               gint32 *file_attr,
+                                               gint32 *ioerror);
+
+extern MonoBoolean
+ves_icall_System_IO_MonoIO_FindNextFile (gpointer hnd,
+                                               MonoString **file_name,
+                                               gint32 *file_attr,
+                                               gint32 *ioerror);
+
+extern MonoBoolean
+ves_icall_System_IO_MonoIO_FindCloseFile (gpointer hnd);
 
 extern MonoString *
 ves_icall_System_IO_MonoIO_FindFirst (MonoString *path,
                                      MonoString *path_with_pattern,
                                      gint32 *result_mask,
                                      gint32 *error,
-                                     gpointer *handle) MONO_INTERNAL;
+                                     gpointer *handle);
 extern MonoString *
-ves_icall_System_IO_MonoIO_FindNext (gpointer handle, gint32 *result_mask, gint32 *error) MONO_INTERNAL;
+ves_icall_System_IO_MonoIO_FindNext (gpointer handle, gint32 *result_mask, gint32 *error);
 
 extern int
-ves_icall_System_IO_MonoIO_FindClose (gpointer handle) MONO_INTERNAL;
+ves_icall_System_IO_MonoIO_FindClose (gpointer handle);
 
 extern MonoString *
-ves_icall_System_IO_MonoIO_GetCurrentDirectory (gint32 *error) MONO_INTERNAL;
+ves_icall_System_IO_MonoIO_GetCurrentDirectory (gint32 *error);
 
 extern MonoBoolean
 ves_icall_System_IO_MonoIO_SetCurrentDirectory (MonoString *path,
-                                               gint32 *error) MONO_INTERNAL;
+                                               gint32 *error);
 
 extern MonoBoolean
 ves_icall_System_IO_MonoIO_MoveFile (MonoString *path, MonoString *dest,
-                                    gint32 *error) MONO_INTERNAL;
+                                    gint32 *error);
 
 extern MonoBoolean
 ves_icall_System_IO_MonoIO_CopyFile (MonoString *path, MonoString *dest,
-                                    MonoBoolean overwrite, gint32 *error) MONO_INTERNAL;
+                                    MonoBoolean overwrite, gint32 *error);
 
 extern MonoBoolean
-ves_icall_System_IO_MonoIO_DeleteFile (MonoString *path, gint32 *error) MONO_INTERNAL;
+ves_icall_System_IO_MonoIO_DeleteFile (MonoString *path, gint32 *error);
 
 extern gint32 
-ves_icall_System_IO_MonoIO_GetFileAttributes (MonoString *path, gint32 *error) MONO_INTERNAL;
+ves_icall_System_IO_MonoIO_GetFileAttributes (MonoString *path, gint32 *error);
 
 extern MonoBoolean
 ves_icall_System_IO_MonoIO_SetFileAttributes (MonoString *path, gint32 attrs,
-                                             gint32 *error) MONO_INTERNAL;
+                                             gint32 *error);
 
 extern gint32
-ves_icall_System_IO_MonoIO_GetFileType (HANDLE handle, gint32 *error) MONO_INTERNAL;
+ves_icall_System_IO_MonoIO_GetFileType (gpointer handle, gint32 *error);
 
 extern MonoBoolean
 ves_icall_System_IO_MonoIO_GetFileStat (MonoString *path, MonoIOStat *stat,
-                                       gint32 *error) MONO_INTERNAL;
+                                       gint32 *error);
 
-extern HANDLE 
+extern gpointer 
 ves_icall_System_IO_MonoIO_Open (MonoString *filename, gint32 mode,
                                 gint32 access_mode, gint32 share, gint32 options,
-                                gint32 *error) MONO_INTERNAL;
+                                gint32 *error);
 
 extern MonoBoolean
-ves_icall_System_IO_MonoIO_Close (HANDLE handle, gint32 *error) MONO_INTERNAL;
+ves_icall_System_IO_MonoIO_Close (gpointer handle, gint32 *error);
 
 extern gint32 
-ves_icall_System_IO_MonoIO_Read (HANDLE handle, MonoArray *dest,
+ves_icall_System_IO_MonoIO_Read (gpointer handle, MonoArray *dest,
                                 gint32 dest_offset, gint32 count,
-                                gint32 *error) MONO_INTERNAL;
+                                gint32 *error);
 
 extern gint32 
-ves_icall_System_IO_MonoIO_Write (HANDLE handle, MonoArray *src,
+ves_icall_System_IO_MonoIO_Write (gpointer handle, MonoArray *src,
                                  gint32 src_offset, gint32 count,
-                                 gint32 *error) MONO_INTERNAL;
+                                 gint32 *error);
 
 extern gint64 
-ves_icall_System_IO_MonoIO_Seek (HANDLE handle, gint64 offset, gint32 origin,
-                                gint32 *error) MONO_INTERNAL;
+ves_icall_System_IO_MonoIO_Seek (gpointer handle, gint64 offset, gint32 origin,
+                                gint32 *error);
 
 extern MonoBoolean
-ves_icall_System_IO_MonoIO_Flush (HANDLE handle, gint32 *error) MONO_INTERNAL;
+ves_icall_System_IO_MonoIO_Flush (gpointer handle, gint32 *error);
 
 extern gint64 
-ves_icall_System_IO_MonoIO_GetLength (HANDLE handle, gint32 *error) MONO_INTERNAL;
+ves_icall_System_IO_MonoIO_GetLength (gpointer handle, gint32 *error);
 
 extern MonoBoolean
-ves_icall_System_IO_MonoIO_SetLength (HANDLE handle, gint64 length,
-                                     gint32 *error) MONO_INTERNAL;
+ves_icall_System_IO_MonoIO_SetLength (gpointer handle, gint64 length,
+                                     gint32 *error);
 
 extern MonoBoolean
-ves_icall_System_IO_MonoIO_SetFileTime (HANDLE handle, gint64 creation_time,
+ves_icall_System_IO_MonoIO_SetFileTime (gpointer handle, gint64 creation_time,
                                        gint64 last_access_time,
-                                       gint64 last_write_time, gint32 *error) MONO_INTERNAL;
+                                       gint64 last_write_time, gint32 *error);
 
-extern HANDLE 
-ves_icall_System_IO_MonoIO_get_ConsoleOutput (void) MONO_INTERNAL;
+extern gpointer 
+ves_icall_System_IO_MonoIO_get_ConsoleOutput (void);
 
-extern HANDLE 
-ves_icall_System_IO_MonoIO_get_ConsoleInput (void) MONO_INTERNAL;
+extern gpointer 
+ves_icall_System_IO_MonoIO_get_ConsoleInput (void);
 
-extern HANDLE 
-ves_icall_System_IO_MonoIO_get_ConsoleError (void) MONO_INTERNAL;
+extern gpointer 
+ves_icall_System_IO_MonoIO_get_ConsoleError (void);
 
 extern MonoBoolean
-ves_icall_System_IO_MonoIO_CreatePipe (HANDLE *read_handle,
-                                      HANDLE *write_handle) MONO_INTERNAL;
+ves_icall_System_IO_MonoIO_CreatePipe (gpointer *read_handle, gpointer *write_handle, gint32 *error);
 
-extern MonoBoolean ves_icall_System_IO_MonoIO_DuplicateHandle (HANDLE source_process_handle, 
-                                               HANDLE source_handle, HANDLE target_process_handle, HANDLE *target_handle, 
-                                               gint32 access, gint32 inherit, gint32 options) MONO_INTERNAL;
+extern MonoBoolean
+ves_icall_System_IO_MonoIO_DuplicateHandle (gpointer source_process_handle, gpointer source_handle,
+               gpointer target_process_handle, gpointer *target_handle, gint32 access, gint32 inherit, gint32 options, gint32 *error);
 
 extern gunichar2 
-ves_icall_System_IO_MonoIO_get_VolumeSeparatorChar (void) MONO_INTERNAL;
+ves_icall_System_IO_MonoIO_get_VolumeSeparatorChar (void);
 
 extern gunichar2 
-ves_icall_System_IO_MonoIO_get_DirectorySeparatorChar (void) MONO_INTERNAL;
+ves_icall_System_IO_MonoIO_get_DirectorySeparatorChar (void);
 
 extern gunichar2 
-ves_icall_System_IO_MonoIO_get_AltDirectorySeparatorChar (void) MONO_INTERNAL;
+ves_icall_System_IO_MonoIO_get_AltDirectorySeparatorChar (void);
 
 extern gunichar2 
-ves_icall_System_IO_MonoIO_get_PathSeparator (void) MONO_INTERNAL;
+ves_icall_System_IO_MonoIO_get_PathSeparator (void);
 
 extern MonoArray *
-ves_icall_System_IO_MonoIO_get_InvalidPathChars (void) MONO_INTERNAL;
-
-extern gint32
-ves_icall_System_IO_MonoIO_GetTempPath (MonoString **mono_name) MONO_INTERNAL;
+ves_icall_System_IO_MonoIO_get_InvalidPathChars (void);
 
-extern void ves_icall_System_IO_MonoIO_Lock (HANDLE handle, gint64 position,
-                                            gint64 length, gint32 *error) MONO_INTERNAL;
-extern void ves_icall_System_IO_MonoIO_Unlock (HANDLE handle, gint64 position,
-                                              gint64 length, gint32 *error) MONO_INTERNAL;
+extern void ves_icall_System_IO_MonoIO_Lock (gpointer handle, gint64 position,
+                                            gint64 length, gint32 *error);
+extern void ves_icall_System_IO_MonoIO_Unlock (gpointer handle, gint64 position,
+                                              gint64 length, gint32 *error);
 
 extern MonoBoolean
 ves_icall_System_IO_MonoIO_ReplaceFile (MonoString *sourceFileName, MonoString *destinationFileName,
                                        MonoString *destinationBackupFileName, MonoBoolean ignoreMetadataErrors,
-                                       gint32 *error) MONO_INTERNAL;
+                                       gint32 *error);
 
+MONO_RT_EXTERNAL_ONLY
 extern gint64
 mono_filesize_from_path (MonoString *path);
 
 extern gint64
 mono_filesize_from_fd (int fd);
 
+void
+ves_icall_System_IO_MonoIO_DumpHandles (void);
+
 G_END_DECLS
 
 #endif /* _MONO_METADATA_FILEIO_H_ */