Skip to content

Instantly share code, notes, and snippets.

@NattyNarwhal
Last active February 10, 2018 01:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NattyNarwhal/21564c6c5d3fc18f4947a1e4555aed6c to your computer and use it in GitHub Desktop.
Save NattyNarwhal/21564c6c5d3fc18f4947a1e4555aed6c to your computer and use it in GitHub Desktop.
diff --git a/mcs/class/referencesource/System/net/System/Net/Sockets/Socket.cs b/mcs/class/referencesource/System/net/System/Net/Sockets/Socket.cs
index 16e4366..12716af 100644
--- a/mcs/class/referencesource/System/net/System/Net/Sockets/Socket.cs
+++ b/mcs/class/referencesource/System/net/System/Net/Sockets/Socket.cs
@@ -6063,8 +6063,8 @@ namespace System.Net.Sockets {
bool ipv6 = true;
#if MONO
- ipv4 = IsProtocolSupported (System.Net.NetworkInformation.NetworkInterfaceComponent.IPv4);
- ipv6 = IsProtocolSupported (System.Net.NetworkInformation.NetworkInterfaceComponent.IPv6);
+ //ipv4 = IsProtocolSupported (System.Net.NetworkInformation.NetworkInterfaceComponent.IPv4);
+ //ipv6 = IsProtocolSupported (System.Net.NetworkInformation.NetworkInterfaceComponent.IPv6);
#else
SafeCloseSocket.InnerSafeCloseSocket socketV4 =
UnsafeNclNativeMethods.OSSOCK.WSASocket(
diff --git a/mono/eglib/gfile-unix.c b/mono/eglib/gfile-unix.c
index a91a25f..3aacf9f 100644
--- a/mono/eglib/gfile-unix.c
+++ b/mono/eglib/gfile-unix.c
@@ -79,27 +79,32 @@ g_file_test (const gchar *filename, GFileTest test)
return FALSE;
}
-#ifdef _AIX
-/* HACK: the preprocessor will not give us mkdtemp no matter
- what and Mono (for good reason) does
- "-Werror-implicit-function-declaration" so we error out;
- instead declare mkdtemp here; the linker will find mkdtemp
- anwyays. libuv has had similar issues, but they just ignore
- the compiler warning instead of failing on it.
-
- See: github.com/libuv/libuv/pull/740 */
-
-extern char *mkdtemp(char *);
-#endif
-
gchar *
g_mkdtemp (char *tmp_template)
{
-#ifdef HAVE_MKDTEMP
+/*
+ * On systems without mkdtemp, use a reimplemented version
+ * adapted from the Win32 version of this file. AIX is an
+ * exception because i before version 7.2 lacks mkdtemp in
+ * libc, and GCC can "fix" system headers so that it isn't
+ * present without redefining it.
+ */
+#if defined(HAVE_MKDTEMP) && !defined(_AIX)
char *template_copy = g_strdup (tmp_template);
return mkdtemp (template_copy);
#else
- g_error("Function mkdtemp not supported");
+ char *template = g_strdup (tmp_template);
+
+ template = mktemp(template);
+ if (template && *template) {
+ /* 0700 is the mode specified in specs */
+ if (mkdir (template, 0700) == 0){
+ return template;
+ }
+ }
+
+ g_free (template);
+ return NULL;
#endif
}
diff --git a/mono/metadata/object-internals.h b/mono/metadata/object-internals.h
index 9cfd157..7dd864d 100644
--- a/mono/metadata/object-internals.h
+++ b/mono/metadata/object-internals.h
@@ -127,7 +127,7 @@ struct _MonoArray {
mono_64bitaligned_t vector [MONO_ZERO_LEN_ARRAY];
};
-#define MONO_SIZEOF_MONO_ARRAY (sizeof (MonoArray) - MONO_ZERO_LEN_ARRAY * sizeof (double))
+#define MONO_SIZEOF_MONO_ARRAY (sizeof (MonoArray) - MONO_ZERO_LEN_ARRAY * sizeof (mono_64bitaligned_t))
struct _MonoString {
MonoObject object;
diff --git a/mono/utils/mono-hwcap-ppc.c b/mono/utils/mono-hwcap-ppc.c
index c3adc8a..8af5e6e 100644
--- a/mono/utils/mono-hwcap-ppc.c
+++ b/mono/utils/mono-hwcap-ppc.c
@@ -62,16 +62,16 @@ mono_hwcap_arch_init (void)
mono_hwcap_ppc_has_multiple_ls_units = TRUE;
}
#elif defined(_AIX)
- /*
- * FIXME: ensure these are valid, and we match Linux ones
- */
- mono_hwcap_ppc_is_isa_2x = __power_4_andup() ? TRUE : FALSE;
- mono_hwcap_ppc_is_isa_64 = __cpu64() ? TRUE: FALSE;
+ mono_hwcap_ppc_is_isa_64 = __cpu64();
+ mono_hwcap_ppc_is_isa_2x = __power_4_andup();
+ mono_hwcap_ppc_has_icache_snoop = __power_5_andup();
+ /* not on POWER8 */
+ mono_hwcap_ppc_has_multiple_ls_units = __power_4() || __power_5() || __power_6() || __power_7();
/*
* I dont see a way to get extended POWER6 and the PV_6_1
* def seems to be trigged on the POWER6 here despite not
* having these extended instructions, so POWER7 it is
*/
- mono_hwcap_ppc_has_move_fpr_gpr = __power_7_andup() ? TRUE : FALSE;
+ mono_hwcap_ppc_has_move_fpr_gpr = __power_7_andup();
#endif
}
diff --git a/mono/utils/mono-time.c b/mono/utils/mono-time.c
index 7dd323d..b51d6c3 100644
--- a/mono/utils/mono-time.c
+++ b/mono/utils/mono-time.c
@@ -152,7 +152,8 @@ mono_100ns_ticks (void)
timebase.denom *= 100; /* we return 100ns ticks */
}
return now * timebase.numer / timebase.denom;
-#elif defined(CLOCK_MONOTONIC)
+#elif defined(CLOCK_MONOTONIC) && !defined(_AIX)
+ /* !_AIX is defined because i 7.1 doesn't have clock_getres */
struct timespec tspec;
static struct timespec tspec_freq = {0};
static int can_use_clock = 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment