[kaffe] CVS kaffe (guilhem): Implemented stack overflow detection.
Kaffe CVS
cvs-commits at kaffe.org
Thu Apr 22 11:36:02 PDT 2004
PatchSet 4679
Date: 2004/04/22 16:28:03
Author: guilhem
Branch: HEAD
Tag: (none)
Log:
Implemented stack overflow detection.
* configure.ac: Check for sigaltstack.
* config/i386/beos/md.h, config/i386/bsdi/md.h, config/i386/dgux/md.h,
config/i386/freebsd2/md.h, config/i386/gnu/md.h,
config/i386/linux/md.h, config/i386/netbsd1/md.h,
config/i386/nextstep3/md.h, config/i386/openbsd2/md.h,
config/i386/oskit/md.h, config/i386/qnx/md.h,
config/i386/sco3.2v5/md.h, config/i386/solaris2/md.h,
config/i386/univel_svr4/md.h, config/sparc/bsdi3/md.h,
config/sparc/linux/md.h, config/sparc/netbsd1/md.h,
config/sparc/nextstep3/md.h, config/sparc/openbsd2/md.h,
config/sparc/solaris2/md.h, config/sparc/sunos4/md.h,
config/sparc/uxpds/md.h: Added the new STACK_POINTER macro.
* kaffe/kaffevm/exception.c
(stackOverflowHandler): New exception handler.
(initExceptions): Updated the call to jthread_init_exceptions.
* kaffe/kaffevm/thread.c: Loosened the check for infinity concerning
rlim_max.
* kaffe/kaffevm/systems/unix-jthreads/jsignal.h,
kaffe/kaffevm/systems/unix-jthreads/signal.c
(detectStackBoundaries): Detect the real boundaries of the main
stack.
(infiniteLoop, stackOverflowDetector): Helpers to detect boundaries
of the stack.
(registerSignalHandler): Use SA_ONSTACK if available to use an
alternate stack for SIGSEGV.
(nullException): Use SIGNAL_ARGS instead of EXCEPTIONPROTO. If
STACK_POINTER is available check for the position of the stack pointer
in the stack and call the right handler accordingly.
(jthread_initexceptions): New parameter for stack overflows.
* kaffe/kaffevm/systems/unix-pthreads/thread-internal.h,
kaffe/kaffevm/systems/unix-pthreads/signal.c,
kaffe/kaffevm/systems/oskit-pthreads/jthread.h,
kaffe/kaffevm/systems/oskit-pthreads/signal.c,
kaffe/kaffevm/systems/beos-native/signal.c,
kaffe/kaffevm/systems/beos-native/jthread.h:
Changed the prototype of jthread_initexceptions to the new one.
* configure, config/config.h.in: Regenerated.
Members:
ChangeLog:1.2255->1.2256
configure:1.310->1.311
configure.ac:1.10->1.11
config/config.h.in:1.98->1.99
config/i386/beos/md.h:1.6->1.7
config/i386/bsdi/md.h:1.4->1.5
config/i386/dgux/md.h:1.3->1.4
config/i386/freebsd2/md.h:1.7->1.8
config/i386/gnu/md.h:1.3->1.4
config/i386/linux/md.h:1.6->1.7
config/i386/netbsd1/md.h:1.3->1.4
config/i386/nextstep3/md.h:1.4->1.5
config/i386/openbsd2/md.h:1.4->1.5
config/i386/oskit/md.h:1.5->1.6
config/i386/qnx/md.h:1.6->1.7
config/i386/sco3.2v5/md.h:1.3->1.4
config/i386/solaris2/md.h:1.3->1.4
config/i386/univel_svr4/md.h:1.5->1.6
config/sparc/bsdi3/md.h:1.2->1.3
config/sparc/linux/md.h:1.4->1.5
config/sparc/netbsd1/md.h:1.3->1.4
config/sparc/nextstep3/md.h:1.2->1.3
config/sparc/openbsd2/md.h:1.3->1.4
config/sparc/solaris2/md.h:1.2->1.3
config/sparc/sunos4/md.h:1.5->1.6
config/sparc/uxpds/md.h:1.2->1.3
kaffe/kaffevm/exception.c:1.83->1.84
kaffe/kaffevm/thread.c:1.62->1.63
kaffe/kaffevm/systems/beos-native/jthread.h:1.5->1.6
kaffe/kaffevm/systems/beos-native/signal.c:1.2->1.3
kaffe/kaffevm/systems/oskit-pthreads/jthread.h:1.11->1.12
kaffe/kaffevm/systems/oskit-pthreads/signal.c:1.5->1.6
kaffe/kaffevm/systems/unix-jthreads/jsignal.h:1.3->1.4
kaffe/kaffevm/systems/unix-jthreads/jthread.c:1.112->1.113
kaffe/kaffevm/systems/unix-jthreads/jthread.h:1.56->1.57
kaffe/kaffevm/systems/unix-jthreads/signal.c:1.12->1.13
kaffe/kaffevm/systems/unix-pthreads/signal.c:1.2->1.3
kaffe/kaffevm/systems/unix-pthreads/thread-internal.h:1.12->1.13
libltdl/config-h.in:1.19->1.20
libraries/clib/nio/FileChannelImpl.c:1.3->1.4
libraries/javalib/gnu/java/net/protocol/file/Handler.java:1.4->1.5
libraries/javalib/java/util/SimpleTimeZone.java:1.13->1.14
Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.2255 kaffe/ChangeLog:1.2256
--- kaffe/ChangeLog:1.2255 Thu Apr 22 16:20:52 2004
+++ kaffe/ChangeLog Thu Apr 22 16:28:03 2004
@@ -1,3 +1,49 @@
+2004-04-22 Guilhem Lavaux <guilhem at kaffe.org>
+
+ * configure.ac: Check for sigaltstack.
+
+ * config/i386/beos/md.h, config/i386/bsdi/md.h, config/i386/dgux/md.h,
+ config/i386/freebsd2/md.h, config/i386/gnu/md.h,
+ config/i386/linux/md.h, config/i386/netbsd1/md.h,
+ config/i386/nextstep3/md.h, config/i386/openbsd2/md.h,
+ config/i386/oskit/md.h, config/i386/qnx/md.h,
+ config/i386/sco3.2v5/md.h, config/i386/solaris2/md.h,
+ config/i386/univel_svr4/md.h, config/sparc/bsdi3/md.h,
+ config/sparc/linux/md.h, config/sparc/netbsd1/md.h,
+ config/sparc/nextstep3/md.h, config/sparc/openbsd2/md.h,
+ config/sparc/solaris2/md.h, config/sparc/sunos4/md.h,
+ config/sparc/uxpds/md.h: Added the new STACK_POINTER macro.
+
+ * kaffe/kaffevm/exception.c
+ (stackOverflowHandler): New exception handler.
+ (initExceptions): Updated the call to jthread_init_exceptions.
+
+ * kaffe/kaffevm/thread.c: Loosened the check for infinity concerning
+ rlim_max.
+
+ * kaffe/kaffevm/systems/unix-jthreads/jsignal.h,
+ kaffe/kaffevm/systems/unix-jthreads/signal.c
+ (detectStackBoundaries): Detect the real boundaries of the main
+ stack.
+ (infiniteLoop, stackOverflowDetector): Helpers to detect boundaries
+ of the stack.
+ (registerSignalHandler): Use SA_ONSTACK if available to use an
+ alternate stack for SIGSEGV.
+ (nullException): Use SIGNAL_ARGS instead of EXCEPTIONPROTO. If
+ STACK_POINTER is available check for the position of the stack pointer
+ in the stack and call the right handler accordingly.
+ (jthread_initexceptions): New parameter for stack overflows.
+
+ * kaffe/kaffevm/systems/unix-pthreads/thread-internal.h,
+ kaffe/kaffevm/systems/unix-pthreads/signal.c,
+ kaffe/kaffevm/systems/oskit-pthreads/jthread.h,
+ kaffe/kaffevm/systems/oskit-pthreads/signal.c,
+ kaffe/kaffevm/systems/beos-native/signal.c,
+ kaffe/kaffevm/systems/beos-native/jthread.h:
+ Changed the prototype of jthread_initexceptions to the new one.
+
+ * configure, config/config.h.in: Regenerated.
+
2004-04-22 Dalibor Topic <robilad at kaffe.org>
* libraries/javalib/java/sql/Array.java,
Index: kaffe/configure
diff -u kaffe/configure:1.310 kaffe/configure:1.311
--- kaffe/configure:1.310 Wed Apr 21 15:57:54 2004
+++ kaffe/configure Thu Apr 22 16:28:04 2004
@@ -49858,7 +49858,8 @@
-for ac_func in sbrk valloc memalign mallopt getrlimit
+
+for ac_func in sbrk valloc memalign mallopt getrlimit sigaltstack
do
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
echo "$as_me:$LINENO: checking for $ac_func" >&5
Index: kaffe/configure.ac
diff -u kaffe/configure.ac:1.10 kaffe/configure.ac:1.11
--- kaffe/configure.ac:1.10 Wed Apr 21 15:57:59 2004
+++ kaffe/configure.ac Thu Apr 22 16:28:07 2004
@@ -1329,7 +1329,7 @@
AC_CHECK_FUNCS([fcntl ioctl])
AC_CHECK_FUNCS([alarm setitimer])
AC_CHECK_FUNCS([sigprocmask sigsetmask sigemptyset sigaddset signal sigaction])
-AC_CHECK_FUNCS([sbrk valloc memalign mallopt getrlimit])
+AC_CHECK_FUNCS([sbrk valloc memalign mallopt getrlimit sigaltstack])
AC_CHECK_FUNCS([madvise])
AC_CHECK_FUNCS([waitpid kill fork execve execvp])
AC_CHECK_FUNCS([sync fsync ftruncate])
Index: kaffe/config/config.h.in
diff -u kaffe/config/config.h.in:1.98 kaffe/config/config.h.in:1.99
--- kaffe/config/config.h.in:1.98 Wed Apr 21 15:57:59 2004
+++ kaffe/config/config.h.in Thu Apr 22 16:28:08 2004
@@ -399,6 +399,9 @@
/* Define to 1 if you have the `sigaddset' function. */
#undef HAVE_SIGADDSET
+/* Define to 1 if you have the `sigaltstack' function. */
+#undef HAVE_SIGALTSTACK
+
/* Define to 1 if you have the <sigcontext.h> header file. */
#undef HAVE_SIGCONTEXT_H
Index: kaffe/config/i386/beos/md.h
diff -u kaffe/config/i386/beos/md.h:1.6 kaffe/config/i386/beos/md.h:1.7
--- kaffe/config/i386/beos/md.h:1.6 Thu Dec 11 17:56:20 2003
+++ kaffe/config/i386/beos/md.h Thu Apr 22 16:28:09 2004
@@ -5,7 +5,7 @@
* Copyright (c) 1996, 1997
* Transvirtual Technologies, Inc. All rights reserved.
*
- * Copyright (c) 2003
+ * Copyright (c) 2003, 2004
* Kaffe.org contributors. See ChangeLog for details.
*
* See the file "license.terms" for information on usage and redistribution
@@ -35,6 +35,7 @@
#define SIGNAL_CONTEXT_POINTER(scp) struct vregs * scp
#define GET_SIGNAL_CONTEXT_POINTER(sc) (sc)
#define SIGNAL_PC(scp) ((scp)->eip)
+#define STACK_POINTER(scp) ((scp)->sp)
#if defined(TRANSLATOR)
#include "jit-md.h"
Index: kaffe/config/i386/bsdi/md.h
diff -u kaffe/config/i386/bsdi/md.h:1.4 kaffe/config/i386/bsdi/md.h:1.5
--- kaffe/config/i386/bsdi/md.h:1.4 Thu Dec 11 17:56:21 2003
+++ kaffe/config/i386/bsdi/md.h Thu Apr 22 16:28:09 2004
@@ -5,7 +5,7 @@
* Copyright (c) 1996, 1997
* Transvirtual Technologies, Inc. All rights reserved.
*
- * Copyright (c) 2003
+ * Copyright (c) 2003, 2004
* Kaffe.org contributors. See ChangeLog for details.
*
* See the file "license.terms" for information on usage and redistribution
@@ -29,6 +29,7 @@
#define SIGNAL_CONTEXT_POINTER(scp) struct sigcontext* scp
#define GET_SIGNAL_CONTEXT_POINTER(sc) (sc)
#define SIGNAL_PC(scp) (scp)->sc_pc
+#define STACK_POINTER(scp) (scp)->sc_sp
#if defined(TRANSLATOR)
#include "jit-md.h"
Index: kaffe/config/i386/dgux/md.h
diff -u kaffe/config/i386/dgux/md.h:1.3 kaffe/config/i386/dgux/md.h:1.4
--- kaffe/config/i386/dgux/md.h:1.3 Thu Dec 11 17:56:21 2003
+++ kaffe/config/i386/dgux/md.h Thu Apr 22 16:28:11 2004
@@ -30,6 +30,7 @@
#define SIGNAL_CONTEXT_POINTER(scp) ucontext_t* scp
#define GET_SIGNAL_CONTEXT_POINTER(scp) (scp)
#define SIGNAL_PC(scp) ((scp)->uc_mcontext.gregs[R_EIP])
+#define STACK_POINTER(scp) ((scp)->uc_mcontext.gregs[R_ESP])
#if defined(TRANSLATOR)
#include "jit-md.h"
Index: kaffe/config/i386/freebsd2/md.h
diff -u kaffe/config/i386/freebsd2/md.h:1.7 kaffe/config/i386/freebsd2/md.h:1.8
--- kaffe/config/i386/freebsd2/md.h:1.7 Thu Dec 11 17:56:22 2003
+++ kaffe/config/i386/freebsd2/md.h Thu Apr 22 16:28:11 2004
@@ -5,7 +5,7 @@
* Copyright (c) 1996, 1997
* Transvirtual Technologies, Inc. All rights reserved.
*
- * Copyright (c) 2003
+ * Copyright (c) 2003, 2004
* Kaffe.org contributors. See ChangeLog for details.
*
* See the file "license.terms" for information on usage and redistribution
@@ -47,6 +47,7 @@
#define SIGNAL_CONTEXT_POINTER(scp) struct sigcontext *scp
#define GET_SIGNAL_CONTEXT_POINTER(sc) (sc)
#define SIGNAL_PC(scp) (scp)->sc_pc
+#define STACK_POINTER(scp) (scp)->sc_sp
#if defined(TRANSLATOR)
#include "jit-md.h"
Index: kaffe/config/i386/gnu/md.h
diff -u kaffe/config/i386/gnu/md.h:1.3 kaffe/config/i386/gnu/md.h:1.4
--- kaffe/config/i386/gnu/md.h:1.3 Thu Dec 11 17:56:22 2003
+++ kaffe/config/i386/gnu/md.h Thu Apr 22 16:28:11 2004
@@ -5,7 +5,7 @@
* Copyright (c) 1996, 1997
* Transvirtual Technologies, Inc. All rights reserved.
*
- * Copyright (c) 2003
+ * Copyright (c) 2003, 2004
* Kaffe.org contributors. See ChangeLog for details.
*
* See the file "license.terms" for information on usage and redistribution
@@ -29,6 +29,7 @@
#endif
#define SIGNAL_PC(scp) (scp)->eip
+#define STACK_POINTER(scp) (scp)->esp
#if defined(TRANSLATOR)
#include "jit-md.h"
Index: kaffe/config/i386/linux/md.h
diff -u kaffe/config/i386/linux/md.h:1.6 kaffe/config/i386/linux/md.h:1.7
--- kaffe/config/i386/linux/md.h:1.6 Thu Dec 11 17:56:22 2003
+++ kaffe/config/i386/linux/md.h Thu Apr 22 16:28:11 2004
@@ -41,6 +41,7 @@
#define GET_SIGNAL_CONTEXT_POINTER(sc) (&sc)
#define SIGNAL_PC(scp) (scp)->eip
+#define STACK_POINTER(scp) (scp)->esp
#if defined(TRANSLATOR)
#include "jit-md.h"
Index: kaffe/config/i386/netbsd1/md.h
diff -u kaffe/config/i386/netbsd1/md.h:1.3 kaffe/config/i386/netbsd1/md.h:1.4
--- kaffe/config/i386/netbsd1/md.h:1.3 Thu Dec 11 17:56:23 2003
+++ kaffe/config/i386/netbsd1/md.h Thu Apr 22 16:28:12 2004
@@ -5,7 +5,7 @@
* Copyright (c) 1996, 1997
* Transvirtual Technologies, Inc. All rights reserved.
*
- * Copyright (c) 2003
+ * Copyright (c) 2003, 2004
* Kaffe.org contributors. See ChangeLog for details.
*
* See the file "license.terms" for information on usage and redistribution
@@ -29,6 +29,7 @@
#define SIGNAL_CONTEXT_POINTER(scp) struct sigcontext *scp
#define GET_SIGNAL_CONTEXT_POINTER(sc) (sc)
#define SIGNAL_PC(scp) (scp)->sc_pc
+#define STACK_POINTER(scp) (scp)->sc_sp
#if defined(TRANSLATOR)
#include "jit-md.h"
Index: kaffe/config/i386/nextstep3/md.h
diff -u kaffe/config/i386/nextstep3/md.h:1.4 kaffe/config/i386/nextstep3/md.h:1.5
--- kaffe/config/i386/nextstep3/md.h:1.4 Thu Dec 11 17:56:23 2003
+++ kaffe/config/i386/nextstep3/md.h Thu Apr 22 16:28:12 2004
@@ -30,6 +30,7 @@
#define SIGNAL_CONTEXT_POINTER(scp) struct sigcontext* scp
#define GET_SIGNAL_CONTEXT_POINTER(scp) (scp)
#define SIGNAL_PC(scp) ((scp)->sc_eip)
+#define STACK_POINTER(scp) ((scp)->sc_esp)
#if defined(TRANSLATOR)
#include "jit-md.h"
Index: kaffe/config/i386/openbsd2/md.h
diff -u kaffe/config/i386/openbsd2/md.h:1.4 kaffe/config/i386/openbsd2/md.h:1.5
--- kaffe/config/i386/openbsd2/md.h:1.4 Thu Dec 11 17:56:23 2003
+++ kaffe/config/i386/openbsd2/md.h Thu Apr 22 16:28:12 2004
@@ -5,7 +5,7 @@
* Copyright (c) 1996, 1997
* Transvirtual Technologies, Inc. All rights reserved.
*
- * Copyright (c) 2003
+ * Copyright (c) 2003, 2004
* Kaffe.org contributors. See ChangeLog for details.
*
* See the file "license.terms" for information on usage and redistribution
@@ -30,6 +30,7 @@
#define SIGNAL_CONTEXT_POINTER(scp) struct sigcontext *scp
#define GET_SIGNAL_CONTEXT_POINTER(sc) (sc)
#define SIGNAL_PC(scp) (scp)->sc_pc
+#define STACK_POINTER(scp) (scp)->sc_sp
#if defined(TRANSLATOR)
#include "jit-md.h"
Index: kaffe/config/i386/oskit/md.h
diff -u kaffe/config/i386/oskit/md.h:1.5 kaffe/config/i386/oskit/md.h:1.6
--- kaffe/config/i386/oskit/md.h:1.5 Thu Dec 11 17:56:24 2003
+++ kaffe/config/i386/oskit/md.h Thu Apr 22 16:28:12 2004
@@ -27,6 +27,7 @@
#define SIGNAL_CONTEXT_POINTER(scp) struct sigcontext* scp
#define GET_SIGNAL_CONTEXT_POINTER(scp) (scp)
#define SIGNAL_PC(scp) ((scp)->sc_eip)
+#define STACK_POINTER(scp) ((scp)->sc_sp)
#if defined(TRANSLATOR)
#include "jit-md.h"
Index: kaffe/config/i386/qnx/md.h
diff -u kaffe/config/i386/qnx/md.h:1.6 kaffe/config/i386/qnx/md.h:1.7
--- kaffe/config/i386/qnx/md.h:1.6 Thu Dec 11 17:56:24 2003
+++ kaffe/config/i386/qnx/md.h Thu Apr 22 16:28:13 2004
@@ -66,6 +66,7 @@
#define SIGNAL_CONTEXT_POINTER(scp) struct _sigcontext *scp
#define GET_SIGNAL_CONTEXT_POINTER(scp) (scp)
#define SIGNAL_PC(scp) ((scp)->sc_ip)
+#define STACK_POINTER(scp) ((scp)->sc_sp)
#if defined(TRANSLATOR)
#include "jit-md.h"
Index: kaffe/config/i386/sco3.2v5/md.h
diff -u kaffe/config/i386/sco3.2v5/md.h:1.3 kaffe/config/i386/sco3.2v5/md.h:1.4
--- kaffe/config/i386/sco3.2v5/md.h:1.3 Thu Dec 11 17:56:24 2003
+++ kaffe/config/i386/sco3.2v5/md.h Thu Apr 22 16:28:13 2004
@@ -5,7 +5,7 @@
* Copyright (c) 1996, 1997
* Transvirtual Technologies, Inc. All rights reserved.
*
- * Copyright (c) 2003
+ * Copyright (c) 2003, 2004
* Kaffe.org contributors. See ChangeLog for details.
*
* See the file "license.terms" for information on usage and redistribution
@@ -25,6 +25,7 @@
#define SIGNAL_CONTEXT_POINTER(scp) ucontext_t* ctx
#define GET_SIGNAL_CONTEXT_POINTER(scp) (scp)
#define SIGNAL_PC(scp) ((scp)->uc_mcontext.regs[EIP])
+#define STACK_POINTER(scp) ((scp)->uc_mcontext.regs[ESP])
#if defined(TRANSLATOR)
#include "jit-md.h"
Index: kaffe/config/i386/solaris2/md.h
diff -u kaffe/config/i386/solaris2/md.h:1.3 kaffe/config/i386/solaris2/md.h:1.4
--- kaffe/config/i386/solaris2/md.h:1.3 Thu Dec 11 17:56:25 2003
+++ kaffe/config/i386/solaris2/md.h Thu Apr 22 16:28:13 2004
@@ -23,6 +23,7 @@
#define SIGNAL_CONTEXT_POINTER(scp) struct ucontext_t * scp
#define GET_SIGNAL_CONTEXT_POINTER(sc) (sc)
#define SIGNAL_PC(scp) ((scp)->uc_mcontext.gregs[EIP])
+#define STACK_POINTER(scp) ((scp)->uc_mcontext.gregs[ESP])
#if defined(TRANSLATOR)
#include "jit-md.h"
Index: kaffe/config/i386/univel_svr4/md.h
diff -u kaffe/config/i386/univel_svr4/md.h:1.5 kaffe/config/i386/univel_svr4/md.h:1.6
--- kaffe/config/i386/univel_svr4/md.h:1.5 Thu Dec 11 17:56:25 2003
+++ kaffe/config/i386/univel_svr4/md.h Thu Apr 22 16:28:13 2004
@@ -24,6 +24,7 @@
#define SIGNAL_CONTEXT_POINTER(scp) ucontext_t* scp
#define GET_SIGNAL_CONTEXT_POINTER(scp) (scp)
#define SIGNAL_PC(scp) ((scp)->uc_mcontext.gregs[EIP])
+#define STACK_POINTER(scp) ((scp)->uc_mcontext.gregs[ESP])
#if defined(TRANSLATOR)
#include "jit-md.h"
Index: kaffe/config/sparc/bsdi3/md.h
diff -u kaffe/config/sparc/bsdi3/md.h:1.2 kaffe/config/sparc/bsdi3/md.h:1.3
--- kaffe/config/sparc/bsdi3/md.h:1.2 Wed Aug 27 09:22:34 2003
+++ kaffe/config/sparc/bsdi3/md.h Thu Apr 22 16:28:13 2004
@@ -18,7 +18,8 @@
#define SIGNAL_ARGS(sig, sc) int sig, int code, struct sigcontext* sc
#define SIGNAL_CONTEXT_POINTER(scp) struct sigcontext* scp
#define GET_SIGNAL_CONTEXT_POINTER(scp) (scp)
-#define SIGNAL_PC(scp) ((spc)->sc_pc)
+#define SIGNAL_PC(scp) ((scp)->sc_pc)
+#define STACK_POINTER(scp) ((scp)->sc_sp)
#if defined(TRANSLATOR)
#include "jit-md.h"
Index: kaffe/config/sparc/linux/md.h
diff -u kaffe/config/sparc/linux/md.h:1.4 kaffe/config/sparc/linux/md.h:1.5
--- kaffe/config/sparc/linux/md.h:1.4 Wed Aug 27 09:22:34 2003
+++ kaffe/config/sparc/linux/md.h Thu Apr 22 16:28:14 2004
@@ -37,7 +37,8 @@
#define SIGNAL_ARGS(sig, sc) int sig, struct sigcontext* sc
#define SIGNAL_CONTEXT_POINTER(scp) struct sigcontext* scp
#define GET_SIGNAL_CONTEXT_POINTER(scp) (scp)
-#define SIGNAL_PC(scp) ((scp)->si_regs.pc)
+#define SIGNAL_PC(scp) ((scp)->sigc_pc)
+#define STACK_POINTER(scp) ((scp)->sigc_sp)
#if defined(TRANSLATOR)
#include "jit-md.h"
Index: kaffe/config/sparc/netbsd1/md.h
diff -u kaffe/config/sparc/netbsd1/md.h:1.3 kaffe/config/sparc/netbsd1/md.h:1.4
--- kaffe/config/sparc/netbsd1/md.h:1.3 Wed Aug 27 09:22:35 2003
+++ kaffe/config/sparc/netbsd1/md.h Thu Apr 22 16:28:14 2004
@@ -19,6 +19,7 @@
#define SIGNAL_CONTEXT_POINTER(scp) struct sigcontext* scp
#define GET_SIGNAL_CONTEXT_POINTER(scp) (scp)
#define SIGNAL_PC(scp) ((scp)->sc_pc)
+#define STACK_POINTER(scp) ((scp)->sc_sp)
#if defined(TRANSLATOR)
#include "jit-md.h"
Index: kaffe/config/sparc/nextstep3/md.h
diff -u kaffe/config/sparc/nextstep3/md.h:1.2 kaffe/config/sparc/nextstep3/md.h:1.3
--- kaffe/config/sparc/nextstep3/md.h:1.2 Wed Aug 27 09:22:35 2003
+++ kaffe/config/sparc/nextstep3/md.h Thu Apr 22 16:28:14 2004
@@ -18,7 +18,8 @@
#define SIGNAL_ARGS(sig, sc) int sig, int code, struct sigcontext* sc
#define SIGNAL_CONTEXT_POINTER(scp) struct sigcontext* scp
#define GET_SIGNAL_CONTEXT_POINTER(scp) (scp)
-#define SIGNAL_PC(scp) ((scp)->sc_eip)
+#define SIGNAL_PC(scp) ((scp)->sc_pc)
+#define STACK_POINTER(scp) ((scp)->sc_sp)
#if defined(TRANSLATOR)
Index: kaffe/config/sparc/openbsd2/md.h
diff -u kaffe/config/sparc/openbsd2/md.h:1.3 kaffe/config/sparc/openbsd2/md.h:1.4
--- kaffe/config/sparc/openbsd2/md.h:1.3 Wed Aug 27 09:22:36 2003
+++ kaffe/config/sparc/openbsd2/md.h Thu Apr 22 16:28:15 2004
@@ -23,6 +23,7 @@
#define SIGNAL_CONTEXT_POINTER(scp) struct sigcontext* scp
#define GET_SIGNAL_CONTEXT_POINTER(scp) (scp)
#define SIGNAL_PC(scp) ((scp)->sc_pc)
+#define STACK_POINTER(scp) ((scp)->sc_sp)
#if defined(TRANSLATOR)
#include "jit-md.h"
Index: kaffe/config/sparc/solaris2/md.h
diff -u kaffe/config/sparc/solaris2/md.h:1.2 kaffe/config/sparc/solaris2/md.h:1.3
--- kaffe/config/sparc/solaris2/md.h:1.2 Wed Aug 27 09:22:36 2003
+++ kaffe/config/sparc/solaris2/md.h Thu Apr 22 16:28:15 2004
@@ -26,6 +26,7 @@
#define SIGNAL_CONTEXT_POINTER(scp) ucontext_t* scp
#define GET_SIGNAL_CONTEXT_POINTER(scp) (scp)
#define SIGNAL_PC(scp) ((scp)->uc_mcontext.gregs[REG_PC])
+#define STACK_POINTER(scp) ((scp)->uc_mcontext.gregs[REG_SP])
#if defined(TRANSLATOR)
#include "jit-md.h"
Index: kaffe/config/sparc/sunos4/md.h
diff -u kaffe/config/sparc/sunos4/md.h:1.5 kaffe/config/sparc/sunos4/md.h:1.6
--- kaffe/config/sparc/sunos4/md.h:1.5 Wed Aug 27 09:22:36 2003
+++ kaffe/config/sparc/sunos4/md.h Thu Apr 22 16:28:15 2004
@@ -25,6 +25,7 @@
#define SIGNAL_CONTEXT_POINTER(scp) struct sigcontext* scp
#define GET_SIGNAL_CONTEXT_POINTER(scp) (scp)
#define SIGNAL_PC(scp) ((scp)->sc_pc)
+#define STACK_POINTER(scp) ((scp)->sc_sp)
#if defined(TRANSLATOR)
#include "jit-md.h"
Index: kaffe/config/sparc/uxpds/md.h
diff -u kaffe/config/sparc/uxpds/md.h:1.2 kaffe/config/sparc/uxpds/md.h:1.3
--- kaffe/config/sparc/uxpds/md.h:1.2 Wed Aug 27 09:22:37 2003
+++ kaffe/config/sparc/uxpds/md.h Thu Apr 22 16:28:15 2004
@@ -26,6 +26,7 @@
#define SIGNAL_CONTEXT_POINTER(scp) ucontext_t* scp
#define GET_SIGNAL_CONTEXT_POINTER(scp) (scp)
#define SIGNAL_PC(scp) ((scp)->uc_mcontext.gregs[REG_PC])
+#define STACK_POINTER(scp) ((scp)->uc_mcontext.gregs[REG_SP])
#if defined(TRANSLATOR)
#include "jit-md.h"
Index: kaffe/kaffe/kaffevm/exception.c
diff -u kaffe/kaffe/kaffevm/exception.c:1.83 kaffe/kaffe/kaffevm/exception.c:1.84
--- kaffe/kaffe/kaffevm/exception.c:1.83 Thu Apr 22 08:13:56 2004
+++ kaffe/kaffe/kaffevm/exception.c Thu Apr 22 16:28:16 2004
@@ -68,6 +68,7 @@
static void nullException(struct _exceptionFrame *) NONRETURNING;
static void floatingException(struct _exceptionFrame *) NONRETURNING;
+static void stackOverflowException(struct _exceptionFrame *) NONRETURNING;
static void dispatchException(Hjava_lang_Throwable*, stackTraceInfo*) NONRETURNING;
static bool findExceptionBlockInMethod(uintp, Hjava_lang_Class*, Method*, uintp*);
@@ -443,6 +444,10 @@
dprintf("%s: %s\n", cname, stringJava2C(msg));
} else {
dprintf("%s\n", cname);
+ if (strcmp(cname, "java/lang/StackOverflowError") == 0)
+ dprintf("This error may occur because the stack size is not sufficient. \n"
+ "Try to increase the stack size using 'ulimit -s' or with the '-ss'\n"
+ "option on kaffe.\n");
}
}
printStackTrace((Hjava_lang_Throwable*)eobj, 0, 1);
@@ -459,7 +464,28 @@
dprintf("initExceptions()\n");
)
/* Catch signals we need to convert to exceptions */
- jthread_initexceptions(nullException, floatingException);
+ jthread_initexceptions(nullException, floatingException, stackOverflowException);
+}
+
+/*
+ * Stack Overflow exception - catches stack overflows.
+ */
+static void
+stackOverflowException(struct _exceptionFrame *frame)
+{
+ Hjava_lang_Throwable* soe;
+ Hjava_lang_VMThrowable* vmstate;
+ Hjava_lang_Object* backtrace;
+
+ soe = (Hjava_lang_Throwable*)newObject(javaLangStackOverflowError);
+ vmstate = (Hjava_lang_VMThrowable*)newObject(javaLangVMThrowable);
+ backtrace = buildStackTrace(frame);
+ unhand(vmstate)->backtrace = backtrace;
+ unhand(soe)->vmState = vmstate;
+#if defined(HAVE_GCJ_SUPPORT)
+ FAKE_THROW_FRAME();
+#endif /* defined(HAVE_GCJ_SUPPORT) */
+ dispatchException(soe, (stackTraceInfo*)backtrace);
}
/*
Index: kaffe/kaffe/kaffevm/thread.c
diff -u kaffe/kaffe/kaffevm/thread.c:1.62 kaffe/kaffe/kaffevm/thread.c:1.63
--- kaffe/kaffe/kaffevm/thread.c:1.62 Thu Apr 22 08:13:56 2004
+++ kaffe/kaffe/kaffevm/thread.c Thu Apr 22 16:28:16 2004
@@ -714,14 +714,14 @@
* Since everything is stored in the threadData struct now, we can simply
* attach a faked java.lang.Thread instance later on.
*/
-#ifdef HAVE_GETRLIMIT
+#if defined(HAVE_GETRLIMIT)
{
struct rlimit rl;
if (getrlimit(RLIMIT_STACK, &rl) < 0)
stackSize = MAINSTACKSIZE;
else
- stackSize = (rl.rlim_max == RLIM_INFINITY) ? rl.rlim_cur : rl.rlim_max;
+ stackSize = (rl.rlim_max >= RLIM_INFINITY) ? rl.rlim_cur : rl.rlim_max;
}
#else
stackSize = MAINSTACKSIZE;
Index: kaffe/kaffe/kaffevm/systems/beos-native/jthread.h
diff -u kaffe/kaffe/kaffevm/systems/beos-native/jthread.h:1.5 kaffe/kaffe/kaffevm/systems/beos-native/jthread.h:1.6
--- kaffe/kaffe/kaffevm/systems/beos-native/jthread.h:1.5 Mon Mar 29 20:24:31 2004
+++ kaffe/kaffe/kaffevm/systems/beos-native/jthread.h Thu Apr 22 16:28:16 2004
@@ -152,7 +152,8 @@
* Initialize handlers for null pointer accesses and div by zero
*/
void jthread_initexceptions(exchandler_t _nullHandler,
- exchandler_t _floatingHandler);
+ exchandler_t _floatingHandler,
+ exchandler_t _stackOverflowHandler);
/*
* set a function to be run when last non-daemon dies
Index: kaffe/kaffe/kaffevm/systems/beos-native/signal.c
diff -u kaffe/kaffe/kaffevm/systems/beos-native/signal.c:1.2 kaffe/kaffe/kaffevm/systems/beos-native/signal.c:1.3
--- kaffe/kaffe/kaffevm/systems/beos-native/signal.c:1.2 Tue Feb 9 06:08:18 1999
+++ kaffe/kaffe/kaffevm/systems/beos-native/signal.c Thu Apr 22 16:28:16 2004
@@ -41,7 +41,8 @@
*/
void
jthread_initexceptions(exchandler_t _nullHandler,
- exchandler_t _floatingHandler)
+ exchandler_t _floatingHandler,
+ exchandler_t _stackOverflowHandler UNUSED)
{
nullHandler = _nullHandler;
floatingHandler = _floatingHandler;
Index: kaffe/kaffe/kaffevm/systems/oskit-pthreads/jthread.h
diff -u kaffe/kaffe/kaffevm/systems/oskit-pthreads/jthread.h:1.11 kaffe/kaffe/kaffevm/systems/oskit-pthreads/jthread.h:1.12
--- kaffe/kaffe/kaffevm/systems/oskit-pthreads/jthread.h:1.11 Mon Mar 29 20:24:31 2004
+++ kaffe/kaffe/kaffevm/systems/oskit-pthreads/jthread.h Thu Apr 22 16:28:16 2004
@@ -136,7 +136,8 @@
* Initialize handlers for null pointer accesses and div by zero
*/
void jthread_initexceptions(exchandler_t _nullHandler,
- exchandler_t _floatingHandler);
+ exchandler_t _floatingHandler,
+ exchandler_t _stackOverflowHandler);
/*
* set a function to be run when last non-daemon dies
Index: kaffe/kaffe/kaffevm/systems/oskit-pthreads/signal.c
diff -u kaffe/kaffe/kaffevm/systems/oskit-pthreads/signal.c:1.5 kaffe/kaffe/kaffevm/systems/oskit-pthreads/signal.c:1.6
--- kaffe/kaffe/kaffevm/systems/oskit-pthreads/signal.c:1.5 Fri Mar 10 01:00:48 2000
+++ kaffe/kaffe/kaffevm/systems/oskit-pthreads/signal.c Thu Apr 22 16:28:16 2004
@@ -86,7 +86,8 @@
*/
void
jthread_initexceptions(exchandler_t _nullHandler,
- exchandler_t _floatingHandler)
+ exchandler_t _floatingHandler,
+ exchandler_t _stackOverflowHandler UNUSED)
{
nullHandler = _nullHandler;
floatingHandler = _floatingHandler;
Index: kaffe/kaffe/kaffevm/systems/unix-jthreads/jsignal.h
diff -u kaffe/kaffe/kaffevm/systems/unix-jthreads/jsignal.h:1.3 kaffe/kaffe/kaffevm/systems/unix-jthreads/jsignal.h:1.4
--- kaffe/kaffe/kaffevm/systems/unix-jthreads/jsignal.h:1.3 Mon Feb 8 18:34:39 1999
+++ kaffe/kaffe/kaffevm/systems/unix-jthreads/jsignal.h Thu Apr 22 16:28:16 2004
@@ -8,6 +8,9 @@
* Copyright (c) 1996, 1997, 1998, 1999
* Transvirtual Technologies, Inc. All rights reserved.
*
+ * Copyright (c) 2004
+ * The Kaffe.org's team.
+ *
* This file is licensed under the terms of the GNU Public License.
*
* See the file "license.terms" for information on usage and redistribution
@@ -15,6 +18,7 @@
*
* Written by Patrick Tullmann <tullmann at cs.utah.edu> and
* Godmar Back <gback at cs.utah.edu>
+ *
*/
/*
* Signal handling API
@@ -40,5 +44,7 @@
void unblockSignal(int sig);
void unblockAsyncSignals(void);
void blockAsyncSignals(void);
+
+void detectStackBoudaries(jthread jtid, int mainThreadStackSize);
#endif /* UNIXJTHREAD_SIGNAL_H */
Index: kaffe/kaffe/kaffevm/systems/unix-jthreads/jthread.c
diff -u kaffe/kaffe/kaffevm/systems/unix-jthreads/jthread.c:1.112 kaffe/kaffe/kaffevm/systems/unix-jthreads/jthread.c:1.113
--- kaffe/kaffe/kaffevm/systems/unix-jthreads/jthread.c:1.112 Tue Apr 13 16:09:24 2004
+++ kaffe/kaffe/kaffevm/systems/unix-jthreads/jthread.c Thu Apr 22 16:28:16 2004
@@ -1350,15 +1350,7 @@
* - to help in determining whether the next frame in the link chain
* of frames is valid. This is done by checking its range.
*/
-#if defined(STACK_GROWS_UP)
- jtid->stackBase = (void*)(uintp)(&jtid - 0x100);
- jtid->stackEnd = jtid->stackBase + mainThreadStackSize;
- jtid->restorePoint = jtid->stackEnd;
-#else
- jtid->stackEnd = (void*)(uintp)(&jtid + 0x100);
- jtid->stackBase = (char *) jtid->stackEnd - mainThreadStackSize;
- jtid->restorePoint = jtid->stackBase;
-#endif
+ detectStackBoundaries(jtid, mainThreadStackSize);
jtid->localData.jlThread = jlThread;
Index: kaffe/kaffe/kaffevm/systems/unix-jthreads/jthread.h
diff -u kaffe/kaffe/kaffevm/systems/unix-jthreads/jthread.h:1.56 kaffe/kaffe/kaffevm/systems/unix-jthreads/jthread.h:1.57
--- kaffe/kaffe/kaffevm/systems/unix-jthreads/jthread.h:1.56 Sat Apr 3 02:57:46 2004
+++ kaffe/kaffe/kaffevm/systems/unix-jthreads/jthread.h Thu Apr 22 16:28:17 2004
@@ -170,7 +170,8 @@
*/
void
jthread_initexceptions(exchandler_t _nullHandler,
- exchandler_t _floatingHandler);
+ exchandler_t _floatingHandler,
+ exchandler_t _stackOverflowHandler);
/*
* set a function to be run when last non-daemon dies
Index: kaffe/kaffe/kaffevm/systems/unix-jthreads/signal.c
diff -u kaffe/kaffe/kaffevm/systems/unix-jthreads/signal.c:1.12 kaffe/kaffe/kaffevm/systems/unix-jthreads/signal.c:1.13
--- kaffe/kaffe/kaffevm/systems/unix-jthreads/signal.c:1.12 Wed Jan 7 20:07:40 2004
+++ kaffe/kaffe/kaffevm/systems/unix-jthreads/signal.c Thu Apr 22 16:28:17 2004
@@ -19,6 +19,7 @@
#include "jsignal.h"
#include "md.h"
#include "gc.h"
+#include "files.h"
#if defined(INTERPRETER)
#define DEFINEFRAME() /* Does nothing */
@@ -35,16 +36,19 @@
static exchandler_t nullHandler;
static exchandler_t floatingHandler;
+static exchandler_t stackOverflowHandler;
/*
* Setup the internal exceptions.
*/
void
jthread_initexceptions(exchandler_t _nullHandler,
- exchandler_t _floatingHandler)
+ exchandler_t _floatingHandler,
+ exchandler_t _stackOverflowHandler)
{
nullHandler = _nullHandler;
floatingHandler = _floatingHandler;
+ stackOverflowHandler = _stackOverflowHandler;
if (DBGEXPR(EXCEPTION, false, true)) {
/* Catch signals we need to convert to exceptions */
@@ -67,8 +71,10 @@
* Null exception - catches bad memory accesses.
*/
static void
-nullException(EXCEPTIONPROTO)
+nullException(SIGNAL_ARGS(sig, ctx))
{
+ void *stackptr;
+
DEFINEFRAME();
#if defined(__FreeBSD__) && !defined(INTERPRETER)
if ((uintp) ctx->sc_err > gc_heap_base) {
@@ -84,7 +90,17 @@
unblockSignal(sig);
EXCEPTIONFRAME(frame, ctx);
- nullHandler(EXCEPTIONFRAMEPTR);
+#if defined(STACK_POINTER)
+ stackptr = (void *)STACK_POINTER(GET_SIGNAL_CONTEXT_POINTER(ctx));
+#if defined(STACK_GROWS_UP)
+ if (stackptr >= currentJThread->stackEnd)
+#else
+ if (stackptr <= currentJThread->stackBase)
+#endif
+ stackOverflowHandler(EXCEPTIONFRAMEPTR);
+ else
+#endif // STACK_POINTER
+ nullHandler(EXCEPTIONFRAMEPTR);
}
/*
@@ -132,6 +148,10 @@
}
newact.sa_flags = 0;
+#if defined(SA_ONSTACK)
+ if (sig == SIGSEGV)
+ newact.sa_flags |= SA_ONSTACK;
+#endif
#if defined(SA_SIGINFO)
newact.sa_flags |= SA_SIGINFO;
#endif
@@ -319,4 +339,80 @@
#endif
sigprocmask(SIG_BLOCK, &nsig, 0);
+}
+
+#if defined(STACK_POINTER) && defined(SA_ONSTACK) && defined(HAVE_SIGALTSTACK)
+
+static JTHREAD_JMPBUF outOfLoop;
+static void *stackPointer;
+
+static void
+infiniteLoop()
+{
+ int a;
+ infiniteLoop();
+ a = 0;
+}
+
+static void
+stackOverflowDetector(SIGNAL_ARGS(sig, sc))
+{
+ stackPointer = (void *)STACK_POINTER(GET_SIGNAL_CONTEXT_POINTER(sc));
+ unblockSignal(SIGSEGV);
+ JTHREAD_LONGJMP(outOfLoop, 1);
+}
+#endif
+
+void
+detectStackBoundaries(jthread_t jtid, int mainThreadStackSize)
+{
+ stack_t newstack;
+
+#if defined(HAVE_GETRLIMIT)
+ struct rlimit rl;
+
+ if (getrlimit(RLIMIT_STACK, &rl) >= 0)
+ mainThreadStackSize = (rl.rlim_max >= RLIM_INFINITY) ? rl.rlim_cur : rl.rlim_max;
+#endif
+
+#if defined(STACK_POINTER) && defined(SA_ONSTACK) && defined(HAVE_SIGALTSTACK)
+
+ newstack.ss_size = THREADSTACKSIZE;
+ newstack.ss_flags = 0;
+ newstack.ss_sp = KMALLOC(newstack.ss_size);
+ if (sigaltstack(&newstack, NULL) < 0)
+ {
+ dprintf("Unexpected error calling sigaltstack: %s\n",
+ SYS_ERROR(errno));
+ EXIT(1);
+ }
+
+ registerSignalHandler(SIGSEGV, stackOverflowDetector, false);
+
+ if (JTHREAD_SETJMP(outOfLoop) == 0)
+ infiniteLoop();
+
+#if defined(STACK_GROWS_UP)
+ jtid->stackEnd = stackPointer;
+ jtid->stackBase = (char *)jtid->stackEnd - mainThreadStackSize;
+ jtid->restorePoint = jtid->stackEnd;
+#else
+ jtid->stackBase = stackPointer;
+ jtid->stackEnd = (char *)jtid->stackBase + mainThreadStackSize;
+ jtid->restorePoint = jtid->stackBase;
+#endif
+
+#else // STACK_POINTER
+
+#if defined(STACK_GROWS_UP)
+ jtid->stackBase = (void*)(uintp)(&jtid - 0x100);
+ jtid->stackEnd = jtid->stackBase + mainThreadStackSize;
+ jtid->restorePoint = jtid->stackEnd;
+#else
+ jtid->stackEnd = (void*)(uintp)(&jtid + 0x100);
+ jtid->stackBase = (char *) jtid->stackEnd - mainThreadStackSize;
+ jtid->restorePoint = jtid->stackBase;
+#endif
+
+#endif
}
Index: kaffe/kaffe/kaffevm/systems/unix-pthreads/signal.c
diff -u kaffe/kaffe/kaffevm/systems/unix-pthreads/signal.c:1.2 kaffe/kaffe/kaffevm/systems/unix-pthreads/signal.c:1.3
--- kaffe/kaffe/kaffevm/systems/unix-pthreads/signal.c:1.2 Tue Mar 9 15:15:36 2004
+++ kaffe/kaffe/kaffevm/systems/unix-pthreads/signal.c Thu Apr 22 16:28:17 2004
@@ -49,7 +49,8 @@
*/
void
jthread_initexceptions(exchandler_t _nullHandler,
- exchandler_t _floatingHandler)
+ exchandler_t _floatingHandler,
+ exchandler_t _stackOverflowHandler UNUSED)
{
nullHandler = _nullHandler;
floatingHandler = _floatingHandler;
Index: kaffe/kaffe/kaffevm/systems/unix-pthreads/thread-internal.h
diff -u kaffe/kaffe/kaffevm/systems/unix-pthreads/thread-internal.h:1.12 kaffe/kaffe/kaffevm/systems/unix-pthreads/thread-internal.h:1.13
--- kaffe/kaffe/kaffevm/systems/unix-pthreads/thread-internal.h:1.12 Wed Mar 24 21:44:34 2004
+++ kaffe/kaffe/kaffevm/systems/unix-pthreads/thread-internal.h Thu Apr 22 16:28:17 2004
@@ -310,7 +310,8 @@
*
*/
void jthread_initexceptions(exchandler_t _nullHandler,
- exchandler_t _floatingHandler);
+ exchandler_t _floatingHandler,
+ exchandler_t _stackOverflowHandler);
/**
* Initialize the thread subsystem.
Index: kaffe/libltdl/config-h.in
diff -u kaffe/libltdl/config-h.in:1.19 kaffe/libltdl/config-h.in:1.20
--- kaffe/libltdl/config-h.in:1.19 Wed Apr 14 19:40:10 2004
+++ kaffe/libltdl/config-h.in Thu Apr 22 16:28:17 2004
@@ -3,9 +3,6 @@
/* Define to 1 if you have the `argz_append' function. */
#undef HAVE_ARGZ_APPEND
-/* Define to 1 if you have the `argz_create_sep' function. */
-#undef HAVE_ARGZ_CREATE_SEP
-
/* Define to 1 if you have the <argz.h> header file. */
#undef HAVE_ARGZ_H
Index: kaffe/libraries/clib/nio/FileChannelImpl.c
diff -u kaffe/libraries/clib/nio/FileChannelImpl.c:1.3 kaffe/libraries/clib/nio/FileChannelImpl.c:1.4
--- kaffe/libraries/clib/nio/FileChannelImpl.c:1.3 Tue Apr 13 15:43:25 2004
+++ kaffe/libraries/clib/nio/FileChannelImpl.c Thu Apr 22 16:28:17 2004
@@ -67,6 +67,7 @@
int fd;
int rc;
int open_options = 0;
+ jclass clazz;
str = (*env)->GetStringUTFChars(env, fileName, NULL);
@@ -106,9 +107,9 @@
case 0:
break;
default:
- (*env)->ThrowNew(env,
- (*env)->FindClass(env, "java.io.FileNotFoundException"),
- SYS_ERROR(rc));
+ clazz = (*env)->FindClass(env, "java.io.FileNotFoundException");
+ (*env)->ThrowNew(env, clazz, SYS_ERROR(rc));
+ return -1;
}
return fd;
}
Index: kaffe/libraries/javalib/gnu/java/net/protocol/file/Handler.java
diff -u kaffe/libraries/javalib/gnu/java/net/protocol/file/Handler.java:1.4 kaffe/libraries/javalib/gnu/java/net/protocol/file/Handler.java:1.5
--- kaffe/libraries/javalib/gnu/java/net/protocol/file/Handler.java:1.4 Mon Jan 12 02:34:28 2004
+++ kaffe/libraries/javalib/gnu/java/net/protocol/file/Handler.java Thu Apr 22 16:28:18 2004
@@ -1,5 +1,5 @@
/* Handler.java -- "file" protocol handler for java.net
- Copyright (C) 1998, 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -76,17 +76,12 @@
String host = url.getHost();
if ((host != null) && (! host.equals("")))
{
-// throw new IOException("ftp protocol handler not yet implemented.");
-// /*
// Reset the protocol (and implicitly the handler) for this URL.
// Then have the URL attempt the connection again, as it will
// get the changed handler the next time around.
setURL (url, "ftp", url.getHost(), url.getPort(), url.getFile(),
url.getRef());
- // Until the ftp protocol handler is written, this will cause
- // a NullPointerException.
return url.openConnection();
-// */
}
return new Connection(url);
Index: kaffe/libraries/javalib/java/util/SimpleTimeZone.java
diff -u kaffe/libraries/javalib/java/util/SimpleTimeZone.java:1.13 kaffe/libraries/javalib/java/util/SimpleTimeZone.java:1.14
--- kaffe/libraries/javalib/java/util/SimpleTimeZone.java:1.13 Mon Dec 29 11:15:17 2003
+++ kaffe/libraries/javalib/java/util/SimpleTimeZone.java Thu Apr 22 16:28:18 2004
@@ -390,6 +390,7 @@
* @param dayOfWeek The day of week where daylight savings start.
* @param time The time in milliseconds standard time where daylight
* savings start.
+ * @exception IllegalArgumentException if parameters are out of range.
* @see SimpleTimeZone
*/
public void setStartRule(int month, int day, int dayOfWeek, int time)
@@ -402,6 +403,52 @@
this.startDayOfWeek = Math.abs(dayOfWeek);
this.startTime = time;
useDaylight = true;
+ }
+
+ /**
+ * Sets the daylight savings start rule. You must also set the
+ * end rule with <code>setEndRule</code> or the result of
+ * getOffset is undefined. For the parameters see the ten-argument
+ * constructor above.
+ *
+ * @param month The month where daylight savings start, zero
+ * based. You should use the constants in Calendar.
+ * @param day A day of month or day of week in month.
+ * @param dayOfWeek The day of week where daylight savings start.
+ * @param time The time in milliseconds standard time where daylight
*** Patch too long, truncated ***
More information about the kaffe
mailing list