Merge "Pass the Java caller's location to OpenNativeLibrary."
This commit is contained in:
commit
ad6a5c565c
3 changed files with 5 additions and 17 deletions
|
|
@ -109,19 +109,6 @@ extern bool android_link_namespaces(struct android_namespace_t* from,
|
||||||
struct android_namespace_t* to,
|
struct android_namespace_t* to,
|
||||||
const char* shared_libs_sonames);
|
const char* shared_libs_sonames);
|
||||||
|
|
||||||
/*
|
|
||||||
* Get the default library search path.
|
|
||||||
* The path will be copied into buffer, which must have space for at least
|
|
||||||
* buffer_size chars. Elements are separated with ':', and the path will always
|
|
||||||
* be null-terminated.
|
|
||||||
*
|
|
||||||
* If buffer_size is too small to hold the entire default search path and the
|
|
||||||
* null terminator, this function will abort. There is currently no way to find
|
|
||||||
* out what the required buffer size is. At the time of this writing, PATH_MAX
|
|
||||||
* is sufficient and used by all callers of this function.
|
|
||||||
*/
|
|
||||||
extern void android_get_LD_LIBRARY_PATH(char* buffer, size_t buffer_size);
|
|
||||||
|
|
||||||
extern struct android_namespace_t* android_get_exported_namespace(const char* name);
|
extern struct android_namespace_t* android_get_exported_namespace(const char* name);
|
||||||
|
|
||||||
__END_DECLS
|
__END_DECLS
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ jstring CreateClassLoaderNamespace(JNIEnv* env,
|
||||||
|
|
||||||
__attribute__((visibility("default"))) void* OpenNativeLibrary(
|
__attribute__((visibility("default"))) void* OpenNativeLibrary(
|
||||||
JNIEnv* env, int32_t target_sdk_version, const char* path, jobject class_loader,
|
JNIEnv* env, int32_t target_sdk_version, const char* path, jobject class_loader,
|
||||||
jstring library_path, bool* needs_native_bridge, char** error_msg);
|
const char* caller_location, jstring library_path, bool* needs_native_bridge, char** error_msg);
|
||||||
|
|
||||||
__attribute__((visibility("default"))) bool CloseNativeLibrary(void* handle,
|
__attribute__((visibility("default"))) bool CloseNativeLibrary(void* handle,
|
||||||
const bool needs_native_bridge,
|
const bool needs_native_bridge,
|
||||||
|
|
|
||||||
|
|
@ -624,10 +624,11 @@ jstring CreateClassLoaderNamespace(JNIEnv* env,
|
||||||
}
|
}
|
||||||
|
|
||||||
void* OpenNativeLibrary(JNIEnv* env, int32_t target_sdk_version, const char* path,
|
void* OpenNativeLibrary(JNIEnv* env, int32_t target_sdk_version, const char* path,
|
||||||
jobject class_loader, jstring library_path, bool* needs_native_bridge,
|
jobject class_loader, const char* caller_location, jstring library_path,
|
||||||
char** error_msg) {
|
bool* needs_native_bridge, char** error_msg) {
|
||||||
#if defined(__ANDROID__)
|
#if defined(__ANDROID__)
|
||||||
UNUSED(target_sdk_version);
|
UNUSED(target_sdk_version);
|
||||||
|
UNUSED(caller_location);
|
||||||
if (class_loader == nullptr) {
|
if (class_loader == nullptr) {
|
||||||
*needs_native_bridge = false;
|
*needs_native_bridge = false;
|
||||||
void* handle = dlopen(path, RTLD_NOW);
|
void* handle = dlopen(path, RTLD_NOW);
|
||||||
|
|
@ -654,7 +655,7 @@ void* OpenNativeLibrary(JNIEnv* env, int32_t target_sdk_version, const char* pat
|
||||||
|
|
||||||
return OpenNativeLibraryInNamespace(ns, path, needs_native_bridge, error_msg);
|
return OpenNativeLibraryInNamespace(ns, path, needs_native_bridge, error_msg);
|
||||||
#else
|
#else
|
||||||
UNUSED(env, target_sdk_version, class_loader);
|
UNUSED(env, target_sdk_version, class_loader, caller_location);
|
||||||
|
|
||||||
// Do some best effort to emulate library-path support. It will not
|
// Do some best effort to emulate library-path support. It will not
|
||||||
// work for dependencies.
|
// work for dependencies.
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue