Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(106)

Side by Side Diff: third_party/android_crazy_linker/src/include/crazy_linker.h

Issue 684163002: Library loading fallback. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Final update for review feedback Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 14 matching lines...) Expand all
25 #include <stddef.h> 25 #include <stddef.h>
26 26
27 #ifdef __cplusplus 27 #ifdef __cplusplus
28 extern "C" { 28 extern "C" {
29 #endif 29 #endif
30 30
31 // Function attribute to indicate that it needs to be exported by 31 // Function attribute to indicate that it needs to be exported by
32 // the library. 32 // the library.
33 #define _CRAZY_PUBLIC __attribute__((__visibility__("default"))) 33 #define _CRAZY_PUBLIC __attribute__((__visibility__("default")))
34 34
35 // Maximum path length of a file in a zip file.
36 const size_t kMaxFilePathLengthInZip = 256;
37
35 // Status values returned by crazy linker functions to indicate 38 // Status values returned by crazy linker functions to indicate
36 // success or failure. They were chosen to match boolean values, 39 // success or failure. They were chosen to match boolean values,
37 // this allows one to test for failures with: 40 // this allows one to test for failures with:
38 // 41 //
39 // if (!crazy_linker_function(....)) { 42 // if (!crazy_linker_function(....)) {
40 // ... an error occured. 43 // ... an error occured.
41 // } 44 // }
42 // 45 //
43 // If the function called used a crazy_context_t, it is possible to 46 // If the function called used a crazy_context_t, it is possible to
44 // retrieve the error details with crazy_context_get_error(). 47 // retrieve the error details with crazy_context_get_error().
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 // Note that this works even if the memory is inside a system library that 331 // Note that this works even if the memory is inside a system library that
329 // was not previously opened with crazy_library_open(). 332 // was not previously opened with crazy_library_open().
330 // |address| is the memory address. 333 // |address| is the memory address.
331 // On success, returns CRAZY_STATUS_SUCCESS and sets |*library|. 334 // On success, returns CRAZY_STATUS_SUCCESS and sets |*library|.
332 // The caller muyst call crazy_library_close() once it's done with the 335 // The caller muyst call crazy_library_close() once it's done with the
333 // library. 336 // library.
334 crazy_status_t crazy_library_find_from_address( 337 crazy_status_t crazy_library_find_from_address(
335 void* address, 338 void* address,
336 crazy_library_t** library) _CRAZY_PUBLIC; 339 crazy_library_t** library) _CRAZY_PUBLIC;
337 340
341 // Return the full path of |lib_name| in the zip file
342 // (lib/<abi>/crazy.<lib_name>). The result is returned in
343 // |buffer[0..buffer_size - 1]|. If |buffer_size| is too small,
344 // CRAZY_STATUS_FAILURE is returned.
345 crazy_status_t crazy_library_file_path_in_zip_file(const char* lib_name,
346 char* buffer,
347 size_t buffer_size)
348 _CRAZY_PUBLIC;
349
338 // Check whether |lib_name| is page aligned in |zipfile_name|. 350 // Check whether |lib_name| is page aligned in |zipfile_name|.
339 crazy_status_t crazy_linker_check_library_aligned_in_zip_file( 351 crazy_status_t crazy_linker_check_library_aligned_in_zip_file(
340 const char* zipfile_name, 352 const char* zipfile_name,
341 const char* lib_name) _CRAZY_PUBLIC; 353 const char* lib_name) _CRAZY_PUBLIC;
342 354
343 // Close a library. This decrements its reference count. If it reaches 355 // Close a library. This decrements its reference count. If it reaches
344 // zero, the library be unloaded from the process. 356 // zero, the library be unloaded from the process.
345 void crazy_library_close(crazy_library_t* library) _CRAZY_PUBLIC; 357 void crazy_library_close(crazy_library_t* library) _CRAZY_PUBLIC;
346 358
347 // Close a library, with associated context to support delayed operations. 359 // Close a library, with associated context to support delayed operations.
348 void crazy_library_close_with_context(crazy_library_t* library, 360 void crazy_library_close_with_context(crazy_library_t* library,
349 crazy_context_t* context) _CRAZY_PUBLIC; 361 crazy_context_t* context) _CRAZY_PUBLIC;
350 362
351 #ifdef __cplusplus 363 #ifdef __cplusplus
352 } /* extern "C" */ 364 } /* extern "C" */
353 #endif 365 #endif
354 366
355 #endif /* CRAZY_LINKER_H */ 367 #endif /* CRAZY_LINKER_H */
OLDNEW
« no previous file with comments | « base/android/linker/linker_jni.cc ('k') | third_party/android_crazy_linker/src/src/crazy_linker_api.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698