| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CRAZY_LINKER_H | 5 #ifndef CRAZY_LINKER_H |
| 6 #define CRAZY_LINKER_H | 6 #define CRAZY_LINKER_H |
| 7 | 7 |
| 8 // This is the crazy linker, a custom dynamic linker that can be used | 8 // This is the crazy linker, a custom dynamic linker that can be used |
| 9 // by NDK applications to load shared libraries (not executables) with | 9 // by NDK applications to load shared libraries (not executables) with |
| 10 // a twist. | 10 // a twist. |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 // Note that this works even if the memory is inside a system library that | 343 // Note that this works even if the memory is inside a system library that |
| 344 // was not previously opened with crazy_library_open(). | 344 // was not previously opened with crazy_library_open(). |
| 345 // |address| is the memory address. | 345 // |address| is the memory address. |
| 346 // On success, returns CRAZY_STATUS_SUCCESS and sets |*library|. | 346 // On success, returns CRAZY_STATUS_SUCCESS and sets |*library|. |
| 347 // The caller muyst call crazy_library_close() once it's done with the | 347 // The caller muyst call crazy_library_close() once it's done with the |
| 348 // library. | 348 // library. |
| 349 crazy_status_t crazy_library_find_from_address( | 349 crazy_status_t crazy_library_find_from_address( |
| 350 void* address, | 350 void* address, |
| 351 crazy_library_t** library) _CRAZY_PUBLIC; | 351 crazy_library_t** library) _CRAZY_PUBLIC; |
| 352 | 352 |
| 353 // Return the full path of |lib_name| in the zip file | |
| 354 // (lib/<abi>/crazy.<lib_name>). The result is returned in | |
| 355 // |buffer[0..buffer_size - 1]|. If |buffer_size| is too small, | |
| 356 // CRAZY_STATUS_FAILURE is returned. | |
| 357 crazy_status_t crazy_library_file_path_in_zip_file(const char* lib_name, | |
| 358 char* buffer, | |
| 359 size_t buffer_size) | |
| 360 _CRAZY_PUBLIC; | |
| 361 | |
| 362 // Check whether |lib_name| is page aligned and uncompressed in |zipfile_name|. | |
| 363 crazy_status_t crazy_linker_check_library_is_mappable_in_zip_file( | |
| 364 const char* zipfile_name, | |
| 365 const char* lib_name) _CRAZY_PUBLIC; | |
| 366 | |
| 367 // Close a library. This decrements its reference count. If it reaches | 353 // Close a library. This decrements its reference count. If it reaches |
| 368 // zero, the library be unloaded from the process. | 354 // zero, the library be unloaded from the process. |
| 369 void crazy_library_close(crazy_library_t* library) _CRAZY_PUBLIC; | 355 void crazy_library_close(crazy_library_t* library) _CRAZY_PUBLIC; |
| 370 | 356 |
| 371 // Close a library, with associated context to support delayed operations. | 357 // Close a library, with associated context to support delayed operations. |
| 372 void crazy_library_close_with_context(crazy_library_t* library, | 358 void crazy_library_close_with_context(crazy_library_t* library, |
| 373 crazy_context_t* context) _CRAZY_PUBLIC; | 359 crazy_context_t* context) _CRAZY_PUBLIC; |
| 374 | 360 |
| 375 #ifdef __cplusplus | 361 #ifdef __cplusplus |
| 376 } /* extern "C" */ | 362 } /* extern "C" */ |
| 377 #endif | 363 #endif |
| 378 | 364 |
| 379 #endif /* CRAZY_LINKER_H */ | 365 #endif /* CRAZY_LINKER_H */ |
| OLD | NEW |