* (C) 2002 Ximian, Inc.
* Copyright (c) 2002-2006 Novell, Inc.
* Copyright 2011 Xamarin Inc (http://www.xamarin.com).
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
*/
#include <config.h>
#include <mono/io-layer/timefuncs-private.h>
#include <mono/io-layer/thread-private.h>
#include <mono/io-layer/io-portability.h>
+#include <mono/io-layer/io-trace.h>
#include <mono/utils/strenc.h>
#include <mono/utils/mono-once.h>
-
-#if 0
-#define DEBUG(...) g_message(__VA_ARGS__)
-#define DEBUG_ENABLED 1
-#else
-#define DEBUG(...)
-#endif
+#include <mono/utils/mono-logger-internals.h>
static void file_close (gpointer handle, gpointer data);
static WapiFileType file_getfiletype(void);
* This is is a best effort kind of thing. It assumes a reasonable sane set
* of permissions by the underlying OS.
*
- * We assume that basic unix permission bits are authoritative. Which might not
+ * We generally assume that basic unix permission bits are authoritative. Which might not
* be the case under systems with extended permissions systems (posix ACLs, SELinux, OSX/iOS sandboxing, etc)
*
* The choice of access as the fallback is due to the expected lower overhead compared to trying to open the file.
static gboolean
is_file_writable (struct stat *st, const char *path)
{
+#if __APPLE__
+ // OS X Finder "locked" or `ls -lO` "uchg".
+ // This only covers one of several cases where an OS X file could be unwritable through special flags.
+ if (st->st_flags & (UF_IMMUTABLE|SF_IMMUTABLE))
+ return 0;
+#endif
+
/* Is it globally writable? */
if (st->st_mode & S_IWOTH)
return 1;
struct _WapiHandle_file *file_handle = (struct _WapiHandle_file *)data;
int fd = file_handle->fd;
- DEBUG("%s: closing file handle %p [%s]", __func__, handle,
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: closing file handle %p [%s]", __func__, handle,
file_handle->filename);
if (file_handle->attrs & FILE_FLAG_DELETE_ON_CLOSE)
if(!(file_handle->fileaccess & GENERIC_READ) &&
!(file_handle->fileaccess & GENERIC_ALL)) {
- DEBUG("%s: handle %p doesn't have GENERIC_READ access: %u",
+ 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);
if(ret==-1) {
gint err = errno;
- DEBUG("%s: read of handle %p error: %s", __func__,
+ 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));
return(FALSE);
if(!(file_handle->fileaccess & GENERIC_WRITE) &&
!(file_handle->fileaccess & GENERIC_ALL)) {
- DEBUG("%s: handle %p doesn't have GENERIC_WRITE access: %u", __func__, handle, file_handle->fileaccess);
+ 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);
return(FALSE);
*/
current_pos = lseek (fd, (off_t)0, SEEK_CUR);
if (current_pos == -1) {
- DEBUG ("%s: handle %p lseek failed: %s", __func__,
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p lseek failed: %s", __func__,
handle, strerror (errno));
_wapi_set_last_error_from_errno ();
return(FALSE);
} else {
_wapi_set_last_error_from_errno ();
- DEBUG("%s: write of handle %p error: %s",
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: write of handle %p error: %s",
__func__, handle, strerror(errno));
return(FALSE);
if(!(file_handle->fileaccess & GENERIC_WRITE) &&
!(file_handle->fileaccess & GENERIC_ALL)) {
- DEBUG("%s: handle %p doesn't have GENERIC_WRITE access: %u", __func__, handle, file_handle->fileaccess);
+ 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);
return(FALSE);
ret=fsync(fd);
if (ret==-1) {
- DEBUG("%s: fsync of handle %p error: %s", __func__, handle,
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: fsync of handle %p error: %s", __func__, handle,
strerror(errno));
_wapi_set_last_error_from_errno ();
if(!(file_handle->fileaccess & GENERIC_READ) &&
!(file_handle->fileaccess & GENERIC_WRITE) &&
!(file_handle->fileaccess & GENERIC_ALL)) {
- DEBUG ("%s: handle %p doesn't have GENERIC_READ or GENERIC_WRITE access: %u", __func__, handle, file_handle->fileaccess);
+ 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);
return(INVALID_SET_FILE_POINTER);
whence=SEEK_END;
break;
default:
- DEBUG("%s: invalid seek type %d", __func__, method);
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: invalid seek type %d", __func__, method);
SetLastError (ERROR_INVALID_PARAMETER);
return(INVALID_SET_FILE_POINTER);
#ifdef HAVE_LARGE_FILE_SUPPORT
if(highmovedistance==NULL) {
offset=movedistance;
- DEBUG("%s: setting offset to %lld (low %d)", __func__,
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: setting offset to %lld (low %d)", __func__,
offset, movedistance);
} else {
offset=((gint64) *highmovedistance << 32) | (guint32)movedistance;
- DEBUG("%s: setting offset to %lld 0x%llx (high %d 0x%x, low %d 0x%x)", __func__, offset, offset, *highmovedistance, *highmovedistance, movedistance, movedistance);
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: setting offset to %lld 0x%llx (high %d 0x%x, low %d 0x%x)", __func__, offset, offset, *highmovedistance, *highmovedistance, movedistance, movedistance);
}
#else
offset=movedistance;
#endif
- DEBUG ("%s: moving handle %p by %lld bytes from %d", __func__,
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: moving handle %p by %lld bytes from %d", __func__,
handle, (long long)offset, whence);
#ifdef PLATFORM_ANDROID
newpos=lseek(fd, offset, whence);
#endif
if(newpos==-1) {
- DEBUG("%s: lseek on handle %p returned error %s",
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: lseek on handle %p returned error %s",
__func__, handle, strerror(errno));
_wapi_set_last_error_from_errno ();
return(INVALID_SET_FILE_POINTER);
}
- DEBUG ("%s: lseek returns %lld", __func__, newpos);
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: lseek returns %lld", __func__, newpos);
#ifdef HAVE_LARGE_FILE_SUPPORT
ret=newpos & 0xFFFFFFFF;
}
#endif
- DEBUG ("%s: move of handle %p returning %d/%d", __func__,
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: move of handle %p returning %d/%d", __func__,
handle, ret, highmovedistance==NULL?0:*highmovedistance);
return(ret);
if(!(file_handle->fileaccess & GENERIC_WRITE) &&
!(file_handle->fileaccess & GENERIC_ALL)) {
- DEBUG("%s: handle %p doesn't have GENERIC_WRITE access: %u", __func__, handle, file_handle->fileaccess);
+ 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);
return(FALSE);
ret=fstat(fd, &statbuf);
if(ret==-1) {
- DEBUG ("%s: handle %p fstat failed: %s", __func__,
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p fstat failed: %s", __func__,
handle, strerror(errno));
_wapi_set_last_error_from_errno ();
pos=lseek(fd, (off_t)0, SEEK_CUR);
if(pos==-1) {
- DEBUG("%s: handle %p lseek failed: %s", __func__,
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p lseek failed: %s", __func__,
handle, strerror(errno));
_wapi_set_last_error_from_errno ();
!_wapi_thread_cur_apc_pending());
if(ret==-1) {
- DEBUG("%s: handle %p extend write failed: %s", __func__, handle, strerror(errno));
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p extend write failed: %s", __func__, handle, strerror(errno));
_wapi_set_last_error_from_errno ();
return(FALSE);
/* And put the file position back after the write */
ret = lseek (fd, pos, SEEK_SET);
if (ret == -1) {
- DEBUG ("%s: handle %p second lseek failed: %s",
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p second lseek failed: %s",
__func__, handle, strerror(errno));
_wapi_set_last_error_from_errno ();
}
while (ret==-1 && errno==EINTR && !_wapi_thread_cur_apc_pending());
if(ret==-1) {
- DEBUG("%s: handle %p ftruncate failed: %s", __func__,
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p ftruncate failed: %s", __func__,
handle, strerror(errno));
_wapi_set_last_error_from_errno ();
if(!(file_handle->fileaccess & GENERIC_READ) &&
!(file_handle->fileaccess & GENERIC_WRITE) &&
!(file_handle->fileaccess & GENERIC_ALL)) {
- DEBUG("%s: handle %p doesn't have GENERIC_READ or GENERIC_WRITE access: %u", __func__, handle, file_handle->fileaccess);
+ 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);
return(INVALID_FILE_SIZE);
ret = fstat(fd, &statbuf);
if (ret == -1) {
- DEBUG ("%s: handle %p fstat failed: %s", __func__,
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p fstat failed: %s", __func__,
handle, strerror(errno));
_wapi_set_last_error_from_errno ();
if (S_ISBLK(statbuf.st_mode)) {
guint64 bigsize;
if (ioctl(fd, BLKGETSIZE64, &bigsize) < 0) {
- DEBUG ("%s: handle %p ioctl BLKGETSIZE64 failed: %s",
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p ioctl BLKGETSIZE64 failed: %s",
__func__, handle, strerror(errno));
_wapi_set_last_error_from_errno ();
*highsize = bigsize>>32;
}
- DEBUG ("%s: Returning block device size %d/%d",
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Returning block device size %d/%d",
__func__, size, *highsize);
return(size);
size = statbuf.st_size;
#endif
- DEBUG ("%s: Returning size %d/%d", __func__, size, *highsize);
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Returning size %d/%d", __func__, size, *highsize);
return(size);
}
if(!(file_handle->fileaccess & GENERIC_READ) &&
!(file_handle->fileaccess & GENERIC_ALL)) {
- DEBUG("%s: handle %p doesn't have GENERIC_READ access: %u",
+ 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);
ret=fstat(fd, &statbuf);
if(ret==-1) {
- DEBUG("%s: handle %p fstat failed: %s", __func__, handle,
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p fstat failed: %s", __func__, handle,
strerror(errno));
_wapi_set_last_error_from_errno ();
return(FALSE);
}
- DEBUG("%s: atime: %ld ctime: %ld mtime: %ld", __func__,
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: atime: %ld ctime: %ld mtime: %ld", __func__,
statbuf.st_atime, statbuf.st_ctime,
statbuf.st_mtime);
access_ticks=((guint64)statbuf.st_atime*10000000)+116444736000000000ULL;
write_ticks=((guint64)statbuf.st_mtime*10000000)+116444736000000000ULL;
- DEBUG("%s: aticks: %llu cticks: %llu wticks: %llu", __func__,
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: aticks: %llu cticks: %llu wticks: %llu", __func__,
access_ticks, create_ticks, write_ticks);
if(create_time!=NULL) {
if(!(file_handle->fileaccess & GENERIC_WRITE) &&
!(file_handle->fileaccess & GENERIC_ALL)) {
- DEBUG("%s: handle %p doesn't have GENERIC_WRITE access: %u", __func__, handle, file_handle->fileaccess);
+ 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);
return(FALSE);
}
if(file_handle->filename == NULL) {
- DEBUG("%s: handle %p unknown filename", __func__, handle);
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p unknown filename", __func__, handle);
SetLastError (ERROR_INVALID_HANDLE);
return(FALSE);
*/
ret=fstat (fd, &statbuf);
if(ret==-1) {
- DEBUG("%s: handle %p fstat failed: %s", __func__, handle,
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p fstat failed: %s", __func__, handle,
strerror(errno));
SetLastError (ERROR_INVALID_PARAMETER);
* but this will do for now.
*/
if (access_ticks < 116444736000000000ULL) {
- DEBUG ("%s: attempt to set access time too early",
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: attempt to set access time too early",
__func__);
SetLastError (ERROR_INVALID_PARAMETER);
return(FALSE);
* but this will do for now.
*/
if (write_ticks < 116444736000000000ULL) {
- DEBUG ("%s: attempt to set write time too early",
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: attempt to set write time too early",
__func__);
SetLastError (ERROR_INVALID_PARAMETER);
return(FALSE);
utbuf.modtime=statbuf.st_mtime;
}
- DEBUG ("%s: setting handle %p access %ld write %ld", __func__,
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: setting handle %p access %ld write %ld", __func__,
handle, utbuf.actime, utbuf.modtime);
ret = _wapi_utime (file_handle->filename, &utbuf);
if (ret == -1) {
- DEBUG ("%s: handle %p [%s] utime failed: %s", __func__,
+ 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);
struct _WapiHandle_file *console_handle = (struct _WapiHandle_file *)data;
int fd = console_handle->fd;
- DEBUG("%s: closing console handle %p", __func__, handle);
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: closing console handle %p", __func__, handle);
g_free (console_handle->filename);
- if (fd > 2)
+ if (fd > 2) {
+ if (console_handle->share_info)
+ _wapi_handle_share_release (console_handle->share_info);
close (fd);
+ }
}
static WapiFileType console_getfiletype(void)
if(!(console_handle->fileaccess & GENERIC_READ) &&
!(console_handle->fileaccess & GENERIC_ALL)) {
- DEBUG ("%s: handle %p doesn't have GENERIC_READ access: %u",
+ 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);
} while (ret==-1 && errno==EINTR && !_wapi_thread_cur_apc_pending());
if(ret==-1) {
- DEBUG("%s: read of handle %p error: %s", __func__, handle,
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: read of handle %p error: %s", __func__, handle,
strerror(errno));
_wapi_set_last_error_from_errno ();
if(!(console_handle->fileaccess & GENERIC_WRITE) &&
!(console_handle->fileaccess & GENERIC_ALL)) {
- DEBUG("%s: handle %p doesn't have GENERIC_WRITE access: %u", __func__, handle, console_handle->fileaccess);
+ 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);
return(FALSE);
} else {
_wapi_set_last_error_from_errno ();
- DEBUG ("%s: write of handle %p error: %s",
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: write of handle %p error: %s",
__func__, handle, strerror(errno));
return(FALSE);
struct _WapiHandle_file *pipe_handle = (struct _WapiHandle_file*)data;
int fd = pipe_handle->fd;
- DEBUG("%s: closing pipe handle %p", __func__, handle);
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: closing pipe handle %p", __func__, handle);
/* No filename with pipe handles */
+ if (pipe_handle->share_info)
+ _wapi_handle_share_release (pipe_handle->share_info);
+
close (fd);
}
if(!(pipe_handle->fileaccess & GENERIC_READ) &&
!(pipe_handle->fileaccess & GENERIC_ALL)) {
- DEBUG("%s: handle %p doesn't have GENERIC_READ access: %u",
+ 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);
return(FALSE);
}
- DEBUG ("%s: reading up to %d bytes from pipe %p", __func__,
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: reading up to %d bytes from pipe %p", __func__,
numbytes, handle);
do {
} else {
_wapi_set_last_error_from_errno ();
- DEBUG("%s: read of handle %p error: %s", __func__,
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: read of handle %p error: %s", __func__,
handle, strerror(errno));
return(FALSE);
}
}
- DEBUG ("%s: read %d bytes from pipe", __func__, ret);
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: read %d bytes from pipe %p", __func__, ret, handle);
if(bytesread!=NULL) {
*bytesread=ret;
if(!(pipe_handle->fileaccess & GENERIC_WRITE) &&
!(pipe_handle->fileaccess & GENERIC_ALL)) {
- DEBUG("%s: handle %p doesn't have GENERIC_WRITE access: %u", __func__, handle, pipe_handle->fileaccess);
+ 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);
return(FALSE);
}
- DEBUG ("%s: writing up to %d bytes to pipe %p", __func__, numbytes,
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: writing up to %d bytes to pipe %p", __func__, numbytes,
handle);
do {
} else {
_wapi_set_last_error_from_errno ();
- DEBUG("%s: write of handle %p error: %s", __func__,
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: write of handle %p error: %s", __func__,
handle, strerror(errno));
return(FALSE);
flags=O_RDWR;
break;
default:
- DEBUG("%s: Unknown access type 0x%x", __func__,
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Unknown access type 0x%x", __func__,
fileaccess);
break;
}
flags|=O_TRUNC;
break;
default:
- DEBUG("%s: Unknown create mode 0x%x", __func__,
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Unknown create mode 0x%x", __func__,
createmode);
break;
}
*/
if (file_existing_share == 0) {
/* Quick and easy, no possibility to share */
- DEBUG ("%s: Share mode prevents open: requested access: 0x%x, file has sharing = NONE", __func__, fileaccess);
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Share mode prevents open: requested access: 0x%x, file has sharing = NONE", __func__, fileaccess);
_wapi_handle_share_release (*share_info);
((file_existing_share == FILE_SHARE_WRITE) &&
(fileaccess != GENERIC_WRITE))) {
/* New access mode doesn't match up */
- DEBUG ("%s: Share mode prevents open: requested access: 0x%x, file has sharing: 0x%x", __func__, fileaccess, file_existing_share);
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Share mode prevents open: requested access: 0x%x, file has sharing: 0x%x", __func__, fileaccess, file_existing_share);
_wapi_handle_share_release (*share_info);
((file_existing_access & GENERIC_WRITE) &&
!(sharemode & FILE_SHARE_WRITE))) {
/* New share mode doesn't match up */
- DEBUG ("%s: Access mode prevents open: requested share: 0x%x, file has access: 0x%x", __func__, sharemode, file_existing_access);
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Access mode prevents open: requested share: 0x%x, file has access: 0x%x", __func__, sharemode, file_existing_access);
_wapi_handle_share_release (*share_info);
return(FALSE);
}
} else {
- DEBUG ("%s: New file!", __func__);
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: New file!", __func__);
}
return(TRUE);
*/
if (file_existing_share == 0) {
/* Quick and easy, no possibility to share */
- DEBUG ("%s: Share mode prevents open: requested access: 0x%x, file has sharing = NONE", __func__, fileaccess);
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Share mode prevents open: requested access: 0x%x, file has sharing = NONE", __func__, (*share_info)->access);
_wapi_handle_share_release (*share_info);
if (!(file_existing_share & FILE_SHARE_DELETE)) {
/* New access mode doesn't match up */
- DEBUG ("%s: Share mode prevents open: requested access: 0x%x, file has sharing: 0x%x", __func__, fileaccess, file_existing_share);
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Share mode prevents open: requested access: 0x%x, file has sharing: 0x%x", __func__, (*share_info)->access, file_existing_share);
_wapi_handle_share_release (*share_info);
return(FALSE);
}
} else {
- DEBUG ("%s: New file!", __func__);
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: New file!", __func__);
}
return(TRUE);
share_info) == TRUE) {
return (TRUE);
}
-
- /* Still violating. It's possible that a process crashed
- * while still holding a file handle, and that a non-mono
- * process has the file open. (For example, C-c mcs while
- * editing a source file.) As a last resort, run a handle
- * collection, which will remove stale share entries.
- */
- _wapi_handle_collect ();
return(share_allows_open (statbuf, sharemode, fileaccess, share_info));
}
}
if (name == NULL) {
- DEBUG ("%s: name is NULL", __func__);
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: name is NULL", __func__);
SetLastError (ERROR_INVALID_NAME);
return(INVALID_HANDLE_VALUE);
filename = mono_unicode_to_external (name);
if (filename == NULL) {
- DEBUG("%s: unicode conversion returned NULL", __func__);
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: unicode conversion returned NULL", __func__);
SetLastError (ERROR_INVALID_NAME);
return(INVALID_HANDLE_VALUE);
}
- DEBUG ("%s: Opening %s with share 0x%x and access 0x%x", __func__,
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Opening %s with share 0x%x and access 0x%x", __func__,
filename, sharemode, fileaccess);
fd = _wapi_open (filename, flags, perms);
}
if (fd == -1) {
- DEBUG("%s: Error opening file %s: %s", __func__, filename,
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Error opening file %s: %s", __func__, filename,
strerror(errno));
_wapi_set_last_path_error_from_errno (NULL, filename);
g_free (filename);
}
if (fd >= _wapi_fd_reserve) {
- DEBUG ("%s: File descriptor is too big", __func__);
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: File descriptor is too big", __func__);
SetLastError (ERROR_TOO_MANY_OPEN_FILES);
ret = fstat (fd, &statbuf);
if (ret == -1) {
- DEBUG ("%s: fstat error of file %s: %s", __func__,
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: fstat error of file %s: %s", __func__,
filename, strerror (errno));
_wapi_set_last_error_from_errno ();
g_free (filename);
}
if (file_handle.share_info == NULL) {
/* No space, so no more files can be opened */
- DEBUG ("%s: No space in the share table", __func__);
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: No space in the share table", __func__);
SetLastError (ERROR_TOO_MANY_OPEN_FILES);
close (fd);
#endif
if (S_ISFIFO (statbuf.st_mode)) {
handle_type = WAPI_HANDLE_PIPE;
+ /* maintain invariant that pipes have no filename */
+ file_handle.filename = NULL;
+ g_free (filename);
+ filename = NULL;
} else if (S_ISCHR (statbuf.st_mode)) {
handle_type = WAPI_HANDLE_CONSOLE;
} else {
return(INVALID_HANDLE_VALUE);
}
- DEBUG("%s: returning handle %p", __func__, handle);
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: returning handle %p", __func__, handle);
return(handle);
}
#endif
if(name==NULL) {
- DEBUG("%s: name is NULL", __func__);
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: name is NULL", __func__);
SetLastError (ERROR_INVALID_NAME);
return(FALSE);
filename=mono_unicode_to_external(name);
if(filename==NULL) {
- DEBUG("%s: unicode conversion returned NULL", __func__);
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: unicode conversion returned NULL", __func__);
SetLastError (ERROR_INVALID_NAME);
return(FALSE);
attrs = GetFileAttributes (name);
if (attrs == INVALID_FILE_ATTRIBUTES) {
- DEBUG ("%s: file attributes error", __func__);
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: file attributes error", __func__);
/* Error set by GetFileAttributes() */
g_free (filename);
return(FALSE);
struct _WapiFileShare *shareinfo;
if(name==NULL) {
- DEBUG("%s: name is NULL", __func__);
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: name is NULL", __func__);
SetLastError (ERROR_INVALID_NAME);
return(FALSE);
utf8_name = mono_unicode_to_external (name);
if (utf8_name == NULL) {
- DEBUG ("%s: unicode conversion returned NULL", __func__);
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: unicode conversion returned NULL", __func__);
SetLastError (ERROR_INVALID_NAME);
return FALSE;
}
if(dest_name==NULL) {
- DEBUG("%s: name is NULL", __func__);
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: name is NULL", __func__);
g_free (utf8_name);
SetLastError (ERROR_INVALID_NAME);
utf8_dest_name = mono_unicode_to_external (dest_name);
if (utf8_dest_name == NULL) {
- DEBUG ("%s: unicode conversion returned NULL", __func__);
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: unicode conversion returned NULL", __func__);
g_free (utf8_name);
SetLastError (ERROR_INVALID_NAME);
if (report_errors)
_wapi_set_last_error_from_errno ();
- DEBUG ("%s: write failed.", __func__);
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: write failed.", __func__);
free (buf);
return FALSE;
}
int ret_utime;
if(name==NULL) {
- DEBUG("%s: name is NULL", __func__);
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: name is NULL", __func__);
SetLastError (ERROR_INVALID_NAME);
return(FALSE);
utf8_src = mono_unicode_to_external (name);
if (utf8_src == NULL) {
- DEBUG ("%s: unicode conversion of source returned NULL",
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: unicode conversion of source returned NULL",
__func__);
SetLastError (ERROR_INVALID_PARAMETER);
}
if(dest_name==NULL) {
- DEBUG("%s: dest is NULL", __func__);
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: dest is NULL", __func__);
g_free (utf8_src);
SetLastError (ERROR_INVALID_NAME);
utf8_dest = mono_unicode_to_external (dest_name);
if (utf8_dest == NULL) {
- DEBUG ("%s: unicode conversion of dest returned NULL",
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: unicode conversion of dest returned NULL",
__func__);
SetLastError (ERROR_INVALID_PARAMETER);
dest_time.actime = st.st_atime;
ret_utime = utime (utf8_dest, &dest_time);
if (ret_utime == -1)
- DEBUG ("%s: file [%s] utime failed: %s", __func__, utf8_dest, strerror(errno));
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: file [%s] utime failed: %s", __func__, utf8_dest, strerror(errno));
g_free (utf8_src);
g_free (utf8_dest);
gchar *utf8_ret;
if (arg == NULL) {
- DEBUG ("%s: %s is NULL", __func__, arg_name);
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: %s is NULL", __func__, arg_name);
SetLastError (ERROR_INVALID_NAME);
return NULL;
}
utf8_ret = mono_unicode_to_external (arg);
if (utf8_ret == NULL) {
- DEBUG ("%s: unicode conversion of %s returned 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);
return NULL;
break;
default:
- DEBUG("%s: unknown standard handle type", __func__);
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: unknown standard handle type", __func__);
SetLastError (ERROR_INVALID_PARAMETER);
return(INVALID_HANDLE_VALUE);
const guint16 *ip;
if(system_time==NULL) {
- DEBUG("%s: system_time NULL", __func__);
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: system_time NULL", __func__);
SetLastError (ERROR_INVALID_PARAMETER);
return(FALSE);
* year and day calculation to work later
*/
if(file_ticks<0) {
- DEBUG("%s: file_time too big", __func__);
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: file_time too big", __func__);
SetLastError (ERROR_INVALID_PARAMETER);
return(FALSE);
totaldays=(file_ticks / TICKS_PER_DAY);
rem = file_ticks % TICKS_PER_DAY;
- DEBUG("%s: totaldays: %lld rem: %lld", __func__, totaldays, rem);
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: totaldays: %lld rem: %lld", __func__, totaldays, rem);
system_time->wHour=rem/TICKS_PER_HOUR;
rem %= TICKS_PER_HOUR;
- DEBUG("%s: Hour: %d rem: %lld", __func__, system_time->wHour, rem);
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Hour: %d rem: %lld", __func__, system_time->wHour, rem);
system_time->wMinute = rem / TICKS_PER_MINUTE;
rem %= TICKS_PER_MINUTE;
- DEBUG("%s: Minute: %d rem: %lld", __func__, system_time->wMinute,
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Minute: %d rem: %lld", __func__, system_time->wMinute,
rem);
system_time->wSecond = rem / TICKS_PER_SECOND;
rem %= TICKS_PER_SECOND;
- DEBUG("%s: Second: %d rem: %lld", __func__, system_time->wSecond,
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Second: %d rem: %lld", __func__, system_time->wSecond,
rem);
system_time->wMilliseconds = rem / TICKS_PER_MILLISECOND;
- DEBUG("%s: Milliseconds: %d", __func__,
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Milliseconds: %d", __func__,
system_time->wMilliseconds);
/* January 1, 1601 was a Monday, according to Emacs calendar */
system_time->wDayOfWeek = ((1 + totaldays) % 7) + 1;
- DEBUG("%s: Day of week: %d", __func__, system_time->wDayOfWeek);
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Day of week: %d", __func__, system_time->wDayOfWeek);
/* This algorithm to find year and month given days from epoch
* from glibc
while(totaldays < 0 || totaldays >= (isleap(y)?366:365)) {
/* Guess a corrected year, assuming 365 days per year */
gint64 yg = y + totaldays / 365 - (totaldays % 365 < 0);
- DEBUG("%s: totaldays: %lld yg: %lld y: %lld", __func__,
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: totaldays: %lld yg: %lld y: %lld", __func__,
totaldays, yg,
y);
g_message("%s: LEAPS(yg): %lld LEAPS(y): %lld", __func__,
totaldays -= ((yg - y) * 365
+ LEAPS_THRU_END_OF (yg - 1)
- LEAPS_THRU_END_OF (y - 1));
- DEBUG("%s: totaldays: %lld", __func__, totaldays);
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: totaldays: %lld", __func__, totaldays);
y = yg;
- DEBUG("%s: y: %lld", __func__, y);
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: y: %lld", __func__, y);
}
system_time->wYear = y;
- DEBUG("%s: Year: %d", __func__, system_time->wYear);
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Year: %d", __func__, system_time->wYear);
ip = mon_yday[isleap(y)];
continue;
}
totaldays-=ip[y];
- DEBUG("%s: totaldays: %lld", __func__, totaldays);
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: totaldays: %lld", __func__, totaldays);
system_time->wMonth = y + 1;
- DEBUG("%s: Month: %d", __func__, system_time->wMonth);
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Month: %d", __func__, system_time->wMonth);
system_time->wDay = totaldays + 1;
- DEBUG("%s: Day: %d", __func__, system_time->wDay);
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Day: %d", __func__, system_time->wDay);
return(TRUE);
}
int result;
if (pattern == NULL) {
- DEBUG ("%s: pattern is NULL", __func__);
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: pattern is NULL", __func__);
SetLastError (ERROR_PATH_NOT_FOUND);
return(INVALID_HANDLE_VALUE);
utf8_pattern = mono_unicode_to_external (pattern);
if (utf8_pattern == NULL) {
- DEBUG ("%s: unicode conversion returned NULL", __func__);
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: unicode conversion returned NULL", __func__);
SetLastError (ERROR_INVALID_NAME);
return(INVALID_HANDLE_VALUE);
}
- DEBUG ("%s: looking for [%s]", __func__, utf8_pattern);
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: looking for [%s]", __func__, utf8_pattern);
/* Figure out which bit of the pattern is the directory */
dir_part = _wapi_dirname (utf8_pattern);
}
if (result < 0) {
-#ifdef DEBUG_ENABLED
- gint errnum = errno;
-#endif
_wapi_set_last_path_error_from_errno (dir_part, NULL);
- DEBUG ("%s: scandir error: %s", __func__,
- g_strerror (errnum));
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: scandir error: %s", __func__, g_strerror (errno));
g_free (utf8_pattern);
g_free (entry_part);
g_free (dir_part);
g_free (utf8_pattern);
g_free (entry_part);
- DEBUG ("%s: Got %d matches", __func__, result);
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Got %d matches", __func__, result);
find_handle.dir_part = dir_part;
find_handle.num = result;
}
if (result != 0) {
- DEBUG ("%s: stat failed: %s", __func__, filename);
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: stat failed: %s", __func__, filename);
g_free (filename);
goto retry;
#ifndef __native_client__
result = _wapi_lstat (filename, &linkbuf);
if (result != 0) {
- DEBUG ("%s: lstat failed: %s", __func__, filename);
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: lstat failed: %s", __func__, filename);
g_free (filename);
goto retry;
}
g_free (filename);
- DEBUG ("%s: Found [%s]", __func__, utf8_filename);
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Found [%s]", __func__, utf8_filename);
/* fill data block */
int result;
if (name == NULL) {
- DEBUG("%s: name is NULL", __func__);
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: name is NULL", __func__);
SetLastError (ERROR_INVALID_NAME);
return(FALSE);
utf8_name = mono_unicode_to_external (name);
if (utf8_name == NULL) {
- DEBUG ("%s: unicode conversion returned NULL", __func__);
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: unicode conversion returned NULL", __func__);
SetLastError (ERROR_INVALID_NAME);
return FALSE;
int result;
if (name == NULL) {
- DEBUG("%s: name is NULL", __func__);
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: name is NULL", __func__);
SetLastError (ERROR_INVALID_NAME);
return(FALSE);
utf8_name = mono_unicode_to_external (name);
if (utf8_name == NULL) {
- DEBUG ("%s: unicode conversion returned NULL", __func__);
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: unicode conversion returned NULL", __func__);
SetLastError (ERROR_INVALID_NAME);
return FALSE;
guint32 ret;
if (name == NULL) {
- DEBUG("%s: name is NULL", __func__);
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: name is NULL", __func__);
SetLastError (ERROR_INVALID_NAME);
return(FALSE);
utf8_name = mono_unicode_to_external (name);
if (utf8_name == NULL) {
- DEBUG ("%s: unicode conversion returned NULL", __func__);
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: unicode conversion returned NULL", __func__);
SetLastError (ERROR_INVALID_PARAMETER);
return (INVALID_FILE_ATTRIBUTES);
int result;
if (level != GetFileExInfoStandard) {
- DEBUG ("%s: info level %d not supported.", __func__,
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: info level %d not supported.", __func__,
level);
SetLastError (ERROR_INVALID_PARAMETER);
}
if (name == NULL) {
- DEBUG("%s: name is NULL", __func__);
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: name is NULL", __func__);
SetLastError (ERROR_INVALID_NAME);
return(FALSE);
utf8_name = mono_unicode_to_external (name);
if (utf8_name == NULL) {
- DEBUG ("%s: unicode conversion returned NULL", __func__);
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: unicode conversion returned NULL", __func__);
SetLastError (ERROR_INVALID_PARAMETER);
return FALSE;
*/
if (name == NULL) {
- DEBUG("%s: name is NULL", __func__);
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: name is NULL", __func__);
SetLastError (ERROR_INVALID_NAME);
return(FALSE);
utf8_name = mono_unicode_to_external (name);
if (utf8_name == NULL) {
- DEBUG ("%s: unicode conversion returned NULL", __func__);
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: unicode conversion returned NULL", __func__);
SetLastError (ERROR_INVALID_NAME);
return FALSE;
mono_once (&io_ops_once, io_ops_init);
- DEBUG ("%s: Creating pipe", __func__);
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Creating pipe", __func__);
ret=pipe (filedes);
if(ret==-1) {
- DEBUG ("%s: Error creating pipe: %s", __func__,
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Error creating pipe: %s", __func__,
strerror (errno));
_wapi_set_last_error_from_errno ();
if (filedes[0] >= _wapi_fd_reserve ||
filedes[1] >= _wapi_fd_reserve) {
- DEBUG ("%s: File descriptor is too big", __func__);
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: File descriptor is too big", __func__);
SetLastError (ERROR_TOO_MANY_OPEN_FILES);
*readpipe = read_handle;
*writepipe = write_handle;
- DEBUG ("%s: Returning pipe: read handle %p, write handle %p",
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Returning pipe: read handle %p, write handle %p",
__func__, read_handle, write_handle);
return(TRUE);
if (state->fsname_index == 1 && state->fsname [0] == '/')
ignore_entry = FALSE;
- else if (state->fsname_index == 0 || memcmp ("none", state->fsname, state->fsname_index) == 0)
+ else if (memcmp ("overlay", state->fsname, state->fsname_index) == 0 ||
+ memcmp ("aufs", state->fstype, state->fstype_index) == 0) {
+ /* Don't ignore overlayfs and aufs - these might be used on Docker
+ * (https://bugzilla.xamarin.com/show_bug.cgi?id=31021) */
+ ignore_entry = FALSE;
+ } else if (state->fsname_index == 0 || memcmp ("none", state->fsname, state->fsname_index) == 0) {
ignore_entry = TRUE;
- else if (state->fstype_index >= 5 && memcmp ("fuse.", state->fstype, 5) == 0) {
+ } else if (state->fstype_index >= 5 && memcmp ("fuse.", state->fstype, 5) == 0) {
/* Ignore GNOME's gvfs */
if (state->fstype_index == 21 && memcmp ("fuse.gvfs-fuse-daemon", state->fstype, state->fstype_index) == 0)
ignore_entry = TRUE;
else {
utf8_path_name = mono_unicode_to_external (path_name);
if (utf8_path_name == NULL) {
- DEBUG("%s: unicode conversion returned NULL", __func__);
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: unicode conversion returned NULL", __func__);
SetLastError (ERROR_INVALID_NAME);
return(FALSE);
if (ret == -1) {
_wapi_set_last_error_from_errno ();
- DEBUG ("%s: statvfs failed: %s", __func__, strerror (errno));
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: statvfs failed: %s", __func__, strerror (errno));
return(FALSE);
}
else {
utf8_root_path_name = mono_unicode_to_external (root_path_name);
if (utf8_root_path_name == NULL) {
- DEBUG("%s: unicode conversion returned NULL", __func__);
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: unicode conversion returned NULL", __func__);
return(DRIVE_NO_ROOT_DIR);
}