Update to mono 2.6.4;

(a lot of patches are in upstream now)
This commit is contained in:
robert 2010-04-27 12:39:49 +00:00
parent 5f912fab1d
commit 5d24fb6f79
20 changed files with 13 additions and 924 deletions

View File

@ -1,12 +1,11 @@
# $OpenBSD: Makefile,v 1.40 2010/04/16 11:59:45 robert Exp $
# $OpenBSD: Makefile,v 1.41 2010/04/27 12:39:49 robert Exp $
# sync with net/avahi,-mono
ONLY_FOR_ARCHS= amd64 i386 powerpc # arm
COMMENT= cross platform, open source .NET developement framework
DISTNAME= mono-2.6.3
PKGNAME= ${DISTNAME}p18
DISTNAME= mono-2.6.4
CATEGORIES= lang devel
@ -53,11 +52,8 @@ CONFIGURE_ENV= LDFLAGS="-L${LOCALBASE}/lib" \
CPPFLAGS="-I${LOCALBASE}/include" \
LC_ALL=C
CONFIGURE_ARGS= ${CONFIGURE_SHARED} \
--with-gc=boehm \
--with-glib=system \
--with-tls=pthread \
--with-jit=yes \
--with-interp=no \
--with-libgdiplus=installed \
--enable-quiet-build=no \
--disable-shared-handles
@ -85,6 +81,11 @@ BASH_SCRIPTS= mcs/class/Mono.WebBrowser/build-csproj2k5 \
FAKE_FLAGS= sysconfdir=${PREFIX}/share/examples
# XXX gmake randomy breaks here
pre-build:
@cd ${WRKSRC}/mono && exec ${_SYSTRACE_CMD} ${SETENV} ${MAKE_ENV} \
${MAKE} ${MAKE_FLAGS}
pre-configure:
${SUBST_CMD} ${WRKSRC}/runtime/mono-wrapper.in \
${WRKSRC}/runtime/monodis-wrapper.in

View File

@ -1,5 +1,5 @@
MD5 (mono-2.6.3.tar.bz2) = sdwhusLHx1gUqfMiRura3Q==
RMD160 (mono-2.6.3.tar.bz2) = 49YfYYoOnwY9brhuM29d6qI8vMg=
SHA1 (mono-2.6.3.tar.bz2) = pKq39GmDZk3Ez2OgHk/nqKSd4sY=
SHA256 (mono-2.6.3.tar.bz2) = DsuC0gB/Ry+O68hcNJgTUVv2QubqAhiQ7OQFVa1Q2Uc=
SIZE (mono-2.6.3.tar.bz2) = 27761467
MD5 (mono-2.6.4.tar.bz2) = NCp8o76jy+wMisSLkyL8tA==
RMD160 (mono-2.6.4.tar.bz2) = xcEr0CJv87RbuJUb+1x0QV6B1rE=
SHA1 (mono-2.6.4.tar.bz2) = w7VW5jz6Y1aHpANyqD5KG4/RAQM=
SHA256 (mono-2.6.4.tar.bz2) = wFufO8w7A424YM3w2oGgAQwUimc6MRBU7//F9hPNeSI=
SIZE (mono-2.6.4.tar.bz2) = 27690544

View File

@ -1,80 +0,0 @@
$OpenBSD: patch-configure_in,v 1.4 2010/04/08 12:12:33 robert Exp $
--- configure.in.orig Thu Feb 25 16:20:57 2010
+++ configure.in Thu Apr 8 12:14:12 2010
@@ -147,14 +147,19 @@ case "$host" in
;;
*-*-*openbsd*)
platform_win32=no
- CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE -DGC_FREEBSD_THREADS -DPLATFORM_BSD"
- libmono_cflags="-D_THREAD_SAFE"
++ CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE -DGC_OPENBSD_THREADS -DPLATFORM_BSD -D_GNU_SOURCE -D_REENTRANT -DUSE_MMAP"
+ if test "x$disable_munmap" != "xyes"; then
+ CPPFLAGS="$CPPFLAGS -DUSE_MUNMAP"
+ fi
+ libmono_cflags="-D_THREAD_SAFE -D_REENTRANT"
LDFLAGS="$LDFLAGS -pthread"
libmono_ldflags="-pthread"
need_link_unlink=yes
AC_DEFINE(PTHREAD_POINTER_ID)
libdl=
+ gc_default=boehm
libgc_threads=pthreads
+ with_sigaltstack=no
use_sigposix=yes
;;
*-*-linux*)
@@ -314,7 +319,7 @@ fi
AM_CONDITIONAL(NO_VERSION_SCRIPT, test x$no_version_script = xyes)
-AC_CHECK_HEADERS(sys/filio.h sys/sockio.h netdb.h utime.h sys/utime.h semaphore.h sys/un.h linux/rtc.h sys/syscall.h sys/mkdev.h sys/uio.h)
+AC_CHECK_HEADERS(sys/filio.h sys/sockio.h netdb.h utime.h sys/utime.h semaphore.h sys/un.h linux/rtc.h sys/syscall.h sys/mkdev.h sys/uio.h sys/param.h)
AC_CHECK_HEADERS(sys/user.h sys/socket.h sys/ipc.h sys/sem.h sys/utsname.h alloca.h ucontext.h pwd.h sys/select.h netinet/tcp.h netinet/in.h unistd.h sys/types.h)
@@ -764,6 +769,7 @@ case "x$gc" in
AC_SUBST(HAVE_BOEHM_GC)
LIBGC_LIBS="-lgc $libdl"
LIBGC_STATIC_LIBS="$LIBGC_LIBS"
+ libmono_ldflags="$libmono_ldflags -lgc"
# AC_CHECK_FUNCS does not work for some reason...
AC_CHECK_LIB(gc, GC_gcj_malloc, found_gcj_malloc="yes",,$libdl)
@@ -1228,6 +1234,9 @@ if test x$platform_win32 = xno; then
*-*-*freebsd*)
AC_CHECK_LIB(pthread, main, LIBS="$LIBS -pthread")
;;
+ *-*-*openbsd*)
+ AC_CHECK_LIB(pthread, main, LIBS="$LIBS -pthread")
+ ;;
*)
AC_CHECK_LIB(pthread, main, LIBS="$LIBS -lpthread")
;;
@@ -1620,6 +1629,7 @@ if test x$platform_win32 = xno; then
AC_CHECK_MEMBERS(
[struct kinfo_proc.kp_proc],,,
[#include <sys/types.h>
+ #include <sys/param.h>
#include <sys/sysctl.h>
#include <sys/proc.h>
])
@@ -1743,7 +1753,7 @@ AC_MSG_RESULT($try_dev_random)
case "{$target}" in
*-openbsd*)
- NAME_DEV_RANDOM="/dev/srandom"
+ NAME_DEV_RANDOM="/dev/arandom"
;;
dnl Win32 does not have /dev/random, they have their own method...
@@ -1932,8 +1942,8 @@ JIT_SUPPORTED=no
INTERP_SUPPORTED=no
LIBC="libc.so.6"
INTL="libc.so.6"
-SQLITE="libsqlite.so.0"
-SQLITE3="libsqlite3.so.0"
+SQLITE="libsqlite.so"
+SQLITE3="libsqlite3.so"
X11="libX11.so"
sizeof_register="SIZEOF_VOID_P"

