#include <sys/types.h>
#include <mono/metadata/object.h>
-#include <mono/io-layer/io-layer.h>
#include <mono/metadata/exception.h>
#include <mono/metadata/assembly.h>
#include <mono/metadata/appdomain.h>
#include <mono/metadata/w32handle.h>
#include <mono/metadata/w32socket.h>
#include <mono/metadata/w32socket-internals.h>
+#include <mono/metadata/w32error.h>
#include <time.h>
#ifdef HAVE_SYS_TIME_H
return WSAIoctl (sock, command, input, inputlen, output, outputlen, written, NULL, NULL);
}
+static gboolean
+mono_w32socket_close (SOCKET sock)
+{
+ return CloseHandle (sock);
+}
+
#endif /* HOST_WIN32 */
static void
mono_threadpool_io_remove_socket (GPOINTER_TO_INT (sock));
MONO_ENTER_GC_SAFE;
- CloseHandle (GINT_TO_POINTER (sock));
+ mono_w32socket_close ((SOCKET) sock);
MONO_EXIT_GC_SAFE;
}
/* FIXME: replace file by a proper fd that we can call open and close on, as they are interruptible */
- file = ves_icall_System_IO_MonoIO_Open (filename, FileMode_Open, FileAccess_Read, FileShare_Read, 0, werror);
-
+ file = mono_w32file_create (mono_string_chars (filename), OPEN_EXISTING, GENERIC_READ, FILE_SHARE_READ, 0);
if (file == INVALID_HANDLE_VALUE) {
- SetLastError (*werror);
+ *werror = mono_w32error_get_last ();
return FALSE;
}
mono_thread_info_install_interrupt (abort_syscall, (gpointer) (gsize) mono_native_thread_id_get (), &interrupted);
if (interrupted) {
- CloseHandle (file);
- SetLastError (WSAEINTR);
+ mono_w32file_close (file);
+ mono_w32error_set_last (WSAEINTR);
return FALSE;
}
mono_thread_info_uninstall_interrupt (&interrupted);
if (interrupted) {
- CloseHandle (file);
+ mono_w32file_close (file);
*werror = WSAEINTR;
return FALSE;
}
MONO_ENTER_GC_SAFE;
- CloseHandle (file);
+ mono_w32file_close (file);
MONO_EXIT_GC_SAFE;