mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-16 11:21:08 -10:00
Compare commits
7
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0511d99a29 | ||
|
|
e587464d80 | ||
|
|
406bd743d8 | ||
|
|
b790bf549e | ||
|
|
afbe09bbca | ||
|
|
c98c771228 | ||
|
|
e6dd37fa96 |
No files matched your search
@@ -1124,6 +1124,7 @@ namespace MonoTests.System.Diagnostics
|
||||
|
||||
[Test]
|
||||
[ExpectedException(typeof(InvalidOperationException))]
|
||||
[NUnit.Framework.Category ("AndroidNotWorking")] //Getting the name of init works fine on Android, go figure.
|
||||
public void HigherPrivilegeProcessName ()
|
||||
{
|
||||
if (!RunningOnUnix)
|
||||
@@ -1133,6 +1134,7 @@ namespace MonoTests.System.Diagnostics
|
||||
}
|
||||
|
||||
[Test]
|
||||
[NUnit.Framework.Category ("AndroidNotWorking")] //SELinux makes probing the parent process impossible
|
||||
public void NonChildProcessWaitForExit ()
|
||||
{
|
||||
if (!RunningOnUnix)
|
||||
@@ -1156,6 +1158,7 @@ namespace MonoTests.System.Diagnostics
|
||||
}
|
||||
|
||||
[Test]
|
||||
[NUnit.Framework.Category ("AndroidNotWorking")] //SELinux makes probing the parent process impossible
|
||||
public void NonChildProcessName ()
|
||||
{
|
||||
if (!RunningOnUnix)
|
||||
@@ -1170,6 +1173,7 @@ namespace MonoTests.System.Diagnostics
|
||||
}
|
||||
|
||||
[Test]
|
||||
[NUnit.Framework.Category ("AndroidNotWorking")] //SELinux makes probing the parent process impossible
|
||||
public void NonChildProcessId ()
|
||||
{
|
||||
if (!RunningOnUnix)
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace MonoTests.System.Net
|
||||
IAsyncResult async = Dns.BeginGetHostByName (site1Name, null, null);
|
||||
IPHostEntry entry = Dns.EndGetHostByName (async);
|
||||
SubTestValidIPHostEntry (entry);
|
||||
Assert.IsTrue (entry.HostName == "google-public-dns-a.google.com");
|
||||
Assert.AreEqual ("google-public-dns-a.google.com", entry.HostName, "#1");
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -219,26 +219,13 @@ namespace MonoTests.System.Net
|
||||
#if FEATURE_NO_BSD_SOCKETS
|
||||
[ExpectedException (typeof (PlatformNotSupportedException))]
|
||||
#endif
|
||||
[NUnit.Framework.Category ("AndroidNotWorking")] //Some Android devices like to return catch-all IPs for invalid host names.
|
||||
public void GetHostByName ()
|
||||
{
|
||||
SubTestGetHostByName (site1Name, site1Dot);
|
||||
SubTestGetHostByName (site2Name, site2Dot);
|
||||
try {
|
||||
var entry = Dns.GetHostByName (noneExistingSite);
|
||||
/*
|
||||
* Work around broken t-online.de DNS Server.
|
||||
*
|
||||
* T-Online's DNS Server for DSL Customers resolves
|
||||
* non-exisitng domain names to
|
||||
* http://navigationshilfe1.t-online.de/dnserror?url=....
|
||||
* instead of reporting an error.
|
||||
*/
|
||||
var navigationshilfe1 = IPAddress.Parse ("80.156.86.78");
|
||||
var navigationshilfe2 = IPAddress.Parse ("62.157.140.133");
|
||||
foreach (var addr in entry.AddressList) {
|
||||
if (addr.Equals (navigationshilfe1) || addr.Equals (navigationshilfe2))
|
||||
return;
|
||||
}
|
||||
Assert.Fail ("Should raise a SocketException (assuming that '" + noneExistingSite + "' does not exist)");
|
||||
} catch (SocketException) {
|
||||
}
|
||||
|
||||
@@ -3111,9 +3111,6 @@ mono_w32file_get_std_handle (gint stdhandle)
|
||||
mono_w32error_set_last (ERROR_NO_MORE_FILES);
|
||||
goto done;
|
||||
}
|
||||
} else {
|
||||
/* Add a reference to this handle */
|
||||
mono_w32handle_ref (handle);
|
||||
}
|
||||
|
||||
done:
|
||||
|
||||
@@ -152,8 +152,10 @@ mono_w32process_get_modules (pid_t pid)
|
||||
guint64 device;
|
||||
|
||||
fp = open_process_map (pid, "r");
|
||||
if (!fp)
|
||||
if (!fp) {
|
||||
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Can't open process map file for pid %d", __func__, pid);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
while (fgets (buf, sizeof(buf), fp)) {
|
||||
p = buf;
|
||||
|
||||
@@ -1171,10 +1171,10 @@ mono_w32process_module_get_filename (gpointer process, gpointer module, gunichar
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -1197,8 +1197,8 @@ mono_w32process_module_get_name (gpointer process, gpointer module, gunichar2 *b
|
||||
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 */
|
||||
|
||||
@@ -1215,7 +1215,8 @@ mono_w32process_module_get_name (gpointer process, gpointer module, gunichar2 *b
|
||||
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;
|
||||
}
|
||||
@@ -1236,11 +1237,14 @@ mono_w32process_module_get_name (gpointer process, gpointer module, gunichar2 *b
|
||||
}
|
||||
|
||||
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);
|
||||
@@ -1252,6 +1256,7 @@ mono_w32process_module_get_name (gpointer process, gpointer module, gunichar2 *b
|
||||
|
||||
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;
|
||||
@@ -1263,11 +1268,11 @@ mono_w32process_module_get_name (gpointer process, gpointer module, gunichar2 *b
|
||||
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);
|
||||
@@ -1279,6 +1284,7 @@ mono_w32process_module_get_name (gpointer process, gpointer module, gunichar2 *b
|
||||
return len;
|
||||
}
|
||||
|
||||
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Can't find procname_ext %p", __func__, process);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2314,7 +2320,6 @@ mono_w32process_set_cli_launcher (gchar *path)
|
||||
gpointer
|
||||
ves_icall_Microsoft_Win32_NativeMethods_GetCurrentProcess (void)
|
||||
{
|
||||
mono_w32handle_ref (current_process);
|
||||
return current_process;
|
||||
}
|
||||
|
||||
|
||||
@@ -41,6 +41,10 @@ G_BEGIN_DECLS
|
||||
|
||||
#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;
|
||||
|
||||
@@ -124,7 +128,7 @@ mono_os_cond_init (mono_cond_t *cond)
|
||||
{
|
||||
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);
|
||||
@@ -174,7 +178,7 @@ mono_os_cond_wait (mono_cond_t *cond, mono_mutex_t *mutex)
|
||||
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;
|
||||
@@ -187,7 +191,7 @@ mono_os_cond_timedwait (mono_cond_t *cond, mono_mutex_t *mutex, guint32 timeout_
|
||||
|
||||
/* 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))
|
||||
|
||||
Reference in new issue
Block a user