X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=ltt%2Fjni_interface.c;h=2a525b0af174b3c7d1accc7184ca512476033064;hb=27cc2365b44ded4c7d90d3cde2470bcfe9ca107d;hp=d4a720732dd5799458f7e6e29b246bea0cef73ef;hpb=7671b5b8b86bf05837cc0fc3ade750e078001ccc;p=lttv.git diff --git a/ltt/jni_interface.c b/ltt/jni_interface.c index d4a72073..2a525b0a 100644 --- a/ltt/jni_interface.c +++ b/ltt/jni_interface.c @@ -1,3 +1,20 @@ +/* This file is part of the Linux Trace Toolkit viewer + * Copyright (C) 2010 William Bourque + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License Version 2.1 as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ /* Important to get consistent size_t type */ #define _FILE_OFFSET_BITS 64 @@ -71,7 +88,6 @@ struct saveTimeAndTracefile LttTracefile *tracefile; }; - /* ### COMMON Methods ### # @@ -93,6 +109,27 @@ JNIEXPORT void JNICALL Java_org_eclipse_linuxtools_lttng_jni_Jni_1C_1Common_ltt_ #### */ + +JNIEXPORT void JNICALL Java_org_eclipse_linuxtools_lttng_jni_factory_JniTraceVersion_ltt_1getTraceVersion(JNIEnv *env, jobject jobj, jstring tracepath) { + + const gchar *c_pathname = (*env)->GetStringUTFChars(env, tracepath, 0); + jint tmpMajorNumber = 0; + jint tmpMinorNumber = 0; + + jclass accessClass = (*env)->GetObjectClass(env, jobj); + jmethodID accessFunction = (*env)->GetMethodID(env, accessClass, "setTraceVersionFromC", "(II)V"); + + struct LttTraceVersion version_number; + + if ( get_version(c_pathname, &version_number) >= 0) { + tmpMajorNumber = version_number.ltt_major_version; + tmpMinorNumber = version_number.ltt_minor_version; + } + + (*env)->CallVoidMethod(env, jobj, accessFunction, tmpMajorNumber, tmpMinorNumber ); +} + + /* ### TRACE methods ### #