summaryrefslogtreecommitdiff
path: root/runtime/runtime.cc
diff options
context:
space:
mode:
author Victor Hsieh <victorhsieh@google.com> 2021-05-24 14:21:55 -0700
committer Treehugger Robot <treehugger-gerrit@google.com> 2021-06-10 15:22:02 +0000
commita09d8b7d4cb6f35f12f2bd2ed4e04a0eb129eeea (patch)
tree79587d30dda7acb00545333067596dfcfa11bdb6 /runtime/runtime.cc
parente300c4e4eabe3388b730efe35561e54f1c306710 (diff)
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
Diffstat (limited to 'runtime/runtime.cc')
-rw-r--r--runtime/runtime.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/runtime/runtime.cc b/runtime/runtime.cc
index 35b7055275..d54ef6bd30 100644
--- a/runtime/runtime.cc
+++ b/runtime/runtime.cc
@@ -1394,6 +1394,13 @@ bool Runtime::Init(RuntimeArgumentMap&& runtime_options_in) {
}
}
+ boot_class_path_fds_ = runtime_options.ReleaseOrDefault(Opt::BootClassPathFds);
+ if (!boot_class_path_fds_.empty() && boot_class_path_fds_.size() != boot_class_path_.size()) {
+ LOG(ERROR) << "Number of FDs specified in -Xbootclasspathfds must match the number of JARs in "
+ << "-Xbootclasspath.";
+ return false;
+ }
+
class_path_string_ = runtime_options.ReleaseOrDefault(Opt::ClassPath);
properties_ = runtime_options.ReleaseOrDefault(Opt::PropertiesList);
@@ -1517,6 +1524,7 @@ bool Runtime::Init(RuntimeArgumentMap&& runtime_options_in) {
runtime_options.GetOrDefault(Opt::NonMovingSpaceCapacity),
GetBootClassPath(),
GetBootClassPathLocations(),
+ GetBootClassPathFds(),
image_locations_,
instruction_set_,
// Override the collector type to CC if the read barrier config.