IAsyncResult async = Dns.BeginGetHostByName (site1Name, null, null);\r
IPHostEntry entry = Dns.EndGetHostByName (async);\r
SubTestValidIPHostEntry (entry);\r
- Assert.IsTrue (entry.HostName == "google-public-dns-a.google.com");\r
+ Assert.AreEqual ("google-public-dns-a.google.com", entry.HostName, "#1");\r
}\r
\r
[Test]\r
#if FEATURE_NO_BSD_SOCKETS\r
[ExpectedException (typeof (PlatformNotSupportedException))]\r
#endif\r
+ [NUnit.Framework.Category ("AndroidNotWorking")] //Some Android devices like to return catch-all IPs for invalid host names.\r
public void GetHostByName ()\r
{\r
SubTestGetHostByName (site1Name, site1Dot);\r
SubTestGetHostByName (site2Name, site2Dot);\r
try {\r
var entry = Dns.GetHostByName (noneExistingSite);\r
- /*\r
- * Work around broken t-online.de DNS Server.\r
- * \r
- * T-Online's DNS Server for DSL Customers resolves\r
- * non-exisitng domain names to\r
- * http://navigationshilfe1.t-online.de/dnserror?url=....\r
- * instead of reporting an error.\r
- */\r
- var navigationshilfe1 = IPAddress.Parse ("80.156.86.78");\r
- var navigationshilfe2 = IPAddress.Parse ("62.157.140.133");\r
- foreach (var addr in entry.AddressList) {\r
- if (addr.Equals (navigationshilfe1) || addr.Equals (navigationshilfe2))\r
- return;\r
- }\r
Assert.Fail ("Should raise a SocketException (assuming that '" + noneExistingSite + "' does not exist)");\r
} catch (SocketException) {\r
}\r
bytes += 2;
if (size < bytes) {
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Size %d smaller than needed (%ld); truncating", __func__, size, bytes);
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Size %d smaller than needed (%zd); truncating", __func__, size, bytes);
memcpy (basename, proc_path, size);
} else {
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Size %d larger than needed (%ld)", __func__, size, bytes);
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Size %d larger than needed (%zd)", __func__, size, bytes);
memcpy (basename, proc_path, bytes);
}
char *pname = NULL;
gboolean res;
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Getting module base name, process handle %p module %p",
- __func__, process, module);
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Getting module base name, process handle %p module %p basename %p size %d",
+ __func__, process, module, basename, size);
size = size * sizeof (gunichar2); /* adjust for unicode characters */
pname = g_strdup (process_handle->pname);
mods = mono_w32process_get_modules (pid);
- if (!mods) {
+ if (!mods && module != NULL) {
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Can't get modules %p", __func__, process);
g_free (pname);
return 0;
}
}
if (procname_ext == NULL) {
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Can't find procname_ext from procmods %p", __func__, process);
/* If it's *still* null, we might have hit the
* case where reading /proc/$pid/maps gives an
* empty file for this user.
*/
procname_ext = mono_w32process_get_name (pid);
+ if (!procname_ext)
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Can't find procname_ext from proc_get_name %p pid %d", __func__, process, pid);
}
g_slist_free (mods);
procname = mono_unicode_from_external (procname_ext, &bytes);
if (procname == NULL) {
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Can't get procname %p", __func__, process);
/* bugger */
g_free (procname_ext);
return 0;
bytes += 2;
if (size < bytes) {
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Size %d smaller than needed (%ld); truncating", __func__, size, bytes);
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Size %d smaller than needed (%zd); truncating", __func__, size, bytes);
memcpy (basename, procname, size);
} else {
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Size %d larger than needed (%ld)",
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Size %d larger than needed (%zd)",
__func__, size, bytes);
memcpy (basename, procname, bytes);
return len;
}
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Can't find procname_ext %p", __func__, process);
return 0;
}
gpointer
ves_icall_Microsoft_Win32_NativeMethods_GetCurrentProcess (void)
{
- mono_w32handle_ref (current_process);
return current_process;
}
#if !defined(HOST_WIN32)
+#if !defined(CLOCK_MONOTONIC) || defined(PLATFORM_MACOSX) || defined(PLATFORM_ANDROID)
+#define BROKEN_CLOCK_SOURCE
+#endif
+
typedef pthread_mutex_t mono_mutex_t;
typedef pthread_cond_t mono_cond_t;
{
int res;
-#if !defined(CLOCK_MONOTONIC) || defined(PLATFORM_MACOSX)
+#ifdef BROKEN_CLOCK_SOURCE
res = pthread_cond_init (cond, NULL);
if (G_UNLIKELY (res != 0))
g_error ("%s: pthread_cond_init failed with \"%s\" (%d)", __func__, g_strerror (res), res);
static inline int
mono_os_cond_timedwait (mono_cond_t *cond, mono_mutex_t *mutex, guint32 timeout_ms)
{
-#if !defined(CLOCK_MONOTONIC) || defined(PLATFORM_MACOSX)
+#ifdef BROKEN_CLOCK_SOURCE
struct timeval tv;
#endif
struct timespec ts;
/* ms = 10^-3, us = 10^-6, ns = 10^-9 */
-#if !defined(CLOCK_MONOTONIC) || defined(PLATFORM_MACOSX)
+#ifdef BROKEN_CLOCK_SOURCE
/* clock_gettime is not supported in MAC OS x */
res = gettimeofday (&tv, NULL);
if (G_UNLIKELY (res != 0))