#include <mono/metadata/mono-debug.h>
#include <mono/utils/mono-uri.h>
#include <mono/metadata/mono-config.h>
-#include <mono/metadata/mono-config-internals.h>
#include <mono/utils/mono-digest.h>
#include <mono/utils/mono-logger-internals.h>
#include <mono/utils/mono-path.h>
#include "class-internals.h"
#include "domain-internals.h"
#include "mono-hash-internals.h"
-#include "mono-config-internals.h"
#include "object-internals.h"
#include "class-init.h"
#include <mono/metadata/assembly.h>
#include "mono/utils/mono-dl.h"
#include "mono/utils/monobitset.h"
#include "mono/utils/mono-property-hash.h"
-#include "mono/utils/mono-value-hash.h"
#include <mono/utils/mono-error.h>
#include "mono/utils/mono-conc-hashtable.h"
#include "mono/utils/refcount.h"
+++ /dev/null
-/**
- * \file
- */
-
-#ifndef __MONO_METADATA_CONFIG_INTERNALS_H__
-#define __MONO_METADATA_CONFIG_INTERNALS_H__
-
-#include "mono/metadata/mono-config.h"
-
-void
-mono_config_for_assembly_internal (MonoImage *assembly);
-
-#endif /* __MONO_METADATA_CONFIG_INTERNALS_H__ */
#include "mono/metadata/loader.h"
#include "mono/metadata/loader-internals.h"
#include "mono/metadata/mono-config.h"
-#include "mono/metadata/mono-config-internals.h"
#include "mono/metadata/metadata-internals.h"
#include "mono/metadata/object-internals.h"
#include "mono/utils/mono-logger-internals.h"
mono-stdlib.c
mono-property-hash.h
mono-property-hash.c
- mono-value-hash.h
- mono-value-hash.c
freebsd-dwarf.h
dtrace.h
mono-error.c
} while (0)
static DWORD
-win32_sleep_ex_interrupt_checked (MonoThreadInfo *info, DWORD timeout, BOOL alertable)
-{
- WIN32_CHECK_INTERRUPT (info, alertable);
- return SleepEx (timeout, alertable);
-}
-
-static DWORD
-win32_sleep_ex (DWORD timeout, BOOL alertable, BOOL cooperative)
-{
- DWORD result = WAIT_FAILED;
- MonoThreadInfo * const info = alertable ? mono_thread_info_current_unchecked () : NULL;
-
- WIN32_ENTER_ALERTABLE_WAIT (info);
-
- if (cooperative) {
- MONO_ENTER_GC_SAFE;
- result = win32_sleep_ex_interrupt_checked (info, timeout, alertable);
- MONO_EXIT_GC_SAFE;
- } else {
- result = win32_sleep_ex_interrupt_checked (info, timeout, alertable);
- }
-
- WIN32_LEAVE_ALERTABLE_WAIT (info);
-
- return result;
-}
-
-DWORD
-mono_win32_sleep_ex (DWORD timeout, BOOL alertable)
-{
- return win32_sleep_ex (timeout, alertable, FALSE);
-}
-
-DWORD
-mono_coop_win32_sleep_ex (DWORD timeout, BOOL alertable)
-{
- return win32_sleep_ex (timeout, alertable, TRUE);
-}
-
-static DWORD
win32_wait_for_single_object_ex_interrupt_checked (MonoThreadInfo *info, HANDLE handle, DWORD timeout, BOOL alertable)
{
WIN32_CHECK_INTERRUPT (info, alertable);
{
return win32_wait_for_multiple_objects_ex (count, handles, waitAll, timeout, alertable, error, TRUE);
}
-
-#if HAVE_API_SUPPORT_WIN32_SIGNAL_OBJECT_AND_WAIT
-static DWORD
-win32_signal_object_and_wait_interrupt_checked (MonoThreadInfo *info, HANDLE toSignal, HANDLE toWait, DWORD timeout, BOOL alertable)
-{
- WIN32_CHECK_INTERRUPT (info, alertable);
- return SignalObjectAndWait (toSignal, toWait, timeout, alertable);
-}
-
-static DWORD
-win32_signal_object_and_wait (HANDLE toSignal, HANDLE toWait, DWORD timeout, BOOL alertable, BOOL cooperative)
-{
- DWORD result = WAIT_FAILED;
- MonoThreadInfo * const info = alertable ? mono_thread_info_current_unchecked () : NULL;
-
- WIN32_ENTER_ALERTABLE_WAIT (info);
-
- if (cooperative) {
- MONO_ENTER_GC_SAFE;
- result = win32_signal_object_and_wait_interrupt_checked (info, toSignal, toWait, timeout, alertable);
- MONO_EXIT_GC_SAFE;
- } else {
- result = win32_signal_object_and_wait_interrupt_checked (info, toSignal, toWait, timeout, alertable);
- }
-
- WIN32_LEAVE_ALERTABLE_WAIT (info);
-
- return result;
-}
-#elif !HAVE_EXTERN_DEFINED_WIN32_SIGNAL_OBJECT_AND_WAIT
-static DWORD
-win32_signal_object_and_wait (HANDLE toSignal, HANDLE toWait, DWORD timeout, BOOL alertable, BOOL cooperative)
-{
- g_unsupported_api ("SignalObjectAndWait");
- SetLastError (ERROR_NOT_SUPPORTED);
- return WAIT_FAILED;
-}
-#endif /* HAVE_API_SUPPORT_WIN32_SIGNAL_OBJECT_AND_WAIT */
-
-DWORD
-mono_win32_signal_object_and_wait (HANDLE toSignal, HANDLE toWait, DWORD timeout, BOOL alertable)
-{
- return win32_signal_object_and_wait (toSignal, toWait, timeout, alertable, FALSE);
-}
-
-DWORD
-mono_coop_win32_signal_object_and_wait (HANDLE toSignal, HANDLE toWait, DWORD timeout, BOOL alertable)
-{
- return win32_signal_object_and_wait (toSignal, toWait, timeout, alertable, TRUE);
-}
-
-#if HAVE_API_SUPPORT_WIN32_MSG_WAIT_FOR_MULTIPLE_OBJECTS
-static DWORD
-win32_msg_wait_for_multiple_objects_ex_interrupt_checked (MonoThreadInfo *info, DWORD count, CONST HANDLE *handles, DWORD timeout, DWORD wakeMask, DWORD flags, BOOL alertable)
-{
- WIN32_CHECK_INTERRUPT (info, alertable);
- return MsgWaitForMultipleObjectsEx (count, handles, timeout, wakeMask, flags);
-}
-
-static DWORD
-win32_msg_wait_for_multiple_objects_ex (DWORD count, CONST HANDLE *handles, DWORD timeout, DWORD wakeMask, DWORD flags, BOOL cooperative)
-{
- DWORD result = WAIT_FAILED;
- BOOL alertable = flags & MWMO_ALERTABLE;
- MonoThreadInfo * const info = alertable ? mono_thread_info_current_unchecked () : NULL;
-
- WIN32_ENTER_ALERTABLE_WAIT (info);
-
- if (cooperative) {
- MONO_ENTER_GC_SAFE;
- result = win32_msg_wait_for_multiple_objects_ex_interrupt_checked (info, count, handles, timeout, wakeMask, flags, alertable);
- MONO_EXIT_GC_SAFE;
- } else {
- result = win32_msg_wait_for_multiple_objects_ex_interrupt_checked (info, count, handles, timeout, wakeMask, flags, alertable);
- }
-
- WIN32_LEAVE_ALERTABLE_WAIT (info);
-
- return result;
-}
-#elif !HAVE_EXTERN_DEFINED_WIN32_MSG_WAIT_FOR_MULTIPLE_OBJECTS
-static DWORD
-win32_msg_wait_for_multiple_objects_ex (DWORD count, CONST HANDLE *handles, DWORD timeout, DWORD wakeMask, DWORD flags, BOOL cooperative)
-{
- g_unsupported_api ("MsgWaitForMultipleObjectsEx");
- SetLastError (ERROR_NOT_SUPPORTED);
- return WAIT_FAILED;
-}
-#endif /* HAVE_API_SUPPORT_WIN32_MSG_WAIT_FOR_MULTIPLE_OBJECTS */
-
-DWORD
-mono_win32_msg_wait_for_multiple_objects_ex (DWORD count, CONST HANDLE *handles, DWORD timeout, DWORD wakeMask, DWORD flags)
-{
- return win32_msg_wait_for_multiple_objects_ex (count, handles, timeout, wakeMask, flags, FALSE);
-}
-
-DWORD
-mono_coop_win32_msg_wait_for_multiple_objects_ex (DWORD count, CONST HANDLE *handles, DWORD timeout, DWORD wakeMask, DWORD flags)
-{
- return win32_msg_wait_for_multiple_objects_ex (count, handles, timeout, wakeMask, flags, TRUE);
-}
-
-static DWORD
-win32_wsa_wait_for_multiple_events_interrupt_checked (MonoThreadInfo *info, DWORD count, const WSAEVENT FAR *handles, BOOL waitAll, DWORD timeout, BOOL alertable)
-{
- WIN32_CHECK_INTERRUPT (info, alertable);
- return WSAWaitForMultipleEvents (count, handles, waitAll, timeout, alertable);
-}
-
-static DWORD
-win32_wsa_wait_for_multiple_events (DWORD count, const WSAEVENT FAR *handles, BOOL waitAll, DWORD timeout, BOOL alertable, BOOL cooperative)
-{
- DWORD result = WAIT_FAILED;
- MonoThreadInfo * const info = alertable ? mono_thread_info_current_unchecked () : NULL;
-
- WIN32_ENTER_ALERTABLE_WAIT (info);
-
- if (cooperative) {
- MONO_ENTER_GC_SAFE;
- result = win32_wsa_wait_for_multiple_events_interrupt_checked (info, count, handles, waitAll, timeout, alertable);
- MONO_EXIT_GC_SAFE;
- } else {
- result = win32_wsa_wait_for_multiple_events_interrupt_checked (info, count, handles, waitAll, timeout, alertable);
- }
-
- WIN32_LEAVE_ALERTABLE_WAIT (info);
-
- return result;
-}
-
-DWORD
-mono_win32_wsa_wait_for_multiple_events (DWORD count, const WSAEVENT FAR *handles, BOOL waitAll, DWORD timeout, BOOL alertable)
-{
- return win32_wsa_wait_for_multiple_events (count, handles, waitAll, timeout, alertable, FALSE);
-}
-
-DWORD
-mono_coop_win32_wsa_wait_for_multiple_events (DWORD count, const WSAEVENT FAR *handles, BOOL waitAll, DWORD timeout, BOOL alertable)
-{
- return win32_wsa_wait_for_multiple_events (count, handles, waitAll, timeout, alertable, TRUE);
-}
#include <mono/utils/mono-error.h>
DWORD
-mono_win32_sleep_ex (DWORD timeout, BOOL alertable);
-
-DWORD
-mono_coop_win32_sleep_ex (DWORD timeout, BOOL alertable);
-
-DWORD
mono_win32_wait_for_single_object_ex (HANDLE handle, DWORD timeout, BOOL alertable);
DWORD
DWORD
mono_coop_win32_wait_for_multiple_objects_ex (DWORD count, CONST HANDLE *handles, BOOL waitAll, DWORD timeout, BOOL alertable, MonoError *error);
-DWORD
-mono_win32_signal_object_and_wait (HANDLE toSignal, HANDLE toWait, DWORD timeout, BOOL alertable);
-
-DWORD
-mono_coop_win32_signal_object_and_wait (HANDLE toSignal, HANDLE toWait, DWORD timeout, BOOL alertable);
-
-DWORD
-mono_win32_msg_wait_for_multiple_objects_ex (DWORD count, CONST HANDLE *handles, DWORD timeout, DWORD wakeMask, DWORD flags);
-
-DWORD
-mono_coop_win32_msg_wait_for_multiple_objects_ex (DWORD count, CONST HANDLE *handles, DWORD timeout, DWORD wakeMask, DWORD flags);
-
-DWORD
-mono_win32_wsa_wait_for_multiple_events (DWORD count, const WSAEVENT FAR *handles, BOOL waitAll, DWORD timeout, BOOL alertable);
-
-DWORD
-mono_coop_win32_wsa_wait_for_multiple_events (DWORD count, const WSAEVENT FAR *handles, BOOL waitAll, DWORD timeout, BOOL alertable);
-
#endif
#endif /* _MONO_UTILS_OS_WAIT_H_ */
}
/*
- * This is a very specific function whose only purpose is to
- * break a given thread from socket syscalls.
- *
- * This only exists because linux won't fail a call to connect
- * if the underlying is closed.
- *
- * TODO We should cleanup and unify this with the other syscall abort
- * facility.
- */
-void
-mono_thread_info_abort_socket_syscall_for_close (MonoNativeThreadId tid)
-{
- MonoThreadHazardPointers *hp;
- MonoThreadInfo *info;
-
- if (tid == mono_native_thread_id_get ())
- return;
-
- mono_thread_info_suspend_lock ();
- hp = mono_hazard_pointer_get ();
- info = mono_thread_info_lookup (tid);
- if (!info) {
- mono_thread_info_suspend_unlock ();
- return;
- }
- mono_threads_begin_global_suspend ();
-
- mono_threads_suspend_abort_syscall (info);
- mono_threads_wait_pending_operations ();
-
- mono_hazard_pointer_clear (hp, 1);
-
- mono_threads_end_global_suspend ();
- mono_thread_info_suspend_unlock ();
-}
-
-/*
* mono_thread_info_set_is_async_context:
*
* Set whenever the current thread is in an async context. Some runtime functions might behave
void
mono_thread_info_suspend_unlock (void);
-void
-mono_thread_info_abort_socket_syscall_for_close (MonoNativeThreadId tid);
-
MONO_COMPONENT_API void
mono_thread_info_set_is_async_context (gboolean async_context);
+++ /dev/null
-/**
- * \file
- * A hash table which only stores values in the hash nodes.
- *
- * Author:
- * Miguel de Icaza (miguel@novell.com)
- * Zoltan Varga (vargaz@gmail.com)
- *
- * (C) 2006,2008 Novell, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#include <stdio.h>
-#include <math.h>
-#include <glib.h>
-
-#include "mono-value-hash.h"
-
-#ifndef G_MAXINT32
-#define G_MAXINT32 2147483647
-#endif
-
-/*
- * This code is based on eglib/ghashtable.c with work done by Hans Petter Jansson
- * (hpj@novell.com) to make it use internal probing instead of chaining.
- */
-
-#define HASH_TABLE_MIN_SHIFT 3 /* 1 << 3 == 8 buckets */
-
-typedef struct _Slot Slot;
-
-#define GET_VALUE(slot) ((gpointer)((((gsize)((slot)->value)) >> 2) << 2))
-
-#define SET_VALUE(slot,value) ((slot)->value = (value))
-
-#define IS_EMPTY(slot) ((gsize)((slot)->value) == 0)
-#define IS_TOMBSTONE(slot) ((gsize)((slot)->value) & 1)
-
-#define MAKE_TOMBSTONE(slot) do { (slot)->value = (gpointer)((gsize)((slot)->value) | 1); } while (1)
-
-#define HASH(table, key) ((table)->hash_func ((key)))
-
-struct _Slot {
- /* A NULL value means the slot is empty */
- /* The tombstone status is stored in the lowest order bit of the value. */
- gpointer value;
-};
-
-static gpointer KEYMARKER_REMOVED = &KEYMARKER_REMOVED;
-
-struct _MonoValueHashTable {
- GHashFunc hash_func;
- GEqualFunc key_equal_func;
- MonoValueHashKeyExtractFunc key_extract_func;
-
- Slot *table;
- int table_size;
- int table_mask;
- int in_use;
- int n_occupied;
- GDestroyNotify value_destroy_func, key_destroy_func;
-};
-
-static void
-mono_value_hash_table_set_shift (MonoValueHashTable *hash_table, gint shift)
-{
- gint i;
- guint mask = 0;
-
- hash_table->table_size = 1 << shift;
-
- for (i = 0; i < shift; i++) {
- mask <<= 1;
- mask |= 1;
- }
-
- hash_table->table_mask = mask;
-}
-
-static gint
-mono_value_hash_table_find_closest_shift (gint n)
-{
- gint i;
-
- for (i = 0; n; i++)
- n >>= 1;
-
- return i;
-}
-
-static void
-mono_value_hash_table_set_shift_from_size (MonoValueHashTable *hash_table, gint size)
-{
- gint shift;
-
- shift = mono_value_hash_table_find_closest_shift (size);
- shift = MAX (shift, HASH_TABLE_MIN_SHIFT);
-
- mono_value_hash_table_set_shift (hash_table, shift);
-}
-
-MonoValueHashTable *
-mono_value_hash_table_new (GHashFunc hash_func, GEqualFunc key_equal_func, MonoValueHashKeyExtractFunc key_extract)
-{
- MonoValueHashTable *hash;
-
- if (hash_func == NULL)
- hash_func = g_direct_hash;
- if (key_equal_func == NULL)
- key_equal_func = g_direct_equal;
- hash = g_new0 (MonoValueHashTable, 1);
-
- hash->hash_func = hash_func;
- hash->key_equal_func = key_equal_func;
- hash->key_extract_func = key_extract;
-
- mono_value_hash_table_set_shift (hash, HASH_TABLE_MIN_SHIFT);
- hash->table = g_new0 (Slot, hash->table_size);
-
- return hash;
-}
-
-#if 0
-
-MonoValueHashTable *
-mono_value_hash_table_new_full (GHashFunc hash_func, GEqualFunc key_equal_func,
- GDestroyNotify key_destroy_func, GDestroyNotify value_destroy_func)
-{
- MonoValueHashTable *hash = mono_value_hash_table_new (hash_func, key_equal_func);
- if (hash == NULL)
- return NULL;
-
- hash->key_destroy_func = key_destroy_func;
- hash->value_destroy_func = value_destroy_func;
-
- return hash;
-}
-
-#endif
-
-static void
-do_rehash (MonoValueHashTable *hash)
-{
- int i;
- int old_size;
- Slot *old_table;
-
- old_size = hash->table_size;
- old_table = hash->table;
-
- mono_value_hash_table_set_shift_from_size (hash, hash->in_use * 2);
-
- /* printf ("New size: %d\n", hash->table_size); */
- hash->table = g_new0 (Slot, hash->table_size);
-
- for (i = 0; i < old_size; i++){
- Slot *s = &old_table [i];
- Slot *new_s;
- guint hash_val;
- guint step = 0;
- gpointer s_value, s_key;
-
- if (IS_EMPTY (s) || IS_TOMBSTONE (s))
- continue;
-
- s_value = GET_VALUE (s);
- s_key = hash->key_extract_func (s_value);
- hash_val = HASH (hash, s_key) & hash->table_mask;
- new_s = &hash->table [hash_val];
-
- while (!IS_EMPTY (new_s)) {
- step++;
- hash_val += step;
- hash_val &= hash->table_mask;
- new_s = &hash->table [hash_val];
- }
-
- *new_s = *s;
- }
- g_free (old_table);
- hash->n_occupied = hash->in_use;
-}
-
-static void
-rehash (MonoValueHashTable *hash)
-{
- int n_occupied = hash->n_occupied;
- int table_size = hash->table_size;
-
- if ((table_size > hash->in_use * 4 && table_size > 1 << HASH_TABLE_MIN_SHIFT) ||
- (table_size <= n_occupied + (n_occupied / 16)))
- do_rehash (hash);
-}
-
-static void
-mono_value_hash_table_insert_replace (MonoValueHashTable *hash, gpointer key, gpointer value, gboolean replace)
-{
- guint hashcode;
- Slot *s;
- guint s_index;
- GEqualFunc equal;
- guint first_tombstone = 0;
- gboolean have_tombstone = FALSE;
- guint step = 0;
-
- g_assert (value);
- g_assert (hash->key_extract_func (value) == key);
-
- g_return_if_fail (hash != NULL);
-
- hashcode = HASH (hash, key);
-
- s_index = hashcode & hash->table_mask;
- s = &hash->table [s_index];
-
- equal = hash->key_equal_func;
-
- while (!IS_EMPTY (s)) {
- gpointer s_value = GET_VALUE (s);
- gpointer s_key = hash->key_extract_func (s_value);
- guint s_key_hash = HASH (hash, s_key);
- if (s_key_hash == hashcode && (*equal) (s_key, key)) {
- if (replace){
- if (hash->key_destroy_func != NULL)
- (*hash->key_destroy_func)(s_key);
- }
- if (hash->value_destroy_func != NULL)
- (*hash->value_destroy_func) (GET_VALUE (s));
- SET_VALUE (s, value);
- return;
- } else if (IS_TOMBSTONE (s) && !have_tombstone) {
- first_tombstone = s_index;
- have_tombstone = TRUE;
- }
-
- step++;
- s_index += step;
- s_index &= hash->table_mask;
- s = &hash->table [s_index];
- }
-
- if (have_tombstone) {
- s = &hash->table [first_tombstone];
- } else {
- hash->n_occupied++;
- }
-
- SET_VALUE (s, value);
- hash->in_use++;
-
- rehash (hash);
-}
-
-void
-mono_value_hash_table_insert (MonoValueHashTable *hash, gpointer key, gpointer value)
-{
- mono_value_hash_table_insert_replace (hash, key, value, TRUE);
-}
-
-static Slot *
-lookup_internal (MonoValueHashTable *hash, gconstpointer key)
-{
- GEqualFunc equal;
- Slot *s;
- guint hashcode;
- guint s_index;
- guint step = 0;
-
- hashcode = HASH (hash, key);
-
- s_index = hashcode & hash->table_mask;
- s = &hash->table [s_index];
-
- equal = hash->key_equal_func;
-
- while (!IS_EMPTY (s)) {
- gpointer s_value = GET_VALUE (s);
- gpointer s_key = hash->key_extract_func (s_value);
- guint s_key_hash = HASH (hash, s_key);
- if (s_key_hash == hashcode && (*equal) (hash->key_extract_func (s_value), key))
- return s;
-
- step++;
- s_index += step;
- s_index &= hash->table_mask;
- s = &hash->table [s_index];
- }
-
- return NULL;
-}
-
-gpointer
-mono_value_hash_table_lookup (MonoValueHashTable *hash, gconstpointer key)
-{
- Slot *slot = lookup_internal (hash, key);
-
- if (slot)
- return GET_VALUE (slot);
- else
- return NULL;
-}
-
-void
-mono_value_hash_table_destroy (MonoValueHashTable *hash)
-{
- int i;
-
- g_return_if_fail (hash != NULL);
-
- for (i = 0; i < hash->table_size; i++){
- Slot *s = &hash->table [i];
-
- if (!IS_EMPTY (s) && !IS_TOMBSTONE (s)) {
- if (hash->key_destroy_func != NULL)
- (*hash->key_destroy_func)(hash->key_extract_func (GET_VALUE (s)));
- if (hash->value_destroy_func != NULL)
- (*hash->value_destroy_func)(GET_VALUE (s));
- }
- }
- g_free (hash->table);
-
- g_free (hash);
-}
+++ /dev/null
-/**
- * \file
- * A hash table which only stores values in the hash nodes.
- *
- * Author:
- * Mark Probst (mark.probst@gmail.com)
- * Zoltan Varga (vargaz@gmail.com)
- *
- * (C) 2008 Novell, Inc.
- *
- */
-#ifndef __MONO_UTILS_MONO_VALUE_HASH__
-#define __MONO_UTILS_MONO_VALUE_HASH__
-
-#include <glib.h>
-#include "mono-compiler.h"
-
-/*
- * This is a hash table with the following features/restrictions:
- * - Keys are not stored in the table, instead a function must be supplied which
- * computes them from the value.
- * - Values are assumed to be normal pointers, i.e. their lowest 2-3 bits should be
- * zero.
- * - NULL values are not allowed.
- * - It uses internal probing instead of chaining.
- * - The above restrictions mean that this hash table will be somewhat slower than
- * hash tables which store the key (or even the key hash) in the hash nodes. But
- * it also means that each hash node has a size of one machine word, instead of
- * 4 in GHashTable.
- * - Removal of entries is not supported, as it is not needed by the runtime right
- * now.
- */
-
-typedef struct _MonoValueHashTable MonoValueHashTable;
-
-typedef gpointer (*MonoValueHashKeyExtractFunc) (gpointer value);
-
-MonoValueHashTable* mono_value_hash_table_new (GHashFunc hash_func,
- GEqualFunc key_equal_func,
- MonoValueHashKeyExtractFunc key_extract);
-
-void
-mono_value_hash_table_destroy (MonoValueHashTable *table);
-
-gpointer
-mono_value_hash_table_lookup (MonoValueHashTable *table, gconstpointer key);
-
-/* The key pointer is actually only passed here to check a debugging
- assertion and to make the API look more familiar. */
-void
-mono_value_hash_table_insert (MonoValueHashTable *table,
- gpointer key, gpointer value);
-
-#endif
#include <mono/utils/networking.h>
#include <glib.h>
-int
-mono_address_size_for_family (int family)
-{
- switch (family) {
- case AF_INET:
- return sizeof (struct in_addr);
-#ifdef HAVE_STRUCT_SOCKADDR_IN6
- case AF_INET6:
- return sizeof (struct in6_addr);
-#endif
- }
- return 0;
-}
-
-
void
mono_free_address_info (MonoAddressInfo *ai)
{
}
}
-void
-mono_address_init (MonoAddress *out_addr, int family, void *in_addr)
-{
- memset (out_addr, 0, sizeof (MonoAddress));
- out_addr->family = family;
- memcpy (&out_addr->addr, in_addr, mono_address_size_for_family (family));
-}
struct sockaddr addr;
} MonoSocketAddress;
-typedef struct {
- int family;
- union {
- struct in_addr v4;
-#ifdef HAVE_STRUCT_SOCKADDR_IN6
- struct in6_addr v6;
-#endif
- } addr;
-} MonoAddress;
-
/* This only supports IPV4 / IPV6 and tcp */
MONO_COMPONENT_API int mono_get_address_info (const char *hostname, int port, int flags, MonoAddressInfo **res);
int inet_pton (int family, const char *address, void *inaddrp);
#endif
-void mono_address_init (MonoAddress *out_addr, int family, void *in_addr);
-int mono_address_size_for_family (int family);
-
MONO_COMPONENT_API void mono_networking_init (void);
void mono_networking_shutdown (void);
#include <glib.h>
-#define WAIT_TOO_MANY_POSTS ((gint) 0x0000012A)
-#define WAIT_NOT_OWNED_BY_CALLER ((gint) 0x0000012B)
-
#ifndef HOST_WIN32
#define WAIT_FAILED ((gint) 0xFFFFFFFF)
#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
-
#endif /* HOST_WIN32 */
#endif /* __MONO_UTILS_W32API_H__ */
#endif
#endif
-#ifndef HAVE_API_SUPPORT_WIN32_COPY_FILE
-#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) || \
- G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT)
-#define HAVE_API_SUPPORT_WIN32_COPY_FILE 1
-#else
-#define HAVE_API_SUPPORT_WIN32_COPY_FILE 0
-#endif
-#endif
-
-#ifndef HAVE_API_SUPPORT_WIN32_COPY_FILE2
-#if G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT)
-#define HAVE_API_SUPPORT_WIN32_COPY_FILE2 1
-#else
-#define HAVE_API_SUPPORT_WIN32_COPY_FILE2 0
-#endif
-#endif
-
#ifndef HAVE_API_SUPPORT_WIN32_COREE
#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
#define HAVE_API_SUPPORT_WIN32_COREE 1
#endif
#endif
-#ifndef HAVE_API_SUPPORT_WIN32_CREATE_PROCESS
-#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) || \
- G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT)
-#define HAVE_API_SUPPORT_WIN32_CREATE_PROCESS 1
-#else
-#define HAVE_API_SUPPORT_WIN32_CREATE_PROCESS 0
-#endif
-#endif
-
-#ifndef HAVE_API_SUPPORT_WIN32_CREATE_PROCESS_WITH_LOGON
-#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
-#define HAVE_API_SUPPORT_WIN32_CREATE_PROCESS_WITH_LOGON 1
-#else
-#define HAVE_API_SUPPORT_WIN32_CREATE_PROCESS_WITH_LOGON 0
-#endif
-#endif
-
#ifndef HAVE_API_SUPPORT_WIN32_CREATE_SEMAPHORE
#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) || \
G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT)
#endif
#endif
-#ifndef HAVE_API_SUPPORT_WIN32_DISCONNECT_EX
-#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) || \
- G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT)
-#define HAVE_API_SUPPORT_WIN32_DISCONNECT_EX 1
-#else
-#define HAVE_API_SUPPORT_WIN32_DISCONNECT_EX 0
-#endif
-#endif
-
-#ifndef HAVE_API_SUPPORT_WIN32_ENUM_PROCESSES
-#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) || \
- G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT)
-#define HAVE_API_SUPPORT_WIN32_ENUM_PROCESSES 1
-#else
-#define HAVE_API_SUPPORT_WIN32_ENUM_PROCESSES 0
-#endif
-#endif
-
#ifndef HAVE_API_SUPPORT_WIN32_ENUM_PROCESS_MODULES
#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
#define HAVE_API_SUPPORT_WIN32_ENUM_PROCESS_MODULES 1
#endif
#endif
-#ifndef HAVE_API_SUPPORT_WIN32_ENUM_WINDOWS
-#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
-#define HAVE_API_SUPPORT_WIN32_ENUM_WINDOWS 1
-#else
-#define HAVE_API_SUPPORT_WIN32_ENUM_WINDOWS 0
-#endif
-#endif
-
#ifndef HAVE_API_SUPPORT_WIN32_FILE_MAPPING
#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
#define HAVE_API_SUPPORT_WIN32_FILE_MAPPING 1
#endif
#endif
-#ifndef HAVE_API_SUPPORT_WIN32_GET_ACP
-#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) || \
- G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT)
-#define HAVE_API_SUPPORT_WIN32_GET_ACP 1
-#else
-#define HAVE_API_SUPPORT_WIN32_GET_ACP 0
-#endif
-#endif
-
-#ifndef HAVE_API_SUPPORT_WIN32_GET_CP_INFO_EX
-#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) || \
- G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT)
-#define HAVE_API_SUPPORT_WIN32_GET_CP_INFO_EX 1
-#else
-#define HAVE_API_SUPPORT_WIN32_GET_CP_INFO_EX 0
-#endif
-#endif
-
-#ifndef HAVE_API_SUPPORT_WIN32_GET_DRIVE_TYPE
-#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) || \
- G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT)
-#define HAVE_API_SUPPORT_WIN32_GET_DRIVE_TYPE 1
-#else
-#define HAVE_API_SUPPORT_WIN32_GET_DRIVE_TYPE 0
-#endif
-#endif
-
-#ifndef HAVE_API_SUPPORT_WIN32_GET_FILE_SIZE_EX
-#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) || \
- G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT)
-#define HAVE_API_SUPPORT_WIN32_GET_FILE_SIZE_EX 1
-#else
-#define HAVE_API_SUPPORT_WIN32_GET_FILE_SIZE_EX 0
-#endif
-#endif
-
-#ifndef HAVE_API_SUPPORT_WIN32_GET_FILE_VERSION_INFO
-#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
-#define HAVE_API_SUPPORT_WIN32_GET_FILE_VERSION_INFO 1
-#else
-#define HAVE_API_SUPPORT_WIN32_GET_FILE_VERSION_INFO 0
-#endif
-#endif
-
-#ifndef HAVE_API_SUPPORT_WIN32_GET_LOGICAL_DRIVE_STRINGS
-#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
-#define HAVE_API_SUPPORT_WIN32_GET_LOGICAL_DRIVE_STRINGS 1
-#else
-#define HAVE_API_SUPPORT_WIN32_GET_LOGICAL_DRIVE_STRINGS 0
-#endif
-#endif
-
#ifndef HAVE_API_SUPPORT_WIN32_GET_MODULE_BASE_NAME
#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) || \
G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT)
#endif
#endif
-#ifndef HAVE_API_SUPPORT_WIN32_GET_MODULE_INFORMATION
-#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) || \
- G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT)
-#define HAVE_API_SUPPORT_WIN32_GET_MODULE_INFORMATION 1
-#else
-#define HAVE_API_SUPPORT_WIN32_GET_MODULE_INFORMATION 0
-#endif
-#endif
-
-#ifndef HAVE_API_SUPPORT_WIN32_GET_PRIORITY_CLASS
-#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
-#define HAVE_API_SUPPORT_WIN32_GET_PRIORITY_CLASS 1
-#else
-#define HAVE_API_SUPPORT_WIN32_GET_PRIORITY_CLASS 0
-#endif
-#endif
-
-#ifndef HAVE_API_SUPPORT_WIN32_GET_PROCESS_TIMES
-#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) || \
- G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT)
-#define HAVE_API_SUPPORT_WIN32_GET_PROCESS_TIMES 1
-#else
-#define HAVE_API_SUPPORT_WIN32_GET_PROCESS_TIMES 0
-#endif
-#endif
-
-#ifndef HAVE_API_SUPPORT_WIN32_GET_STD_HANDLE
-#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
-#define HAVE_API_SUPPORT_WIN32_GET_STD_HANDLE 1
-#else
-#define HAVE_API_SUPPORT_WIN32_GET_STD_HANDLE 0
-#endif
-#endif
-
-#ifndef HAVE_API_SUPPORT_WIN32_GET_SYSTEM_TIME_AS_FILE_TIME
-#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) || \
- G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT)
-#define HAVE_API_SUPPORT_WIN32_GET_SYSTEM_TIME_AS_FILE_TIME 1
-#else
-#define HAVE_API_SUPPORT_WIN32_GET_SYSTEM_TIME_AS_FILE_TIME 0
-#endif
-#endif
-
-#ifndef HAVE_API_SUPPORT_WIN32_GET_SYSTEM_TIMES
-#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
-#define HAVE_API_SUPPORT_WIN32_GET_SYSTEM_TIMES 1
-#else
-#define HAVE_API_SUPPORT_WIN32_GET_SYSTEM_TIMES 0
-#endif
-#endif
-
-#ifndef HAVE_API_SUPPORT_WIN32_GET_WORKING_SET_SIZE
-#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
-#define HAVE_API_SUPPORT_WIN32_GET_WORKING_SET_SIZE 1
-#else
-#define HAVE_API_SUPPORT_WIN32_GET_WORKING_SET_SIZE 0
-#endif
-#endif
-
#ifndef HAVE_API_SUPPORT_WIN32_IS_WOW64_PROCESS
#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
#define HAVE_API_SUPPORT_WIN32_IS_WOW64_PROCESS 1
#endif
#endif
-#ifndef HAVE_API_SUPPORT_WIN32_LOCAL_INFO
-#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) || \
- G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT)
-#define HAVE_API_SUPPORT_WIN32_LOCAL_INFO 1
-#else
-#define HAVE_API_SUPPORT_WIN32_LOCAL_INFO 0
-#endif
-#endif
-
-#ifndef HAVE_API_SUPPORT_WIN32_LOCAL_INFO_EX
-#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) || \
- G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT)
-#define HAVE_API_SUPPORT_WIN32_LOCAL_INFO_EX 1
-#else
-#define HAVE_API_SUPPORT_WIN32_LOCAL_INFO_EX 0
-#endif
-#endif
-
-#ifndef HAVE_API_SUPPORT_WIN32_LOCK_FILE
-#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) || \
- G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT)
-#define HAVE_API_SUPPORT_WIN32_LOCK_FILE 1
-#else
-#define HAVE_API_SUPPORT_WIN32_LOCK_FILE 0
-#endif
-#endif
-
-#ifndef HAVE_API_SUPPORT_WIN32_MOVE_FILE
-#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
-#define HAVE_API_SUPPORT_WIN32_MOVE_FILE 1
-#else
-#define HAVE_API_SUPPORT_WIN32_MOVE_FILE 0
-#endif
-#endif
-
-#ifndef HAVE_API_SUPPORT_WIN32_MOVE_FILE_EX
-#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) || \
- G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT)
-#define HAVE_API_SUPPORT_WIN32_MOVE_FILE_EX 1
-#else
-#define HAVE_API_SUPPORT_WIN32_MOVE_FILE_EX 0
-#endif
-#endif
-
-#ifndef HAVE_API_SUPPORT_WIN32_MSG_WAIT_FOR_MULTIPLE_OBJECTS
-#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
-#define HAVE_API_SUPPORT_WIN32_MSG_WAIT_FOR_MULTIPLE_OBJECTS 1
-#else
-#define HAVE_API_SUPPORT_WIN32_MSG_WAIT_FOR_MULTIPLE_OBJECTS 0
-#endif
-#endif
-
-#ifndef HAVE_API_SUPPORT_WIN32_OPEN_PROCESS
-#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) || \
- G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT)
-#define HAVE_API_SUPPORT_WIN32_OPEN_PROCESS 1
-#else
-#define HAVE_API_SUPPORT_WIN32_OPEN_PROCESS 0
-#endif
-#endif
-
#ifndef HAVE_API_SUPPORT_WIN32_OPEN_THREAD
#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) || \
G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT)
#endif
#endif
-#ifndef HAVE_API_SUPPORT_WIN32_REPLACE_FILE
-#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) || \
- G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT)
-#define HAVE_API_SUPPORT_WIN32_REPLACE_FILE 1
-#else
-#define HAVE_API_SUPPORT_WIN32_REPLACE_FILE 0
-#endif
-#endif
-
#ifndef HAVE_API_SUPPORT_WIN32_RESET_STKOFLW
#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
#define HAVE_API_SUPPORT_WIN32_RESET_STKOFLW 1
#endif
#endif
-#ifndef HAVE_API_SUPPORT_WIN32_SET_PRIORITY_CLASS
-#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
-#define HAVE_API_SUPPORT_WIN32_SET_PRIORITY_CLASS 1
-#else
-#define HAVE_API_SUPPORT_WIN32_SET_PRIORITY_CLASS 0
-#endif
-#endif
-
#ifndef HAVE_API_SUPPORT_WIN32_SET_THREAD_CONTEXT
#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
#define HAVE_API_SUPPORT_WIN32_SET_THREAD_CONTEXT 1
#endif
#endif
-#ifndef HAVE_API_SUPPORT_WIN32_SET_WORKING_SET_SIZE
-#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
-#define HAVE_API_SUPPORT_WIN32_SET_WORKING_SET_SIZE 1
-#else
-#define HAVE_API_SUPPORT_WIN32_SET_WORKING_SET_SIZE 0
-#endif
-#endif
-
-#ifndef HAVE_API_SUPPORT_WIN32_SHELL_EXECUTE_EX
-#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
-#define HAVE_API_SUPPORT_WIN32_SHELL_EXECUTE_EX 1
-#else
-#define HAVE_API_SUPPORT_WIN32_SHELL_EXECUTE_EX 0
-#endif
-#endif
-
-#ifndef HAVE_API_SUPPORT_WIN32_SIGNAL_OBJECT_AND_WAIT
-#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) || \
- G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT)
-#define HAVE_API_SUPPORT_WIN32_SIGNAL_OBJECT_AND_WAIT 1
-#else
-#define HAVE_API_SUPPORT_WIN32_SIGNAL_OBJECT_AND_WAIT 0
-#endif
-#endif
-
#ifndef HAVE_API_SUPPORT_WIN32_TIMERS
#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
#define HAVE_API_SUPPORT_WIN32_TIMERS 1
#endif
#endif
-#ifndef HAVE_API_SUPPORT_WIN32_TRANSMIT_FILE
-#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) || \
- G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT)
-#define HAVE_API_SUPPORT_WIN32_TRANSMIT_FILE 1
-#else
-#define HAVE_API_SUPPORT_WIN32_TRANSMIT_FILE 0
-#endif
-#endif
-
-#ifndef HAVE_API_SUPPORT_WIN32_UNLOCK_FILE
-#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) || \
- G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT)
-#define HAVE_API_SUPPORT_WIN32_UNLOCK_FILE 1
-#else
-#define HAVE_API_SUPPORT_WIN32_UNLOCK_FILE 0
-#endif
-#endif
-
-#ifndef HAVE_API_SUPPORT_WIN32_VER_LANGUAGE_NAME
-#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
-#define HAVE_API_SUPPORT_WIN32_VER_LANGUAGE_NAME 1
-#else
-#define HAVE_API_SUPPORT_WIN32_VER_LANGUAGE_NAME 0
-#endif
-#endif
-
-#ifndef HAVE_API_SUPPORT_WIN32_VER_QUERY_VALUE
-#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
-#define HAVE_API_SUPPORT_WIN32_VER_QUERY_VALUE 1
-#else
-#define HAVE_API_SUPPORT_WIN32_VER_QUERY_VALUE 0
-#endif
-#endif
-
#ifndef HAVE_API_SUPPORT_WIN32_PIPE_OPEN_CLOSE
#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
#define HAVE_API_SUPPORT_WIN32_PIPE_OPEN_CLOSE 1