diff options
| author | Dimitry Ivanov <dimitry@google.com> | 2016-05-03 14:55:25 -0700 |
|---|---|---|
| committer | Dimitry Ivanov <dimitry@google.com> | 2016-05-04 15:26:33 -0700 |
| commit | 7a1f9518f77e33e40efcec7ace0ee5d3855ccd8b (patch) | |
| tree | aec54f34318b8c2e70dd6736c7cb578089c5451c /libnativeloader | |
| parent | bfd6a0f24dbcf00db61c283249e5e5a4f6a9d8a6 (diff) | |
| download | system_core-7a1f9518f77e33e40efcec7ace0ee5d3855ccd8b.tar.gz system_core-7a1f9518f77e33e40efcec7ace0ee5d3855ccd8b.tar.bz2 system_core-7a1f9518f77e33e40efcec7ace0ee5d3855ccd8b.zip | |
nativeloader: Add CloseNativeLibrary() method
This method is called by art on UnloadNativeLibraries()
Bug: http://b/28406866
Change-Id: Ibccff93c83d6ccd3d0a1c0294a64b09281b4e05e
(cherry picked from commit 09a516bf161c5cabdaa3a67df5aa7fbac667f5f9)
Diffstat (limited to 'libnativeloader')
| -rw-r--r-- | libnativeloader/include/nativeloader/native_loader.h | 3 | ||||
| -rw-r--r-- | libnativeloader/native_loader.cpp | 4 |
2 files changed, 7 insertions, 0 deletions
diff --git a/libnativeloader/include/nativeloader/native_loader.h b/libnativeloader/include/nativeloader/native_loader.h index 1bd3b8f07..d147bb970 100644 --- a/libnativeloader/include/nativeloader/native_loader.h +++ b/libnativeloader/include/nativeloader/native_loader.h @@ -43,6 +43,9 @@ void* OpenNativeLibrary(JNIEnv* env, jobject class_loader, jstring library_path); +__attribute__((visibility("default"))) +bool CloseNativeLibrary(void* handle); + #if defined(__ANDROID__) // Look up linker namespace by class_loader. Returns nullptr if // there is no namespace associated with the class_loader. diff --git a/libnativeloader/native_loader.cpp b/libnativeloader/native_loader.cpp index e20c82303..20606b98f 100644 --- a/libnativeloader/native_loader.cpp +++ b/libnativeloader/native_loader.cpp @@ -231,6 +231,10 @@ void* OpenNativeLibrary(JNIEnv* env, #endif } +bool CloseNativeLibrary(void* handle) { + return dlclose(handle) == 0; +} + #if defined(__ANDROID__) android_namespace_t* FindNamespaceByClassLoader(JNIEnv* env, jobject class_loader) { std::lock_guard<std::mutex> guard(g_namespaces_mutex); |
