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 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 | 354 |
355 // Return the full path of |lib_name| in the zip file | 355 // Return the full path of |lib_name| in the zip file |
356 // (lib/<abi>/crazy.<lib_name>). The result is returned in | 356 // (lib/<abi>/crazy.<lib_name>). The result is returned in |
357 // |buffer[0..buffer_size - 1]|. If |buffer_size| is too small, | 357 // |buffer[0..buffer_size - 1]|. If |buffer_size| is too small, |
358 // CRAZY_STATUS_FAILURE is returned. | 358 // CRAZY_STATUS_FAILURE is returned. |
359 crazy_status_t crazy_library_file_path_in_zip_file(const char* lib_name, | 359 crazy_status_t crazy_library_file_path_in_zip_file(const char* lib_name, |
360 char* buffer, | 360 char* buffer, |
361 size_t buffer_size) | 361 size_t buffer_size) |
362 _CRAZY_PUBLIC; | 362 _CRAZY_PUBLIC; |
363 | 363 |
| 364 |
| 365 // Return the offset and size of a library stored in the zip file; |
| 366 crazy_status_t crazy_library_offset_size_in_zip_file(const char* zip_filename, |
| 367 const char* lib_name, |
| 368 int* offset, int* size) |
| 369 _CRAZY_PUBLIC; |
| 370 |
| 371 // Fault a library in memory. |
| 372 // |filename| file to fault in. |
| 373 // |offset| start offset in the file. |
| 374 // |size| size of the file section to consider. -1 for the whole file. |
| 375 crazy_status_t crazy_prefault_library(const char* filename, int offset, |
| 376 int size) _CRAZY_PUBLIC; |
| 377 |
364 // Check whether |lib_name| is page aligned and uncompressed in |zipfile_name|. | 378 // Check whether |lib_name| is page aligned and uncompressed in |zipfile_name|. |
365 crazy_status_t crazy_linker_check_library_is_mappable_in_zip_file( | 379 crazy_status_t crazy_linker_check_library_is_mappable_in_zip_file( |
366 const char* zipfile_name, | 380 const char* zipfile_name, |
367 const char* lib_name) _CRAZY_PUBLIC; | 381 const char* lib_name) _CRAZY_PUBLIC; |
368 | 382 |
369 // Close a library. This decrements its reference count. If it reaches | 383 // Close a library. This decrements its reference count. If it reaches |
370 // zero, the library be unloaded from the process. | 384 // zero, the library be unloaded from the process. |
371 void crazy_library_close(crazy_library_t* library) _CRAZY_PUBLIC; | 385 void crazy_library_close(crazy_library_t* library) _CRAZY_PUBLIC; |
372 | 386 |
373 // Close a library, with associated context to support delayed operations. | 387 // Close a library, with associated context to support delayed operations. |
374 void crazy_library_close_with_context(crazy_library_t* library, | 388 void crazy_library_close_with_context(crazy_library_t* library, |
375 crazy_context_t* context) _CRAZY_PUBLIC; | 389 crazy_context_t* context) _CRAZY_PUBLIC; |
376 | 390 |
377 #ifdef __cplusplus | 391 #ifdef __cplusplus |
378 } /* extern "C" */ | 392 } /* extern "C" */ |
379 #endif | 393 #endif |
380 | 394 |
381 #endif /* CRAZY_LINKER_H */ | 395 #endif /* CRAZY_LINKER_H */ |
OLD | NEW |