io-trace.h \
io-layer.h \
io-portability.h \
- macros.h \
messages.h \
security.h \
sockets.h \
- status.h \
- timefuncs.h \
- types.h \
uglify.h \
versioninfo.h \
wapi.h \
io-private.h \
io-layer.h \
locking.c \
- macros.h \
messages.c \
messages.h \
posix.c \
sockets.h \
socket-private.h \
socket-wrappers.h \
- status.h \
- timefuncs.c \
- timefuncs.h \
- types.h \
uglify.h \
versioninfo.c \
versioninfo.h \
#include <mono/io-layer/wapi.h>
#include <mono/io-layer/wapi-private.h>
#include <mono/io-layer/io-private.h>
-#include <mono/io-layer/timefuncs.h>
#include <mono/io-layer/io-portability.h>
#include <mono/io-layer/io-trace.h>
#include <mono/utils/strenc.h>
static GHashTable *file_share_hash;
static mono_mutex_t file_share_mutex;
+static void
+time_t_to_filetime (time_t timeval, WapiFileTime *filetime)
+{
+ guint64 ticks;
+
+ ticks = ((guint64)timeval * 10000000) + 116444736000000000ULL;
+ filetime->dwLowDateTime = ticks & 0xFFFFFFFF;
+ filetime->dwHighDateTime = ticks >> 32;
+}
+
static void
_wapi_handle_share_release (_WapiFileShare *share_info)
{
find_data->dwFileAttributes = _wapi_stat_to_file_attributes (utf8_filename, &buf, &linkbuf);
#endif
- _wapi_time_t_to_filetime (create_time, &find_data->ftCreationTime);
- _wapi_time_t_to_filetime (buf.st_atime, &find_data->ftLastAccessTime);
- _wapi_time_t_to_filetime (buf.st_mtime, &find_data->ftLastWriteTime);
+ time_t_to_filetime (create_time, &find_data->ftCreationTime);
+ time_t_to_filetime (buf.st_atime, &find_data->ftLastAccessTime);
+ time_t_to_filetime (buf.st_mtime, &find_data->ftLastWriteTime);
if (find_data->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
find_data->nFileSizeHigh = 0;
g_free (utf8_name);
- _wapi_time_t_to_filetime (create_time, &data->ftCreationTime);
- _wapi_time_t_to_filetime (buf.st_atime, &data->ftLastAccessTime);
- _wapi_time_t_to_filetime (buf.st_mtime, &data->ftLastWriteTime);
+ time_t_to_filetime (create_time, &data->ftCreationTime);
+ time_t_to_filetime (buf.st_atime, &data->ftLastAccessTime);
+ time_t_to_filetime (buf.st_mtime, &data->ftLastWriteTime);
if (data->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
data->nFileSizeHigh = 0;
#endif
#if defined(HAVE_STATVFS) || defined(HAVE_STATFS)
-gboolean GetDiskFreeSpaceEx(const gunichar2 *path_name, WapiULargeInteger *free_bytes_avail,
- WapiULargeInteger *total_number_of_bytes,
- WapiULargeInteger *total_number_of_free_bytes)
+gboolean GetDiskFreeSpaceEx(const gunichar2 *path_name, ULARGE_INTEGER *free_bytes_avail,
+ ULARGE_INTEGER *total_number_of_bytes,
+ ULARGE_INTEGER *total_number_of_free_bytes)
{
#ifdef HAVE_STATVFS
struct statvfs fsstat;
return(TRUE);
}
#else
-gboolean GetDiskFreeSpaceEx(const gunichar2 *path_name, WapiULargeInteger *free_bytes_avail,
- WapiULargeInteger *total_number_of_bytes,
- WapiULargeInteger *total_number_of_free_bytes)
+gboolean GetDiskFreeSpaceEx(const gunichar2 *path_name, ULARGE_INTEGER *free_bytes_avail,
+ ULARGE_INTEGER *total_number_of_bytes,
+ ULARGE_INTEGER *total_number_of_free_bytes)
{
if (free_bytes_avail != NULL) {
free_bytes_avail->QuadPart = (guint64) -1;
#include <stdlib.h>
#include "mono/io-layer/wapi.h"
-#include "mono/io-layer/timefuncs.h"
G_BEGIN_DECLS
guint16 wMilliseconds;
} WapiSystemTime;
+typedef struct {
+#if G_BYTE_ORDER == G_BIG_ENDIAN
+ guint32 dwHighDateTime;
+ guint32 dwLowDateTime;
+#else
+ guint32 dwLowDateTime;
+ guint32 dwHighDateTime;
+#endif
+} WapiFileTime;
+
typedef struct
{
guint32 dwFileAttributes;
guint32 nFileSizeLow;
} WapiFileAttributesData;
+typedef union {
+ struct {
+ guint32 LowPart;
+ guint32 HighPart;
+ } u;
+ guint64 QuadPart;
+} ULARGE_INTEGER;
+
#define INVALID_SET_FILE_POINTER ((guint32)-1)
#define INVALID_FILE_SIZE ((guint32)0xFFFFFFFF)
#define INVALID_FILE_ATTRIBUTES ((guint32)-1)
extern gboolean CreatePipe (gpointer *readpipe, gpointer *writepipe,
WapiSecurityAttributes *security, guint32 size);
extern gint32 GetLogicalDriveStrings (guint32 len, gunichar2 *buf);
-extern gboolean GetDiskFreeSpaceEx(const gunichar2 *path_name, WapiULargeInteger *free_bytes_avail,
- WapiULargeInteger *total_number_of_bytes,
- WapiULargeInteger *total_number_of_free_bytes);
+extern gboolean GetDiskFreeSpaceEx(const gunichar2 *path_name, ULARGE_INTEGER *free_bytes_avail,
+ ULARGE_INTEGER *total_number_of_bytes,
+ ULARGE_INTEGER *total_number_of_free_bytes);
extern guint32 GetDriveType(const gunichar2 *root_path_name);
extern gboolean LockFile (gpointer handle, guint32 offset_low,
guint32 offset_high, guint32 length_low,
+++ /dev/null
-/*
- * macros.h: Useful macros
- *
- * Author:
- * Dick Porter (dick@ximian.com)
- *
- * (C) 2002 Ximian, Inc.
- */
-
-#ifndef _WAPI_MACROS_H_
-#define _WAPI_MACROS_H_
-
-#include <glib.h>
-
-#if defined(__native_client__)
-#include <mono/metadata/nacl-stub.h>
-#endif
-
-#define MAKEWORD(low, high) ((guint16)(((guint8)(low)) | \
- ((guint16)((guint8)(high))) << 8))
-#define MAKELONG(low, high) ((guint32)(((guint16)(low)) | \
- ((guint32)((guint16)(high))) << 16))
-#define LOWORD(i32) ((guint16)((i32) & 0xFFFF))
-#define HIWORD(i32) ((guint16)(((guint32)(i32) >> 16) & 0xFFFF))
-#define LOBYTE(i16) ((guint8)((i16) & 0xFF))
-#define HIBYTE(i16) ((guint8)(((guint16)(i16) >> 8) & 0xFF))
-
-#endif /* _WAPI_MACROS_H_ */
+++ /dev/null
-/*
- * status.h: Status return codes
- *
- * Author:
- * Dick Porter (dick@ximian.com)
- *
- * (C) 2002 Ximian, Inc.
- */
-
-#ifndef _WAPI_STATUS_H_
-#define _WAPI_STATUS_H_
-
-typedef enum {
- STATUS_WAIT_0 = (int) 0x00000000,
- STATUS_ABANDONED_WAIT_0 = (int) 0x00000080,
- STATUS_USER_APC = (int) 0x000000C0,
- STATUS_TIMEOUT = (int) 0x00000102,
- STATUS_PENDING = (int) 0x00000103,
- STATUS_SEGMENT_NOTIFICATION = (int) 0x40000005,
- STATUS_GUARD_PAGE_VIOLATION = (int) 0x80000001,
- STATUS_DATATYPE_MISALIGNMENT = (int) 0x80000002,
- STATUS_BREAKPOINT = (int) 0x80000003,
- STATUS_SINGLE_STEP = (int) 0x80000004,
- STATUS_ACCESS_VIOLATION = (int) 0xC0000005,
- STATUS_IN_PAGE_ERROR = (int) 0xC0000006,
- STATUS_NO_MEMORY = (int) 0xC0000017,
- STATUS_ILLEGAL_INSTRUCTION = (int) 0xC000001D,
- STATUS_NONCONTINUABLE_EXCEPTION = (int) 0xC0000025,
- STATUS_INVALID_DISPOSITION = (int) 0xC0000026,
- STATUS_ARRAY_BOUNDS_EXCEEDED = (int) 0xC000008C,
- STATUS_FLOAT_DENORMAL_OPERAND = (int) 0xC000008D,
- STATUS_FLOAT_DIVIDE_BY_ZERO = (int) 0xC000008E,
- STATUS_FLOAT_INEXACT_RESULT = (int) 0xC000008F,
- STATUS_FLOAT_INVALID_OPERATION = (int) 0xC0000090,
- STATUS_FLOAT_OVERFLOW = (int) 0xC0000091,
- STATUS_FLOAT_STACK_CHECK = (int) 0xC0000092,
- STATUS_FLOAT_UNDERFLOW = (int) 0xC0000093,
- STATUS_INTEGER_DIVIDE_BY_ZERO = (int) 0xC0000094,
- STATUS_INTEGER_UNDERFLOW = (int) 0xC0000095,
- STATUS_PRIVILEGED_INSTRUCTION = (int) 0xC0000096,
- STATUS_STACK_OVERFLOW = (int) 0xC00000FD,
- STATUS_CONTROL_C_EXIT = (int) 0xC000013A
-} WapiStatus;
-
-#endif /* _WAPI_STATUS_H_ */
+++ /dev/null
-/*
- * timefuncs.c: performance timer and other time functions
- *
- * Author:
- * Dick Porter (dick@ximian.com)
- *
- * (C) 2002 Ximian, Inc.
- */
-
-#include <config.h>
-#include <glib.h>
-#include <sys/time.h>
-#include <stdlib.h>
-#include <stdio.h>
-
-#include <mono/io-layer/wapi.h>
-#include <mono/io-layer/timefuncs.h>
-#include "mono/utils/mono-time.h"
-
-#undef DEBUG
-
-void _wapi_time_t_to_filetime (time_t timeval, WapiFileTime *filetime)
-{
- guint64 ticks;
-
- ticks = ((guint64)timeval * 10000000) + 116444736000000000ULL;
- filetime->dwLowDateTime = ticks & 0xFFFFFFFF;
- filetime->dwHighDateTime = ticks >> 32;
-}
+++ /dev/null
-/*
- * timefuncs.h: performance timer and other time functions
- *
- * Author:
- * Dick Porter (dick@ximian.com)
- *
- * (C) 2002 Ximian, Inc.
- */
-
-#ifndef _WAPI_TIME_H_
-#define _WAPI_TIME_H_
-
-#include <glib.h>
-
-#include <sys/time.h>
-
-#include "mono/io-layer/wapi.h"
-
-G_BEGIN_DECLS
-
-/* The typical idiom for this struct is to cast it to and from 64bit
- * ints, hence the endian switch.
- */
-typedef struct
-{
-#if G_BYTE_ORDER == G_BIG_ENDIAN
- guint32 dwHighDateTime;
- guint32 dwLowDateTime;
-#else
- guint32 dwLowDateTime;
- guint32 dwHighDateTime;
-#endif
-} WapiFileTime;
-
-extern void _wapi_time_t_to_filetime (time_t timeval, WapiFileTime *filetime);
-
-G_END_DECLS
-#endif /* _WAPI_TIME_H_ */
+++ /dev/null
-/*
- * types.h: Generic type definitions
- *
- * Author:
- * Dick Porter (dick@ximian.com)
- *
- * (C) 2002 Ximian, Inc.
- */
-
-#ifndef _WAPI_TYPES_H_
-#define _WAPI_TYPES_H_
-
-#include <glib.h>
-
-typedef union {
- struct {
- guint32 LowPart;
- gint32 HighPart;
- } u;
- guint64 QuadPart;
-} WapiLargeInteger;
-
-typedef union {
- struct {
- guint32 LowPart;
- guint32 HighPart;
- } u;
- guint64 QuadPart;
-} WapiULargeInteger;
-
-#endif /* _WAPI_TYPES_H_ */
typedef WapiWSAData *LDWSADATA;
typedef WapiWSABuf WSABUF;
typedef WapiWSABuf *LPWSABUF;
-typedef WapiLargeInteger LARGE_INTEGER;
-typedef WapiLargeInteger *PLARGE_INTEGER;
-typedef WapiULargeInteger ULARGE_INTEGER;
-typedef WapiULargeInteger *PULARGE_INTEGER;
typedef WapiFindData WIN32_FIND_DATA;
typedef WapiFindData *LPWIN32_FIND_DATA;
typedef WapiFileAttributesData WIN32_FILE_ATTRIBUTE_DATA;
#include <sys/types.h>
#include <mono/io-layer/wapi-remap.h>
-#include <mono/io-layer/types.h>
-#include <mono/io-layer/macros.h>
#include <mono/io-layer/io.h>
#include <mono/io-layer/error.h>
#include <mono/io-layer/messages.h>
#include <mono/io-layer/security.h>
#include <mono/io-layer/sockets.h>
-#include <mono/io-layer/status.h>
-#include <mono/io-layer/timefuncs.h>
#include <mono/io-layer/versioninfo.h>
G_BEGIN_DECLS
-#define WAIT_FAILED 0xFFFFFFFF
-#define WAIT_OBJECT_0 ((STATUS_WAIT_0) +0)
-#define WAIT_ABANDONED ((STATUS_ABANDONED_WAIT_0) +0)
-#define WAIT_ABANDONED_0 ((STATUS_ABANDONED_WAIT_0) +0)
-#define WAIT_TIMEOUT STATUS_TIMEOUT
-#define WAIT_IO_COMPLETION STATUS_USER_APC
+#define WAIT_FAILED ((int) 0xFFFFFFFF)
+#define WAIT_OBJECT_0 ((int) 0x00000000)
+#define WAIT_ABANDONED_0 ((int) 0x00000080)
+#define WAIT_TIMEOUT ((int) 0x00000102)
+#define WAIT_IO_COMPLETION ((int) 0x000000C0)
void
wapi_init (void);
pid_t id;
guint32 exitstatus;
gpointer main_thread;
- WapiFileTime create_time;
- WapiFileTime exit_time;
+ guint64 create_time;
+ guint64 exit_time;
char *proc_name;
size_t min_working_set;
size_t max_working_set;
process_handle->exitstatus = 128 + WTERMSIG (status);
else
process_handle->exitstatus = WEXITSTATUS (status);
- _wapi_time_t_to_filetime (time (NULL), &process_handle->exit_time);
+
+ process_handle->exit_time = mono_100ns_datetime ();
process_handle->exited = TRUE;
process_handle->min_working_set = 204800;
process_handle->max_working_set = 1413120;
- _wapi_time_t_to_filetime (time (NULL), &process_handle->create_time);
+ process_handle->create_time = mono_100ns_datetime ();
}
static void
processtime->highDateTime = ticks >> 32;
}
-static void
-wapifiletime_to_processtime (WapiFileTime wapi_filetime, ProcessTime *processtime)
-{
- processtime->lowDateTime = wapi_filetime.dwLowDateTime;
- processtime->highDateTime = wapi_filetime.dwHighDateTime;
-}
-
MonoBoolean
ves_icall_Microsoft_Win32_NativeMethods_GetProcessTimes (gpointer handle, gint64 *creation_time, gint64 *exit_time, gint64 *kernel_time, gint64 *user_time)
{
return FALSE;
}
- wapifiletime_to_processtime (process_handle->create_time, creation_processtime);
+ ticks_to_processtime (process_handle->create_time, creation_processtime);
/* A process handle is only signalled if the process has
* exited, otherwise exit_processtime isn't set */
if (mono_w32handle_issignalled (handle))
- wapifiletime_to_processtime (process_handle->exit_time, exit_processtime);
+ ticks_to_processtime (process_handle->exit_time, exit_processtime);
#ifdef HAVE_GETRUSAGE
if (process_handle->id == getpid ()) {
}
if (VerQueryValue (data, query, (gpointer *)&ffi, &ffi_size)) {
- LOGDEBUG (g_message ("%s: recording assembly: FileName [%s] FileVersionInfo [%d.%d.%d.%d]", __func__, g_utf16_to_utf8 (filename, -1, NULL, NULL, NULL), HIWORD (ffi->dwFileVersionMS), LOWORD (ffi->dwFileVersionMS), HIWORD (ffi->dwFileVersionLS), LOWORD (ffi->dwFileVersionLS)));
+ #define LOWORD(i32) ((guint16)((i32) & 0xFFFF))
+ #define HIWORD(i32) ((guint16)(((guint32)(i32) >> 16) & 0xFFFF))
+
+ LOGDEBUG (g_message ("%s: recording assembly: FileName [%s] FileVersionInfo [%d.%d.%d.%d]",
+ __func__, g_utf16_to_utf8 (filename, -1, NULL, NULL, NULL), HIWORD (ffi->dwFileVersionMS),
+ LOWORD (ffi->dwFileVersionMS), HIWORD (ffi->dwFileVersionLS), LOWORD (ffi->dwFileVersionLS)));
process_set_field_int (filever, "filemajorpart", HIWORD (ffi->dwFileVersionMS));
process_set_field_int (filever, "fileminorpart", LOWORD (ffi->dwFileVersionMS));
process_set_field_bool (filever, "ispatched", ((ffi->dwFileFlags & ffi->dwFileFlagsMask) & VS_FF_PATCHED) != 0);
process_set_field_bool (filever, "isprivatebuild", ((ffi->dwFileFlags & ffi->dwFileFlagsMask) & VS_FF_PRIVATEBUILD) != 0);
process_set_field_bool (filever, "isspecialbuild", ((ffi->dwFileFlags & ffi->dwFileFlagsMask) & VS_FF_SPECIALBUILD) != 0);
+
+ #undef LOWORD
+ #undef HIWORD
}
g_free (query);
WSADATA wsadata;
int err;
- err = WSAStartup (MAKEWORD (2,0), &wsadata);
+ err = WSAStartup (2 /* 2.0 */, &wsadata);
if(err)
g_error ("%s: Couldn't initialise networking", __func__);
}