mono/tests/gc-descriptors/Makefile
mono/unit-tests/Makefile
mono/benchmark/Makefile
-mono/io-layer/Makefile
mono/mini/Makefile
mono/profiler/Makefile
m4/Makefile
endif
if CROSS_COMPILING
-SUBDIRS = $(btls_dirs) arch utils io-layer cil metadata $(sgen_dirs) mini dis profiler
+SUBDIRS = $(btls_dirs) arch utils cil metadata $(sgen_dirs) mini dis profiler
else
if INSTALL_MONOTOUCH
-SUBDIRS = $(btls_dirs) arch utils io-layer metadata $(sgen_dirs) mini profiler
+SUBDIRS = $(btls_dirs) arch utils metadata $(sgen_dirs) mini profiler
monotouch-do-build:
@list='$(SUBDIRS)'; for subdir in $$list; do \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$target); \
done;
else
-SUBDIRS = $(btls_dirs) arch utils io-layer cil metadata $(sgen_dirs) mini dis tests unit-tests benchmark profiler
+SUBDIRS = $(btls_dirs) arch utils cil metadata $(sgen_dirs) mini dis tests unit-tests benchmark profiler
endif
endif
-DIST_SUBDIRS = btls arch utils io-layer cil metadata $(sgen_dirs) mini dis tests unit-tests benchmark profiler
+DIST_SUBDIRS = btls arch utils cil metadata $(sgen_dirs) mini dis tests unit-tests benchmark profiler
runtime_lib= \
$(metadata_lib) \
$(gc_lib) \
- $(top_builddir)/mono/io-layer/libwapi.la \
$(top_builddir)/mono/utils/libmonoutils.la \
$(GLIB_LIBS) $(LIBICONV)
+++ /dev/null
-/semantic.cache
-/.deps
-/.libs
-/Makefile
-/Makefile.in
-/mono-handle-d
-/*.lo
-/*.la
-/*.o
-/.project
-/.cproject
-/TAGS
+++ /dev/null
-
-noinst_LTLIBRARIES = libwapi.la
-
-AM_CPPFLAGS = \
- $(GLIB_CFLAGS) \
- $(LIBGC_CPPFLAGS) \
- -DMONO_BINDIR=\""$(bindir)"\" \
- -I$(top_srcdir) \
- $(SHARED_CFLAGS)
-
-libwapiincludedir = $(includedir)/mono-$(API_VER)/mono/io-layer
-
-OTHER_H = \
- error.h \
- io-layer.h \
- wapi.h \
- wapi-remap.h
-
-OTHER_SRC = \
- error.c \
- error.h \
- io-layer.h \
- wapi.h \
- wapi.c
-
-
-WINDOWS_H = \
- io-layer.h
-
-WINDOWS_SRC = \
- io-layer.h \
- io-layer-dummy.c
-
-if HOST_WIN32
-libwapi_la_SOURCES = $(WINDOWS_SRC) $(WINDOWS_H)
-else
-libwapi_la_SOURCES = $(OTHER_SRC) $(OTHER_H)
-endif
-if PLATFORM_DARWIN
-libwapi_la_LIBADD = -lproc
-endif
-
-EXTRA_DIST = \
- $(WINDOWS_SRC)
- $(OTHER_SRC)
-
-
+++ /dev/null
-/*
- * error.c: Error reporting
- *
- * Author:
- * Dick Porter (dick@ximian.com)
- *
- * (C) 2002 Ximian, Inc.
- */
-
-#include <config.h>
-#include <glib.h>
-#include <pthread.h>
-#include <string.h>
-#include <errno.h>
-
-#include "mono/io-layer/wapi.h"
-#include "mono/utils/mono-lazy-init.h"
-
-static pthread_key_t error_key;
-static mono_lazy_init_t error_key_once = MONO_LAZY_INIT_STATUS_NOT_INITIALIZED;
-
-static void error_init(void)
-{
- int ret;
-
- ret = pthread_key_create(&error_key, NULL);
- g_assert (ret == 0);
-}
-
-/**
- * GetLastError:
- *
- * Retrieves the last error that occurred in the calling thread.
- *
- * Return value: The error code for the last error that happened on
- * the calling thread.
- */
-guint32 GetLastError(void)
-{
- guint32 err;
- void *errptr;
-
- mono_lazy_initialize(&error_key_once, error_init);
- errptr=pthread_getspecific(error_key);
- err=GPOINTER_TO_UINT(errptr);
-
- return(err);
-}
-
-/**
- * SetLastError:
- * @code: The error code.
- *
- * Sets the error code in the calling thread.
- */
-void SetLastError(guint32 code)
-{
- int ret;
-
- /* Set the thread-local error code */
- mono_lazy_initialize(&error_key_once, error_init);
- ret = pthread_setspecific(error_key, GUINT_TO_POINTER(code));
- g_assert (ret == 0);
-}
-
-gint
-_wapi_get_win32_file_error (gint err)
-{
- gint ret;
- /* mapping ideas borrowed from wine. they may need some work */
-
- switch (err) {
- case EACCES: case EPERM: case EROFS:
- ret = ERROR_ACCESS_DENIED;
- break;
-
- case EAGAIN:
- ret = ERROR_SHARING_VIOLATION;
- break;
-
- case EBUSY:
- ret = ERROR_LOCK_VIOLATION;
- break;
-
- case EEXIST:
- ret = ERROR_FILE_EXISTS;
- break;
-
- case EINVAL: case ESPIPE:
- ret = ERROR_SEEK;
- break;
-
- case EISDIR:
- ret = ERROR_CANNOT_MAKE;
- break;
-
- case ENFILE: case EMFILE:
- ret = ERROR_TOO_MANY_OPEN_FILES;
- break;
-
- case ENOENT: case ENOTDIR:
- ret = ERROR_FILE_NOT_FOUND;
- break;
-
- case ENOSPC:
- ret = ERROR_HANDLE_DISK_FULL;
- break;
-
- case ENOTEMPTY:
- ret = ERROR_DIR_NOT_EMPTY;
- break;
-
- case ENOEXEC:
- ret = ERROR_BAD_FORMAT;
- break;
-
- case ENAMETOOLONG:
- ret = ERROR_FILENAME_EXCED_RANGE;
- break;
-
-#ifdef EINPROGRESS
- case EINPROGRESS:
- ret = ERROR_IO_PENDING;
- break;
-#endif
-
- case ENOSYS:
- ret = ERROR_NOT_SUPPORTED;
- break;
-
- case EBADF:
- ret = ERROR_INVALID_HANDLE;
- break;
-
- case EIO:
- ret = ERROR_INVALID_HANDLE;
- break;
-
- case EINTR:
- ret = ERROR_IO_PENDING; /* best match I could find */
- break;
-
- case EPIPE:
- ret = ERROR_WRITE_FAULT;
- break;
-
- default:
- g_message ("Unknown errno: %s\n", g_strerror (err));
- ret = ERROR_GEN_FAILURE;
- break;
- }
-
- return ret;
-}
-
+++ /dev/null
-/*
- * error.h: Error reporting
- *
- * Author:
- * Dick Porter (dick@ximian.com)
- *
- * (C) 2002 Ximian, Inc.
- */
-
-#ifndef _WAPI_ERROR_H_
-#define _WAPI_ERROR_H_
-
-typedef enum {
- ERROR_SUCCESS = 0,
- ERROR_FILE_NOT_FOUND = 2,
- ERROR_PATH_NOT_FOUND = 3,
- ERROR_TOO_MANY_OPEN_FILES = 4,
- ERROR_ACCESS_DENIED = 5,
- ERROR_INVALID_HANDLE = 6,
- ERROR_NOT_ENOUGH_MEMORY = 8,
- ERROR_BAD_FORMAT = 11,
- ERROR_INVALID_ACCESS = 12,
- ERROR_INVALID_DATA = 13,
- ERROR_OUTOFMEMORY = 14,
- ERROR_NOT_SAME_DEVICE = 17,
- ERROR_NO_MORE_FILES = 18,
- ERROR_BAD_LENGTH = 24,
- ERROR_SEEK = 25,
- ERROR_WRITE_FAULT = 29,
- ERROR_GEN_FAILURE = 31,
- ERROR_SHARING_VIOLATION = 32,
- ERROR_LOCK_VIOLATION = 33,
- ERROR_HANDLE_DISK_FULL = 39,
- ERROR_NOT_SUPPORTED = 50,
- ERROR_FILE_EXISTS = 80,
- ERROR_CANNOT_MAKE = 82,
- ERROR_INVALID_PARAMETER = 87,
- ERROR_INVALID_NAME = 123,
- ERROR_PROC_NOT_FOUND = 127,
- ERROR_DIR_NOT_EMPTY = 145,
- ERROR_ALREADY_EXISTS = 183,
- ERROR_BAD_EXE_FORMAT = 193,
- ERROR_FILENAME_EXCED_RANGE = 206,
- ERROR_DIRECTORY = 267,
- ERROR_IO_PENDING = 997,
- ERROR_ENCRYPTION_FAILED = 6000,
- WSAEINTR = 10004,
- WSAEBADF = 10009,
- WSAEACCES = 10013,
- WSAEFAULT = 10014,
- WSAEINVAL = 10022,
- WSAEMFILE = 10024,
- WSAEWOULDBLOCK = 10035,
- WSAEINPROGRESS = 10036,
- WSAEALREADY = 10037,
- WSAENOTSOCK = 10038,
- WSAEDESTADDRREQ = 10039,
- WSAEMSGSIZE = 10040,
- WSAENOPROTOOPT = 10042,
- WSAEPROTONOSUPPORT = 10043,
- WSAESOCKTNOSUPPORT = 10044,
- WSAEOPNOTSUPP = 10045,
- WSAEAFNOSUPPORT = 10047,
- WSAEADDRINUSE = 10048,
- WSAEADDRNOTAVAIL = 10049,
- WSAENETDOWN = 10050,
- WSAENETUNREACH = 10051,
- WSAECONNRESET = 10054,
- WSAENOBUFS = 10055,
- WSAEISCONN = 10056,
- WSAENOTCONN = 10057,
- WSAESHUTDOWN = 10058,
- WSAETIMEDOUT = 10060,
- WSAECONNREFUSED = 10061,
- WSAEHOSTDOWN = 10064,
- WSAEHOSTUNREACH = 10065,
- WSASYSCALLFAILURE = 10107,
-} WapiError;
-
-G_BEGIN_DECLS
-
-guint32 GetLastError (void);
-void SetLastError (guint32 code);
-gint _wapi_get_win32_file_error (gint err);
-
-G_END_DECLS
-
-#endif /* _WAPI_ERROR_H_ */
+++ /dev/null
-/*
- * io-layer-dummy.c: Dummy file to fill the library on windows
- *
- * Author:
- * Dick Porter (dick@ximian.com)
- *
- * (C) 2002 Ximian, Inc.
- */
-
-extern char *_mono_iolayer_dummylib;
-char *_mono_iolayer_dummylib="This is a dummy library that isn't needed on Windows";
+++ /dev/null
-/*
- * io-layer.h: Include the right files depending on platform. This
- * file is the only entry point into the io-layer library.
- *
- * Author:
- * Dick Porter (dick@ximian.com)
- *
- * (C) 2002 Ximian, Inc.
- */
-
-#ifndef _MONO_IOLAYER_IOLAYER_H_
-#define _MONO_IOLAYER_IOLAYER_H_
-
-#include <config.h>
-#include <glib.h>
-
-#if defined(__WIN32__) || defined(_WIN32)
-/* Native win32 */
-#define __USE_W32_SOCKETS
-#include <winsock2.h>
-#include <windows.h>
-#include <winbase.h>
-/*
- * The mingw version says:
- * /usr/i686-pc-mingw32/sys-root/mingw/include/ws2tcpip.h:38:2: error: #error "ws2tcpip.h is not compatible with winsock.h. Include winsock2.h instead."
- */
-#ifdef _MSC_VER
-#include <ws2tcpip.h>
-#endif
-#include <psapi.h>
-
- /*
- * Workaround for missing WSAPOLLFD typedef in mingw's winsock2.h that is required for mswsock.h below.
- * Remove once http://sourceforge.net/p/mingw/bugs/1980/ is fixed.
- */
-#if defined(__MINGW_MAJOR_VERSION) && __MINGW_MAJOR_VERSION == 4
-typedef struct pollfd {
- SOCKET fd;
- short events;
- short revents;
-} WSAPOLLFD, *PWSAPOLLFD, *LPWSAPOLLFD;
-#endif
-
-#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
-#include <mswsock.h>
-#endif
-
-#else /* EVERYONE ELSE */
-#include "mono/io-layer/wapi.h"
-#endif /* HOST_WIN32 */
-
-#ifdef __native_client__
-#include "mono/metadata/nacl-stub.h"
-#endif
-
-#endif /* _MONO_IOLAYER_IOLAYER_H_ */
+++ /dev/null
-/*
- * wapi-remap.h: io-layer symbol remapping support
- *
- * (C) 2014 Xamarin, Inc.
- */
-
-#ifndef __WAPI_REMAP_H__
-#define __WAPI_REMAP_H__
-
-/*
- * The windows function names used by the io-layer can collide with symbols in system and 3rd party libs, esp. on osx/ios. So remap them to
- * wapi_<funcname>.
- */
-
-#define GetLastError wapi_GetLastError
-#define SetLastError wapi_SetLastError
-#define CloseHandle wapi_CloseHandle
-
-#endif /* __WAPI_REMAP_H__ */
+++ /dev/null
-
-#include "wapi.h"
-
-#include "mono/utils/mono-lazy-init.h"
-#include "mono/metadata/w32handle.h"
-
-/* Use this instead of getpid(), to cope with linuxthreads. It's a
- * function rather than a variable lookup because we need to get at
- * this before share_init() might have been called. */
-static mono_lazy_init_t _wapi_pid_init_lazy = MONO_LAZY_INIT_STATUS_NOT_INITIALIZED;
-static pid_t _wapi_pid;
-
-static void
-_wapi_pid_init (void)
-{
- _wapi_pid = getpid ();
-}
-
-pid_t
-wapi_getpid (void)
-{
- mono_lazy_initialize (&_wapi_pid_init_lazy, _wapi_pid_init);
- return _wapi_pid;
-}
-
-/**
- * CloseHandle:
- * @handle: The handle to release
- *
- * Closes and invalidates @handle, releasing any resources it
- * consumes. When the last handle to a temporary or non-persistent
- * object is closed, that object can be deleted. Closing the same
- * handle twice is an error.
- *
- * Return value: %TRUE on success, %FALSE otherwise.
- */
-gboolean CloseHandle(gpointer handle)
-{
- if (handle == INVALID_HANDLE_VALUE){
- SetLastError (ERROR_INVALID_PARAMETER);
- return FALSE;
- }
- if (handle == (gpointer)0 && mono_w32handle_get_type (handle) != MONO_W32HANDLE_CONSOLE) {
- /* Problem: because we map file descriptors to the
- * same-numbered handle we can't tell the difference
- * between a bogus handle and the handle to stdin.
- * Assume that it's the console handle if that handle
- * exists...
- */
- SetLastError (ERROR_INVALID_PARAMETER);
- return FALSE;
- }
-
- mono_w32handle_unref (handle);
- return TRUE;
-}
+++ /dev/null
-/*
- * wapi.h: Public include files
- *
- * Author:
- * Dick Porter (dick@ximian.com)
- *
- * (C) 2002 Ximian, Inc.
- */
-
-#ifndef _WAPI_WAPI_H_
-#define _WAPI_WAPI_H_
-
-#include <config.h>
-#include <glib.h>
-
-#ifdef HAVE_DIRENT_H
-#include <dirent.h>
-#endif
-#include <unistd.h>
-#include <utime.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include <mono/io-layer/wapi-remap.h>
-#include <mono/io-layer/error.h>
-#include <mono/utils/mono-logger-internals.h>
-
-G_BEGIN_DECLS
-
-#define WAIT_FAILED ((gint) 0xFFFFFFFF)
-#define WAIT_OBJECT_0 ((gint) 0x00000000)
-#define WAIT_ABANDONED_0 ((gint) 0x00000080)
-#define WAIT_TIMEOUT ((gint) 0x00000102)
-#define WAIT_IO_COMPLETION ((gint) 0x000000C0)
-
-#ifdef DISABLE_IO_LAYER_TRACE
-#define MONO_TRACE(...)
-#else
-#define MONO_TRACE(...) mono_trace (__VA_ARGS__)
-#endif
-
-#define WINAPI
-
-typedef guint32 DWORD;
-typedef gboolean BOOL;
-typedef gint32 LONG;
-typedef guint32 ULONG;
-typedef guint UINT;
-
-typedef gpointer HANDLE;
-typedef gpointer HMODULE;
-
-gboolean
-CloseHandle (gpointer handle);
-
-pid_t
-wapi_getpid (void);
-
-G_END_DECLS
-
-#endif /* _WAPI_WAPI_H_ */
w32event-win32.c \
w32process-win32.c \
w32process-win32-internals.h \
- w32socket-win32.c
+ w32socket-win32.c \
+ w32error-win32.c
platform_sources = $(win32_sources)
w32socket-unix.c \
w32file-unix.c \
w32file-unix-glob.c \
- w32file-unix-glob.h
+ w32file-unix-glob.h \
+ w32error-unix.c
platform_sources = $(unix_sources)
endif
w32handle-namespace.h \
w32handle-namespace.c \
w32handle.h \
- w32handle.c
+ w32handle.c \
+ w32error.h
# These source files have compile time dependencies on GC code
gc_dependent_sources = \
#include <mono/utils/mono-memory-model.h>
#include <mono/utils/mono-threads.h>
#include <mono/metadata/w32handle.h>
-#include <mono/io-layer/io-layer.h>
+#include <mono/metadata/w32error.h>
+#include <mono/utils/w32api.h>
#ifdef HOST_WIN32
#include <direct.h>
#endif
full_path = mono_path_resolve_symlinks (filename);
result = mono_w32file_write (handle, full_path, strlen (full_path), &n);
g_free (full_path);
- CloseHandle (handle);
+ mono_w32file_close (handle);
return result;
}
g_free (shadow);
/* Fix for bug #17251 - if file not found try finding assembly by other means (it is not fatal error) */
- if (GetLastError() == ERROR_FILE_NOT_FOUND || GetLastError() == ERROR_PATH_NOT_FOUND)
+ if (mono_w32error_get_last() == ERROR_FILE_NOT_FOUND || mono_w32error_get_last() == ERROR_PATH_NOT_FOUND)
return NULL; /* file not found, shadow copy failed */
mono_error_set_execution_engine (oerror, "Failed to create shadow copy (mono_w32file_copy).");
#include <mono/metadata/reflection-internals.h>
#include <mono/metadata/mono-endian.h>
#include <mono/metadata/mono-debug.h>
-#include <mono/io-layer/io-layer.h>
#include <mono/utils/mono-uri.h>
#include <mono/metadata/mono-config.h>
#include <mono/metadata/mono-config-dirs.h>
#include <mono/utils/mono-threads.h>
#include "attach.h"
-#include <mono/io-layer/io-layer.h>
+#include <mono/utils/w32api.h>
/*
* This module enables other processes to attach to a running mono process and
#include "mono/utils/atomic.h"
#include "mono/utils/mono-error.h"
#include "mono/utils/mono-error-internals.h"
-#include "mono/io-layer/io-layer.h"
#include <string.h>
#include <errno.h>
+#include <mono/utils/w32api.h>
#if defined(HOST_WIN32)
#include <oleauto.h>
#include <mono/metadata/threadpool.h>
#include <mono/utils/mono-signal-handler.h>
#include <mono/utils/mono-proclib.h>
-#include <mono/io-layer/io-layer.h>
+#include <mono/utils/w32api.h>
/* On solaris, curses.h must come before both termios.h and term.h */
#ifdef HAVE_CURSES_H
#include <glib.h>
#include <string.h>
-#include <mono/io-layer/io-layer.h>
#include <mono/utils/mono-path.h>
+#include "utils/w32api.h"
#include "cil-coff.h"
#include "metadata-internals.h"
#include "image.h"
#ifdef HOST_WIN32
-#include <mono/io-layer/io-layer.h>
#include <mono/utils/mono-compiler.h>
+#include <mono/utils/w32api.h>
#include "image.h"
#define STATUS_SUCCESS 0x00000000L
#include <metadata/threads.h>
#include <metadata/profiler-private.h>
#include <mono/metadata/coree.h>
-#include <mono/io-layer/io-layer.h>
//#define DEBUG_DOMAIN_UNLOAD 1
#include <mono/metadata/environment.h>
#include <mono/metadata/exception.h>
#include <mono/utils/mono-compiler.h>
-#include <mono/io-layer/io-layer.h>
+#include <mono/utils/w32api.h>
extern MonoString* ves_icall_System_Environment_GetOSVersionString (void);
#include <mono/metadata/marshal.h>
#include <mono/utils/mono-dl.h>
#include <mono/utils/mono-io-portability.h>
-#include <mono/io-layer/io-layer.h>
+#include <mono/metadata/w32error.h>
#ifdef HOST_WIN32
#include <mono/utils/atomic.h>
#include <mono/utils/mono-coop-semaphore.h>
#include <mono/utils/hazard-pointer.h>
-#include <mono/io-layer/io-layer.h>
+#include <mono/utils/w32api.h>
#ifndef HOST_WIN32
#include <pthread.h>
#include <mono/metadata/w32mutex.h>
#include <mono/metadata/w32semaphore.h>
#include <mono/metadata/w32event.h>
-#include <mono/io-layer/io-layer.h>
#include <mono/utils/monobitset.h>
#include <mono/utils/mono-time.h>
#include <mono/utils/mono-proclib.h>
#include <mono/utils/bsearch.h>
#include <mono/utils/mono-os-mutex.h>
#include <mono/utils/mono-threads.h>
+#include <mono/metadata/w32error.h>
+#include <mono/utils/w32api.h>
#include "decimal-ms.h"
#include "number-ms.h"
result = mono_w32file_get_disk_free_space (mono_string_chars (path_name), free_bytes_avail, total_number_of_bytes, total_number_of_free_bytes);
if (!result)
- *error = GetLastError ();
+ *error = mono_w32error_get_last ();
return result;
}
#include "loader.h"
#include "marshal.h"
#include "coree.h"
-#include <mono/io-layer/io-layer.h>
#include <mono/utils/checked-build.h>
#include <mono/utils/mono-logger-internals.h>
#include <mono/utils/mono-path.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
+#include <mono/metadata/w32error.h>
#define INVALID_ADDRESS 0xffffffff
fname_utf16 = g_utf8_to_utf16 (absfname, -1, NULL, NULL, NULL);
module_handle = MonoLoadImage (fname_utf16);
if (status && module_handle == NULL)
- last_error = GetLastError ();
+ last_error = mono_w32error_get_last ();
/* mono_image_open_from_module_handle is called by _CorDllMain. */
image = g_hash_table_lookup (loaded_images, absfname);
#include <execinfo.h>
#endif
-#include <mono/io-layer/io-layer.h>
#include <mono/utils/mono-compiler.h>
#include "lock-tracer.h"
#include <mono/metadata/threads-types.h>
#include <mono/metadata/exception.h>
#include <mono/metadata/threads.h>
-#include <mono/io-layer/io-layer.h>
#include <mono/metadata/object-internals.h>
#include <mono/metadata/class-internals.h>
#include <mono/metadata/gc-internals.h>
#include <mono/metadata/profiler-private.h>
#include <mono/utils/mono-time.h>
#include <mono/utils/atomic.h>
+#include <mono/utils/w32api.h>
/*
* Pull the list of opcodes
/* Orphaned events left by aborted threads */
while (new_->wait_list) {
LOCK_DEBUG (g_message (G_GNUC_PRETTY_FUNCTION ": (%d): Closing orphaned event %d", mono_thread_info_get_small_id (), new_->wait_list->data));
- CloseHandle (new_->wait_list->data);
+ mono_w32event_close (new_->wait_list->data);
new_->wait_list = g_slist_remove (new_->wait_list, new_->wait_list->data);
}
}
/* This looks superfluous */
if (mono_thread_current_check_pending_interrupt ()) {
- CloseHandle (event);
+ mono_w32event_close (event);
return FALSE;
}
*/
mon->wait_list = g_slist_remove (mon->wait_list, event);
}
- CloseHandle (event);
+ mono_w32event_close (event);
return success;
}
#include "utils/mono-networkinterfaces.h"
#include "utils/mono-error-internals.h"
#include "utils/atomic.h"
-#include <mono/io-layer/io-layer.h>
/* map of CounterSample.cs */
struct _MonoCounterSample {
#include <mono/metadata/object-internals.h>
#include <mono/metadata/metadata-internals.h>
#include <mono/metadata/security.h>
-#include <mono/io-layer/io-layer.h>
#include <mono/utils/strenc.h>
#ifndef HOST_WIN32
#include <mono/utils/mono-threads.h>
#include <mono/utils/mono-threads-coop.h>
#include "cominterop.h"
-#include <mono/io-layer/io-layer.h>
+#include <mono/utils/w32api.h>
static void
get_default_field_value (MonoDomain* domain, MonoClassField *field, void *value, MonoError *error);
#include "mono/metadata/domain-internals.h"
#include "mono/metadata/gc-internals.h"
#include "mono/metadata/mono-config-dirs.h"
-#include "mono/io-layer/io-layer.h"
#include "mono/utils/mono-dl.h"
#include <mono/utils/mono-logger-internals.h>
#include <string.h>
#include "mono/metadata/tabledefs.h"
#include "mono/metadata/tokentype.h"
#include "mono/metadata/w32file.h"
+#include "mono/metadata/w32error.h"
#include "mono/utils/checked-build.h"
#include "mono/utils/mono-digest.h"
#include "mono/utils/mono-error-internals.h"
-
-#include "mono/io-layer/io-layer.h"
+#include "mono/utils/w32api.h"
#define TEXT_OFFSET 512
#define CLI_H_SIZE 136
{
guint32 dummy;
if (!mono_w32file_write (f, buffer, numbytes, &dummy))
- g_error ("mono_w32file_write returned %d\n", GetLastError ());
+ g_error ("mono_w32file_write returned %d\n", mono_w32error_get_last ());
}
/*
continue;
if (mono_w32file_seek (file, assembly->sections [i].offset, NULL, FILE_BEGIN) == INVALID_SET_FILE_POINTER)
- g_error ("mono_w32file_seek returned %d\n", GetLastError ());
+ g_error ("mono_w32file_seek returned %d\n", mono_w32error_get_last ());
switch (i) {
case MONO_SECTION_TEXT:
/* check that the file is properly padded */
if (mono_w32file_seek (file, file_offset, NULL, FILE_BEGIN) == INVALID_SET_FILE_POINTER)
- g_error ("mono_w32file_seek returned %d\n", GetLastError ());
+ g_error ("mono_w32file_seek returned %d\n", mono_w32error_get_last ());
if (! mono_w32file_truncate (file))
- g_error ("mono_w32file_truncate returned %d\n", GetLastError ());
+ g_error ("mono_w32file_truncate returned %d\n", mono_w32error_get_last ());
mono_dynamic_stream_reset (&assembly->code);
mono_dynamic_stream_reset (&assembly->us);
#include "mono/metadata/tokentype.h"
#include "mono/utils/checked-build.h"
#include "mono/utils/mono-digest.h"
-#include "mono/io-layer/io-layer.h"
+#include "mono/utils/w32api.h"
static GENERATE_GET_CLASS_WITH_CACHE (marshal_as_attribute, System.Runtime.InteropServices, MarshalAsAttribute);
static GENERATE_GET_CLASS_WITH_CACHE (module_builder, System.Reflection.Emit, ModuleBuilder);
#include <mono/utils/mono-threads.h>
#include <mono/utils/mono-lazy-init.h>
#include <mono/utils/mono-logger-internals.h>
-#include <mono/io-layer/io-layer.h>
+#include <mono/utils/w32api.h>
typedef struct {
gboolean (*init) (gint wakeup_pipe_fd);
#include <mono/utils/mono-time.h>
#include <mono/utils/mono-rand.h>
#include <mono/utils/refcount.h>
-#include <mono/io-layer/io-layer.h>
+#include <mono/utils/w32api.h>
#define CPU_USAGE_LOW 80
#define CPU_USAGE_HIGH 95
#include <mono/utils/mono-threads.h>
#include <mono/utils/mono-time.h>
#include <mono/utils/refcount.h>
-#include <mono/io-layer/io-layer.h>
typedef struct {
MonoDomain *domain;
g_assert(wait_event);
MonoWaitHandle *wait_handle = mono_wait_handle_new (mono_object_domain (ares), wait_event, error);
if (!is_ok (error)) {
- CloseHandle (wait_event);
+ mono_w32event_close (wait_event);
return NULL;
}
MONO_OBJECT_SETREF (ares, handle, (MonoObject*) wait_handle);
#include <mono/metadata/gc-internals.h>
#include <mono/metadata/marshal.h>
#include <mono/metadata/runtime.h>
-#include <mono/io-layer/io-layer.h>
#include <mono/metadata/object-internals.h>
#include <mono/metadata/mono-debug-debugger.h>
#include <mono/utils/monobitset.h>
#include <mono/metadata/gc-internals.h>
#include <mono/metadata/reflection-internals.h>
#include <mono/metadata/abi-details.h>
+#include <mono/metadata/w32error.h>
+#include <mono/utils/w32api.h>
#ifdef HAVE_SIGNAL_H
#include <signal.h>
mono_threads_lock ();
mono_g_hash_table_remove (threads_starting_up, thread);
mono_threads_unlock ();
- mono_error_set_execution_engine (error, "Couldn't create thread. Error 0x%x", GetLastError());
+ mono_error_set_execution_engine (error, "Couldn't create thread. Error 0x%x", mono_w32error_get_last());
/* ref is not going to be decremented in start_wrapper_internal */
InterlockedDecrement (&start_info->ref);
ret = FALSE;
--- /dev/null
+
+#include "w32error.h"
+
+#include "utils/mono-lazy-init.h"
+
+static mono_lazy_init_t error_key_once = MONO_LAZY_INIT_STATUS_NOT_INITIALIZED;
+
+static pthread_key_t error_key;
+
+static void
+error_key_init (void)
+{
+ gint ret;
+ ret = pthread_key_create (&error_key, NULL);
+ g_assert (ret == 0);
+}
+
+guint32
+mono_w32error_get_last (void)
+{
+ mono_lazy_initialize (&error_key_once, error_key_init);
+ return GPOINTER_TO_UINT (pthread_getspecific (error_key));
+}
+
+void
+mono_w32error_set_last (guint32 error)
+{
+ gint ret;
+ mono_lazy_initialize (&error_key_once, error_key_init);
+ ret = pthread_setspecific (error_key, GUINT_TO_POINTER (error));
+ g_assert (ret == 0);
+}
+
+guint32
+mono_w32error_unix_to_win32 (guint32 error)
+{
+ /* mapping ideas borrowed from wine. they may need some work */
+
+ switch (error) {
+ case EACCES:
+ case EPERM:
+ case EROFS: return ERROR_ACCESS_DENIED;
+ case EAGAIN: return ERROR_SHARING_VIOLATION;
+ case EBUSY: return ERROR_LOCK_VIOLATION;
+ case EEXIST: return ERROR_FILE_EXISTS;
+ case EINVAL:
+ case ESPIPE: return ERROR_SEEK;
+ case EISDIR: return ERROR_CANNOT_MAKE;
+ case ENFILE:
+ case EMFILE: return ERROR_TOO_MANY_OPEN_FILES;
+ case ENOENT:
+ case ENOTDIR: return ERROR_FILE_NOT_FOUND;
+ case ENOSPC: return ERROR_HANDLE_DISK_FULL;
+ case ENOTEMPTY: return ERROR_DIR_NOT_EMPTY;
+ case ENOEXEC: return ERROR_BAD_FORMAT;
+ case ENAMETOOLONG: return ERROR_FILENAME_EXCED_RANGE;
+#ifdef EINPROGRESS
+ case EINPROGRESS: return ERROR_IO_PENDING;
+#endif
+ case ENOSYS: return ERROR_NOT_SUPPORTED;
+ case EBADF: return ERROR_INVALID_HANDLE;
+ case EIO: return ERROR_INVALID_HANDLE;
+ case EINTR: return ERROR_IO_PENDING; /* best match I could find */
+ case EPIPE: return ERROR_WRITE_FAULT;
+ default:
+ g_error ("%s: unknown error (%d) \"%s\"", error, g_strerror (error));
+ }
+}
--- /dev/null
+
+#include <windows.h>
+
+#include "w32error.h"
+
+guint32
+mono_w32error_get_last (void)
+{
+ return GetLastError ();
+}
+
+void
+mono_w32error_set_last (guint32 error)
+{
+ SetLastError (error);
+}
+
+guint32
+mono_w32error_unix_to_win32 (guint32 error)
+{
+ g_assert_not_reached ();
+}
--- /dev/null
+
+#ifndef _MONO_METADATA_W32ERROR_H_
+#define _MONO_METADATA_W32ERROR_H_
+
+#include <config.h>
+#include <glib.h>
+
+#if !defined(HOST_WIN32)
+
+#define ERROR_SUCCESS 0
+#define ERROR_FILE_NOT_FOUND 2
+#define ERROR_PATH_NOT_FOUND 3
+#define ERROR_TOO_MANY_OPEN_FILES 4
+#define ERROR_ACCESS_DENIED 5
+#define ERROR_INVALID_HANDLE 6
+#define ERROR_NOT_ENOUGH_MEMORY 8
+#define ERROR_BAD_FORMAT 11
+#define ERROR_INVALID_ACCESS 12
+#define ERROR_INVALID_DATA 13
+#define ERROR_OUTOFMEMORY 14
+#define ERROR_NOT_SAME_DEVICE 17
+#define ERROR_NO_MORE_FILES 18
+#define ERROR_BAD_LENGTH 24
+#define ERROR_SEEK 25
+#define ERROR_WRITE_FAULT 29
+#define ERROR_GEN_FAILURE 31
+#define ERROR_SHARING_VIOLATION 32
+#define ERROR_LOCK_VIOLATION 33
+#define ERROR_HANDLE_DISK_FULL 39
+#define ERROR_NOT_SUPPORTED 50
+#define ERROR_FILE_EXISTS 80
+#define ERROR_CANNOT_MAKE 82
+#define ERROR_INVALID_PARAMETER 87
+#define ERROR_INVALID_NAME 123
+#define ERROR_PROC_NOT_FOUND 127
+#define ERROR_DIR_NOT_EMPTY 145
+#define ERROR_ALREADY_EXISTS 183
+#define ERROR_BAD_EXE_FORMAT 193
+#define ERROR_FILENAME_EXCED_RANGE 206
+#define ERROR_DIRECTORY 267
+#define ERROR_IO_PENDING 997
+#define ERROR_ENCRYPTION_FAILED 6000
+#define WSAEINTR 10004
+#define WSAEBADF 10009
+#define WSAEACCES 10013
+#define WSAEFAULT 10014
+#define WSAEINVAL 10022
+#define WSAEMFILE 10024
+#define WSAEWOULDBLOCK 10035
+#define WSAEINPROGRESS 10036
+#define WSAEALREADY 10037
+#define WSAENOTSOCK 10038
+#define WSAEDESTADDRREQ 10039
+#define WSAEMSGSIZE 10040
+#define WSAENOPROTOOPT 10042
+#define WSAEPROTONOSUPPORT 10043
+#define WSAESOCKTNOSUPPORT 10044
+#define WSAEOPNOTSUPP 10045
+#define WSAEAFNOSUPPORT 10047
+#define WSAEADDRINUSE 10048
+#define WSAEADDRNOTAVAIL 10049
+#define WSAENETDOWN 10050
+#define WSAENETUNREACH 10051
+#define WSAECONNRESET 10054
+#define WSAENOBUFS 10055
+#define WSAEISCONN 10056
+#define WSAENOTCONN 10057
+#define WSAESHUTDOWN 10058
+#define WSAETIMEDOUT 10060
+#define WSAECONNREFUSED 10061
+#define WSAEHOSTDOWN 10064
+#define WSAEHOSTUNREACH 10065
+#define WSASYSCALLFAILURE 10107
+
+#endif
+
+guint32
+mono_w32error_get_last (void);
+
+void
+mono_w32error_set_last (guint32 error);
+
+guint32
+mono_w32error_unix_to_win32 (guint32 error);
+
+#endif /* _MONO_METADATA_W32ERROR_H_ */
#include "w32event.h"
+#include "w32error.h"
#include "w32handle-namespace.h"
-#include "mono/io-layer/io-layer.h"
#include "mono/utils/mono-logger-internals.h"
#include "mono/metadata/w32handle.h"
return handle;
}
+gboolean
+mono_w32event_close (gpointer handle)
+{
+ return mono_w32handle_close (handle);
+}
+
void
mono_w32event_set (gpointer handle)
{
if (handle == INVALID_HANDLE_VALUE) {
g_warning ("%s: error creating %s handle",
__func__, mono_w32handle_get_typename (type));
- SetLastError (ERROR_GEN_FAILURE);
+ mono_w32error_set_last (ERROR_GEN_FAILURE);
return NULL;
}
if (handle == INVALID_HANDLE_VALUE) {
/* The name has already been used for a different object. */
handle = NULL;
- SetLastError (ERROR_INVALID_HANDLE);
+ mono_w32error_set_last (ERROR_INVALID_HANDLE);
} else if (handle) {
/* Not an error, but this is how the caller is informed that the event wasn't freshly created */
- SetLastError (ERROR_ALREADY_EXISTS);
+ mono_w32error_set_last (ERROR_ALREADY_EXISTS);
/* mono_w32handle_namespace_search_handle already adds a ref to the handle */
} else {
/* Need to blow away any old errors here, because code tests
* for ERROR_ALREADY_EXISTS on success (!) to see if an event
* was freshly created */
- SetLastError (ERROR_SUCCESS);
+ mono_w32error_set_last (ERROR_SUCCESS);
event = name ? namedevent_create (manual, initial, mono_string_chars (name)) : event_create (manual, initial);
- *error = GetLastError ();
+ *error = mono_w32error_get_last ();
return event;
}
MonoW32HandleEvent *event_handle;
if (handle == NULL) {
- SetLastError (ERROR_INVALID_HANDLE);
+ mono_w32error_set_last (ERROR_INVALID_HANDLE);
return(FALSE);
}
case MONO_W32HANDLE_NAMEDEVENT:
break;
default:
- SetLastError (ERROR_INVALID_HANDLE);
+ mono_w32error_set_last (ERROR_INVALID_HANDLE);
return FALSE;
}
MonoW32HandleType type;
MonoW32HandleEvent *event_handle;
- SetLastError (ERROR_SUCCESS);
+ mono_w32error_set_last (ERROR_SUCCESS);
if (handle == NULL) {
- SetLastError (ERROR_INVALID_HANDLE);
+ mono_w32error_set_last (ERROR_INVALID_HANDLE);
return(FALSE);
}
case MONO_W32HANDLE_NAMEDEVENT:
break;
default:
- SetLastError (ERROR_INVALID_HANDLE);
+ mono_w32error_set_last (ERROR_INVALID_HANDLE);
return FALSE;
}
void
ves_icall_System_Threading_Events_CloseEvent_internal (gpointer handle)
{
- CloseHandle (handle);
+ mono_w32handle_close (handle);
}
gpointer
return CreateEvent (NULL, manual, initial, NULL);
}
+gboolean
+mono_w32event_close (gpointer handle)
+{
+ return CloseHandle (handle);
+}
+
void
mono_w32event_set (gpointer handle)
{
gpointer
mono_w32event_create (gboolean manual, gboolean initial);
+gboolean
+mono_w32event_close (gpointer handle);
+
void
mono_w32event_set (gpointer handle);
#include "w32file-unix-glob.h"
#include "w32handle.h"
+#include "w32error.h"
#include "utils/mono-io-portability.h"
#include "utils/mono-logger-internals.h"
#include "utils/mono-os-mutex.h"
typedef struct {
guint64 device;
guint64 inode;
- pid_t opened_by_pid;
guint32 sharemode;
guint32 access;
guint32 handle_refs;
file_share->device = device;
file_share->inode = inode;
- file_share->opened_by_pid = wapi_getpid ();
file_share->sharemode = new_sharemode;
file_share->access = new_access;
file_share->handle_refs = 1;
gint ret;
if (offset < 0 || length < 0) {
- SetLastError (ERROR_INVALID_PARAMETER);
+ mono_w32error_set_last (ERROR_INVALID_PARAMETER);
return FALSE;
}
return TRUE;
}
- SetLastError (ERROR_LOCK_VIOLATION);
+ mono_w32error_set_last (ERROR_LOCK_VIOLATION);
return FALSE;
}
return TRUE;
}
- SetLastError (ERROR_LOCK_VIOLATION);
+ mono_w32error_set_last (ERROR_LOCK_VIOLATION);
return FALSE;
}
static void
_wapi_set_last_error_from_errno (void)
{
- SetLastError (_wapi_get_win32_file_error (errno));
+ mono_w32error_set_last (mono_w32error_unix_to_win32 (errno));
}
static void _wapi_set_last_path_error_from_errno (const gchar *dir,
}
if (_wapi_access (dirname, F_OK) == 0) {
- SetLastError (ERROR_FILE_NOT_FOUND);
+ mono_w32error_set_last (ERROR_FILE_NOT_FOUND);
} else {
- SetLastError (ERROR_PATH_NOT_FOUND);
+ mono_w32error_set_last (ERROR_PATH_NOT_FOUND);
}
g_free (dirname);
if(ok==FALSE) {
g_warning ("%s: error looking up file handle %p", __func__,
handle);
- SetLastError (ERROR_INVALID_HANDLE);
+ mono_w32error_set_last (ERROR_INVALID_HANDLE);
return(FALSE);
}
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p doesn't have GENERIC_READ access: %u",
__func__, handle, file_handle->fileaccess);
- SetLastError (ERROR_ACCESS_DENIED);
+ mono_w32error_set_last (ERROR_ACCESS_DENIED);
return(FALSE);
}
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: read of handle %p error: %s", __func__,
handle, strerror(err));
- SetLastError (_wapi_get_win32_file_error (err));
+ mono_w32error_set_last (mono_w32error_unix_to_win32 (err));
return(FALSE);
}
if(ok==FALSE) {
g_warning ("%s: error looking up file handle %p", __func__,
handle);
- SetLastError (ERROR_INVALID_HANDLE);
+ mono_w32error_set_last (ERROR_INVALID_HANDLE);
return(FALSE);
}
!(file_handle->fileaccess & GENERIC_ALL)) {
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p doesn't have GENERIC_WRITE access: %u", __func__, handle, file_handle->fileaccess);
- SetLastError (ERROR_ACCESS_DENIED);
+ mono_w32error_set_last (ERROR_ACCESS_DENIED);
return(FALSE);
}
if(ok==FALSE) {
g_warning ("%s: error looking up file handle %p", __func__,
handle);
- SetLastError (ERROR_INVALID_HANDLE);
+ mono_w32error_set_last (ERROR_INVALID_HANDLE);
return(FALSE);
}
!(file_handle->fileaccess & GENERIC_ALL)) {
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p doesn't have GENERIC_WRITE access: %u", __func__, handle, file_handle->fileaccess);
- SetLastError (ERROR_ACCESS_DENIED);
+ mono_w32error_set_last (ERROR_ACCESS_DENIED);
return(FALSE);
}
if(ok==FALSE) {
g_warning ("%s: error looking up file handle %p", __func__,
handle);
- SetLastError (ERROR_INVALID_HANDLE);
+ mono_w32error_set_last (ERROR_INVALID_HANDLE);
return(INVALID_SET_FILE_POINTER);
}
!(file_handle->fileaccess & GENERIC_ALL)) {
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p doesn't have GENERIC_READ or GENERIC_WRITE access: %u", __func__, handle, file_handle->fileaccess);
- SetLastError (ERROR_ACCESS_DENIED);
+ mono_w32error_set_last (ERROR_ACCESS_DENIED);
return(INVALID_SET_FILE_POINTER);
}
default:
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: invalid seek type %d", __func__, method);
- SetLastError (ERROR_INVALID_PARAMETER);
+ mono_w32error_set_last (ERROR_INVALID_PARAMETER);
return(INVALID_SET_FILE_POINTER);
}
if(ok==FALSE) {
g_warning ("%s: error looking up file handle %p", __func__,
handle);
- SetLastError (ERROR_INVALID_HANDLE);
+ mono_w32error_set_last (ERROR_INVALID_HANDLE);
return(FALSE);
}
fd = file_handle->fd;
!(file_handle->fileaccess & GENERIC_ALL)) {
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p doesn't have GENERIC_WRITE access: %u", __func__, handle, file_handle->fileaccess);
- SetLastError (ERROR_ACCESS_DENIED);
+ mono_w32error_set_last (ERROR_ACCESS_DENIED);
return(FALSE);
}
if(ok==FALSE) {
g_warning ("%s: error looking up file handle %p", __func__,
handle);
- SetLastError (ERROR_INVALID_HANDLE);
+ mono_w32error_set_last (ERROR_INVALID_HANDLE);
return(INVALID_FILE_SIZE);
}
fd = file_handle->fd;
!(file_handle->fileaccess & GENERIC_ALL)) {
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p doesn't have GENERIC_READ or GENERIC_WRITE access: %u", __func__, handle, file_handle->fileaccess);
- SetLastError (ERROR_ACCESS_DENIED);
+ mono_w32error_set_last (ERROR_ACCESS_DENIED);
return(INVALID_FILE_SIZE);
}
* caller can't tell if this is an error, so clear the error
* value
*/
- SetLastError (ERROR_SUCCESS);
+ mono_w32error_set_last (ERROR_SUCCESS);
ret = fstat(fd, &statbuf);
if (ret == -1) {
if(ok==FALSE) {
g_warning ("%s: error looking up file handle %p", __func__,
handle);
- SetLastError (ERROR_INVALID_HANDLE);
+ mono_w32error_set_last (ERROR_INVALID_HANDLE);
return(FALSE);
}
fd = file_handle->fd;
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p doesn't have GENERIC_READ access: %u",
__func__, handle, file_handle->fileaccess);
- SetLastError (ERROR_ACCESS_DENIED);
+ mono_w32error_set_last (ERROR_ACCESS_DENIED);
return(FALSE);
}
if(ok==FALSE) {
g_warning ("%s: error looking up file handle %p", __func__,
handle);
- SetLastError (ERROR_INVALID_HANDLE);
+ mono_w32error_set_last (ERROR_INVALID_HANDLE);
return(FALSE);
}
fd = file_handle->fd;
!(file_handle->fileaccess & GENERIC_ALL)) {
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p doesn't have GENERIC_WRITE access: %u", __func__, handle, file_handle->fileaccess);
- SetLastError (ERROR_ACCESS_DENIED);
+ mono_w32error_set_last (ERROR_ACCESS_DENIED);
return(FALSE);
}
if(file_handle->filename == NULL) {
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p unknown filename", __func__, handle);
- SetLastError (ERROR_INVALID_HANDLE);
+ mono_w32error_set_last (ERROR_INVALID_HANDLE);
return(FALSE);
}
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p fstat failed: %s", __func__, handle,
strerror(errno));
- SetLastError (ERROR_INVALID_PARAMETER);
+ mono_w32error_set_last (ERROR_INVALID_PARAMETER);
return(FALSE);
}
if (access_ticks < 116444736000000000ULL) {
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: attempt to set access time too early",
__func__);
- SetLastError (ERROR_INVALID_PARAMETER);
+ mono_w32error_set_last (ERROR_INVALID_PARAMETER);
return(FALSE);
}
if (sizeof (utbuf.actime) == 4 && ((access_ticks - 116444736000000000ULL) / 10000000) > INT_MAX) {
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: attempt to set write time that is too big for a 32bits time_t",
__func__);
- SetLastError (ERROR_INVALID_PARAMETER);
+ mono_w32error_set_last (ERROR_INVALID_PARAMETER);
return(FALSE);
}
if (write_ticks < 116444736000000000ULL) {
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: attempt to set write time too early",
__func__);
- SetLastError (ERROR_INVALID_PARAMETER);
+ mono_w32error_set_last (ERROR_INVALID_PARAMETER);
return(FALSE);
}
if (sizeof (utbuf.modtime) == 4 && ((write_ticks - 116444736000000000ULL) / 10000000) > INT_MAX) {
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: attempt to set write time that is too big for a 32bits time_t",
__func__);
- SetLastError (ERROR_INVALID_PARAMETER);
+ mono_w32error_set_last (ERROR_INVALID_PARAMETER);
return(FALSE);
}
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p [%s] utime failed: %s", __func__,
handle, file_handle->filename, strerror(errno));
- SetLastError (ERROR_INVALID_PARAMETER);
+ mono_w32error_set_last (ERROR_INVALID_PARAMETER);
return(FALSE);
}
if(ok==FALSE) {
g_warning ("%s: error looking up console handle %p", __func__,
handle);
- SetLastError (ERROR_INVALID_HANDLE);
+ mono_w32error_set_last (ERROR_INVALID_HANDLE);
return(FALSE);
}
fd = console_handle->fd;
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p doesn't have GENERIC_READ access: %u",
__func__, handle, console_handle->fileaccess);
- SetLastError (ERROR_ACCESS_DENIED);
+ mono_w32error_set_last (ERROR_ACCESS_DENIED);
return(FALSE);
}
if(ok==FALSE) {
g_warning ("%s: error looking up console handle %p", __func__,
handle);
- SetLastError (ERROR_INVALID_HANDLE);
+ mono_w32error_set_last (ERROR_INVALID_HANDLE);
return(FALSE);
}
fd = console_handle->fd;
!(console_handle->fileaccess & GENERIC_ALL)) {
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p doesn't have GENERIC_WRITE access: %u", __func__, handle, console_handle->fileaccess);
- SetLastError (ERROR_ACCESS_DENIED);
+ mono_w32error_set_last (ERROR_ACCESS_DENIED);
return(FALSE);
}
if(ok==FALSE) {
g_warning ("%s: error looking up pipe handle %p", __func__,
handle);
- SetLastError (ERROR_INVALID_HANDLE);
+ mono_w32error_set_last (ERROR_INVALID_HANDLE);
return(FALSE);
}
fd = pipe_handle->fd;
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p doesn't have GENERIC_READ access: %u",
__func__, handle, pipe_handle->fileaccess);
- SetLastError (ERROR_ACCESS_DENIED);
+ mono_w32error_set_last (ERROR_ACCESS_DENIED);
return(FALSE);
}
if(ok==FALSE) {
g_warning ("%s: error looking up pipe handle %p", __func__,
handle);
- SetLastError (ERROR_INVALID_HANDLE);
+ mono_w32error_set_last (ERROR_INVALID_HANDLE);
return(FALSE);
}
fd = pipe_handle->fd;
!(pipe_handle->fileaccess & GENERIC_ALL)) {
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p doesn't have GENERIC_WRITE access: %u", __func__, handle, pipe_handle->fileaccess);
- SetLastError (ERROR_ACCESS_DENIED);
+ mono_w32error_set_last (ERROR_ACCESS_DENIED);
return(FALSE);
}
perms = 0600;
if (attrs & FILE_ATTRIBUTE_ENCRYPTED){
- SetLastError (ERROR_ENCRYPTION_FAILED);
+ mono_w32error_set_last (ERROR_ENCRYPTION_FAILED);
return INVALID_HANDLE_VALUE;
}
if (name == NULL) {
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: name is NULL", __func__);
- SetLastError (ERROR_INVALID_NAME);
+ mono_w32error_set_last (ERROR_INVALID_NAME);
return(INVALID_HANDLE_VALUE);
}
if (filename == NULL) {
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: unicode conversion returned NULL", __func__);
- SetLastError (ERROR_INVALID_NAME);
+ mono_w32error_set_last (ERROR_INVALID_NAME);
return(INVALID_HANDLE_VALUE);
}
if (fd >= mono_w32handle_fd_reserve) {
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: File descriptor is too big", __func__);
- SetLastError (ERROR_TOO_MANY_OPEN_FILES);
+ mono_w32error_set_last (ERROR_TOO_MANY_OPEN_FILES);
close (fd);
g_free (filename);
if (share_allows_open (&statbuf, sharemode, fileaccess,
&file_handle.share_info) == FALSE) {
- SetLastError (ERROR_SHARING_VIOLATION);
+ mono_w32error_set_last (ERROR_SHARING_VIOLATION);
g_free (filename);
close (fd);
/* No space, so no more files can be opened */
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: No space in the share table", __func__);
- SetLastError (ERROR_TOO_MANY_OPEN_FILES);
+ mono_w32error_set_last (ERROR_TOO_MANY_OPEN_FILES);
close (fd);
g_free (filename);
g_free (filename);
close (fd);
- SetLastError (ERROR_GEN_FAILURE);
+ mono_w32error_set_last (ERROR_GEN_FAILURE);
return(INVALID_HANDLE_VALUE);
}
return(handle);
}
+gboolean
+mono_w32file_close (gpointer handle)
+{
+ return mono_w32handle_close (handle);
+}
+
gboolean mono_w32file_delete(const gunichar2 *name)
{
gchar *filename;
if(name==NULL) {
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: name is NULL", __func__);
- SetLastError (ERROR_INVALID_NAME);
+ mono_w32error_set_last (ERROR_INVALID_NAME);
return(FALSE);
}
if(filename==NULL) {
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: unicode conversion returned NULL", __func__);
- SetLastError (ERROR_INVALID_NAME);
+ mono_w32error_set_last (ERROR_INVALID_NAME);
return(FALSE);
}
if (share_allows_open (&statbuf, 0, GENERIC_WRITE,
&shareinfo) == FALSE) {
- SetLastError (ERROR_SHARING_VIOLATION);
+ mono_w32error_set_last (ERROR_SHARING_VIOLATION);
g_free (filename);
return FALSE;
}
if(name==NULL) {
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: name is NULL", __func__);
- SetLastError (ERROR_INVALID_NAME);
+ mono_w32error_set_last (ERROR_INVALID_NAME);
return(FALSE);
}
if (utf8_name == NULL) {
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: unicode conversion returned NULL", __func__);
- SetLastError (ERROR_INVALID_NAME);
+ mono_w32error_set_last (ERROR_INVALID_NAME);
return FALSE;
}
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: name is NULL", __func__);
g_free (utf8_name);
- SetLastError (ERROR_INVALID_NAME);
+ mono_w32error_set_last (ERROR_INVALID_NAME);
return(FALSE);
}
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: unicode conversion returned NULL", __func__);
g_free (utf8_name);
- SetLastError (ERROR_INVALID_NAME);
+ mono_w32error_set_last (ERROR_INVALID_NAME);
return FALSE;
}
stat_dest.st_ino != stat_src.st_ino) {
g_free (utf8_name);
g_free (utf8_dest_name);
- SetLastError (ERROR_ALREADY_EXISTS);
+ mono_w32error_set_last (ERROR_ALREADY_EXISTS);
return FALSE;
}
}
* then we can implement that later.
*/
if (share_allows_delete (&stat_src, &shareinfo) == FALSE) {
- SetLastError (ERROR_SHARING_VIOLATION);
+ mono_w32error_set_last (ERROR_SHARING_VIOLATION);
return FALSE;
}
if (shareinfo)
if (result == -1) {
switch(errno_copy) {
case EEXIST:
- SetLastError (ERROR_ALREADY_EXISTS);
+ mono_w32error_set_last (ERROR_ALREADY_EXISTS);
break;
case EXDEV:
gint32 copy_error;
if (S_ISDIR (stat_src.st_mode)) {
- SetLastError (ERROR_NOT_SAME_DEVICE);
+ mono_w32error_set_last (ERROR_NOT_SAME_DEVICE);
return FALSE;
}
/* Try a copy to the new location, and delete the source */
if(name==NULL) {
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: name is NULL", __func__);
- SetLastError (ERROR_INVALID_NAME);
+ mono_w32error_set_last (ERROR_INVALID_NAME);
return(FALSE);
}
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: unicode conversion of source returned NULL",
__func__);
- SetLastError (ERROR_INVALID_PARAMETER);
+ mono_w32error_set_last (ERROR_INVALID_PARAMETER);
return(FALSE);
}
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: dest is NULL", __func__);
g_free (utf8_src);
- SetLastError (ERROR_INVALID_NAME);
+ mono_w32error_set_last (ERROR_INVALID_NAME);
return(FALSE);
}
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: unicode conversion of dest returned NULL",
__func__);
- SetLastError (ERROR_INVALID_PARAMETER);
+ mono_w32error_set_last (ERROR_INVALID_PARAMETER);
g_free (utf8_src);
g_free (utf8_dest);
close (src_fd);
- SetLastError (ERROR_SHARING_VIOLATION);
+ mono_w32error_set_last (ERROR_SHARING_VIOLATION);
return (FALSE);
}
dest_fd = _wapi_open (utf8_dest, O_WRONLY | O_CREAT | O_EXCL, st.st_mode);
} else {
/* FIXME: it kinda sucks that this code path potentially scans
- * the directory twice due to the weird SetLastError()
+ * the directory twice due to the weird mono_w32error_set_last()
* behavior. */
dest_fd = _wapi_open (utf8_dest, O_WRONLY | O_TRUNC, st.st_mode);
if (dest_fd < 0) {
/* Apparently this error is set if we
* overwrite the dest file
*/
- SetLastError (ERROR_ALREADY_EXISTS);
+ mono_w32error_set_last (ERROR_ALREADY_EXISTS);
}
}
if (dest_fd < 0) {
if (arg == NULL) {
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: %s is NULL", __func__, arg_name);
- SetLastError (ERROR_INVALID_NAME);
+ mono_w32error_set_last (ERROR_INVALID_NAME);
return NULL;
}
if (utf8_ret == NULL) {
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: unicode conversion of %s returned NULL",
__func__, arg_name);
- SetLastError (ERROR_INVALID_PARAMETER);
+ mono_w32error_set_last (ERROR_INVALID_PARAMETER);
return NULL;
}
*/
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: fcntl error on fd %d: %s", __func__, fd, strerror(errno));
- SetLastError (_wapi_get_win32_file_error (errno));
+ mono_w32error_set_last (mono_w32error_unix_to_win32 (errno));
return INVALID_HANDLE_VALUE;
}
handle = mono_w32handle_new_fd (MONO_W32HANDLE_CONSOLE, fd, &file_handle);
if (handle == INVALID_HANDLE_VALUE) {
g_warning ("%s: error creating file handle", __func__);
- SetLastError (ERROR_GEN_FAILURE);
+ mono_w32error_set_last (ERROR_GEN_FAILURE);
return INVALID_HANDLE_VALUE;
}
handle = _wapi_stdhandle_create (fd, name);
if (handle == INVALID_HANDLE_VALUE) {
- SetLastError (ERROR_NO_MORE_FILES);
+ mono_w32error_set_last (ERROR_NO_MORE_FILES);
goto done;
}
} else {
type = mono_w32handle_get_type (handle);
if(io_ops[type].readfile==NULL) {
- SetLastError (ERROR_INVALID_HANDLE);
+ mono_w32error_set_last (ERROR_INVALID_HANDLE);
return(FALSE);
}
type = mono_w32handle_get_type (handle);
if(io_ops[type].writefile==NULL) {
- SetLastError (ERROR_INVALID_HANDLE);
+ mono_w32error_set_last (ERROR_INVALID_HANDLE);
return(FALSE);
}
type = mono_w32handle_get_type (handle);
if(io_ops[type].flushfile==NULL) {
- SetLastError (ERROR_INVALID_HANDLE);
+ mono_w32error_set_last (ERROR_INVALID_HANDLE);
return(FALSE);
}
type = mono_w32handle_get_type (handle);
if (io_ops[type].setendoffile == NULL) {
- SetLastError (ERROR_INVALID_HANDLE);
+ mono_w32error_set_last (ERROR_INVALID_HANDLE);
return(FALSE);
}
type = mono_w32handle_get_type (handle);
if (io_ops[type].seek == NULL) {
- SetLastError (ERROR_INVALID_HANDLE);
+ mono_w32error_set_last (ERROR_INVALID_HANDLE);
return(INVALID_SET_FILE_POINTER);
}
type = mono_w32handle_get_type (handle);
if (io_ops[type].getfiletype == NULL) {
- SetLastError (ERROR_INVALID_HANDLE);
+ mono_w32error_set_last (ERROR_INVALID_HANDLE);
return(FILE_TYPE_UNKNOWN);
}
type = mono_w32handle_get_type (handle);
if (io_ops[type].getfilesize == NULL) {
- SetLastError (ERROR_INVALID_HANDLE);
+ mono_w32error_set_last (ERROR_INVALID_HANDLE);
return(INVALID_FILE_SIZE);
}
type = mono_w32handle_get_type (handle);
if (io_ops[type].getfiletime == NULL) {
- SetLastError (ERROR_INVALID_HANDLE);
+ mono_w32error_set_last (ERROR_INVALID_HANDLE);
return(FALSE);
}
type = mono_w32handle_get_type (handle);
if (io_ops[type].setfiletime == NULL) {
- SetLastError (ERROR_INVALID_HANDLE);
+ mono_w32error_set_last (ERROR_INVALID_HANDLE);
return(FALSE);
}
if(system_time==NULL) {
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: system_time NULL", __func__);
- SetLastError (ERROR_INVALID_PARAMETER);
+ mono_w32error_set_last (ERROR_INVALID_PARAMETER);
return(FALSE);
}
if(file_ticks<0) {
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: file_time too big", __func__);
- SetLastError (ERROR_INVALID_PARAMETER);
+ mono_w32error_set_last (ERROR_INVALID_PARAMETER);
return(FALSE);
}
if (pattern == NULL) {
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: pattern is NULL", __func__);
- SetLastError (ERROR_PATH_NOT_FOUND);
+ mono_w32error_set_last (ERROR_PATH_NOT_FOUND);
return(INVALID_HANDLE_VALUE);
}
if (utf8_pattern == NULL) {
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: unicode conversion returned NULL", __func__);
- SetLastError (ERROR_INVALID_NAME);
+ mono_w32error_set_last (ERROR_INVALID_NAME);
return(INVALID_HANDLE_VALUE);
}
* FIXME: Figure out a better solution to keep some checks...
*/
if (strchr (dir_part, '*') || strchr (dir_part, '?')) {
- SetLastError (ERROR_INVALID_NAME);
+ mono_w32error_set_last (ERROR_INVALID_NAME);
g_free (dir_part);
g_free (entry_part);
g_free (utf8_pattern);
/* No files, which windows seems to call
* FILE_NOT_FOUND
*/
- SetLastError (ERROR_FILE_NOT_FOUND);
+ mono_w32error_set_last (ERROR_FILE_NOT_FOUND);
g_free (utf8_pattern);
g_free (entry_part);
g_free (dir_part);
g_free (dir_part);
g_free (entry_part);
g_free (utf8_pattern);
- SetLastError (ERROR_GEN_FAILURE);
+ mono_w32error_set_last (ERROR_GEN_FAILURE);
return(INVALID_HANDLE_VALUE);
}
if (handle != INVALID_HANDLE_VALUE &&
!mono_w32file_find_next (handle, find_data)) {
mono_w32file_find_close (handle);
- SetLastError (ERROR_NO_MORE_FILES);
+ mono_w32error_set_last (ERROR_NO_MORE_FILES);
handle = INVALID_HANDLE_VALUE;
}
if(ok==FALSE) {
g_warning ("%s: error looking up find handle %p", __func__,
handle);
- SetLastError (ERROR_INVALID_HANDLE);
+ mono_w32error_set_last (ERROR_INVALID_HANDLE);
return(FALSE);
}
retry:
if (find_handle->count >= find_handle->num) {
- SetLastError (ERROR_NO_MORE_FILES);
+ mono_w32error_set_last (ERROR_NO_MORE_FILES);
goto cleanup;
}
gboolean ok;
if (handle == NULL) {
- SetLastError (ERROR_INVALID_HANDLE);
+ mono_w32error_set_last (ERROR_INVALID_HANDLE);
return(FALSE);
}
if(ok==FALSE) {
g_warning ("%s: error looking up find handle %p", __func__,
handle);
- SetLastError (ERROR_INVALID_HANDLE);
+ mono_w32error_set_last (ERROR_INVALID_HANDLE);
return(FALSE);
}
if (name == NULL) {
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: name is NULL", __func__);
- SetLastError (ERROR_INVALID_NAME);
+ mono_w32error_set_last (ERROR_INVALID_NAME);
return(FALSE);
}
if (utf8_name == NULL) {
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: unicode conversion returned NULL", __func__);
- SetLastError (ERROR_INVALID_NAME);
+ mono_w32error_set_last (ERROR_INVALID_NAME);
return FALSE;
}
if (name == NULL) {
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: name is NULL", __func__);
- SetLastError (ERROR_INVALID_NAME);
+ mono_w32error_set_last (ERROR_INVALID_NAME);
return(FALSE);
}
if (utf8_name == NULL) {
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: unicode conversion returned NULL", __func__);
- SetLastError (ERROR_INVALID_NAME);
+ mono_w32error_set_last (ERROR_INVALID_NAME);
return FALSE;
}
if (name == NULL) {
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: name is NULL", __func__);
- SetLastError (ERROR_INVALID_NAME);
+ mono_w32error_set_last (ERROR_INVALID_NAME);
return(FALSE);
}
if (utf8_name == NULL) {
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: unicode conversion returned NULL", __func__);
- SetLastError (ERROR_INVALID_PARAMETER);
+ mono_w32error_set_last (ERROR_INVALID_PARAMETER);
return (INVALID_FILE_ATTRIBUTES);
}
if (name == NULL) {
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: name is NULL", __func__);
- SetLastError (ERROR_INVALID_NAME);
+ mono_w32error_set_last (ERROR_INVALID_NAME);
return(FALSE);
}
if (utf8_name == NULL) {
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: unicode conversion returned NULL", __func__);
- SetLastError (ERROR_INVALID_PARAMETER);
+ mono_w32error_set_last (ERROR_INVALID_PARAMETER);
return FALSE;
}
if (name == NULL) {
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: name is NULL", __func__);
- SetLastError (ERROR_INVALID_NAME);
+ mono_w32error_set_last (ERROR_INVALID_NAME);
return(FALSE);
}
if (utf8_name == NULL) {
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: unicode conversion returned NULL", __func__);
- SetLastError (ERROR_INVALID_NAME);
+ mono_w32error_set_last (ERROR_INVALID_NAME);
return FALSE;
}
gboolean result;
if (path == NULL) {
- SetLastError (ERROR_INVALID_PARAMETER);
+ mono_w32error_set_last (ERROR_INVALID_PARAMETER);
return(FALSE);
}
filedes[1] >= mono_w32handle_fd_reserve) {
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: File descriptor is too big", __func__);
- SetLastError (ERROR_TOO_MANY_OPEN_FILES);
+ mono_w32error_set_last (ERROR_TOO_MANY_OPEN_FILES);
close (filedes[0]);
close (filedes[1]);
g_warning ("%s: error creating pipe read handle", __func__);
close (filedes[0]);
close (filedes[1]);
- SetLastError (ERROR_GEN_FAILURE);
+ mono_w32error_set_last (ERROR_GEN_FAILURE);
return(FALSE);
}
close (filedes[0]);
close (filedes[1]);
- SetLastError (ERROR_GEN_FAILURE);
+ mono_w32error_set_last (ERROR_GEN_FAILURE);
return(FALSE);
}
if (path_name == NULL) {
utf8_path_name = g_strdup (g_get_current_dir());
if (utf8_path_name == NULL) {
- SetLastError (ERROR_DIRECTORY);
+ mono_w32error_set_last (ERROR_DIRECTORY);
return(FALSE);
}
}
if (utf8_path_name == NULL) {
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: unicode conversion returned NULL", __func__);
- SetLastError (ERROR_INVALID_NAME);
+ mono_w32error_set_last (ERROR_INVALID_NAME);
return(FALSE);
}
}
if (!mono_w32handle_lookup (handle, MONO_W32HANDLE_FILE, (gpointer *)&file_handle)) {
g_warning ("%s: error looking up file handle %p", __func__, handle);
- SetLastError (ERROR_INVALID_HANDLE);
+ mono_w32error_set_last (ERROR_INVALID_HANDLE);
return FALSE;
}
if (!(file_handle->fileaccess & GENERIC_READ) && !(file_handle->fileaccess & GENERIC_WRITE) && !(file_handle->fileaccess & GENERIC_ALL)) {
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p doesn't have GENERIC_READ or GENERIC_WRITE access: %u", __func__, handle, file_handle->fileaccess);
- SetLastError (ERROR_ACCESS_DENIED);
+ mono_w32error_set_last (ERROR_ACCESS_DENIED);
return FALSE;
}
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Locking handle %p, offset %lld, length %lld", __func__, handle, offset, length);
#else
if (offset_high > 0 || length_high > 0) {
- SetLastError (ERROR_INVALID_PARAMETER);
+ mono_w32error_set_last (ERROR_INVALID_PARAMETER);
return FALSE;
}
offset = offset_low;
if (!mono_w32handle_lookup (handle, MONO_W32HANDLE_FILE, (gpointer *)&file_handle)) {
g_warning ("%s: error looking up file handle %p", __func__, handle);
- SetLastError (ERROR_INVALID_HANDLE);
+ mono_w32error_set_last (ERROR_INVALID_HANDLE);
return FALSE;
}
if (!(file_handle->fileaccess & GENERIC_READ) && !(file_handle->fileaccess & GENERIC_WRITE) && !(file_handle->fileaccess & GENERIC_ALL)) {
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p doesn't have GENERIC_READ or GENERIC_WRITE access: %u", __func__, handle, file_handle->fileaccess);
- SetLastError (ERROR_ACCESS_DENIED);
+ mono_w32error_set_last (ERROR_ACCESS_DENIED);
return FALSE;
}
result = MoveFile (path, dest);
if (!result)
- *error = GetLastError ();
+ *error = mono_w32error_get_last ();
MONO_EXIT_GC_SAFE;
result = CopyFile (path, dest, !overwrite);
if (!result)
- *error = GetLastError ();
+ *error = mono_w32error_get_last ();
MONO_EXIT_GC_SAFE;
result = ReplaceFile (destinationFileName, sourceFileName, destinationBackupFileName, flags, NULL, NULL);
if (!result)
- *error = GetLastError ();
+ *error = mono_w32error_get_last ();
MONO_EXIT_GC_SAFE;
length = GetFileSize (handle, &length_hi);
if(length==INVALID_FILE_SIZE) {
- *error=GetLastError ();
+ *error=mono_w32error_get_last ();
}
MONO_EXIT_GC_SAFE;
result = LockFile (handle, position & 0xFFFFFFFF, position >> 32, length & 0xFFFFFFFF, length >> 32);
if (!result)
- *error = GetLastError ();
+ *error = mono_w32error_get_last ();
MONO_EXIT_GC_SAFE;
result = UnlockFile (handle, position & 0xFFFFFFFF, position >> 32, length & 0xFFFFFFFF, length >> 32);
if (!result)
- *error = GetLastError ();
+ *error = mono_w32error_get_last ();
MONO_EXIT_GC_SAFE;
return CreateFile (name, fileaccess, sharemode, NULL, createmode, attrs, NULL);
}
+gboolean
+mono_w32file_close (gpointer handle)
+{
+ return CloseHandle (handle);
+}
+
gboolean
mono_w32file_delete (const gunichar2 *name)
{
#endif
#include <mono/metadata/object.h>
-#include <mono/io-layer/io-layer.h>
#include <mono/metadata/w32file.h>
+#include <mono/metadata/w32error.h>
#include <mono/metadata/w32file-internals.h>
#include <mono/metadata/exception.h>
#include <mono/metadata/appdomain.h>
#include <mono/utils/strenc.h>
#include <utils/mono-io-portability.h>
#include <mono/metadata/w32handle.h>
+#include <mono/utils/w32api.h>
#undef DEBUG
if (res != -1)
return res;
- error = GetLastError ();
+ error = mono_w32error_get_last ();
if (error != ERROR_SHARING_VIOLATION)
return res;
if (res)
return TRUE;
- error = GetLastError ();
+ error = mono_w32error_get_last ();
if (error != ERROR_SHARING_VIOLATION)
return FALSE;
ret=mono_w32file_create_directory (mono_string_chars (path));
if(ret==FALSE) {
- *error=GetLastError ();
+ *error=mono_w32error_get_last ();
}
MONO_EXIT_GC_SAFE;
ret=mono_w32file_remove_directory (mono_string_chars (path));
if(ret==FALSE) {
- *error=GetLastError ();
+ *error=mono_w32error_get_last ();
}
MONO_EXIT_GC_SAFE;
goto fail;
}
} else {
- *error = GetLastError ();
+ *error = mono_w32error_get_last ();
goto fail;
}
find_handle = mono_w32file_find_first (path_with_pattern, &data);
if (find_handle == INVALID_HANDLE_VALUE) {
- gint32 find_error = GetLastError ();
+ gint32 find_error = mono_w32error_get_last ();
if (find_error == ERROR_FILE_NOT_FOUND || find_error == ERROR_NO_MORE_FILES) {
/* No files, so just return an empty array */
} while(mono_w32file_find_next (find_handle, &data));
if (mono_w32file_find_close (find_handle) == FALSE) {
- *error = GetLastError ();
+ *error = mono_w32error_get_last ();
goto fail;
}
if (hnd == INVALID_HANDLE_VALUE) {
*file_name = NULL;
*file_attr = 0;
- *ioerror = GetLastError ();
+ *ioerror = mono_w32error_get_last ();
return hnd;
}
if (res == FALSE) {
*file_name = NULL;
*file_attr = 0;
- *ioerror = GetLastError ();
+ *ioerror = mono_w32error_get_last ();
return res;
}
find_handle = mono_w32file_find_first (mono_string_chars (path_with_pattern), &data);
if (find_handle == INVALID_HANDLE_VALUE) {
- gint32 find_error = GetLastError ();
+ gint32 find_error = mono_w32error_get_last ();
*handle = NULL;
if (find_error == ERROR_FILE_NOT_FOUND)
while (incremental_find_check_match (ifh, &data, &result) == 0){
if (mono_w32file_find_next (find_handle, &data) == FALSE){
- int e = GetLastError ();
+ int e = mono_w32error_get_last ();
if (e != ERROR_NO_MORE_FILES)
*ioerror = e;
return NULL;
*error = ERROR_SUCCESS;
do {
if (mono_w32file_find_next (ifh->find_handle, &data) == FALSE){
- int e = GetLastError ();
+ int e = mono_w32error_get_last ();
if (e != ERROR_NO_MORE_FILES)
*error = e;
return NULL;
MONO_ENTER_GC_SAFE;
if (mono_w32file_find_close (ifh->find_handle) == FALSE){
- error = GetLastError ();
+ error = mono_w32error_get_last ();
} else
error = ERROR_SUCCESS;
g_free (ifh->utf8_path);
result = mono_string_new_utf16_checked (mono_domain_get (), buf, len, &error);
} else {
- *io_error=GetLastError ();
+ *io_error=mono_w32error_get_last ();
}
g_free (buf);
ret=mono_w32file_set_cwd (mono_string_chars (path));
if(ret==FALSE) {
- *error=GetLastError ();
+ *error=mono_w32error_get_last ();
}
return(ret);
ret=mono_w32file_delete (mono_string_chars (path));
if(ret==FALSE) {
- *error=GetLastError ();
+ *error=mono_w32error_get_last ();
}
MONO_EXIT_GC_SAFE;
*/
if (ret==-1) {
/* if(ret==INVALID_FILE_ATTRIBUTES) { */
- *error=GetLastError ();
+ *error=mono_w32error_get_last ();
}
MONO_EXIT_GC_SAFE;
ret=mono_w32file_set_attributes (mono_string_chars (path),
convert_attrs ((MonoFileAttributes)attrs));
if(ret==FALSE) {
- *error=GetLastError ();
+ *error=mono_w32error_get_last ();
}
MONO_EXIT_GC_SAFE;
/* Not necessarily an error, but the caller will have
* to decide based on the error value.
*/
- *error=GetLastError ();
+ *error=mono_w32error_get_last ();
}
MONO_EXIT_GC_SAFE;
result = get_file_attributes_ex (mono_string_chars (path), stat);
if (!result) {
- *error=GetLastError ();
+ *error=mono_w32error_get_last ();
memset (stat, 0, sizeof (MonoIOStat));
}
ret=mono_w32file_create (chars, convert_access ((MonoFileAccess)access_mode), convert_share ((MonoFileShare)share), convert_mode ((MonoFileMode)mode), attributes);
if(ret==INVALID_HANDLE_VALUE) {
- *error=GetLastError ();
+ *error=mono_w32error_get_last ();
}
MONO_EXIT_GC_SAFE;
*error=ERROR_SUCCESS;
- ret=CloseHandle (handle);
+ ret=mono_w32file_close (handle);
if(ret==FALSE) {
- *error=GetLastError ();
+ *error=mono_w32error_get_last ();
}
MONO_EXIT_GC_SAFE;
MONO_EXIT_GC_SAFE;
if (!result) {
- *error=GetLastError ();
+ *error=mono_w32error_get_last ();
return -1;
}
MONO_EXIT_GC_SAFE;
if (!result) {
- *error=GetLastError ();
+ *error=mono_w32error_get_last ();
return -1;
}
convert_seekorigin ((MonoSeekOrigin)origin));
if(offset==INVALID_SET_FILE_POINTER) {
- *error=GetLastError ();
+ *error=mono_w32error_get_last ();
}
MONO_EXIT_GC_SAFE;
ret=mono_w32file_flush (handle);
if(ret==FALSE) {
- *error=GetLastError ();
+ *error=mono_w32error_get_last ();
}
MONO_EXIT_GC_SAFE;
offset_hi = 0;
offset = mono_w32file_seek (handle, 0, &offset_hi, FILE_CURRENT);
if(offset==INVALID_SET_FILE_POINTER) {
- *error=GetLastError ();
+ *error=mono_w32error_get_last ();
return(FALSE);
}
offset_set=mono_w32file_seek (handle, length & 0xFFFFFFFF, &length_hi,
FILE_BEGIN);
if(offset_set==INVALID_SET_FILE_POINTER) {
- *error=GetLastError ();
+ *error=mono_w32error_get_last ();
return(FALSE);
}
result = mono_w32file_truncate (handle);
if(result==FALSE) {
- *error=GetLastError ();
+ *error=mono_w32error_get_last ();
return(FALSE);
}
offset_set=mono_w32file_seek (handle, offset & 0xFFFFFFFF, &offset_hi,
FILE_BEGIN);
if(offset_set==INVALID_SET_FILE_POINTER) {
- *error=GetLastError ();
+ *error=mono_w32error_get_last ();
return(FALSE);
}
ret=mono_w32file_set_times (handle, creation_filetime, access_filetime, write_filetime);
if(ret==FALSE) {
- *error=GetLastError ();
+ *error=mono_w32error_get_last ();
}
MONO_EXIT_GC_SAFE;
MONO_EXIT_GC_SAFE;
if(ret==FALSE) {
- *error = GetLastError ();
+ *error = mono_w32error_get_last ();
/* FIXME: throw an exception? */
return(FALSE);
}
MONO_EXIT_GC_SAFE;
if(ret==FALSE) {
- *error = GetLastError ();
+ *error = mono_w32error_get_last ();
/* FIXME: throw an exception? */
return(FALSE);
}
#include <config.h>
#include <glib.h>
-#include "io-layer/io-layer.h"
#include <mono/metadata/object-internals.h>
#include <mono/utils/mono-compiler.h>
gpointer
mono_w32file_create(const gunichar2 *name, guint32 fileaccess, guint32 sharemode, guint32 createmode, guint32 attrs);
+gboolean
+mono_w32file_close (gpointer handle);
+
gboolean
mono_w32file_delete (const gunichar2 *name);
#include "w32mutex.h"
#include "w32semaphore.h"
#include "w32event.h"
-#include "mono/io-layer/io-layer.h"
#include "mono/utils/mono-logger-internals.h"
#include "mono/utils/mono-coop-mutex.h"
mono_w32handle_unref (handle);
}
-/*
- * mono_w32handle_init:
- *
- * Initialize the io-layer.
- */
void
mono_w32handle_init (void)
{
return(GUINT_TO_POINTER(fd));
}
+gboolean
+mono_w32handle_close (gpointer handle)
+{
+ if (handle == INVALID_HANDLE_VALUE)
+ return FALSE;
+ if (handle == (gpointer) 0 && mono_w32handle_get_type (handle) != MONO_W32HANDLE_CONSOLE) {
+ /* Problem: because we map file descriptors to the
+ * same-numbered handle we can't tell the difference
+ * between a bogus handle and the handle to stdin.
+ * Assume that it's the console handle if that handle
+ * exists... */
+ return FALSE;
+ }
+
+ mono_w32handle_unref (handle);
+ return TRUE;
+}
+
gboolean
mono_w32handle_lookup (gpointer handle, MonoW32HandleType type,
gpointer *handle_specific)
gpointer
mono_w32handle_new_fd (MonoW32HandleType type, int fd, gpointer handle_specific);
+gboolean
+mono_w32handle_close (gpointer handle);
+
MonoW32HandleType
mono_w32handle_get_type (gpointer handle);
#include <pthread.h>
+#include "w32error.h"
#include "w32handle-namespace.h"
-#include "mono/io-layer/io-layer.h"
#include "mono/metadata/object-internals.h"
#include "mono/utils/mono-logger-internals.h"
#include "mono/utils/mono-threads.h"
if (handle == INVALID_HANDLE_VALUE) {
g_warning ("%s: error creating %s handle",
__func__, mono_w32handle_get_typename (type));
- SetLastError (ERROR_GEN_FAILURE);
+ mono_w32error_set_last (ERROR_GEN_FAILURE);
return NULL;
}
if (handle == INVALID_HANDLE_VALUE) {
/* The name has already been used for a different object. */
handle = NULL;
- SetLastError (ERROR_INVALID_HANDLE);
+ mono_w32error_set_last (ERROR_INVALID_HANDLE);
} else if (handle) {
/* Not an error, but this is how the caller is informed that the mutex wasn't freshly created */
- SetLastError (ERROR_ALREADY_EXISTS);
+ mono_w32error_set_last (ERROR_ALREADY_EXISTS);
/* mono_w32handle_namespace_search_handle already adds a ref to the handle */
} else {
/* Need to blow away any old errors here, because code tests
* for ERROR_ALREADY_EXISTS on success (!) to see if a mutex
* was freshly created */
- SetLastError (ERROR_SUCCESS);
+ mono_w32error_set_last (ERROR_SUCCESS);
if (!name) {
mutex = mutex_create (owned);
} else {
mutex = namedmutex_create (owned, mono_string_chars (name));
- if (GetLastError () == ERROR_ALREADY_EXISTS)
+ if (mono_w32error_get_last () == ERROR_ALREADY_EXISTS)
*created = FALSE;
}
gboolean ret;
if (handle == NULL) {
- SetLastError (ERROR_INVALID_HANDLE);
+ mono_w32error_set_last (ERROR_INVALID_HANDLE);
return FALSE;
}
case MONO_W32HANDLE_NAMEDMUTEX:
break;
default:
- SetLastError (ERROR_INVALID_HANDLE);
+ mono_w32error_set_last (ERROR_INVALID_HANDLE);
return FALSE;
}
#include <mono/metadata/w32process.h>
#include <mono/metadata/w32process-internals.h>
#include <mono/metadata/w32process-unix-internals.h>
+#include <mono/metadata/w32error.h>
#include <mono/metadata/class.h>
#include <mono/metadata/class-internals.h>
#include <mono/metadata/object.h>
#include <mono/metadata/metadata.h>
#include <mono/metadata/metadata-internals.h>
#include <mono/metadata/exception.h>
-#include <mono/io-layer/io-layer.h>
#include <mono/metadata/w32handle.h>
#include <mono/metadata/w32file.h>
#include <mono/utils/mono-membar.h>
#include <mono/utils/mono-mmap.h>
#include <mono/utils/strenc.h>
#include <mono/utils/mono-io-portability.h>
+#include <mono/utils/w32api.h>
#ifndef MAXPATHLEN
#define MAXPATHLEN 242
static Process *processes;
static mono_mutex_t processes_mutex;
+static pid_t current_pid;
static gpointer current_process;
static const gunichar2 utf16_space_bytes [2] = { 0x20, 0 };
mono_w32handle_register_capabilities (MONO_W32HANDLE_PROCESS,
(MonoW32HandleCapability)(MONO_W32HANDLE_CAP_WAIT | MONO_W32HANDLE_CAP_SPECIAL_WAIT));
+ current_pid = getpid ();
+
memset (&process_handle, 0, sizeof (process_handle));
- process_handle.pid = wapi_getpid ();
+ process_handle.pid = current_pid;
process_set_defaults (&process_handle);
process_set_name (&process_handle);
res = mono_w32handle_lookup (handle, MONO_W32HANDLE_PROCESS, (gpointer*) &process_handle);
if (!res) {
- SetLastError (ERROR_INVALID_HANDLE);
+ mono_w32error_set_last (ERROR_INVALID_HANDLE);
return 0;
}
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Can't find pid %d", __func__, pid);
- SetLastError (ERROR_PROC_NOT_FOUND);
+ mono_w32error_set_last (ERROR_PROC_NOT_FOUND);
return NULL;
}
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: unicode conversion returned NULL",
__func__);
- SetLastError (ERROR_PATH_NOT_FOUND);
+ mono_w32error_set_last (ERROR_PATH_NOT_FOUND);
goto free_strings;
}
if (args == NULL) {
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: unicode conversion returned NULL", __func__);
- SetLastError (ERROR_PATH_NOT_FOUND);
+ mono_w32error_set_last (ERROR_PATH_NOT_FOUND);
goto free_strings;
}
}
if (dir == NULL) {
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: unicode conversion returned NULL", __func__);
- SetLastError (ERROR_PATH_NOT_FOUND);
+ mono_w32error_set_last (ERROR_PATH_NOT_FOUND);
goto free_strings;
}
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Couldn't find executable %s",
__func__, prog);
g_free (unquoted);
- SetLastError (ERROR_FILE_NOT_FOUND);
+ mono_w32error_set_last (ERROR_FILE_NOT_FOUND);
goto free_strings;
}
} else {
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Couldn't find executable %s",
__func__, prog);
g_free (unquoted);
- SetLastError (ERROR_FILE_NOT_FOUND);
+ mono_w32error_set_last (ERROR_FILE_NOT_FOUND);
goto free_strings;
}
}
/* Give up */
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Couldn't find what to exec", __func__);
- SetLastError (ERROR_PATH_NOT_FOUND);
+ mono_w32error_set_last (ERROR_PATH_NOT_FOUND);
goto free_strings;
}
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Couldn't find executable %s",
__func__, token);
g_free (token);
- SetLastError (ERROR_FILE_NOT_FOUND);
+ mono_w32error_set_last (ERROR_FILE_NOT_FOUND);
goto free_strings;
}
} else {
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Couldn't find executable %s", __func__, token);
g_free (token);
- SetLastError (ERROR_FILE_NOT_FOUND);
+ mono_w32error_set_last (ERROR_FILE_NOT_FOUND);
goto free_strings;
}
}
} else {
if (!is_executable (prog)) {
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Executable permisson not set on %s", __func__, prog);
- SetLastError (ERROR_ACCESS_DENIED);
+ mono_w32error_set_last (ERROR_ACCESS_DENIED);
goto free_strings;
}
}
switch (pid = fork ()) {
case -1: /* Error */ {
- SetLastError (ERROR_OUTOFMEMORY);
+ mono_w32error_set_last (ERROR_OUTOFMEMORY);
ret = FALSE;
break;
}
mono_os_sem_destroy (&process->exit_sem);
g_free (process);
- SetLastError (ERROR_OUTOFMEMORY);
+ mono_w32error_set_last (ERROR_OUTOFMEMORY);
ret = FALSE;
break;
}
return ret;
#else
- SetLastError (ERROR_NOT_SUPPORTED);
+ mono_w32error_set_last (ERROR_NOT_SUPPORTED);
return FALSE;
#endif // defined (HAVE_FORK) && defined (HAVE_EXECVE)
}
*/
args = utf16_concat (utf16_quote, lpFile, utf16_quote, lpParameters == NULL ? NULL : utf16_space, lpParameters, NULL);
if (args == NULL) {
- SetLastError (ERROR_INVALID_DATA);
+ mono_w32error_set_last (ERROR_INVALID_DATA);
ret = FALSE;
goto done;
}
ret = process_create (NULL, args, lpDirectory, NULL, process_info);
g_free (args);
- if (!ret && GetLastError () == ERROR_OUTOFMEMORY)
+ if (!ret && mono_w32error_get_last () == ERROR_OUTOFMEMORY)
goto done;
if (!ret) {
args = utf16_concat (handler_utf16, utf16_space, utf16_quote, lpFile, utf16_quote,
lpParameters == NULL ? NULL : utf16_space, lpParameters, NULL);
if (args == NULL) {
- SetLastError (ERROR_INVALID_DATA);
+ mono_w32error_set_last (ERROR_INVALID_DATA);
ret = FALSE;
goto done;
}
ret = process_create (NULL, args, lpDirectory, NULL, process_info);
g_free (args);
if (!ret) {
- if (GetLastError () != ERROR_OUTOFMEMORY)
- SetLastError (ERROR_INVALID_DATA);
+ if (mono_w32error_get_last () != ERROR_OUTOFMEMORY)
+ mono_w32error_set_last (ERROR_INVALID_DATA);
ret = FALSE;
goto done;
}
/* Shell exec should not return a process handle when it spawned a GUI thing, like a browser. */
- CloseHandle (process_info->process_handle);
+ mono_w32handle_close (process_info->process_handle);
process_info->process_handle = NULL;
}
done:
if (ret == FALSE) {
- process_info->pid = -GetLastError ();
+ process_info->pid = -mono_w32error_get_last ();
} else {
process_info->thread_handle = NULL;
#if !defined(MONO_CROSS_COMPILE)
g_free (shell_path);
if (!ret)
- process_info->pid = -GetLastError ();
+ process_info->pid = -mono_w32error_get_last ();
return ret;
}
return FALSE;
}
- if (process_handle->pid == wapi_getpid ()) {
+ if (process_handle->pid == current_pid) {
*exitcode = STILL_ACTIVE;
return TRUE;
}
{
if (WAPI_IS_PSEUDO_PROCESS_HANDLE (handle))
return TRUE;
- return CloseHandle (handle);
+ return mono_w32handle_close (handle);
}
MonoBoolean
res = mono_w32handle_lookup (handle, MONO_W32HANDLE_PROCESS, (gpointer*) &process_handle);
if (!res) {
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Can't find process %p", __func__, handle);
- SetLastError (ERROR_INVALID_HANDLE);
+ mono_w32error_set_last (ERROR_INVALID_HANDLE);
return FALSE;
}
return TRUE;
switch (errno) {
- case EINVAL: SetLastError (ERROR_INVALID_PARAMETER); break;
- case EPERM: SetLastError (ERROR_ACCESS_DENIED); break;
- case ESRCH: SetLastError (ERROR_PROC_NOT_FOUND); break;
- default: SetLastError (ERROR_GEN_FAILURE); break;
+ case EINVAL: mono_w32error_set_last (ERROR_INVALID_PARAMETER); break;
+ case EPERM: mono_w32error_set_last (ERROR_ACCESS_DENIED); break;
+ case ESRCH: mono_w32error_set_last (ERROR_PROC_NOT_FOUND); break;
+ default: mono_w32error_set_last (ERROR_GEN_FAILURE); break;
}
return FALSE;
res = mono_w32handle_lookup (handle, MONO_W32HANDLE_PROCESS, (gpointer*) &process_handle);
if (!res) {
- SetLastError (ERROR_INVALID_HANDLE);
+ mono_w32error_set_last (ERROR_INVALID_HANDLE);
return 0;
}
switch (errno) {
case EPERM:
case EACCES:
- SetLastError (ERROR_ACCESS_DENIED);
+ mono_w32error_set_last (ERROR_ACCESS_DENIED);
break;
case ESRCH:
- SetLastError (ERROR_PROC_NOT_FOUND);
+ mono_w32error_set_last (ERROR_PROC_NOT_FOUND);
break;
default:
- SetLastError (ERROR_GEN_FAILURE);
+ mono_w32error_set_last (ERROR_GEN_FAILURE);
}
return 0;
}
return MONO_W32PROCESS_PRIORITY_CLASS_NORMAL;
#else
- SetLastError (ERROR_NOT_SUPPORTED);
+ mono_w32error_set_last (ERROR_NOT_SUPPORTED);
return 0;
#endif
}
res = mono_w32handle_lookup (handle, MONO_W32HANDLE_PROCESS, (gpointer*) &process_handle);
if (!res) {
- SetLastError (ERROR_INVALID_HANDLE);
+ mono_w32error_set_last (ERROR_INVALID_HANDLE);
return FALSE;
}
prio = -20;
break;
default:
- SetLastError (ERROR_INVALID_PARAMETER);
+ mono_w32error_set_last (ERROR_INVALID_PARAMETER);
return FALSE;
}
switch (errno) {
case EPERM:
case EACCES:
- SetLastError (ERROR_ACCESS_DENIED);
+ mono_w32error_set_last (ERROR_ACCESS_DENIED);
break;
case ESRCH:
- SetLastError (ERROR_PROC_NOT_FOUND);
+ mono_w32error_set_last (ERROR_PROC_NOT_FOUND);
break;
default:
- SetLastError (ERROR_GEN_FAILURE);
+ mono_w32error_set_last (ERROR_GEN_FAILURE);
}
}
return ret == 0;
#else
- SetLastError (ERROR_NOT_SUPPORTED);
+ mono_w32error_set_last (ERROR_NOT_SUPPORTED);
return FALSE;
#endif
}
if (dos_header->e_magic != IMAGE_DOS_SIGNATURE) {
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Bad dos signature 0x%x", __func__, dos_header->e_magic);
- SetLastError (ERROR_INVALID_DATA);
+ mono_w32error_set_last (ERROR_INVALID_DATA);
return(NULL);
}
if (map_size < sizeof(IMAGE_NT_HEADERS32) + GUINT32_FROM_LE (dos_header->e_lfanew)) {
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: File is too small: %d", __func__, map_size);
- SetLastError (ERROR_BAD_LENGTH);
+ mono_w32error_set_last (ERROR_BAD_LENGTH);
return(NULL);
}
if (nt_headers->Signature != IMAGE_NT_SIGNATURE) {
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Bad NT signature 0x%x", __func__, nt_headers->Signature);
- SetLastError (ERROR_INVALID_DATA);
+ mono_w32error_set_last (ERROR_INVALID_DATA);
return(NULL);
}
if (resource_rva == 0) {
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: No resources in file!", __func__);
- SetLastError (ERROR_INVALID_DATA);
+ mono_w32error_set_last (ERROR_INVALID_DATA);
return(NULL);
}
if (resource_dir == NULL) {
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Can't find resource directory", __func__);
- SetLastError (ERROR_INVALID_DATA);
+ mono_w32error_set_last (ERROR_INVALID_DATA);
return(NULL);
}
if (dos_header->e_magic != IMAGE_DOS_SIGNATURE) {
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Bad dos signature 0x%x", __func__, dos_header->e_magic);
- SetLastError (ERROR_INVALID_DATA);
+ mono_w32error_set_last (ERROR_INVALID_DATA);
return(NULL);
}
if (map_size < sizeof(IMAGE_NT_HEADERS64) + GUINT32_FROM_LE (dos_header->e_lfanew)) {
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: File is too small: %d", __func__, map_size);
- SetLastError (ERROR_BAD_LENGTH);
+ mono_w32error_set_last (ERROR_BAD_LENGTH);
return(NULL);
}
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Bad NT signature 0x%x", __func__,
nt_headers->Signature);
- SetLastError (ERROR_INVALID_DATA);
+ mono_w32error_set_last (ERROR_INVALID_DATA);
return(NULL);
}
if (resource_rva == 0) {
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: No resources in file!", __func__);
- SetLastError (ERROR_INVALID_DATA);
+ mono_w32error_set_last (ERROR_INVALID_DATA);
return(NULL);
}
if (resource_dir == NULL) {
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Can't find resource directory", __func__);
- SetLastError (ERROR_INVALID_DATA);
+ mono_w32error_set_last (ERROR_INVALID_DATA);
return(NULL);
}
if (filename_ext == NULL) {
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: unicode conversion returned NULL", __func__);
- SetLastError (ERROR_INVALID_NAME);
+ mono_w32error_set_last (ERROR_INVALID_NAME);
return(NULL);
}
g_free (filename_ext);
- SetLastError (_wapi_get_win32_file_error (errno));
+ mono_w32error_set_last (mono_w32error_unix_to_win32 (errno));
return NULL;
}
g_free (filename_ext);
g_free (located_filename);
- SetLastError (_wapi_get_win32_file_error (errno));
+ mono_w32error_set_last (mono_w32error_unix_to_win32 (errno));
return NULL;
}
if (fstat (fd, &statbuf) == -1) {
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Error stat()ing file %s: %s", __func__, filename_ext, strerror (errno));
- SetLastError (_wapi_get_win32_file_error (errno));
+ mono_w32error_set_last (mono_w32error_unix_to_win32 (errno));
g_free (filename_ext);
close (fd);
return(NULL);
if (statbuf.st_size < sizeof(IMAGE_DOS_HEADER)) {
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: File %s is too small: %lld", __func__, filename_ext, statbuf.st_size);
- SetLastError (ERROR_BAD_LENGTH);
+ mono_w32error_set_last (ERROR_BAD_LENGTH);
g_free (filename_ext);
close (fd);
return(NULL);
if (file_map == NULL) {
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Error mmap()int file %s: %s", __func__, filename_ext, strerror (errno));
- SetLastError (_wapi_get_win32_file_error (errno));
+ mono_w32error_set_last (mono_w32error_unix_to_win32 (errno));
g_free (filename_ext);
close (fd);
return(NULL);
#include <mono/metadata/threadpool-io.h>
#include <mono/utils/strenc.h>
#include <mono/utils/mono-proclib.h>
-#include <mono/io-layer/io-layer.h>
/* FIXME: fix this code to not depend so much on the internals */
#include <mono/metadata/class-internals.h>
#include <mono/metadata/w32handle.h>
+#include <mono/utils/w32api.h>
#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
#include <shellapi.h>
#include "class-internals.h"
#include "image.h"
#include "utils/mono-proclib.h"
-#include "io-layer/io-layer.h"
+#include "utils/w32api.h"
#define LOGDEBUG(...)
/* define LOGDEBUG(...) g_message(__VA_ARGS__) */
{
gpointer process_handle;
gpointer thread_handle;
- guint32 pid; /* Contains GetLastError () on failure */
+ guint32 pid; /* Contains mono_w32error_get_last () on failure */
guint32 tid;
MonoArray *env_variables;
MonoString *username;
#include "w32semaphore.h"
+#include "w32error.h"
#include "w32handle-namespace.h"
-#include "mono/io-layer/io-layer.h"
#include "mono/utils/mono-logger-internals.h"
#include "mono/metadata/w32handle.h"
if (handle == INVALID_HANDLE_VALUE) {
g_warning ("%s: error creating %s handle",
__func__, mono_w32handle_get_typename (type));
- SetLastError (ERROR_GEN_FAILURE);
+ mono_w32error_set_last (ERROR_GEN_FAILURE);
return NULL;
}
if (handle == INVALID_HANDLE_VALUE) {
/* The name has already been used for a different object. */
handle = NULL;
- SetLastError (ERROR_INVALID_HANDLE);
+ mono_w32error_set_last (ERROR_INVALID_HANDLE);
} else if (handle) {
/* Not an error, but this is how the caller is informed that the semaphore wasn't freshly created */
- SetLastError (ERROR_ALREADY_EXISTS);
+ mono_w32error_set_last (ERROR_ALREADY_EXISTS);
/* mono_w32handle_namespace_search_handle already adds a ref to the handle */
} else {
* for ERROR_ALREADY_EXISTS on success (!) to see if a
* semaphore was freshly created
*/
- SetLastError (ERROR_SUCCESS);
+ mono_w32error_set_last (ERROR_SUCCESS);
if (!name)
sem = sem_create (initialCount, maximumCount);
else
sem = namedsem_create (initialCount, maximumCount, mono_string_chars (name));
- *error = GetLastError ();
+ *error = mono_w32error_get_last ();
return sem;
}
MonoBoolean ret;
if (!handle) {
- SetLastError (ERROR_INVALID_HANDLE);
+ mono_w32error_set_last (ERROR_INVALID_HANDLE);
return FALSE;
}
case MONO_W32HANDLE_NAMEDSEM:
break;
default:
- SetLastError (ERROR_INVALID_HANDLE);
+ mono_w32error_set_last (ERROR_INVALID_HANDLE);
return FALSE;
}
#include <sys/socket.h>
#endif
-#include <mono/io-layer/io-layer.h>
+#include <mono/utils/w32api.h>
#ifndef HAVE_SOCKLEN_T
#define socklen_t int
typedef struct {
guint32 len;
gpointer buf;
-} WSABUF;
+} WSABUF, *LPWSABUF;
typedef struct {
gpointer Head;
guint32 HeadLength;
gpointer Tail;
guint32 TailLength;
-} TRANSMIT_FILE_BUFFERS;
+} TRANSMIT_FILE_BUFFERS, *LPTRANSMIT_FILE_BUFFERS;
typedef struct {
guint32 Data1;
gpointer handle2;
} OVERLAPPED;
-typedef BOOL (WINAPI *LPFN_DISCONNECTEX)(SOCKET, OVERLAPPED*, guint32, guint32);
-typedef BOOL (WINAPI *LPFN_TRANSMITFILE)(SOCKET, HANDLE, guint32, guint32, OVERLAPPED*, TRANSMIT_FILE_BUFFERS*, guint32);
-
#endif
void
mono_w32socket_recvfrom (SOCKET s, char *buf, int len, int flags, struct sockaddr *from, socklen_t *fromlen, gboolean blocking);
int
-mono_w32socket_recvbuffers (SOCKET s, WSABUF *lpBuffers, guint32 dwBufferCount, guint32 *lpNumberOfBytesRecvd, guint32 *lpFlags, gpointer lpOverlapped, gpointer lpCompletionRoutine, gboolean blocking);
+mono_w32socket_recvbuffers (SOCKET s, LPWSABUF lpBuffers, guint32 dwBufferCount, guint32 *lpNumberOfBytesRecvd, guint32 *lpFlags, gpointer lpOverlapped, gpointer lpCompletionRoutine, gboolean blocking);
int
mono_w32socket_send (SOCKET s, char *buf, int len, int flags, gboolean blocking);
mono_w32socket_sendto (SOCKET s, const char *buf, int len, int flags, const struct sockaddr *to, int tolen, gboolean blocking);
int
-mono_w32socket_sendbuffers (SOCKET s, WSABUF *lpBuffers, guint32 dwBufferCount, guint32 *lpNumberOfBytesRecvd, guint32 lpFlags, gpointer lpOverlapped, gpointer lpCompletionRoutine, gboolean blocking);
+mono_w32socket_sendbuffers (SOCKET s, LPWSABUF lpBuffers, guint32 dwBufferCount, guint32 *lpNumberOfBytesRecvd, guint32 lpFlags, gpointer lpOverlapped, gpointer lpCompletionRoutine, gboolean blocking);
#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT | HAVE_UWP_WINAPI_SUPPORT)
BOOL
-mono_w32socket_transmit_file (SOCKET hSocket, gpointer hFile, TRANSMIT_FILE_BUFFERS *lpTransmitBuffers, guint32 dwReserved, gboolean blocking);
+mono_w32socket_transmit_file (SOCKET hSocket, gpointer hFile, LPTRANSMIT_FILE_BUFFERS lpTransmitBuffers, guint32 dwReserved, gboolean blocking);
#endif
gint
mono_w32socket_ioctl (SOCKET sock, gint32 command, gchar *input, gint inputlen, gchar *output, gint outputlen, glong *written);
+gboolean
+mono_w32socket_close (SOCKET sock);
+
#endif /* HOST_WIN32 */
gint
#ifdef HAVE_SYS_SENDFILE_H
#include <sys/sendfile.h>
#endif
+#include <sys/stat.h>
#include "w32socket.h"
#include "w32socket-internals.h"
+#include "w32error.h"
#include "w32handle.h"
#include "utils/mono-logger-internals.h"
#include "utils/mono-poll.h"
}
if ((flags & TF_DISCONNECT) == TF_DISCONNECT)
- CloseHandle (handle);
+ mono_w32handle_close (handle);
return TRUE;
}
return 0;
}
+gboolean
+mono_w32socket_close (SOCKET sock)
+{
+ return mono_w32handle_close (GINT_TO_POINTER (sock));
+}
+
gint
mono_w32socket_set_blocking (SOCKET socket, gboolean blocking)
{
void
mono_w32socket_set_last_error (gint32 error)
{
- SetLastError (error);
+ mono_w32error_set_last (error);
}
gint32
mono_w32socket_get_last_error (void)
{
- return GetLastError ();
+ return mono_w32error_get_last ();
}
gint32
#include "w32socket.h"
#include "w32socket-internals.h"
+#include "utils/w32api.h"
+
#define LOGDEBUG(...)
void
#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;
boehm_libs= \
$(monodir)/mono/metadata/libmonoruntime.la \
- $(monodir)/mono/io-layer/libwapi.la \
$(monodir)/mono/utils/libmonoutils.la \
$(GLIB_LIBS) $(LIBICONV) \
$(libgc_libs)
sgen_libs = \
$(monodir)/mono/metadata/libmonoruntimesgen.la \
$(monodir)/mono/sgen/libmonosgen.la \
- $(monodir)/mono/io-layer/libwapi.la \
$(monodir)/mono/utils/libmonoutils.la \
$(GLIB_LIBS) $(LIBICONV)
boehm_static_libs= \
$(monodir)/mono/metadata/libmonoruntime-static.la \
- $(monodir)/mono/io-layer/libwapi.la \
$(monodir)/mono/utils/libmonoutils.la \
$(GLIB_LIBS) $(LIBICONV) \
$(libgc_static_libs)
sgen_static_libs = \
$(monodir)/mono/metadata/libmonoruntimesgen-static.la \
$(monodir)/mono/sgen/libmonosgen-static.la \
- $(monodir)/mono/io-layer/libwapi.la \
$(monodir)/mono/utils/libmonoutils.la \
$(GLIB_LIBS) $(LIBICONV)
#include <mono/utils/json.h>
#include <mono/utils/mono-threads-coop.h>
#include <mono/profiler/mono-profiler-aot.h>
-#include <mono/io-layer/io-layer.h>
+#include <mono/utils/w32api.h>
#include "aot-compiler.h"
#include "seq-points.h"
#include "debugger-agent.h"
#include "mini.h"
#include "seq-points.h"
-#include <mono/io-layer/io-layer.h>
+#include <mono/utils/w32api.h>
/*
* On iOS we can't use System.Environment.Exit () as it will do the wrong
#include <mono/metadata/marshal.h>
#include <mono/metadata/appdomain.h>
#include <mono/metadata/debug-helpers.h>
-#include <mono/io-layer/io-layer.h>
#include "mono/metadata/profiler.h"
#include <mono/metadata/profiler-private.h>
#include <mono/metadata/mono-config.h>
#include <mono/metadata/threads.h>
#include <mono/metadata/appdomain.h>
#include <mono/metadata/debug-helpers.h>
-#include <mono/io-layer/io-layer.h>
#include "mono/metadata/profiler.h"
#include <mono/metadata/profiler-private.h>
#include <mono/metadata/mono-config.h>
#include <mono/metadata/threads.h>
#include <mono/metadata/appdomain.h>
#include <mono/metadata/debug-helpers.h>
-#include <mono/io-layer/io-layer.h>
#include "mono/metadata/profiler.h"
#include <mono/metadata/profiler-private.h>
#include <mono/metadata/mono-config.h>
#include <mono/utils/mono-threads-coop.h>
#include <mono/utils/checked-build.h>
#include <mono/metadata/w32handle.h>
-#include <mono/io-layer/io-layer.h>
#include "mini.h"
#include "seq-points.h"
#include <mono/metadata/threads.h>
#include <mono/metadata/appdomain.h>
#include <mono/metadata/debug-helpers.h>
-#include <mono/io-layer/io-layer.h>
#include "mono/metadata/profiler.h"
#include <mono/metadata/profiler-private.h>
#include <mono/metadata/mono-config.h>
#include <mono/utils/dtrace.h>
#include <mono/utils/mono-threads.h>
#include <mono/utils/mono-threads-coop.h>
-#include <mono/io-layer/io-layer.h>
#include "mini.h"
#include "seq-points.h"
noinst_LTLIBRARIES = libtestlib.la
libtestlib_la_SOURCES =
-libtestlib_la_LIBADD = ../metadata/libmonoruntimesgen.la ../sgen/libmonosgen.la ../utils/libmonoutils.la ../io-layer/libwapi.la
+libtestlib_la_LIBADD = ../metadata/libmonoruntimesgen.la ../sgen/libmonosgen.la ../utils/libmonoutils.la
test_sgen_qsort_SOURCES = test-sgen-qsort.c
test_sgen_qsort_CFLAGS = $(test_cflags)
#include <mono/utils/mono-mmap.h>
#include <mono/utils/mono-threads.h>
#include <mono/utils/mono-counters.h>
-#include <mono/io-layer/io-layer.h>
#endif
typedef struct {
#include "mono-mmap.h"
#include "mono-counters.h"
#include "dlmalloc.h"
-#include <mono/io-layer/io-layer.h>
#include <mono/metadata/profiler-private.h>
#ifdef HAVE_VALGRIND_MEMCHECK_H
#include <valgrind/memcheck.h>
#include <mono/utils/mono-threads-coop.h>
#include <mono/utils/mono-threads-debug.h>
#include <mono/utils/os-event.h>
-
-#include <mono/io-layer/io-layer.h>
+#include <mono/utils/w32api.h>
#include <errno.h>
--- /dev/null
+
+#ifndef __MONO_UTILS_W32API_H__
+#define __MONO_UTILS_W32API_H__
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+#ifndef HOST_WIN32
+
+#define WAIT_FAILED ((gint) 0xFFFFFFFF)
+#define WAIT_OBJECT_0 ((gint) 0x00000000)
+#define WAIT_ABANDONED_0 ((gint) 0x00000080)
+#define WAIT_TIMEOUT ((gint) 0x00000102)
+#define WAIT_IO_COMPLETION ((gint) 0x000000C0)
+
+#define WINAPI
+
+typedef guint32 DWORD;
+typedef gboolean BOOL;
+typedef gint32 LONG;
+typedef guint32 ULONG;
+typedef guint UINT;
+
+typedef gpointer HANDLE;
+typedef gpointer HMODULE;
+
+#else
+
+#define __USE_W32_SOCKETS
+#include <winsock2.h>
+#include <windows.h>
+#include <winbase.h>
+/* The mingw version says: /usr/i686-pc-mingw32/sys-root/mingw/include/ws2tcpip.h:38:2: error: #error "ws2tcpip.h is not compatible with winsock.h. Include winsock2.h instead." */
+#ifdef _MSC_VER
+#include <ws2tcpip.h>
+#endif
+#include <psapi.h>
+
+/* Workaround for missing WSAPOLLFD typedef in mingw's winsock2.h
+ * that is required for mswsock.h below. Remove once
+ * http://sourceforge.net/p/mingw/bugs/1980/ is fixed. */
+#if defined(__MINGW_MAJOR_VERSION) && __MINGW_MAJOR_VERSION == 4
+typedef struct pollfd {
+ SOCKET fd;
+ short events;
+ short revents;
+} WSAPOLLFD, *PWSAPOLLFD, *LPWSAPOLLFD;
+#endif
+
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
+#include <mswsock.h>
+#endif
+
+#endif /* HOST_WIN32 */
+
+G_END_DECLS
+
+#endif /* __MONO_UTILS_W32API_H__ */
<ClCompile Include="..\mono\metadata\property-bag.c" />\r
<ClCompile Include="..\mono\metadata\w32socket-win32.c" />\r
<ClCompile Include="..\mono\metadata\w32file-win32.c" />\r
+ <ClCompile Include="..\mono\metadata\w32error-win32.c" />\r
<ClCompile Include="..\mono\metadata\icall-windows.c" />\r
<ClCompile Include="..\mono\metadata\marshal-windows.c" />\r
<ClCompile Include="..\mono\metadata\mono-security-windows.c" />\r
<ClInclude Include="..\mono\metadata\w32file-internals.h" />\r
<ClInclude Include="..\mono\metadata\w32file-win32-internals.h" />\r
<ClInclude Include="..\mono\metadata\w32file.h" />\r
+ <ClInclude Include="..\mono\metadata\w32error.h" />\r
+ <ClInclude Include="..\mono\metadata\w32api.h" />\r
<ClInclude Include="..\mono\metadata\filewatcher.h" />\r
<ClInclude Include="..\mono\metadata\gc-internals.h" />\r
<ClInclude Include="..\mono\metadata\handle.h" />\r
<ClCompile Include="..\mono\metadata\w32file-win32.c">\r
<Filter>Source Files</Filter>\r
</ClCompile>\r
+ <ClCompile Include="..\mono\metadata\w32error-win32.c">\r
+ <Filter>Source Files</Filter>\r
+ </ClCompile>\r
<ClCompile Include="..\mono\metadata\icall-windows.c">\r
<Filter>Source Files</Filter>\r
</ClCompile>\r
<ClInclude Include="..\mono\metadata\w32file.h">\r
<Filter>Header Files</Filter>\r
</ClInclude>\r
+ <ClInclude Include="..\mono\metadata\w32error.h">\r
+ <Filter>Header Files</Filter>\r
+ </ClInclude>\r
+ <ClInclude Include="..\mono\metadata\w32api.h">\r
+ <Filter>Header Files</Filter>\r
+ </ClInclude>\r
<ClInclude Include="..\mono\metadata\filewatcher.h">\r
<Filter>Header Files</Filter>\r
</ClInclude>\r
<ClCompile Include="..\mono\metadata\environment.c" />\r
<ClCompile Include="..\mono\metadata\w32file-win32.c" />\r
<ClCompile Include="..\mono\metadata\w32file.c" />\r
+ <ClCompile Include="..\mono\metadata\w32error-win32.c" />\r
<ClCompile Include="..\mono\metadata\filewatcher.c" />\r
<ClCompile Include="..\mono\metadata\gc.c" />\r
<ClCompile Include="..\mono\metadata\icall-windows.c" />\r
<ClCompile Include="..\mono\metadata\w32file-win32.c">\r
<Filter>Source Files</Filter>\r
</ClCompile>\r
+ <ClCompile Include="..\mono\metadata\w32error-win32.c">\r
+ <Filter>Source Files</Filter>\r
+ </ClCompile>\r
</ItemGroup>\r
<ItemGroup>\r
<Filter Include="Header Files">\r
#include "mono/metadata/class.h"
#include "mono/metadata/object.h"
#include "mono/metadata/tabledefs.h"
-#include "mono/io-layer/wapi.h"
typedef struct {
const char *fname;
else
static_libs= \
$(top_builddir)/mono/metadata/libmonoruntimesgen-static.la \
- $(top_builddir)/mono/io-layer/libwapi.la \
$(top_builddir)/mono/utils/libmonoutils.la \
$(GLIB_LIBS) $(LIBICONV) \
$(LIBGC_STATIC_LIBS)
pedump_LDADD = \
$(top_builddir)/mono/metadata/libmonoruntimesgen-static.la \
$(top_builddir)/mono/sgen/libmonosgen-static.la \
- $(top_builddir)/mono/io-layer/libwapi.la \
$(top_builddir)/mono/utils/libmonoutils.la \
$(LLVM_LIBS) \
$(LLVM_LDFLAGS) \