View File

@ -1,15 +0,0 @@
$OpenBSD: patch-mcs_class_Mono_Security_Mono_Math_BigInteger_cs,v 1.1 2009/09/06 07:25:27 ajacoutot Exp $
CVE-2007-5197 - BigInteger overflow.
--- mcs/class/Mono.Security/Mono.Math/BigInteger.cs.orig Wed Jul 15 20:54:27 2009
+++ mcs/class/Mono.Security/Mono.Math/BigInteger.cs Fri Aug 28 13:52:19 2009
@@ -1607,7 +1607,7 @@ namespace Mono.Math {
uint j = 1;
// Multiply and add
- for (; j < m.length; j++) {
+ for (; j < m.length && j < A.length; j++) {
c += (ulong)u_i * (ulong)*(mP++) + *(aSP++);
*(aDP++) = (uint)c;
c >>= 32;

View File

@ -1,31 +0,0 @@
$OpenBSD: patch-mcs_class_System_System_Net_Sockets_Socket_cs,v 1.2 2010/03/20 17:16:44 robert Exp $
--- mcs/class/System/System.Net.Sockets/Socket.cs.orig Wed Oct 21 14:27:35 2009
+++ mcs/class/System/System.Net.Sockets/Socket.cs Fri Mar 19 23:29:31 2010
@@ -1272,7 +1272,7 @@ namespace System.Net.Sockets
}
int error = 0;
- if (!blocking) {
+// if (!blocking) {
SocketAddress serial = end_point.Serialize ();
Connect_internal (socket, serial, out error);
if (error == 0) {
@@ -1284,15 +1284,16 @@ namespace System.Net.Sockets
connected = false;
req.Complete (new SocketException (error), true);
}
- }
+// }
- if (blocking || error == (int) SocketError.InProgress || error == (int) SocketError.WouldBlock) {
+/* if (blocking || error == (int) SocketError.InProgress || error == (int) SocketError.WouldBlock) {
// continue asynch
connected = false;
Worker worker = new Worker (req);
SocketAsyncCall sac = new SocketAsyncCall (worker.Connect);
sac.BeginInvoke (null, req);
}
+*/
return(req);
}

View File

@ -1,15 +0,0 @@
$OpenBSD: patch-mcs_class_corlib_Mono_Math_BigInteger_cs,v 1.1 2009/09/06 07:25:27 ajacoutot Exp $
CVE-2007-5197 - BigInteger overflow.
--- mcs/class/corlib/Mono.Math/BigInteger.cs.orig Wed Jul 15 20:53:10 2009
+++ mcs/class/corlib/Mono.Math/BigInteger.cs Fri Aug 28 13:52:23 2009
@@ -1607,7 +1607,7 @@ namespace Mono.Math {
uint j = 1;
// Multiply and add
- for (; j < m.length; j++) {
+ for (; j < m.length && j < A.length; j++) {
c += (ulong)u_i * (ulong)*(mP++) + *(aSP++);
*(aDP++) = (uint)c;
c >>= 32;

View File

@ -1,18 +0,0 @@
$OpenBSD: patch-mono_arch_arm_dpiops_sh,v 1.2 2010/03/20 17:16:44 robert Exp $
--- mono/arch/arm/dpiops.sh.orig Fri Sep 25 16:58:13 2009
+++ mono/arch/arm/dpiops.sh Sat Mar 20 11:03:12 2010
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
OPCODES="AND EOR SUB RSB ADD ADC SBC RSC ORR BIC"
CMP_OPCODES="TST TEQ CMP CMN"
@@ -6,7 +6,7 @@ MOV_OPCODES="MOV MVN"
# $1: opcode list
# $2: template
-function gen() {
+gen() {
for i in $1; do
sed "s/<Op>/$i/g" $2.th
done

View File

@ -1,12 +0,0 @@
$OpenBSD: patch-mono_io-layer_collection_c,v 1.1 2010/04/16 11:59:45 robert Exp $
--- mono/io-layer/collection.c.orig Fri Apr 16 11:26:15 2010
+++ mono/io-layer/collection.c Fri Apr 16 11:26:24 2010
@@ -60,7 +60,7 @@ void _wapi_collection_init (void)
#ifdef HAVE_PTHREAD_ATTR_SETSTACKSIZE
if (set_stacksize == 0) {
-#if defined(__FreeBSD__) || defined(__NetBSD__)
+#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
ret = pthread_attr_setstacksize (&attr, 65536);
#else
ret = pthread_attr_setstacksize (&attr, PTHREAD_STACK_MIN);

View File

@ -1,316 +0,0 @@
$OpenBSD: patch-mono_io-layer_processes_c,v 1.1 2010/04/08 12:12:33 robert Exp $
--- mono/io-layer/processes.c.orig Thu Apr 8 12:26:28 2010
+++ mono/io-layer/processes.c Thu Apr 8 12:24:52 2010
@@ -35,10 +35,12 @@
#include <sys/resource.h>
#endif
-#ifdef PLATFORM_MACOSX
+#if defined(PLATFORM_MACOSX) || defined(__OpenBSD__)
#include <sys/proc.h>
#include <sys/sysctl.h>
-#include <sys/utsname.h>
+# if !defined(__OpenBSD__)
+# include <sys/utsname.h>
+# endif
#endif
#ifdef PLATFORM_SOLARIS
@@ -78,7 +80,9 @@ extern char **environ;
#undef DEBUG
static guint32 process_wait (gpointer handle, guint32 timeout);
+#if !defined(__OpenBSD__)
FILE *open_process_map (int pid, const char *mode);
+#endif
struct _WapiHandleOps _wapi_process_ops = {
NULL, /* close_shared */
@@ -1511,16 +1515,27 @@ static gboolean process_enum (gpointer handle, gpointe
}
#endif /* UNUSED_CODE */
-#ifdef PLATFORM_MACOSX
+#if defined(PLATFORM_MACOSX) || defined(__OpenBSD__)
gboolean EnumProcesses (guint32 *pids, guint32 len, guint32 *needed)
{
guint32 count, fit, i, j;
gint32 err;
gboolean done;
+ size_t proclength, size;
+#if defined(__OpenBSD__)
+ struct kinfo_proc2 *result;
+ int name[6];
+ name[0] = CTL_KERN;
+ name[1] = KERN_PROC2;
+ name[2] = KERN_PROC_ALL;
+ name[3] = 0;
+ name[4] = sizeof(struct kinfo_proc2);
+ name[5] = 0;
+#else
struct kinfo_proc *result;
- size_t proclength;
static const int name[] = { CTL_KERN, KERN_PROC, KERN_PROC_ALL, 0 };
+#endif
mono_once (&process_current_once, process_set_current);
@@ -1529,15 +1544,24 @@ gboolean EnumProcesses (guint32 *pids, guint32 len, gu
do {
proclength = 0;
- err = sysctl ((int *)name, (sizeof(name) / sizeof(*name)) - 1, NULL, &proclength, NULL, 0);
+#if defined(__OpenBSD__)
+ size = (sizeof(name) / sizeof(*name));
+#else
+ size = (sizeof(name) / sizeof(*name)) - 1;
+#endif
+ err = sysctl ((int *)name, size, NULL, &proclength, NULL, 0);
if (err == 0) {
result = malloc (proclength);
if (result == NULL)
return FALSE;
-
- err = sysctl ((int *) name, (sizeof(name) / sizeof(*name)) - 1, result, &proclength, NULL, 0);
+
+#if defined(__OpenBSD__)
+ name[5] = (int)(proclength / sizeof(struct kinfo_proc2));
+#endif
+ err = sysctl ((int *) name, size, result, &proclength, NULL, 0);
+
if (err == 0)
done = TRUE;
else
@@ -1552,11 +1576,19 @@ gboolean EnumProcesses (guint32 *pids, guint32 len, gu
}
return(FALSE);
}
-
+
+#if defined(__OpenBSD__)
+ count = proclength / sizeof(struct kinfo_proc2);
+#else
count = proclength / sizeof(struct kinfo_proc);
+#endif
fit = len / sizeof(guint32);
for (i = 0, j = 0; j< fit && i < count; i++) {
+#if defined(__OpenBSD__)
+ pids [j++] = result [i].p_pid;
+#else
pids [j++] = result [i].kp_proc.p_pid;
+#endif
}
free (result);
result = NULL;
@@ -1648,8 +1680,12 @@ gpointer OpenProcess (guint32 req_access G_GNUC_UNUSED
process_open_compare,
GUINT_TO_POINTER (pid), NULL, TRUE);
if (handle == 0) {
+#if defined(__OpenBSD__)
+ if ((kill(pid, 0) == 0) || (errno == EPERM)) {
+#else
gchar *dir = g_strdup_printf ("/proc/%d", pid);
if (!access (dir, F_OK)) {
+#endif
/* Return a pseudo handle for processes we
* don't have handles for
*/
@@ -1862,6 +1898,67 @@ static GSList *load_modules (void)
return(ret);
}
+#elif defined(__OpenBSD__)
+#include <link.h>
+static int load_modules_callback (struct dl_phdr_info *info, size_t size, void *ptr)
+{
+ if (size < offsetof (struct dl_phdr_info, dlpi_phnum)
+ + sizeof (info->dlpi_phnum))
+ return (-1);
+
+ struct dl_phdr_info *cpy = calloc(1, sizeof(struct dl_phdr_info));
+ if (!cpy)
+ return (-1);
+
+ memcpy(cpy, info, sizeof(*info));
+
+ g_ptr_array_add ((GPtrArray *)ptr, cpy);
+
+ return (0);
+}
+
+static GSList *load_modules (void)
+{
+ GSList *ret = NULL;
+ WapiProcModule *mod;
+ GPtrArray *dlarray = g_ptr_array_new();
+ int i;
+
+ if (dl_iterate_phdr(load_modules_callback, dlarray) < 0)
+ return (ret);
+
+ for (i = 0; i < dlarray->len; i++) {
+ struct dl_phdr_info *info = g_ptr_array_index (dlarray, i);
+
+ mod = g_new0 (WapiProcModule, 1);
+ mod->address_start = (gpointer)(info->dlpi_addr + info->dlpi_phdr[0].p_vaddr);
+ mod->address_end = (gpointer)(info->dlpi_addr +
+ info->dlpi_phdr[info->dlpi_phnum - 1].p_vaddr);
+ mod->perms = g_strdup ("r--p");
+ mod->address_offset = 0;
+ mod->inode = (ino_t) i;
+ mod->filename = g_strdup (info->dlpi_name);
+
+#ifdef DEBUG
+ g_message ("%s: inode=%d, filename=%s, address_start=%p, address_end=%p", __func__,
+ mod->inode, mod->filename, mod->address_start, mod->address_end);
+#endif
+
+ free(info);
+
+ if (g_slist_find_custom (ret, mod, find_procmodule) == NULL) {
+ ret = g_slist_prepend (ret, mod);
+ } else {
+ free_procmodule (mod);
+ }
+ }
+
+ g_ptr_array_free (dlarray, TRUE);
+
+ ret = g_slist_reverse (ret);
+
+ return(ret);
+}
#else
static GSList *load_modules (FILE *fp)
{
@@ -2012,6 +2109,7 @@ static gboolean match_procname_to_modulename (gchar *p
return result;
}
+#if !defined(__OpenBSD__)
FILE *open_process_map (int pid, const char *mode)
{
FILE *fp = NULL;
@@ -2031,13 +2129,16 @@ FILE *open_process_map (int pid, const char *mode)
return fp;
}
+#endif
gboolean EnumProcessModules (gpointer process, gpointer *modules,
guint32 size, guint32 *needed)
{
struct _WapiHandle_process *process_handle;
gboolean ok;
+#if !defined(__OpenBSD__)
FILE *fp;
+#endif
GSList *mods = NULL;
WapiProcModule *module;
guint32 count, avail = size / sizeof(gpointer);
@@ -2075,7 +2176,7 @@ gboolean EnumProcessModules (gpointer process, gpointe
proc_name = process_handle->proc_name;
}
-#ifdef PLATFORM_MACOSX
+#if defined(PLATFORM_MACOSX) || defined(__OpenBSD__)
{
mods = load_modules ();
#else
@@ -2123,10 +2224,12 @@ gboolean EnumProcessModules (gpointer process, gpointe
static gchar *get_process_name_from_proc (pid_t pid)
{
+#if !defined(__OpenBSD__)
+ FILE *fp;
gchar *filename = NULL;
- gchar *ret = NULL;
gchar buf[256];
- FILE *fp;
+#endif
+ gchar *ret = NULL;
#if defined(PLATFORM_SOLARIS)
filename = g_strdup_printf ("/proc/%d/psinfo", pid);
@@ -2149,6 +2252,40 @@ static gchar *get_process_name_from_proc (pid_t pid)
# endif
if (strlen (buf) > 0)
ret = g_strdup (buf);
+#elif defined(__OpenBSD__)
+ int mib [6];
+ size_t size;
+ struct kinfo_proc2 *pi;
+
+ mib [0] = CTL_KERN;
+ mib [1] = KERN_PROC2;
+ mib [2] = KERN_PROC_PID;
+ mib [3] = pid;
+ mib [4] = sizeof(struct kinfo_proc2);
+ mib [5] = 0;
+
+retry:
+ if (sysctl(mib, 6, NULL, &size, NULL, 0) < 0)
+ return(ret);
+
+ if ((pi = malloc(size)) == NULL)
+ return(ret);
+
+ mib[5] = (int)(size / sizeof(struct kinfo_proc2));
+
+ if ((sysctl (mib, 6, pi, &size, NULL, 0) < 0) ||
+ (size != sizeof (struct kinfo_proc2))) {
+ if (errno == ENOMEM) {
+ free(pi);
+ goto retry;
+ }
+ return(ret);
+ }
+
+ if (strlen (pi->p_comm) > 0)
+ ret = g_strdup (pi->p_comm);
+
+ free(pi);
#else
memset (buf, '\0', sizeof(buf));
filename = g_strdup_printf ("/proc/%d/exe", pid);
@@ -2214,7 +2351,9 @@ static guint32 get_module_name (gpointer process, gpoi
gchar *procname_ext = NULL;
glong len;
gsize bytes;
+#if !defined(__OpenBSD__)
FILE *fp;
+#endif
GSList *mods = NULL;
WapiProcModule *found_module;
guint32 count;
@@ -2254,7 +2393,7 @@ static guint32 get_module_name (gpointer process, gpoi
}
/* Look up the address in /proc/<pid>/maps */
-#ifdef PLATFORM_MACOSX
+#if defined(PLATFORM_MACOSX) || defined(__OpenBSD__)
{
mods = load_modules ();
#else
@@ -2366,7 +2505,9 @@ gboolean GetModuleInformation (gpointer process, gpoin
struct _WapiHandle_process *process_handle;
gboolean ok;
pid_t pid;
+#if !defined(__OpenBSD__)
FILE *fp;
+#endif
GSList *mods = NULL;
WapiProcModule *found_module;
guint32 count;
@@ -2404,7 +2545,7 @@ gboolean GetModuleInformation (gpointer process, gpoin
proc_name = g_strdup (process_handle->proc_name);
}
-#ifdef PLATFORM_MACOSX
+#if defined(PLATFORM_MACOSX) || defined(__OpenBSD__)
{
mods = load_modules ();
#else

View File

@ -1,11 +0,0 @@
$OpenBSD: patch-mono_io-layer_sockets_c,v 1.1 2009/09/06 07:25:27 ajacoutot Exp $
--- mono/io-layer/sockets.c.orig Tue Sep 1 14:43:23 2009
+++ mono/io-layer/sockets.c Tue Sep 1 14:43:34 2009
@@ -14,6 +14,7 @@
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
+#include <sys/uio.h>
#ifdef HAVE_SYS_IOCTL_H
# include <sys/ioctl.h>
#endif

View File

@ -1,30 +0,0 @@
$OpenBSD: patch-mono_metadata_socket-io_c,v 1.2 2010/03/20 17:16:44 robert Exp $
--- mono/metadata/socket-io.c.orig Tue Jan 12 01:00:55 2010
+++ mono/metadata/socket-io.c Fri Mar 19 23:29:31 2010
@@ -2767,7 +2767,7 @@ MonoBoolean ves_icall_System_Net_Dns_GetHostByName_int
memset(&hints, 0, sizeof(hints));
hints.ai_family = get_family_hint ();
hints.ai_socktype = SOCK_STREAM;
- hints.ai_flags = AI_CANONNAME | AI_ADDRCONFIG;
+ hints.ai_flags = AI_CANONNAME;
if (*hostname && getaddrinfo(hostname, NULL, &hints, &info) == -1) {
return(FALSE);
@@ -2912,7 +2912,7 @@ extern MonoBoolean ves_icall_System_Net_Dns_GetHostByA
struct sockaddr_in6 saddr6;
struct addrinfo *info = NULL, hints;
gint32 family;
- char hostname[1024] = {0};
+ char hostname[NI_MAXHOST] = {0};
int flags = 0;
#else
struct in_addr inaddr;
@@ -2969,7 +2969,7 @@ extern MonoBoolean ves_icall_System_Net_Dns_GetHostByA
memset (&hints, 0, sizeof(hints));
hints.ai_family = get_family_hint ();
hints.ai_socktype = SOCK_STREAM;
- hints.ai_flags = AI_CANONNAME | AI_ADDRCONFIG;
+ hints.ai_flags = AI_CANONNAME;
if( getaddrinfo (hostname, NULL, &hints, &info) == -1 ) {
return(FALSE);

View File

@ -1,42 +0,0 @@
$OpenBSD: patch-mono_metadata_threads_c,v 1.1 2010/04/01 21:53:51 robert Exp $
--- mono/metadata/threads.c.orig Thu Apr 1 21:28:08 2010
+++ mono/metadata/threads.c Thu Apr 1 21:36:45 2010
@@ -15,6 +15,10 @@
#include <glib.h>
#include <signal.h>
#include <string.h>
+#if defined(__OpenBSD__)
+#include <pthread.h>
+#include <pthread_np.h>
+#endif
#include <mono/metadata/object.h>
#include <mono/metadata/domain-internals.h>
@@ -855,6 +859,15 @@ mono_thread_get_stack_bounds (guint8 **staddr, size_t
# elif defined(sun)
*staddr = NULL;
pthread_attr_getstacksize (&attr, &stsize);
+# elif defined(__OpenBSD__)
+ stack_t ss;
+ int rslt;
+
+ rslt = pthread_stackseg_np(pthread_self(), &ss);
+ g_assert (rslt == 0);
+
+ *staddr = (guint8*)((size_t)ss.ss_sp - ss.ss_size);
+ *stsize = ss.ss_size;
# else
*staddr = NULL;
*stsize = 0;
@@ -862,8 +875,10 @@ mono_thread_get_stack_bounds (guint8 **staddr, size_t
# endif
# endif
-# ifndef sun
+# if !defined(sun)
+# if !defined(__OpenBSD__)
pthread_attr_getstack (&attr, (void**)staddr, stsize);
+# endif
if (*staddr)
g_assert ((current > *staddr) && (current < *staddr + *stsize));
# endif

View File

@ -1,31 +0,0 @@
$OpenBSD: patch-mono_mini_mini-posix_c,v 1.2 2010/03/27 12:06:26 robert Exp $
--- mono/mini/mini-posix.c.orig Sat Mar 27 12:33:58 2010
+++ mono/mini/mini-posix.c Sat Mar 27 12:34:52 2010
@@ -179,16 +179,22 @@ SIG_HANDLER_SIGNATURE (sigusr1_signal_handler)
}
/*
- * FIXME:
* This is an async signal, so the code below must not call anything which
* is not async safe. That includes the pthread locking functions. If we
* know that we interrupted managed code, then locking is safe.
*/
- ji = mono_jit_info_table_find (mono_domain_get (), mono_arch_ip_from_context(ctx));
- running_managed = ji != NULL;
+ /*
+ * On OpenBSD, ctx can be NULL if we are interrupting poll ().
+ */
+ if (ctx) {
+ ji = mono_jit_info_table_find (mono_domain_get (), mono_arch_ip_from_context(ctx));
+ running_managed = ji != NULL;
- if (mono_debugger_agent_thread_interrupt (ctx, ji))
- return;
+ if (mono_debugger_agent_thread_interrupt (ctx, ji))
+ return;
+ } else {
+ running_managed = FALSE;
+ }
exc = mono_thread_request_interruption (running_managed);
if (!exc)

View File

@ -1,13 +0,0 @@
$OpenBSD: patch-mono_mini_mini-x86_h,v 1.1 2010/03/22 16:56:13 robert Exp $
--- mono/mini/mini-x86.h.orig Mon Mar 22 17:45:19 2010
+++ mono/mini/mini-x86.h Mon Mar 22 17:45:56 2010
@@ -44,7 +44,8 @@ LONG CALLBACK seh_handler(EXCEPTION_POINTERS* ep);
#endif /* PLATFORM_WIN32 */
-#if defined( __linux__) || defined(__sun) || defined(__APPLE__) || defined(__NetBSD__) || defined(__FreeBSD__)
+#if defined( __linux__) || defined(__sun) || defined(__APPLE__) || defined(__NetBSD__) || \
+ defined(__FreeBSD__) || defined(__OpenBSD__)
#define MONO_ARCH_USE_SIGACTION
#endif

View File

@ -1,45 +0,0 @@
$OpenBSD: patch-mono_mini_mini_c,v 1.3 2010/03/22 09:48:15 robert Exp $
--- mono/mini/mini.c.orig Thu Feb 25 16:20:57 2010
+++ mono/mini/mini.c Mon Mar 22 10:22:30 2010
@@ -4773,18 +4773,19 @@ SIG_HANDLER_SIGNATURE (mono_sigill_signal_handler)
mono_arch_handle_exception (ctx, exc, FALSE);
}
+#if defined(MONO_ARCH_USE_SIGACTION) || defined(HOST_WIN32)
+#define HAVE_SIG_INFO
+#endif
+
void
SIG_HANDLER_SIGNATURE (mono_sigsegv_signal_handler)
{
-#ifndef MONO_ARCH_SIGSEGV_ON_ALTSTACK
- MonoException *exc = NULL;
-#endif
MonoJitInfo *ji;
MonoJitTlsData *jit_tls = TlsGetValue (mono_jit_tls_id);
GET_CONTEXT;
-#ifdef MONO_ARCH_SOFT_DEBUG_SUPPORTED
+#if defined(MONO_ARCH_SOFT_DEBUG_SUPPORTED) && defined(HAVE_SIG_INFO)
if (mono_arch_is_single_step_event (info, ctx)) {
mono_debugger_agent_single_step_event (ctx);
return;
@@ -4794,7 +4795,7 @@ SIG_HANDLER_SIGNATURE (mono_sigsegv_signal_handler)
}
#endif
-#ifndef PLATFORM_WIN32
+#if !defined(HOST_WIN32) && defined(HAVE_SIG_INFO)
if (mono_aot_is_pagefault (info->si_addr)) {
mono_aot_handle_pagefault (info->si_addr);
return;
@@ -4844,7 +4845,7 @@ SIG_HANDLER_SIGNATURE (mono_sigsegv_signal_handler)
mono_handle_native_sigsegv (SIGSEGV, ctx);
}
- mono_arch_handle_exception (ctx, exc, FALSE);
+ mono_arch_handle_exception (ctx, NULL, FALSE);
#endif
}

View File

@ -1,12 +0,0 @@
$OpenBSD: patch-mono_tests_libtest_c,v 1.2 2010/03/20 17:16:44 robert Exp $
--- mono/tests/libtest.c.orig Wed Feb 3 22:26:25 2010
+++ mono/tests/libtest.c Fri Mar 19 23:29:31 2010
@@ -3190,7 +3190,7 @@ mono_test_marshal_ccw_itest (MonoComObject *pUnk)
* mono_method_get_unmanaged_thunk tests
*/
-#if defined(__GNUC__) && ((defined(__i386__) && (defined(__linux__) || defined (__APPLE__)) || defined (__FreeBSD__)) || (defined(__ppc__) && defined(__APPLE__)))
+#if defined(__GNUC__) && ((defined(__i386__) && (defined(__linux__) || defined (__APPLE__)) || defined (__FreeBSD__) || defined (__OpenBSD__)) || (defined(__ppc__) && defined(__APPLE__)))
#define ALIGN(size) __attribute__ ((aligned(size)))
#else
#define ALIGN(size)

View File

@ -1,125 +0,0 @@
$OpenBSD: patch-mono_utils_mono-proclib_c,v 1.6 2010/04/08 12:12:33 robert Exp $
--- mono/utils/mono-proclib.c.orig Sat Oct 31 05:22:03 2009
+++ mono/utils/mono-proclib.c Thu Apr 8 11:55:46 2010
@@ -13,6 +13,9 @@
#endif
/* FIXME: bsds untested */
+#if defined(__FreeBSD__) || defined(__OpenBSD__)
+#include <sys/param.h>
+#endif
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
#include <sys/types.h>
#include <sys/sysctl.h>
@@ -21,8 +24,13 @@
#include <sys/user.h>
#endif
#ifdef HAVE_STRUCT_KINFO_PROC_KP_PROC
-#define kinfo_pid_member kp_proc.p_pid
-#define kinfo_name_member kp_proc.p_comm
+# ifdef KERN_PROC2
+# define kinfo_pid_member p_pid
+# define kinfo_name_member p_comm
+# else
+# define kinfo_pid_member kp_proc.p_pid
+# define kinfo_name_member kp_proc.p_comm
+# endif
#else
#define kinfo_pid_member ki_pid
#define kinfo_name_member ki_comm
@@ -41,10 +49,16 @@ gpointer*
mono_process_list (int *size)
{
#if USE_SYSCTL
- int mib [4];
int res, i;
+#ifdef KERN_PROC2
+ int mib [6];
+ size_t data_len = sizeof (struct kinfo_proc2) * 400;
+ struct kinfo_proc2 *processes = malloc (data_len);
+#else
+ int mib [4];
size_t data_len = sizeof (struct kinfo_proc) * 400;
struct kinfo_proc *processes = malloc (data_len);
+#endif
void **buf = NULL;
if (size)
@@ -52,17 +66,33 @@ mono_process_list (int *size)
if (!processes)
return NULL;
+#ifdef KERN_PROC2
mib [0] = CTL_KERN;
+ mib [1] = KERN_PROC2;
+ mib [2] = KERN_PROC_ALL;
+ mib [3] = 0;
+ mib [4] = sizeof(struct kinfo_proc2);
+ mib [5] = 400; /* XXX */
+
+ res = sysctl (mib, 6, processes, &data_len, NULL, 0);
+#else
+ mib [0] = CTL_KERN;
mib [1] = KERN_PROC;
mib [2] = KERN_PROC_ALL;
mib [3] = 0;
res = sysctl (mib, 4, processes, &data_len, NULL, 0);
+#endif /* KERN_PROC2 */
+
if (res < 0) {
free (processes);
return NULL;
}
+#ifdef KERN_PROC2
+ res = data_len/sizeof (struct kinfo_proc2);
+#else
res = data_len/sizeof (struct kinfo_proc);
+#endif /* KERN_PROC2 */
buf = g_realloc (buf, res * sizeof (void*));
for (i = 0; i < res; ++i)
buf [i] = GINT_TO_POINTER (processes [i].kinfo_pid_member);
@@ -155,14 +185,34 @@ char*
mono_process_get_name (gpointer pid, char *buf, int len)
{
#if USE_SYSCTL
- int mib [4];
int res;
+#ifdef KERN_PROC2
+ int mib [6];
+ size_t data_len = sizeof (struct kinfo_proc2);
+ struct kinfo_proc2 processi;
+#else
+ int mib [4];
size_t data_len = sizeof (struct kinfo_proc);
struct kinfo_proc processi;
+#endif /* KERN_PROC2 */
memset (buf, 0, len);
+#ifdef KERN_PROC2
mib [0] = CTL_KERN;
+ mib [1] = KERN_PROC2;
+ mib [2] = KERN_PROC_PID;
+ mib [3] = GPOINTER_TO_UINT (pid);
+ mib [4] = sizeof(struct kinfo_proc2);
+ mib [5] = 400; /* XXX */
+
+ res = sysctl (mib, 6, &processi, &data_len, NULL, 0);
+
+ if (res < 0 || data_len != sizeof (struct kinfo_proc2)) {
+ return buf;
+ }
+#else
+ mib [0] = CTL_KERN;
mib [1] = KERN_PROC;
mib [2] = KERN_PROC_PID;
mib [3] = GPOINTER_TO_UINT (pid);
@@ -171,6 +221,7 @@ mono_process_get_name (gpointer pid, char *buf, int le
if (res < 0 || data_len != sizeof (struct kinfo_proc)) {
return buf;
}
+#endif /* KERN_PROC2 */
strncpy (buf, processi.kinfo_name_member, len - 1);
return buf;
#else

View File

@ -1,42 +0,0 @@
$OpenBSD: patch-mono_utils_mono-sigcontext_h,v 1.2 2010/03/23 08:25:26 robert Exp $
--- mono/utils/mono-sigcontext.h.orig Fri Sep 25 16:58:11 2009
+++ mono/utils/mono-sigcontext.h Tue Mar 23 08:56:28 2010
@@ -54,6 +54,16 @@
#define UCONTEXT_REG_ESI(ctx) (((ucontext_t*)(ctx))->uc_mcontext.__gregs [_REG_ESI])
#define UCONTEXT_REG_EDI(ctx) (((ucontext_t*)(ctx))->uc_mcontext.__gregs [_REG_EDI])
#define UCONTEXT_REG_EIP(ctx) (((ucontext_t*)(ctx))->uc_mcontext.__gregs [_REG_EIP])
+#elif defined(__OpenBSD__)
+ #define UCONTEXT_REG_EAX(ctx) ((ctx)->sc_eax)
+ #define UCONTEXT_REG_EBX(ctx) ((ctx)->sc_ebx)
+ #define UCONTEXT_REG_ECX(ctx) ((ctx)->sc_ecx)
+ #define UCONTEXT_REG_EDX(ctx) ((ctx)->sc_edx)
+ #define UCONTEXT_REG_EBP(ctx) ((ctx)->sc_ebp)
+ #define UCONTEXT_REG_ESP(ctx) ((ctx)->sc_esp)
+ #define UCONTEXT_REG_ESI(ctx) ((ctx)->sc_esi)
+ #define UCONTEXT_REG_EDI(ctx) ((ctx)->sc_edi)
+ #define UCONTEXT_REG_EIP(ctx) ((ctx)->sc_eip)
#else
#define UCONTEXT_REG_EAX(ctx) (((ucontext_t*)(ctx))->uc_mcontext.gregs [REG_EAX])
#define UCONTEXT_REG_EBX(ctx) (((ucontext_t*)(ctx))->uc_mcontext.gregs [REG_EBX])
@@ -70,6 +80,21 @@
#ifdef __FreeBSD__
#define UCONTEXT_GREGS(ctx) &(((ucontext_t*)(ctx))->uc_mcontext)
+#elif defined(__OpenBSD__)
+ /* OpenBSD/amd64 has no gregs array, ucontext_t == sigcontext */
+ #define UCONTEXT_REG_RAX(ctx) ((ctx)->sc_rax)
+ #define UCONTEXT_REG_RBX(ctx) ((ctx)->sc_rbx)
+ #define UCONTEXT_REG_RCX(ctx) ((ctx)->sc_rcx)
+ #define UCONTEXT_REG_RDX(ctx) ((ctx)->sc_rdx)
+ #define UCONTEXT_REG_RBP(ctx) ((ctx)->sc_rbp)
+ #define UCONTEXT_REG_RSP(ctx) ((ctx)->sc_rsp)
+ #define UCONTEXT_REG_RSI(ctx) ((ctx)->sc_rsi)
+ #define UCONTEXT_REG_RDI(ctx) ((ctx)->sc_rdi)
+ #define UCONTEXT_REG_RIP(ctx) ((ctx)->sc_rip)
+ #define UCONTEXT_REG_R12(ctx) ((ctx)->sc_r12)
+ #define UCONTEXT_REG_R13(ctx) ((ctx)->sc_r13)
+ #define UCONTEXT_REG_R14(ctx) ((ctx)->sc_r14)
+ #define UCONTEXT_REG_R15(ctx) ((ctx)->sc_r15)
#else
#define UCONTEXT_GREGS(ctx) &(((ucontext_t*)(ctx))->uc_mcontext.gregs)
#endif

View File

@ -1,45 +0,0 @@
$OpenBSD: patch-mono_utils_mono-time_c,v 1.1 2010/04/08 16:40:04 robert Exp $
--- mono/utils/mono-time.c.orig Thu Apr 8 18:34:07 2010
+++ mono/utils/mono-time.c Thu Apr 8 18:35:15 2010
@@ -57,12 +57,32 @@ mono_100ns_datetime (void)
#include <sys/time.h>
#endif
+#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
+#include <sys/param.h>
+#include <sys/sysctl.h>
+#endif
+
#include <time.h>
static gint64
get_boot_time (void)
{
- /* FIXME: use sysctl (kern.boottime) on OSX */
+#if defined(PLATFORM_MACOSX) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
+ int mib [2];
+ size_t size;
+ time_t now;
+ struct timeval boottime;
+
+ (void)time(&now);
+
+ mib [0] = CTL_KERN;
+ mib [1] = KERN_BOOTTIME;
+
+ size = sizeof(boottime);
+
+ if (sysctl(mib, 2, &boottime, &size, NULL, 0) != -1)
+ return (gint64)((now - boottime.tv_sec) * MTICKS_PER_SEC);
+#else
FILE *uptime = fopen ("/proc/uptime", "r");
if (uptime) {
double upt;
@@ -73,6 +93,7 @@ get_boot_time (void)
}
fclose (uptime);
}
+#endif
/* a made up uptime of 300 seconds */
return (gint64)300 * MTICKS_PER_SEC;
}

View File

@ -1,29 +0,0 @@
$OpenBSD: patch-support_mph_h,v 1.2 2010/03/26 10:40:44 robert Exp $
--- support/mph.h.orig Fri Sep 25 16:58:14 2009
+++ support/mph.h Thu Mar 25 16:41:41 2010
@@ -36,7 +36,7 @@
#include <stdint.h> /* for SIZE_MAX */
#endif
-#if __APPLE__ || __BSD__ || __FreeBSD__
+#if __APPLE__ || __BSD__ || __FreeBSD__ || __OpenBSD__
#define MPH_ON_BSD
#endif
@@ -46,9 +46,13 @@
#define MPH_INTERNAL
#endif
-#if defined (PLATFORM_WIN32) && !defined (EOVERFLOW)
-#define EOVERFLOW 75
-#endif /* def PLATFORM_WIN32 && ndef EOVERFLOW */
+#if !defined(EOVERFLOW)
+# if defined(PLATFORM_WIN32)
+# define EOVERFLOW 75
+# elif defined(__OpenBSD__)
+# define EOVERFLOW 87
+# endif
+#endif /* !defined(EOVERFLOW) */
#if !defined (PLATFORM_WIN32)