| Dimitry Ivanov | 3f66057 | 2016-09-09 10:00:39 -0700 | [diff] [blame] | 1 | /* | 
|  | 2 | * Copyright (C) 2016 The Android Open Source Project | 
|  | 3 | * All rights reserved. | 
|  | 4 | * | 
|  | 5 | * Redistribution and use in source and binary forms, with or without | 
|  | 6 | * modification, are permitted provided that the following conditions | 
|  | 7 | * are met: | 
|  | 8 | *  * Redistributions of source code must retain the above copyright | 
|  | 9 | *    notice, this list of conditions and the following disclaimer. | 
|  | 10 | *  * Redistributions in binary form must reproduce the above copyright | 
|  | 11 | *    notice, this list of conditions and the following disclaimer in | 
|  | 12 | *    the documentation and/or other materials provided with the | 
|  | 13 | *    distribution. | 
|  | 14 | * | 
|  | 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 
|  | 16 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 
|  | 17 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | 
|  | 18 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | 
|  | 19 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | 
|  | 20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | 
|  | 21 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | 
|  | 22 | * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED | 
|  | 23 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | 
|  | 24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT | 
|  | 25 | * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 
|  | 26 | * SUCH DAMAGE. | 
|  | 27 | */ | 
|  | 28 |  | 
|  | 29 | #ifndef __LINKER_MAIN_H | 
|  | 30 | #define __LINKER_MAIN_H | 
|  | 31 |  | 
|  | 32 | #include <android/dlext.h> | 
|  | 33 |  | 
|  | 34 | #include "linker_namespaces.h" | 
|  | 35 | #include "linker_soinfo.h" | 
|  | 36 |  | 
|  | 37 | class ProtectedDataGuard { | 
|  | 38 | public: | 
|  | 39 | ProtectedDataGuard(); | 
|  | 40 | ~ProtectedDataGuard(); | 
|  | 41 |  | 
|  | 42 | private: | 
|  | 43 | void protect_data(int protection); | 
|  | 44 | static size_t ref_count_; | 
|  | 45 | }; | 
|  | 46 |  | 
| Dimitry Ivanov | 4cabfaa | 2017-03-07 11:19:05 -0800 | [diff] [blame] | 47 | void init_default_namespace(const char* executable_path); | 
| Dimitry Ivanov | 3f66057 | 2016-09-09 10:00:39 -0700 | [diff] [blame] | 48 | soinfo* soinfo_alloc(android_namespace_t* ns, const char* name, | 
|  | 49 | struct stat* file_stat, off64_t file_offset, | 
|  | 50 | uint32_t rtld_flags); | 
|  | 51 |  | 
|  | 52 | bool find_libraries(android_namespace_t* ns, | 
|  | 53 | soinfo* start_with, | 
|  | 54 | const char* const library_names[], | 
|  | 55 | size_t library_names_count, | 
|  | 56 | soinfo* soinfos[], | 
|  | 57 | std::vector<soinfo*>* ld_preloads, | 
|  | 58 | size_t ld_preloads_count, | 
|  | 59 | int rtld_flags, | 
|  | 60 | const android_dlextinfo* extinfo, | 
| Dimitry Ivanov | 7d429d3 | 2017-02-01 15:28:52 -0800 | [diff] [blame] | 61 | bool add_as_children, | 
|  | 62 | bool search_linked_namespaces); | 
| Dimitry Ivanov | 3f66057 | 2016-09-09 10:00:39 -0700 | [diff] [blame] | 63 |  | 
|  | 64 | void solist_add_soinfo(soinfo* si); | 
|  | 65 | bool solist_remove_soinfo(soinfo* si); | 
|  | 66 | soinfo* solist_get_head(); | 
|  | 67 | soinfo* solist_get_somain(); | 
|  | 68 |  | 
|  | 69 | #endif |