Pass the Java caller's location to OpenNativeLibrary.
Will be used to find the linker namespace to use. Bug: 122874359 Test: m, gtest, run-test, CtsJdwpTests Change-Id: I3f3be4a1d864741d585ab3ed9ffb93fab262516e
This commit is contained in:
parent
e0c7a8bbdd
commit
5353502062
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,
|
||||
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);
|
||||
|
||||
__END_DECLS
|
||||
|
|
|
@ -47,7 +47,7 @@ jstring CreateClassLoaderNamespace(JNIEnv* env,
|
|||
|
||||
__attribute__((visibility("default"))) void* OpenNativeLibrary(
|
||||
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,
|
||||
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,
|
||||
jobject class_loader, jstring library_path, bool* needs_native_bridge,
|
||||
char** error_msg) {
|
||||
jobject class_loader, const char* caller_location, jstring library_path,
|
||||
bool* needs_native_bridge, char** error_msg) {
|
||||
#if defined(__ANDROID__)
|
||||
UNUSED(target_sdk_version);
|
||||
UNUSED(caller_location);
|
||||
if (class_loader == nullptr) {
|
||||
*needs_native_bridge = false;
|
||||
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);
|
||||
#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
|
||||
// work for dependencies.
|
||||
|
|
Loading…
Reference in a new issue