commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jfcl...@apache.org
Subject svn commit: r164211 - in /jakarta/commons/proper/daemon/trunk/src/samples: Native.c Native.sh SimpleDaemon.java SimpleDaemon.sh
Date Fri, 22 Apr 2005 10:29:05 GMT
Author: jfclere
Date: Fri Apr 22 03:29:03 2005
New Revision: 164211

URL: http://svn.apache.org/viewcvs?rev=164211&view=rev
Log:
Add the missing code used to test the crash of the JVM.

Added:
    jakarta/commons/proper/daemon/trunk/src/samples/Native.c
    jakarta/commons/proper/daemon/trunk/src/samples/Native.sh
Modified:
    jakarta/commons/proper/daemon/trunk/src/samples/SimpleDaemon.java
    jakarta/commons/proper/daemon/trunk/src/samples/SimpleDaemon.sh

Added: jakarta/commons/proper/daemon/trunk/src/samples/Native.c
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/daemon/trunk/src/samples/Native.c?rev=164211&view=auto
==============================================================================
--- jakarta/commons/proper/daemon/trunk/src/samples/Native.c (added)
+++ jakarta/commons/proper/daemon/trunk/src/samples/Native.c Fri Apr 22 03:29:03 2005
@@ -0,0 +1,42 @@
+/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Native routine to core JVM
+ */
+#include <jni.h>
+ 
+#ifndef _Included_Native
+#define _Included_Native
+#ifdef __cplusplus
+extern "C" {
+#endif
+/*
+ * Class:     Native
+ * Method:    toto
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_SimpleDaemon_toto
+  (JNIEnv *env, jclass class) {
+	int i;
+	i = -1;
+	memcpy(&i, &i, i);
+}
+ 
+#ifdef __cplusplus
+}
+#endif
+#endif

Added: jakarta/commons/proper/daemon/trunk/src/samples/Native.sh
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/daemon/trunk/src/samples/Native.sh?rev=164211&view=auto
==============================================================================
--- jakarta/commons/proper/daemon/trunk/src/samples/Native.sh (added)
+++ jakarta/commons/proper/daemon/trunk/src/samples/Native.sh Fri Apr 22 03:29:03 2005
@@ -0,0 +1,18 @@
+## Copyright 2000-2005 The Apache Software Foundation or its licensors, as
+## applicable.
+##
+## Licensed under the Apache License, Version 2.0 (the "License");
+## you may not use this file except in compliance with the License.
+## You may obtain a copy of the License at
+##
+##     http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+##
+# for linux ;-)
+gcc -c -I${JAVA_HOME}/include -I${JAVA_HOME}/include/linux Native.c
+gcc -shared -o Native.so Native.o

Modified: jakarta/commons/proper/daemon/trunk/src/samples/SimpleDaemon.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/daemon/trunk/src/samples/SimpleDaemon.java?rev=164211&r1=164210&r2=164211&view=diff
==============================================================================
--- jakarta/commons/proper/daemon/trunk/src/samples/SimpleDaemon.java (original)
+++ jakarta/commons/proper/daemon/trunk/src/samples/SimpleDaemon.java Fri Apr 22 03:29:03
2005
@@ -291,7 +291,7 @@
 
                         /* Crash JVM in a native call: It need an so file ;-) */
                         case '5':
-                            System.load("/home/jakarta/X509/Native.so");
+                            System.load(System.getProperty("native.library", "./Native.so"));
                             toto();
                             break;
 

Modified: jakarta/commons/proper/daemon/trunk/src/samples/SimpleDaemon.sh
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/daemon/trunk/src/samples/SimpleDaemon.sh?rev=164211&r1=164210&r2=164211&view=diff
==============================================================================
--- jakarta/commons/proper/daemon/trunk/src/samples/SimpleDaemon.sh (original)
+++ jakarta/commons/proper/daemon/trunk/src/samples/SimpleDaemon.sh Fri Apr 22 03:29:03 2005
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-#   Copyright 1999-2004 The Apache Software Foundation
+#   Copyright 1999-2005 The Apache Software Foundation
 #
 #   Licensed under the Apache License, Version 2.0 (the "License");
 #   you may not use this file except in compliance with the License.
@@ -30,9 +30,9 @@
     -home $JAVA_HOME \
     -cp $CLASSPATH \
     -pidfile ./pidfile \
-    -verbose \
     -outfile toto.txt \
     -errfile '&1' \
+    -Dnative.library=${DAEMON_HOME}/src/samples/Native.so \
     SimpleDaemon \
 #
 # To get a verbose JVM



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message