mturk 2005/01/17 10:28:32 Modified: jni/java/org/apache/tomcat/jni OS.java jni/native/os/netware system.c jni/native/os/unix system.c jni/native/os/win32 system.c Log: Use simple OS detection routine. Revision Changes Path 1.3 +25 -1 jakarta-tomcat-connectors/jni/java/org/apache/tomcat/jni/OS.java Index: OS.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/jni/java/org/apache/tomcat/jni/OS.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- OS.java 14 Jan 2005 14:42:37 -0000 1.2 +++ OS.java 17 Jan 2005 18:28:31 -0000 1.3 @@ -24,6 +24,29 @@ public class OS { + /* OS Enums */ + private static final int UNIX = 1; + private static final int NETWARE = 2; + private static final int WIN32 = 3; + private static final int WIN64 = 4; + + /** + * Check for OS type. + * @param type OS type to test. + */ + private static native boolean is(int type); + + static { + IS_UNIX = is(UNIX); + IS_NETWARE = is(NETWARE); + IS_WIN32 = is(WIN32); + IS_WIN64 = is(WIN64); + } + + public static boolean IS_UNIX = false; + public static boolean IS_NETWARE = false; + public static boolean IS_WIN32 = false; + public static boolean IS_WIN64 = false; /** * Get the name of the system default characer set. @@ -53,4 +76,5 @@ */ public static native int random(byte [] buf, int len); + } 1.2 +9 -0 jakarta-tomcat-connectors/jni/native/os/netware/system.c Index: system.c =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/jni/native/os/netware/system.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- system.c 17 Jan 2005 07:15:01 -0000 1.1 +++ system.c 17 Jan 2005 18:28:32 -0000 1.2 @@ -18,3 +18,12 @@ #include "apr_network_io.h" #include "tcn.h" + +TCN_IMPLEMENT_CALL(jboolean, OS, is)(TCN_STDARGS, jint type) +{ + UNREFERENCED_STDARGS; + if (type == 2) + return JNI_TRUE; + else + return JNI_FALSE; +} 1.2 +9 -0 jakarta-tomcat-connectors/jni/native/os/unix/system.c Index: system.c =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/jni/native/os/unix/system.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- system.c 17 Jan 2005 07:15:01 -0000 1.1 +++ system.c 17 Jan 2005 18:28:32 -0000 1.2 @@ -18,3 +18,12 @@ #include "apr_network_io.h" #include "tcn.h" + +TCN_IMPLEMENT_CALL(jboolean, OS, is)(TCN_STDARGS, jint type) +{ + UNREFERENCED_STDARGS; + if (type == 1) + return JNI_TRUE; + else + return JNI_FALSE; +} 1.2 +16 -0 jakarta-tomcat-connectors/jni/native/os/win32/system.c Index: system.c =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/jni/native/os/win32/system.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- system.c 17 Jan 2005 07:15:01 -0000 1.1 +++ system.c 17 Jan 2005 18:28:32 -0000 1.2 @@ -16,5 +16,21 @@ #include "apr.h" #include "apr_pools.h" #include "apr_network_io.h" +#include "apr_arch_misc.h" /* for apr_os_level */ #include "tcn.h" + + +TCN_IMPLEMENT_CALL(jboolean, OS, is)(TCN_STDARGS, jint type) +{ + UNREFERENCED_STDARGS; +#ifdef _WIN64 + if (type == 4) + return JNI_TRUE; + else +#endif + if (type == 3) + return JNI_TRUE; + else + return JNI_FALSE; +}
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]