[kaffe] two OpenBSD patches

Kurt Miller truk at optonline.net
Thu Aug 25 06:02:59 PDT 2005


OpenBSD's pthreads support setting priorities, however they don't
behave like many applications expect. I believe the issue is that higher
priority threads can completly starve lower priority threads. Apps like
mozilla*, Sun's jdk, etc don't expect that and thus have been patched
to not set thread priorities on OpenBSD. The same issue applies to kaffe.

Also sys/resource.h needs sys/types.h and sys/time.h on OpenBSD,
actually *BSD if I believe the man pages.

With the following patches the intrp engine passes all but 6 regress
tests on OpenBSD/i386:

FAIL: DoubleIEEE.java
FAIL: WaitTest.java
FAIL: Preempt.java
FAIL: ProcessTest.java *
FAIL: wc.java
FAIL: CatchDeath.java

* Sometimes passes

The jit engine fails more and needs work on OpenBSD.

Index: configure.ac
===================================================================
RCS file: /cvs/kaffe/kaffe/configure.ac,v
retrieving revision 1.165
diff -u -r1.165 configure.ac
--- configure.ac	21 Aug 2005 18:00:58 -0000	1.165
+++ configure.ac	25 Aug 2005 11:17:59 -0000
@@ -1358,18 +1358,21 @@
 AM_ICONV
 
 # sched_get_priority_* functions are not implemented on OpenBSD <= 3.4
-# at least.
-AC_CHECK_FUNCS([sched_get_priority_max])
-AC_CHECK_FUNCS([sched_get_priority_min])
-AC_EGREP_HEADER(Found_SCHED_OTHER,
-  [
+# at least. setting pthread priorities on OpenBSD has unexpected results,
+# so don't enable setting them for OpenBSD.
+if test x"$Khost_os" != x"openbsd2" ; then
+  AC_CHECK_FUNCS([sched_get_priority_max])
+  AC_CHECK_FUNCS([sched_get_priority_min])
+  AC_EGREP_HEADER(Found_SCHED_OTHER,
+    [
 #include <sched.h>
 #ifdef SCHED_OTHER
 Found_SCHED_OTHER
 #endif
-  ],
-  [ AC_DEFINE(HAVE_SCHED_OTHER_IN_SCHED, 1, [Defined if SCHED_OTHER is in 
sched.h])
-])
+    ],
+    [ AC_DEFINE(HAVE_SCHED_OTHER_IN_SCHED, 1, [Defined if SCHED_OTHER is in 
sched.h])
+  ])
+fi
 
 dnl pthread_attr_setschedpolicy in not implemented on NetBSD <= 1.6
 dnl pthread_yield is not implemented on any systems.
Index: kaffe/kaffevm/thread.c
===================================================================
RCS file: /cvs/kaffe/kaffe/kaffe/kaffevm/thread.c,v
retrieving revision 1.104
diff -u -r1.104 thread.c
--- kaffe/kaffevm/thread.c	19 Aug 2005 03:04:57 -0000	1.104
+++ kaffe/kaffevm/thread.c	25 Aug 2005 04:40:00 -0000
@@ -14,6 +14,12 @@
 
 #include "config.h"
 
+#if defined(HAVE_SYS_TYPES_H)
+#include <sys/types.h>
+#endif
+#if defined(HAVE_SYS_TIME_H)
+#include <sys/time.h>
+#endif
 #if defined(HAVE_SYS_RESOURCE_H)
 #include <sys/resource.h>
 #endif



More information about the kaffe mailing list