aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/com/jogamp/common/os
Commit message (Collapse)AuthorAgeFilesLines
* Fix Bug 843: Remove Platform's requirement and use of ↵Sven Gothel2013-10-011-11/+3
| | | | | | | | | TempJarCache.bootstrapNativeLib(), allowing versatile use of 1st native jar file (big-java-jar w/ big-native-jar) The remaining Platform dependency existed in IOUtil.copyStream2Stream(..), used by JarUtil.extract(..), i.e. the MachineDescription's PAGE_SIZE. Solved by using a const buffer size of 4096 bytes.
* DynamicLibraryBundle: Remove unused importsSven Gothel2013-08-261-3/+0
|
* Platform: Add accurate currentTimeMillis() and currentTimeMicros() native ↵Sven Gothel2013-08-151-0/+22
| | | | methods, based on 'gettimeofday(..)'
* Remove _default_ workaround for Bug 566. Workaround shall no more be ↵v2.0.2Sven Gothel2013-07-201-7/+1
| | | | | | | required - and it deadlocks AWT/NEWT jogl/joal lib loading. Introduced w/ commits 1c03dfd6d1939a46018583419956e350e531f4fe and e9e61421ef6009e6788998c471d1d3d30aaefea6
* Security: Tighten DynamicLinker*, NativeLibrary and DynamicLibraryBundle ↵Sven Gothel2013-06-214-81/+116
| | | | | | | | | | | | | | | | | | | | | | access (2) - Completes 23341a2df2d2ea36784a16fa1db8bc7385351a12 - Replace 'DynamicLinker' interface w/ well documented one - All DynamicLinker methods are now considered secure, i.e.: - open/lookup and close utilize reference counting on handle via a hash map. - lookupSymbol(..) and close(..) impl. validate the passed library handle whether it's retrieved via open*. This is the fast path, not that expensive. - lookupSymbolGlobal(..) performs Check acccess of 'new RuntimePermission("loadLibrary.*")' if SecurityManager is installed. This is the slow path. - DynamicLibraryBundleInfo now reflects the security requirements, i.e. whether priviledged access is needed.
* DynamicLookupHelper: Add secure isFunctionAvailable(..); NativeLibrary: Add ↵Sven Gothel2013-06-203-11/+65
| | | | TODO comments, re protected lookup functions.
* Security: Tighten DynamicLinker*, NativeLibrary and DynamicLibraryBundle access.Sven Gothel2013-06-202-70/+70
|
* Fix Bug 757: Regression of URL to URI conversion (Encoded path not ↵Sven Gothel2013-06-191-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | compatible w/ file scheme. Regression of (Bug 683, Commit b98825eb7cfb61aead4a7dff57471cd2d2c26823). The URI encoded path cannot be read by File I/O (if file scheme), since the latter requests an UTF8/16 name, not an URI encoded name (i.e. %20 for space). The encoded URL is produced if calling 'uri.toURL()' and hence the new 'IOUtil.toURL(URI)' provides a custom conversion recovering the UTF name via 'new File(uri).getPath()'. Tested w/ - synthetic URI/URL coposition (unit test) - manual w/ moving 'build' to 'build öä lala' for gluegen, joal and jogl. +++ Misc.: - 'URI JarUtil.getURIDirname(URI)' -> 'URI IOUtil.getDirname(URI)' ++
* Refine 4feb65517ae4a4e2b9b04cdfc4b85582cb8b9784: Handle verbose error cases ↵Sven Gothel2013-06-181-26/+31
| | | | post catch block, i.e. exception (if occured) and dlerror value.
* Robostness: Catch Throwables on NativeLibrary.open(..) and be verbose in ↵Sven Gothel2013-06-182-6/+20
| | | | DEBUG mode ; DynamicLinker: Add 'String getLastError()'.
* Fix DynamicLinker Impl: Add Bionic specialization using Bionic's non POSIX ↵Sven Gothel2013-06-161-1/+7
| | | | | | | | | | | | | | | values; Using same pattern for Mac OS X. Add Bionic specialization using Bionic's non POSIX values - derive from UnixDynamicLinkerImpl - specify own flag and mode values - use UnixDynamicLinkerImpl native code Using same pattern for Mac OS X - derive from UnixDynamicLinkerImpl - specify own flag and mode values - use UnixDynamicLinkerImpl native code - drop MacOSXDynamicLinkerImpl native code
* Fix Bug 749: Add Support for Solaris SPARC 32bitBritta Eckhardt2013-06-131-7/+13
|
* Bug 752: Review Code Vulnerabilities (Permission Checks of new exposed code ↵Sven Gothel2013-06-112-58/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | and privileged access) This review focuses on how we perform permission checks, or better - do we circumvent some assuming full privileges ? Some native methods do need extra permission validation, i.e. loading native libraries. Further more AccessController.doPrivileged(..) shall not cover generic code exposing a critical feature to the user. Further more .. we should rely on the SecuritManager, i.e. AccessControlContext's 'checkPermission(Permission)' code to comply w/ fine grained permission access. It is also possible to have full permission w/o having any certificates (-> policy file). +++ We remove implicit AccessController.doPrivileged(..) from within our trusted code for generic methods, like Property access, temp. files. +++ SecurityUtil: - Remove 'getCommonAccessControlContext(Class<?> clz)', which returned a local AccessControlContext for later restriction if the passed class contains all certificates as the 'trusted' GlueGen class has. - Simply expose convenient permission check methods relying on SecurityManager / AccessControlContext. PropertyAccess: - 'protected static void addTrustedPrefix(..)' requires AllPermissions if SecurityManager is installed. - Remove implicit doPrivileged(..) triggered by passed AccessControlContext instance, only leave it for trusted prefixes. IOUtil: - Remove all doPrivileged(..) - Elevation shall be performed by caller. DynamicLinker: - 'public long openLibraryLocal(..)' and 'public long openLibraryGlobal(..)' may throw SecurityException, if a SecurityManager is installed and the dyn. link permission is not granted in the calling code. Implemented in their respective Unix, OSX and Windows manifestation. Caller has to elevate privileges via 'doPrivileged(..) {}' ! +++ Tests: - Property access - File access - Native library loading Manual Applet test (unsigned, but w/ SecurityManager and policy file): > gluegen/test/applet Applet has been tested w/ signed JAR w/ Firefox and Java7 on GNU/Linux as well. Manual Application test (unsigned, but w/ SecurityManager and policy file): com.jogamp.junit.sec.TestSecIOUtil01 - Run w/ SecurityManager and policy file: - gluegen/scripts/runtest-secmgr.sh - Run w/o SecurityManager: - gluegen/scripts/runtest.sh
* Bug 747: AndroidVersion: HashMap -> IntObjectHashMapSven Gothel2013-06-091-7/+6
|
* Fix Bug 683 part1: IOUtil, JarUtil, TempJarCache, .. uses URI instead of URL ↵Sven Gothel2013-06-092-16/+27
| | | | to remove DNS Lookups etc ..
* gluegen: remove executable bit from java and c source filesHarvey Harrison2013-04-094-0/+0
| | | | Signed-off-by: Harvey Harrison <[email protected]>
* Promote AWTEDTExecutor to public package com.jogamp.common.util.awt ; ↵Sven Gothel2013-02-281-1/+1
| | | | Exclude java.part.awt in android gluegen-rt.
* Bug 681: Add Elf Parsing for other OS than Linux, if ARM and !ANDROID using ↵Sven Gothel2013-02-091-14/+40
| | | | | | | | /proc/self/exe (Linux) or a found java/jvm native lib. - PlatformPropsImpl.queryABITypeImpl: Check Elf Header for ARM + !ANDROID (i.e. add other OS than Linux, use native java/jmv lib) - NativeLibrary.enumerateLibraryPaths: Add 'sun.boot.library.path' to enumeration! - TestElfReader01: Add test for finding java/jvm native lib and parse it
* GlueGen: NativeLibrary Fix, JNILibLoaderBase EnhancementSven Gothel2013-01-301-48/+64
| | | | | | | | | | | | | | | | | | | - NativeLibrary Fix - enumerateLibraryPaths(..): - Properly iterate through all prefix _and_ suffix. - Make public for JNILibLoaderBase.loadLibraryInternal(..) - isValidNativeLibraryName(..): - Stop iterating through prefix, if previously found but suffix doesn't match. - JNILibLoaderBase.loadLibraryInternal(..) Enhancement - Mark customLibLoader FIXME: remove (we will get rid of jnlp.launcher.class) - If System.load(TempJarCache) and System.loadLibrary(plainLibName) fails, use NativeLibrary.enumerateLibraryPaths() w/ System.load(..) as last resort. Tested on Linux x86_64 Java6 and OSX Java7 manually, no regressions expected.
* Modified Java 1.5 Buffers patch 2b7d1b1d25cb2cd73311ec9159b465f0391bf5e0 - ↵Sven Gothel2013-01-191-1/+14
| | | | | | | | | | | | | | May break GCJ/ECJ .. needs to be revised. - Adding JAVA_6 in PlatformPropsImpl - Buffers.isDirect() chooses fast-path iff JAVA_6, otherwise using reflection (GCJ/ECJ) - Adding JAVA_6 info in VersionUtil - API doc: Refine JAVA_SE and JAVA_6 spec. TODO: In case GCJ etc is unable to compile the JAVA_6 code even though it uses a static condition (probably not), We have to wrap isStatic in an own class, one for JAVA_6 and one for <= 1.5. This will be a good exercise for further issues we may have w/ Java <= 1.5.
* Fix Bug 608: Push down TempJarCache.findLibrary(..) from ↵Sven Gothel2012-10-251-3/+14
| | | | | | | JNILibLoaderBase.loadLibraryInternal() to NativeLibrary.findLibrary(..) This allows using TempJarCache (if used/initialized) for native 'tool' libraries as well. This is the case of JOAL's attempt to load the provided 'libopenal.so'
* Refine API doc of Buffers, fix API doc Platform.NEWLINE.Sven Gothel2012-10-031-1/+1
|
* Platform: Slight reorder of initialization reducing one PrivilegedAction block.Sven Gothel2012-09-071-42/+41
|
* Implement Bug #598 - JOGL ALL JAR File Change incl. it's Native Jar URL ↵Sven Gothel2012-06-261-17/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Derivation +++ JNILibLoaderBase.addNativeJarLibs(..): Add API doc JNILibLoaderBase: "addNativeJarLibs(Class<?> classFromJavaJar, String allNativeJarBaseName, String[] atomicNativeJarBaseNames)" -> "addNativeJarLibs(Class<?>[] classesFromJavaJars, String singleJarMarker, String[] stripBasenameSuffixes)" Derive the 'all' (1st choice) native JAR URL solely on the given class's JAR URL. Examples: JOCL: // only: jocl.jar -> jocl-natives-'os.and.arch'.jar addNativeJarLibs(new Class<?>[] { JOCLJNILibLoader.class }, null, null ); JOGL: final ClassLoader cl = GLProfile.class.getClassLoader(); // either: [jogl-all.jar, jogl-all-noawt.jar, jogl-all-mobile.jar] -> jogl-all-natives-<os.and.arch>.jar // or: nativewindow-core.jar -> nativewindow-natives-<os.and.arch>.jar, // jogl-core.jar -> jogl-natives-<os.and.arch>.jar, // (newt-core.jar -> newt-natives-<os.and.arch>.jar)? (if available) final String newtFactoryClassName = "com.jogamp.newt.NewtFactory"; final Class<?>[] classesFromJavaJars = new Class<?>[] { NWJNILibLoader.class, GLProfile.class, null }; if( ReflectionUtil.isClassAvailable(newtFactoryClassName, cl) ) { classesFromJavaJars[2] = ReflectionUtil.getClass(newtFactoryClassName, false, cl); } JNILibLoaderBase.addNativeJarLibs(classesFromJavaJars, "-all", new String[] { "-noawt", "-mobile", "-core" } ); Efficiency / Performance: - Reduced JAR URL lookup calls JarUtil.getJarURL(..) - JNILibLoaderBase, Platform, JarUtil - Attempt loading Jar files (native, class, ..) only once - TempJarCache Code Cleanup (IOUtil, JarUtil, : - IOException if not found - IllegalArgumentException if null argument +++ jogamp.android-launcher.jar -> jogamp-android-launcher.jar +++
* Fix Platform static initialization interdependencies w/ GlueGen native ↵Sven Gothel2012-06-183-302/+65
| | | | | | | | | | | | library loading Some Platform field declarations and it's static initialization has been delegated to it's new abstract super class PlatformPropsImpl to solve static initialization interdependencies w/ the GlueGen native library loading and it's derived information {@link #getMachineDescription()}, {@link #is32Bit()}, ..<br> This mechanism is preferred in this case to avoid synchronization and locking and allow better performance accessing the mentioned fields/methods.
* Fix Bug 583: Remove Android compile-time dependencies and exclude Android ↵Sven Gothel2012-06-041-11/+34
| | | | | | | | | | | | | specific classes for non Android platforms. Android specifics are delegated via class AndroidUtils, which uses reflection to call AndroidUtilsImpl if platform is Android. Android code is confined to the packages: jogamp.common.os.android.* jogamp.android.launcher.* and only included when compiled for the Android platform.
* DynamicLibraryBundle: API doc refinement, mention the ClassLoader role.Sven Gothel2012-05-042-5/+16
|
* Use ClassLoader to find JNI native libraries. ClassLoader was only used for ↵Sven Gothel2012-05-043-16/+21
| | | | | | | | | | | tool native libraries. NativeLibrary: Expose 'String findLibrary(String libName, ClassLoader loader)', allowing utilization of System.load(loader.findLibrary(libName)). JNILibLoaderBase.loadLibrary(): Add optional ClassLoader argument, used to locate the library DynamicLibraryBundle: Use DynamicLibraryInfo's ClassLoader to find native libraries (tool + jni)
* Platform: Need priviledge read access for property 'java.awt.headless'Sven Gothel2012-04-251-9/+13
|
* Add support for armhf/gnueabihf resulting in new 'os.and.arch' := [ ↵Sven Gothel2012-03-281-35/+84
| | | | | | | | | | | | | | | | 'android-armv7hf' and 'linux-armv7hf' ] - Platform gets new ABIType [ GENERIC, ARMEL, ARMHF ] - Platform impl. needs to guess ABIType in case of ARM, since no Java system property ('os.arch' ..) reflects the new EABI. I consider this a bug, since this will also hinder JNLP to work. The latter also uses 'os.arch' sys property to determine the nativelib resource! (See Platform.guessABITypeImpl(..) for details how we guess the type.) - Adding symbolic links to ubuntu's gnueabihf cross tool chain - Adding armhf crossbuild script
* To help analyzing Bug 566, we allow overwriting the 'workaround' with sys ↵Sven Gothel2012-03-271-1/+5
| | | | prop -Djogamp.debug.NativeLibrary.UseCurrentThreadLibLoader
* Platform: Add AWT_AVAILABLE 'knowledge'; RunnableExecutor: Add AWTEDT impl. ↵Sven Gothel2012-03-263-0/+40
| | | | / API doc cleanup; DynamicLibraryBundle: Add getDefaultRunnableExecutor()
* DynamicLibraryBundle*: Allow DynamicLibraryBundleInfo impl. to designate a ↵Sven Gothel2012-03-262-2/+8
| | | | | | | | | | | | thread to load native libraries. (Fix Bug 566) Due to requirements of native libraries using tls_model("global-dynamic") a thread can be designated to load the 'tool' native libraries. In case the tool lib uses tls_model("global-dynamic"), an implementation shall try to let the early most thread load it. For example, AWT-EDT shall load Mesa8 (Ubuntu-TLS) libGL.so.1
* Minor edits: Fix API doc / Remove Thread.dumpStack()Sven Gothel2012-03-221-1/+0
|
* Add 'asset' URLConnection; IOUtil uses URLConnection / incr. effeciency; ↵Sven Gothel2012-03-171-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Android ClassLoaderUtil cleanup; - Add 'asset' URLConnection - Please read API doc 'PiggybackURLConnection' and 'AssetURLConnection' - Solves generic resource handling where platform locations may differ, ie ClassLoader lookup on Android in the 'assets/' subfolder. - New Android 'AssetDexClassLoader' uses 'assets/' folder for findResource(..) - aapt.signed (our APK ant task) - uses 'assets/' folder - adds the 'assetsdir' attribute allowing to copy other assets into the APK - IOUtil uses URLConnection / incr. effeciency - using URLConnection on all getResource(..) since URL is connected anyways for validation and URLConnection can be used by caller right away - String getRelativeOf(URL, String) -> URL getRelativeOf(URL, String) - preserves scheme, authority, etc - simple parentOf handling, more efficient - reusing new 'asset' protocol impl. - Android ClassLoaderUtil cleanup; - Use createClassLoader(..) impl for build-in static jogamp and user APKs, which removes code redundancy Tests: New code path, especially 'assets' are covered by new unit tests, no regressions on Linux.
* SecurityUtil: Generalize cert validation and AccessControlContext query; ↵Sven Gothel2012-03-131-2/+2
| | | | | | | | | | | | | | | | | | PropertyAccess: Fix security code, grant access to common 'trusted' properties - SecurityUtil - Generalize cert validation for JAR and property access - Grant access to common AccessControlContext for 'same' cert - PropertyAccess: - Fix security code: Passing the current AccessControlContext from the caller didn't include priviledges. - Grant access to common 'trusted' properties, which removes the need of passing the AccessControlContext for general properties like 'jnlp.', 'jogamp.' .. - Enable registering 'trusted' properties, when caller's cert is 'same'
* Intro.: PropertyAccess ; Added safe PropertyAccess for JNILibLoaderBase, ↵Sven Gothel2012-03-131-6/+2
| | | | | | | | | | | | | | | | | Platform, IOUtil, .. - Intro.: PropertyAccess - Base class of all Debug impl, reduces redundancies. - jnlpAlias'ed trusted property is queried within local AccessControlContext to avoid 'JRE' implementation differences (should not be required). - throw NPE and IllegalArgumentException for invalid property key - Added safe PropertyAccess - JNILibLoaderBase: sun.jnlp.applet.launcher - Platform: jogamp.gluegen.UseTempJarCache - IOUtil: java.io.tmpdir
* Fix ARM gluegen-rt-natives-linux-"amdv7, amdv5".jar name lookup typo.Xerxes Rånby2012-02-181-4/+4
| | | | Signed-off-by: Xerxes Rånby <[email protected]>
* Platform: Add Java VersionNumberSven Gothel2012-02-131-2/+11
|
* DynamicLibraryBundle (enhancement)Sven Gothel2012-02-124-30/+31
| | | | | | | - Hold DEBUG, DEBUG_LOOKUP in DynamicLookupHelper - Tool complete only if named tool's GetProcAddressFunc is avail - Allow no tool/glue lib's - Use DEBUG_LOCKUP for lockup symbol trace
* Further fix for bug 537 - Catch IllegalArgumentException in ↵Sven Gothel2012-01-051-17/+13
| | | | Platform.loadGlueGenRTImpl(), Reuse JarUtil (same methodology) to determine whether we run from JarURL
* Fix JAR cache to allow running from class filesWade Walker2011-12-291-1/+17
| | | | | | | If the Platform class is coming from a .class file (instead of from a JAR), disables use of the temp JAR cache. This allows apps to run against JOGL class files as well as JAR files, which is useful when running from within an IDE like Eclipse.
* Fix regression of commit b669435d277a10e6163034aba286ecccce013f69, which ↵Sven Gothel2011-12-181-7/+14
| | | | removed the lib-base-name search for OSX
* NativeLibrary DEBUG: stack trace @ close()Sven Gothel2011-12-011-0/+1
|
* TempJarCache/JNILibLoaderBase: Identify the Jar files by their URL within ↵Sven Gothel2011-12-011-2/+1
| | | | our lifecycle. JarFile's hash almost always differs.
* Minor edits / Put gluegen-rt 'libBaseName' static.Sven Gothel2011-12-011-10/+10
|
* DynamicLibraryBundle/NativeLibrary: Add destroy() to bundle, causing ↵Sven Gothel2011-12-012-11/+42
| | | | unloading of native library.
* JarUtil: Improve Robustness (Bug 522) and API doc, prepare for Jar-In-Jar. ↵Sven Gothel2011-11-291-3/+3
| | | | | | | | Add unit test. Misc.: - IOUtil: Add toURL* methods - TempJarCache: Add 'URL getResource(String)'
* Platform: Add 'getCurrentSleepJitter()'Sven Gothel2011-11-081-1/+26
|
* Platform: Add OS_VERSION_NUMBER / getOSVersionNumber()Sven Gothel2011-10-261-1/+10
|