2 * file-io.h: File IO internal calls
5 * Dick Porter (dick@ximian.com)
6 * Dan Lewis (dihlewis@yahoo.co.uk)
8 * (C) 2001 Ximian, Inc.
11 #ifndef _MONO_METADATA_FILEIO_H_
12 #define _MONO_METADATA_FILEIO_H_
17 #include <mono/metadata/object-internals.h>
18 #include <mono/io-layer/io-layer.h>
19 #include <mono/utils/mono-compiler.h>
23 /* This is a copy of System.IO.FileAccess */
26 FileAccess_Write=0x02,
27 FileAccess_ReadWrite=FileAccess_Read|FileAccess_Write
30 /* This is a copy of System.IO.FileMode */
35 FileMode_OpenOrCreate=4,
40 /* This is a copy of System.IO.FileShare */
45 FileShare_ReadWrite=FileShare_Read|FileShare_Write,
49 /* This is a copy of System.IO.FileOptions */
52 FileOptions_Temporary = 1, // Internal. See note in System.IO.FileOptions
53 FileOptions_Encrypted = 0x4000,
54 FileOptions_DeleteOnClose = 0x4000000,
55 FileOptions_SequentialScan = 0x8000000,
56 FileOptions_RandomAccess = 0x10000000,
57 FileOptions_Asynchronous = 0x40000000,
58 FileOptions_WriteThrough = 0x80000000
61 /* This is a copy of System.IO.SeekOrigin */
68 /* This is a copy of System.IO.MonoIOStat */
69 typedef struct _MonoIOStat {
73 gint64 last_access_time;
74 gint64 last_write_time;
77 /* This is a copy of System.IO.FileAttributes */
79 FileAttributes_ReadOnly=0x00001,
80 FileAttributes_Hidden=0x00002,
81 FileAttributes_System=0x00004,
82 FileAttributes_Directory=0x00010,
83 FileAttributes_Archive=0x00020,
84 FileAttributes_Device=0x00040,
85 FileAttributes_Normal=0x00080,
86 FileAttributes_Temporary=0x00100,
87 FileAttributes_SparseFile=0x00200,
88 FileAttributes_ReparsePoint=0x00400,
89 FileAttributes_Compressed=0x00800,
90 FileAttributes_Offline=0x01000,
91 FileAttributes_NotContentIndexed=0x02000,
92 FileAttributes_Encrypted=0x04000,
93 FileAttributes_MonoExecutable= (int) 0x80000000
95 /* This is not used anymore
96 typedef struct _MonoFSAsyncResult {
99 MonoBoolean completed;
102 MonoWaitHandle *wait_handle;
103 MonoDelegate *async_callback;
104 MonoBoolean completed_synch;
110 MonoDelegate *real_cb;
113 /* System.IO.MonoIO */
116 ves_icall_System_IO_MonoIO_CreateDirectory (MonoString *path, gint32 *error) MONO_INTERNAL;
119 ves_icall_System_IO_MonoIO_RemoveDirectory (MonoString *path, gint32 *error) MONO_INTERNAL;
122 ves_icall_System_IO_MonoIO_GetFileSystemEntries (MonoString *path,
123 MonoString *path_with_pattern,
124 gint mask, gint attrs,
125 gint32 *error) MONO_INTERNAL;
128 ves_icall_System_IO_MonoIO_FindFirst (MonoString *path,
129 MonoString *path_with_pattern,
132 gpointer *handle) MONO_INTERNAL;
134 ves_icall_System_IO_MonoIO_FindNext (gpointer handle, gint32 *result_mask, gint32 *error) MONO_INTERNAL;
137 ves_icall_System_IO_MonoIO_FindClose (gpointer handle) MONO_INTERNAL;
140 ves_icall_System_IO_MonoIO_GetCurrentDirectory (gint32 *error) MONO_INTERNAL;
143 ves_icall_System_IO_MonoIO_SetCurrentDirectory (MonoString *path,
144 gint32 *error) MONO_INTERNAL;
147 ves_icall_System_IO_MonoIO_MoveFile (MonoString *path, MonoString *dest,
148 gint32 *error) MONO_INTERNAL;
151 ves_icall_System_IO_MonoIO_CopyFile (MonoString *path, MonoString *dest,
152 MonoBoolean overwrite, gint32 *error) MONO_INTERNAL;
155 ves_icall_System_IO_MonoIO_DeleteFile (MonoString *path, gint32 *error) MONO_INTERNAL;
158 ves_icall_System_IO_MonoIO_GetFileAttributes (MonoString *path, gint32 *error) MONO_INTERNAL;
161 ves_icall_System_IO_MonoIO_SetFileAttributes (MonoString *path, gint32 attrs,
162 gint32 *error) MONO_INTERNAL;
165 ves_icall_System_IO_MonoIO_GetFileType (HANDLE handle, gint32 *error) MONO_INTERNAL;
168 ves_icall_System_IO_MonoIO_GetFileStat (MonoString *path, MonoIOStat *stat,
169 gint32 *error) MONO_INTERNAL;
172 ves_icall_System_IO_MonoIO_Open (MonoString *filename, gint32 mode,
173 gint32 access_mode, gint32 share, gint32 options,
174 gint32 *error) MONO_INTERNAL;
177 ves_icall_System_IO_MonoIO_Close (HANDLE handle, gint32 *error) MONO_INTERNAL;
180 ves_icall_System_IO_MonoIO_Read (HANDLE handle, MonoArray *dest,
181 gint32 dest_offset, gint32 count,
182 gint32 *error) MONO_INTERNAL;
185 ves_icall_System_IO_MonoIO_Write (HANDLE handle, MonoArray *src,
186 gint32 src_offset, gint32 count,
187 gint32 *error) MONO_INTERNAL;
190 ves_icall_System_IO_MonoIO_Seek (HANDLE handle, gint64 offset, gint32 origin,
191 gint32 *error) MONO_INTERNAL;
194 ves_icall_System_IO_MonoIO_Flush (HANDLE handle, gint32 *error) MONO_INTERNAL;
197 ves_icall_System_IO_MonoIO_GetLength (HANDLE handle, gint32 *error) MONO_INTERNAL;
200 ves_icall_System_IO_MonoIO_SetLength (HANDLE handle, gint64 length,
201 gint32 *error) MONO_INTERNAL;
204 ves_icall_System_IO_MonoIO_SetFileTime (HANDLE handle, gint64 creation_time,
205 gint64 last_access_time,
206 gint64 last_write_time, gint32 *error) MONO_INTERNAL;
209 ves_icall_System_IO_MonoIO_get_ConsoleOutput (void) MONO_INTERNAL;
212 ves_icall_System_IO_MonoIO_get_ConsoleInput (void) MONO_INTERNAL;
215 ves_icall_System_IO_MonoIO_get_ConsoleError (void) MONO_INTERNAL;
218 ves_icall_System_IO_MonoIO_CreatePipe (HANDLE *read_handle,
219 HANDLE *write_handle) MONO_INTERNAL;
221 extern MonoBoolean ves_icall_System_IO_MonoIO_DuplicateHandle (HANDLE source_process_handle,
222 HANDLE source_handle, HANDLE target_process_handle, HANDLE *target_handle,
223 gint32 access, gint32 inherit, gint32 options) MONO_INTERNAL;
226 ves_icall_System_IO_MonoIO_get_VolumeSeparatorChar (void) MONO_INTERNAL;
229 ves_icall_System_IO_MonoIO_get_DirectorySeparatorChar (void) MONO_INTERNAL;
232 ves_icall_System_IO_MonoIO_get_AltDirectorySeparatorChar (void) MONO_INTERNAL;
235 ves_icall_System_IO_MonoIO_get_PathSeparator (void) MONO_INTERNAL;
238 ves_icall_System_IO_MonoIO_get_InvalidPathChars (void) MONO_INTERNAL;
241 ves_icall_System_IO_MonoIO_GetTempPath (MonoString **mono_name) MONO_INTERNAL;
243 extern void ves_icall_System_IO_MonoIO_Lock (HANDLE handle, gint64 position,
244 gint64 length, gint32 *error) MONO_INTERNAL;
245 extern void ves_icall_System_IO_MonoIO_Unlock (HANDLE handle, gint64 position,
246 gint64 length, gint32 *error) MONO_INTERNAL;
249 ves_icall_System_IO_MonoIO_ReplaceFile (MonoString *sourceFileName, MonoString *destinationFileName,
250 MonoString *destinationBackupFileName, MonoBoolean ignoreMetadataErrors,
251 gint32 *error) MONO_INTERNAL;
254 mono_filesize_from_path (MonoString *path);
257 mono_filesize_from_fd (int fd);
261 #endif /* _MONO_METADATA_FILEIO_H_ */