Add runtime option -Xbootclasspathfds: for pre-opened fds
The new option allows the client to pass a pre-opened fds to the
runtime. The number of elements must match the number of BCP jars
specified in -Xbootclasspath. An fd of negative number is a valid
option, in such case the runtime will still open the jar in the
corresponding path in -Xbootclasspath.
Example: -Xbootclasspathfds:10:11:-1:12
The option is currently only used in "unstarted runtime", but will also
be used elsewhere in the follow-up changes.
Bug: 187327262
Test: patch odrefresh to use the option, no longer seeing such openat(2)
Test: m test-art-host-gtest
Change-Id: I1bebbd80136419c03ac1309a8cb8229a0fd69838
diff --git a/runtime/gc/heap.cc b/runtime/gc/heap.cc
index e84c436..4676ded 100644
--- a/runtime/gc/heap.cc
+++ b/runtime/gc/heap.cc
@@ -262,6 +262,7 @@
size_t non_moving_space_capacity,
const std::vector<std::string>& boot_class_path,
const std::vector<std::string>& boot_class_path_locations,
+ const std::vector<int>& boot_class_path_fds,
const std::vector<std::string>& image_file_names,
const InstructionSet image_instruction_set,
CollectorType foreground_collector_type,
@@ -462,6 +463,7 @@
MemMap heap_reservation;
if (space::ImageSpace::LoadBootImage(boot_class_path,
boot_class_path_locations,
+ boot_class_path_fds,
image_file_names,
image_instruction_set,
runtime->ShouldRelocate(),