[freenet-cvs] r17904 - in trunk/contrib: . NativeThread NativeThread/lib NativeThread/lib/freenet NativeThread/lib/freenet/support freenet_ext
nextgens at freenetproject.org
nextgens at freenetproject.org
Fri Feb 15 02:55:14 UTC 2008
Author: nextgens
Date: 2008-02-15 02:55:13 +0000 (Fri, 15 Feb 2008)
New Revision: 17904
Added:
trunk/contrib/NativeThread/
trunk/contrib/NativeThread/Makefile
trunk/contrib/NativeThread/NativeThread.c
trunk/contrib/NativeThread/lib/
trunk/contrib/NativeThread/lib/freenet/
trunk/contrib/NativeThread/lib/freenet/support/
trunk/contrib/NativeThread/lib/freenet/support/io/
Modified:
trunk/contrib/freenet_ext/build.xml
Log:
freenet-ext: integration of NativeThread into the build-process, see http://archives.freenetproject.org/thread/20080214.235159.6deed539.en.html
Added: trunk/contrib/NativeThread/Makefile
===================================================================
--- trunk/contrib/NativeThread/Makefile (rev 0)
+++ trunk/contrib/NativeThread/Makefile 2008-02-15 02:55:13 UTC (rev 17904)
@@ -0,0 +1,23 @@
+CC = gcc
+INC = /path/to/java/include
+CFLAGS = -Wall -O3
+LDFLAGS = -shared -Wl,-soname,libnative.so -I$(INC) -I$(INC)/linux
+LIBS=-static -lc
+FREEENETDIR=/home/nextgens/repo/freenet/
+
+all: libNativeThread.so
+
+NativeThread.java:
+ ln -s $(FREEENETDIR)/src/freenet/support/io/NativeThread.java
+
+NativeThread.class: NativeThread.java
+ javac NativeThread.java
+
+libNativeThread.so: NativeThread.c NativeThread.h
+ $(CC) $(CFLAGS) -o libNativeThread.so $(LDFLAGS) NativeThread.c $(LIBS)
+
+NativeThread.h: NativeThread.class
+ javah NativeThread
+
+clean:
+ -rm -f *.class NativeThread.h libNativeThread*.so NativeThread.java
Added: trunk/contrib/NativeThread/NativeThread.c
===================================================================
--- trunk/contrib/NativeThread/NativeThread.c (rev 0)
+++ trunk/contrib/NativeThread/NativeThread.c 2008-02-15 02:55:13 UTC (rev 17904)
@@ -0,0 +1,23 @@
+#include<sys/resource.h>
+#include<sys/time.h>
+#include<stdio.h>
+#include <errno.h>
+
+#include"NativeThread.h"
+
+JNIEXPORT jint JNICALL Java_sandbox_NativeThread_getLinuxPriority
+ (JNIEnv * env, jobject jobj) {
+ return getpriority(PRIO_PROCESS, 0);
+}
+
+JNIEXPORT jboolean JNICALL Java_sandbox_NativeThread_setLinuxPriority
+(JNIEnv * env, jobject jobj, jint prio) {
+ int ret;
+ errno = 0;
+ ret = setpriority(PRIO_PROCESS, 0, prio);
+ if (ret == -1 && errno != 0) {
+ printf("Setting the thread priority failed!! %d %d\n",ret,errno);
+ return JNI_FALSE;
+ }
+ return JNI_TRUE;
+}
Modified: trunk/contrib/freenet_ext/build.xml
===================================================================
--- trunk/contrib/freenet_ext/build.xml 2008-02-14 19:40:08 UTC (rev 17903)
+++ trunk/contrib/freenet_ext/build.xml 2008-02-15 02:55:13 UTC (rev 17904)
@@ -53,6 +53,12 @@
<fileset dir="../NativeBigInteger/lib" includes="net/**" />
</copy>
</target>
+
+ <target name="nativethread" depends="init">
+ <copy todir="${build}">
+ <fileset dir="../NativeThread/lib" includes="freenet/**" />
+ </copy>
+ </target>
<target name="bdb" depends="init" description="Build the BDB provider">
<ant antfile="build.xml" dir="../bdb/"/>
@@ -78,7 +84,7 @@
<delete file="${jar.location}"/>
</target>
- <target name="jar" depends="clean,fec,jcpuid,bigint,bdb,wrapper" description="Create the jar file">
+ <target name="jar" depends="clean,fec,jcpuid,nativethread,bigint,bdb,wrapper" description="Create the jar file">
<jar jarfile="${jar.location}" basedir="${build}" includes="**">
<zipfileset src="../fec/common/lib/onion-common.jar"/>
<zipfileset src="../bdb/lib/je.jar"/>
More information about the cvs
mailing list