summaryrefslogtreecommitdiffstats
path: root/src/java/jogamp/common/os/UnixDynamicLinkerImpl.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2015-01-30 21:09:17 +0100
committerSven Gothel <[email protected]>2015-01-30 21:09:17 +0100
commit12feaa7d3b1544098f684d851e3caff1ec88cbc8 (patch)
tree2d979c57cca37220bc026a8ee08ee479ae0508bf /src/java/jogamp/common/os/UnixDynamicLinkerImpl.java
parent3caf446e29a3934900b9983dfd72cb8aa0d9e8d7 (diff)
Refine Native Library Code: Bulk Permissions, Cleanup DynamicLinker impl. - and fix Android AArch64 BionicDynamicLinker (Bug 1122)
- Bulk Permissions ProcAddressTable.reset(..) performs address lookup in one block. Now claiming all permissions upfront once, and releasing them afterwards. - Cleanup DynamicLinker impl. Proper top-down impl. of DynamicLinkerImpl, handling all security code and validations. - Fix Android AArch64 BionicDynamicLinker (Bug 1122) Dalvik uses diff RTLD_* defines for AArch64!
Diffstat (limited to 'src/java/jogamp/common/os/UnixDynamicLinkerImpl.java')
-rw-r--r--src/java/jogamp/common/os/UnixDynamicLinkerImpl.java41
1 files changed, 5 insertions, 36 deletions
diff --git a/src/java/jogamp/common/os/UnixDynamicLinkerImpl.java b/src/java/jogamp/common/os/UnixDynamicLinkerImpl.java
index 59be76c..5e8ba9d 100644
--- a/src/java/jogamp/common/os/UnixDynamicLinkerImpl.java
+++ b/src/java/jogamp/common/os/UnixDynamicLinkerImpl.java
@@ -27,8 +27,6 @@
*/
package jogamp.common.os;
-import com.jogamp.common.util.SecurityUtil;
-
/* pp */ abstract class UnixDynamicLinkerImpl extends DynamicLinkerImpl {
//
@@ -49,46 +47,17 @@ import com.jogamp.common.util.SecurityUtil;
/** Interface to C language function: <br> <code> void * dlsym(void * , const char * ); </code> */
protected static native long dlsym(long arg0, java.lang.String arg1);
- protected final long openLibraryImpl(final String pathname, final int dlSymFlags, final boolean debug) throws SecurityException {
- SecurityUtil.checkLinkPermission(pathname);
- final long handle = dlopen(pathname, dlSymFlags);
- if( 0 != handle ) {
- incrLibRefCount(handle, pathname);
- } else if ( DEBUG || debug ) {
- System.err.println("dlopen \""+pathname+"\" failed, error: "+dlerror());
- }
- return handle;
- }
-
- protected final long lookupSymbolGlobalImpl(final long dlSymGlobalFlag, final String symbolName) throws SecurityException {
- SecurityUtil.checkAllLinkPermission();
- final long addr = dlsym(dlSymGlobalFlag, symbolName);
- if(DEBUG_LOOKUP) {
- System.err.println("DynamicLinkerImpl.lookupSymbolGlobal("+symbolName+") -> 0x"+Long.toHexString(addr));
- }
- return addr;
- }
-
@Override
- public final long lookupSymbol(final long libraryHandle, final String symbolName) throws IllegalArgumentException {
- if( null == getLibRef( libraryHandle ) ) {
- throw new IllegalArgumentException("Library handle 0x"+Long.toHexString(libraryHandle)+" unknown.");
- }
- final long addr = dlsym(libraryHandle, symbolName);
- if(DEBUG_LOOKUP) {
- System.err.println("DynamicLinkerImpl.lookupSymbol(0x"+Long.toHexString(libraryHandle)+", "+symbolName+") -> 0x"+Long.toHexString(addr));
- }
- return addr;
+ protected final long lookupSymbolLocalImpl(final long libraryHandle, final String symbolName) throws SecurityException {
+ return dlsym(libraryHandle, symbolName);
}
@Override
- public final void closeLibrary(final long libraryHandle) throws IllegalArgumentException {
- if( null == decrLibRefCount( libraryHandle ) ) {
- throw new IllegalArgumentException("Library handle 0x"+Long.toHexString(libraryHandle)+" unknown.");
- }
- dlclose(libraryHandle);
+ protected final void closeLibraryImpl(final long libraryHandle) throws SecurityException {
+ dlclose(libraryHandle);
}
+
@Override
public final String getLastError() {
return dlerror();