From 5883bedea4bbad6738e8e4a8c308841a7f000b11 Mon Sep 17 00:00:00 2001 From: "A. Cody Schuffelen" Date: Mon, 13 Jul 2026 13:50:17 -0700 Subject: [PATCH 1/9] Extract //cuttlefish/process:envp_to_map This was in command_subprocess.* but only had one caller which was in a different file. Bug: b/533572315 --- .../cuttlefish/host/commands/cvd/BUILD.bazel | 2 +- base/cvd/cuttlefish/host/commands/cvd/main.cc | 2 +- base/cvd/cuttlefish/process/BUILD.bazel | 10 ++++ .../cuttlefish/process/command_subprocess.cc | 21 -------- .../cuttlefish/process/command_subprocess.h | 2 - base/cvd/cuttlefish/process/envp_to_map.cc | 49 +++++++++++++++++++ base/cvd/cuttlefish/process/envp_to_map.h | 25 ++++++++++ 7 files changed, 86 insertions(+), 25 deletions(-) create mode 100644 base/cvd/cuttlefish/process/envp_to_map.cc create mode 100644 base/cvd/cuttlefish/process/envp_to_map.h diff --git a/base/cvd/cuttlefish/host/commands/cvd/BUILD.bazel b/base/cvd/cuttlefish/host/commands/cvd/BUILD.bazel index 072eb92fc4c..326da1a6b89 100644 --- a/base/cvd/cuttlefish/host/commands/cvd/BUILD.bazel +++ b/base/cvd/cuttlefish/host/commands/cvd/BUILD.bazel @@ -43,7 +43,7 @@ cf_cc_binary( "//cuttlefish/host/commands/cvd/version", "//cuttlefish/host/libs/vm_manager", "//cuttlefish/posix:strerror", - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:envp_to_map", "//libbase", "@abseil-cpp//absl/cleanup", "@abseil-cpp//absl/log", diff --git a/base/cvd/cuttlefish/host/commands/cvd/main.cc b/base/cvd/cuttlefish/host/commands/cvd/main.cc index e3ca135ee8d..81aa1c6dfbe 100644 --- a/base/cvd/cuttlefish/host/commands/cvd/main.cc +++ b/base/cvd/cuttlefish/host/commands/cvd/main.cc @@ -44,7 +44,7 @@ #include "cuttlefish/host/commands/cvd/utils/common.h" #include "cuttlefish/host/commands/cvd/version/version.h" #include "cuttlefish/posix/strerror.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/envp_to_map.h" // TODO(315772518) Re-enable once metrics send is reenabled // #include "cuttlefish/host/commands/cvd/metrics/cvd_metrics_api.h" diff --git a/base/cvd/cuttlefish/process/BUILD.bazel b/base/cvd/cuttlefish/process/BUILD.bazel index aec9514d500..d60e285413a 100644 --- a/base/cvd/cuttlefish/process/BUILD.bazel +++ b/base/cvd/cuttlefish/process/BUILD.bazel @@ -23,6 +23,16 @@ cf_cc_library( ], ) +cf_cc_library( + name = "envp_to_map", + srcs = ["envp_to_map.cc"], + hdrs = ["envp_to_map.h"], + deps = [ + "@abseil-cpp//absl/log", + "@abseil-cpp//absl/strings", + ], +) + cf_cc_library( name = "managed_stdio", srcs = ["managed_stdio.cc"], diff --git a/base/cvd/cuttlefish/process/command_subprocess.cc b/base/cvd/cuttlefish/process/command_subprocess.cc index 9ec6e516ee4..863fb520a50 100644 --- a/base/cvd/cuttlefish/process/command_subprocess.cc +++ b/base/cvd/cuttlefish/process/command_subprocess.cc @@ -35,7 +35,6 @@ #include #include #include -#include #include #include #include @@ -103,26 +102,6 @@ std::vector ToCharPointers(const std::vector& vect) { } } // namespace -std::unordered_map EnvpToMap(char** envp) { - std::unordered_map env_map; - if (!envp) { - return env_map; - } - for (char** e = envp; *e != nullptr; e++) { - std::vector key_value = - absl::StrSplit(*e, absl::MaxSplits('=', 1)); - if (key_value.size() != 2) { - LOG(WARNING) << "Environment var in unknown format: " << *e; - continue; - } - auto [it, inserted] = env_map.emplace(key_value[0], key_value[1]); - if (!inserted) { - LOG(WARNING) << "Duplicate environment variable " << key_value[0]; - } - } - return env_map; -} - SubprocessOptions& SubprocessOptions::Verbose(bool verbose) & { verbose_ = verbose; return *this; diff --git a/base/cvd/cuttlefish/process/command_subprocess.h b/base/cvd/cuttlefish/process/command_subprocess.h index bf3036876f9..651ac93a855 100644 --- a/base/cvd/cuttlefish/process/command_subprocess.h +++ b/base/cvd/cuttlefish/process/command_subprocess.h @@ -37,8 +37,6 @@ namespace cuttlefish { -std::unordered_map EnvpToMap(char** envp); - enum class StopperResult { kStopFailure, /* Failed to stop the subprocess. */ kStopCrash, /* Attempted to stop the subprocess cleanly, but that failed. */ diff --git a/base/cvd/cuttlefish/process/envp_to_map.cc b/base/cvd/cuttlefish/process/envp_to_map.cc new file mode 100644 index 00000000000..77eca6894e0 --- /dev/null +++ b/base/cvd/cuttlefish/process/envp_to_map.cc @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "cuttlefish/process/envp_to_map.h" + +#include +#include +#include +#include + +#include "absl/log/log.h" +#include "absl/strings/str_split.h" + +namespace cuttlefish { + +std::unordered_map EnvpToMap(char** envp) { + std::unordered_map env_map; + if (!envp) { + return env_map; + } + for (char** e = envp; *e != nullptr; e++) { + std::vector key_value = + absl::StrSplit(*e, absl::MaxSplits('=', 1)); + if (key_value.size() != 2) { + LOG(WARNING) << "Environment var in unknown format: " << *e; + continue; + } + auto [it, inserted] = env_map.emplace(key_value[0], key_value[1]); + if (!inserted) { + LOG(WARNING) << "Duplicate environment variable " << key_value[0]; + } + } + return env_map; +} + +} // namespace cuttlefish diff --git a/base/cvd/cuttlefish/process/envp_to_map.h b/base/cvd/cuttlefish/process/envp_to_map.h new file mode 100644 index 00000000000..f8f084653a4 --- /dev/null +++ b/base/cvd/cuttlefish/process/envp_to_map.h @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#pragma once + +#include +#include + +namespace cuttlefish { + +std::unordered_map EnvpToMap(char** envp); + +} // namespace cuttlefish From fb8c039194eefa6107909f6804194886232a94fe Mon Sep 17 00:00:00 2001 From: "A. Cody Schuffelen" Date: Mon, 13 Jul 2026 14:28:24 -0700 Subject: [PATCH 2/9] Split apart command_subprocess.cc Bug: b/533572315 --- base/cvd/cuttlefish/process/BUILD.bazel | 50 ++- .../{command_subprocess.cc => command.cc} | 209 +----------- base/cvd/cuttlefish/process/command.h | 206 ++++++++++++ .../cuttlefish/process/command_subprocess.h | 308 +----------------- base/cvd/cuttlefish/process/execute.cc | 61 ++++ base/cvd/cuttlefish/process/execute.h | 50 +++ base/cvd/cuttlefish/process/subprocess.cc | 177 ++++++++++ base/cvd/cuttlefish/process/subprocess.h | 86 +++++ .../cuttlefish/process/subprocess_options.cc | 62 ++++ .../cuttlefish/process/subprocess_options.h | 51 +++ 10 files changed, 747 insertions(+), 513 deletions(-) rename base/cvd/cuttlefish/process/{command_subprocess.cc => command.cc} (64%) create mode 100644 base/cvd/cuttlefish/process/command.h create mode 100644 base/cvd/cuttlefish/process/execute.cc create mode 100644 base/cvd/cuttlefish/process/execute.h create mode 100644 base/cvd/cuttlefish/process/subprocess.cc create mode 100644 base/cvd/cuttlefish/process/subprocess.h create mode 100644 base/cvd/cuttlefish/process/subprocess_options.cc create mode 100644 base/cvd/cuttlefish/process/subprocess_options.h diff --git a/base/cvd/cuttlefish/process/BUILD.bazel b/base/cvd/cuttlefish/process/BUILD.bazel index d60e285413a..89d3df849b1 100644 --- a/base/cvd/cuttlefish/process/BUILD.bazel +++ b/base/cvd/cuttlefish/process/BUILD.bazel @@ -7,14 +7,16 @@ package( cf_build_test(name = "cf_build_test") cf_cc_library( - name = "command_subprocess", - srcs = ["command_subprocess.cc"], - hdrs = ["command_subprocess.h"], + name = "command", + srcs = ["command.cc"], + hdrs = ["command.h"], depend_on_what_you_use_enabled = False, deps = [ "//cuttlefish/common/libs/fs", "//cuttlefish/common/libs/utils:contains", "//cuttlefish/common/libs/utils:files", + "//cuttlefish/process:subprocess", + "//cuttlefish/process:subprocess_options", "//cuttlefish/result", "//libbase", "@abseil-cpp//absl/log", @@ -23,6 +25,17 @@ cf_cc_library( ], ) +cf_cc_library( + name = "command_subprocess", + hdrs = ["command_subprocess.h"], + deps = [ + "//cuttlefish/process:command", + "//cuttlefish/process:execute", + "//cuttlefish/process:subprocess", + "//cuttlefish/process:subprocess_options", + ], +) + cf_cc_library( name = "envp_to_map", srcs = ["envp_to_map.cc"], @@ -33,6 +46,20 @@ cf_cc_library( ], ) +cf_cc_library( + name = "execute", + srcs = ["execute.cc"], + hdrs = ["execute.h"], + deps = [ + "//cuttlefish/common/libs/fs", + "//cuttlefish/process:command", + "//cuttlefish/process:subprocess", + "//cuttlefish/process:subprocess_options", + "//cuttlefish/result:expect", + "//cuttlefish/result:result_type", + ], +) + cf_cc_library( name = "managed_stdio", srcs = ["managed_stdio.cc"], @@ -46,3 +73,20 @@ cf_cc_library( "@abseil-cpp//absl/log", ], ) + +cf_cc_library( + name = "subprocess", + srcs = ["subprocess.cc"], + hdrs = ["subprocess.h"], + deps = [ + "//cuttlefish/result:expect", + "//cuttlefish/result:result_type", + "@abseil-cpp//absl/log", + ], +) + +cf_cc_library( + name = "subprocess_options", + srcs = ["subprocess_options.cc"], + hdrs = ["subprocess_options.h"], +) diff --git a/base/cvd/cuttlefish/process/command_subprocess.cc b/base/cvd/cuttlefish/process/command.cc similarity index 64% rename from base/cvd/cuttlefish/process/command_subprocess.cc rename to base/cvd/cuttlefish/process/command.cc index 863fb520a50..67db29af77c 100644 --- a/base/cvd/cuttlefish/process/command_subprocess.cc +++ b/base/cvd/cuttlefish/process/command.cc @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/command.h" #include #include @@ -22,7 +22,6 @@ #include #include #include -#include #include #include @@ -49,6 +48,8 @@ #include "cuttlefish/common/libs/fs/shared_fd.h" #include "cuttlefish/common/libs/utils/contains.h" #include "cuttlefish/common/libs/utils/files.h" +#include "cuttlefish/process/subprocess.h" +#include "cuttlefish/process/subprocess_options.h" #include "cuttlefish/result/result.h" #ifdef __linux__ @@ -102,184 +103,6 @@ std::vector ToCharPointers(const std::vector& vect) { } } // namespace -SubprocessOptions& SubprocessOptions::Verbose(bool verbose) & { - verbose_ = verbose; - return *this; -} -SubprocessOptions SubprocessOptions::Verbose(bool verbose) && { - verbose_ = verbose; - return std::move(*this); -} - -#ifdef __linux__ -SubprocessOptions& SubprocessOptions::ExitWithParent(bool exit_with_parent) & { - exit_with_parent_ = exit_with_parent; - return *this; -} -SubprocessOptions SubprocessOptions::ExitWithParent(bool exit_with_parent) && { - exit_with_parent_ = exit_with_parent; - return std::move(*this); -} -#endif - -SubprocessOptions& SubprocessOptions::InGroup(bool in_group) & { - in_group_ = in_group; - return *this; -} -SubprocessOptions SubprocessOptions::InGroup(bool in_group) && { - in_group_ = in_group; - return std::move(*this); -} - -SubprocessOptions& SubprocessOptions::Strace(std::string s) & { - strace_ = std::move(s); - return *this; -} -SubprocessOptions SubprocessOptions::Strace(std::string s) && { - strace_ = std::move(s); - return std::move(*this); -} - -Subprocess::Subprocess(Subprocess&& subprocess) - : pid_(subprocess.pid_.load()), - started_(subprocess.started_), - stopper_(subprocess.stopper_) { - // Make sure the moved object no longer controls this subprocess - subprocess.pid_ = -1; - subprocess.started_ = false; -} - -Subprocess& Subprocess::operator=(Subprocess&& other) { - pid_ = other.pid_.load(); - started_ = other.started_; - stopper_ = other.stopper_; - - other.pid_ = -1; - other.started_ = false; - return *this; -} - -int Subprocess::Wait() { - if (pid_ < 0) { - LOG(ERROR) - << "Attempt to wait on invalid pid(has it been waited on already?): " - << pid_; - return -1; - } - int wstatus = 0; - auto pid = pid_.load(); // Wait will set pid_ to -1 after waiting - auto wait_ret = waitpid(pid, &wstatus, 0); - if (wait_ret < 0) { - auto error = errno; - LOG(ERROR) << "Error on call to waitpid: " << strerror(error); - return wait_ret; - } - int retval = 0; - if (WIFEXITED(wstatus)) { - pid_ = -1; - retval = WEXITSTATUS(wstatus); - if (retval) { - VLOG(0) << "Subprocess " << pid << " exited with error code: " << retval; - } - } else if (WIFSIGNALED(wstatus)) { - pid_ = -1; - int sig_num = WTERMSIG(wstatus); - LOG(ERROR) << "Subprocess " << pid << " was interrupted by a signal '" - << strsignal(sig_num) << "' (" << sig_num << ")"; - retval = -1; - } - return retval; -} -// NOLINTNEXTLINE(misc-include-cleaner): -int Subprocess::Wait(siginfo_t* infop, int options) { - if (pid_ < 0) { - LOG(ERROR) - << "Attempt to wait on invalid pid(has it been waited on already?): " - << pid_; - return -1; - } - *infop = {}; - // NOLINTNEXTLINE(misc-include-cleaner): - auto retval = TEMP_FAILURE_RETRY(waitid(P_PID, pid_, infop, options)); - // We don't want to wait twice for the same process - bool exited = infop->si_code == CLD_EXITED || infop->si_code == CLD_DUMPED; - bool reaped = !(options & WNOWAIT); - if (exited && reaped) { - pid_ = -1; - } - return retval; -} - -static Result SendSignalImpl(const int signal, const pid_t pid, - bool to_group, const bool started) { - if (pid == -1) { - return CF_ERR(strerror(ESRCH)); - } - CF_EXPECTF(started == true, - "The Subprocess object lost the ownership" - "of the process {}.", - pid); - int ret_code = 0; - if (to_group) { - ret_code = killpg(getpgid(pid), signal); - } else { - ret_code = kill(pid, signal); - } - CF_EXPECTF(ret_code == 0, "kill/killpg returns {} with errno: {}", ret_code, - strerror(errno)); - return {}; -} - -Result Subprocess::SendSignal(const int signal) { - CF_EXPECT(SendSignalImpl(signal, pid_, /* to_group */ false, started_)); - return {}; -} - -Result Subprocess::SendSignalToGroup(const int signal) { - CF_EXPECT(SendSignalImpl(signal, pid_, /* to_group */ true, started_)); - return {}; -} - -StopperResult KillSubprocess(Subprocess* subprocess) { - auto pid = subprocess->pid(); - if (pid > 0) { - auto pgid = getpgid(pid); - if (pgid < 0) { - auto error = errno; - LOG(WARNING) << "Error obtaining process group id of process with pid=" - << pid << ": " << strerror(error); - // Send the kill signal anyways, because pgid will be -1 it will be sent - // to the process and not a (non-existent) group - } - bool is_group_head = pid == pgid; - auto kill_ret = (is_group_head ? killpg : kill)(pid, SIGKILL); - if (kill_ret == 0) { - return StopperResult::kStopSuccess; - } - auto kill_cmd = is_group_head ? "killpg(" : "kill("; - PLOG(ERROR) << kill_cmd << pid << ", SIGKILL) failed: "; - return StopperResult::kStopFailure; - } - return StopperResult::kStopSuccess; -} - -SubprocessStopper KillSubprocessFallback(std::function nice) { - return KillSubprocessFallback([nice](Subprocess*) { return nice(); }); -} - -SubprocessStopper KillSubprocessFallback(SubprocessStopper nice_stopper) { - return [nice_stopper](Subprocess* process) { - auto nice_result = nice_stopper(process); - if (nice_result == StopperResult::kStopFailure) { - auto harsh_result = KillSubprocess(process); - return harsh_result == StopperResult::kStopSuccess - ? StopperResult::kStopCrash - : harsh_result; - } - return nice_result; - }; -} - Command::Command(std::string executable, SubprocessStopper stopper) : subprocess_stopper_(stopper) { for (char** env = environ; *env; env++) { @@ -546,30 +369,4 @@ std::string Command::AsBashScript( return contents; } -int Execute(std::vector commands) { - const Result result = - Execute(std::move(commands), SubprocessOptions(), WEXITED); - if (result.ok() && result->si_code == CLD_EXITED) { - return result->si_status; // NOLINT(misc-include-cleaner): - } else { - return -1; - } -} - -Result Execute(std::vector command, - SubprocessOptions subprocess_options, - int wait_options) { - Command cmd(std::move(command[0])); - for (size_t i = 1; i < command.size(); ++i) { - cmd.AddParameter(std::move(command[i])); - } - Subprocess subprocess = cmd.Start(std::move(subprocess_options)); - CF_EXPECT(subprocess.Started(), "Subprocess failed to start."); - - siginfo_t info; - CF_EXPECT_EQ(subprocess.Wait(&info, wait_options), 0); - - return info; -} - } // namespace cuttlefish diff --git a/base/cvd/cuttlefish/process/command.h b/base/cvd/cuttlefish/process/command.h new file mode 100644 index 00000000000..2f066180bfb --- /dev/null +++ b/base/cvd/cuttlefish/process/command.h @@ -0,0 +1,206 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#pragma once + +#include +#include +#include +#include +#include +#include +#include + +#include "absl/log/check.h" + +#include "cuttlefish/common/libs/fs/shared_fd.h" +#include "cuttlefish/process/subprocess.h" +#include "cuttlefish/process/subprocess_options.h" + +namespace cuttlefish { + +// An executable command. Multiple subprocesses can be started from the same +// command object. This class owns any file descriptors that the subprocess +// should inherit. +class Command { + private: + template + // For every type other than SharedFD (for which there is a specialisation) + void BuildParameter(std::stringstream* stream, T t) { + *stream << t; + } + // Special treatment for SharedFD + void BuildParameter(std::stringstream* stream, SharedFD shared_fd); + // Special treatment for bool so it uses true/false instead of 1/0 + void BuildParameter(std::stringstream* stream, bool arg); + template + void BuildParameter(std::stringstream* stream, T t, Args... args) { + BuildParameter(stream, t); + BuildParameter(stream, args...); + } + + public: + // Constructs a command object from the path to an executable binary and an + // optional subprocess stopper. When not provided, stopper defaults to sending + // SIGKILL to the subprocess. + Command(std::string executable, SubprocessStopper stopper = KillSubprocess); + Command(Command&&) = default; + // The default copy constructor is unsafe because it would mean multiple + // closing of the inherited file descriptors. If needed it can be implemented + // using dup(2) + Command(const Command&) = delete; + Command& operator=(const Command&) = delete; + ~Command(); + + const std::string& Executable() const { + return executable_ ? *executable_ : command_[0]; + } + + Command& SetExecutable(std::string executable) & { + executable_ = std::move(executable); + return *this; + } + Command SetExecutable(std::string executable) && { + return std::move(SetExecutable(executable)); + } + + Command& SetName(std::string name) & { + command_[0] = std::move(name); + return *this; + } + Command SetName(std::string name) && { + return std::move(SetName(std::move(name))); + } + + Command& SetExecutableAndName(std::string name) & { + return SetExecutable(name).SetName(std::move(name)); + } + + Command SetExecutableAndName(std::string name) && { + return std::move(SetExecutableAndName(std::move(name))); + } + + Command& SetStopper(SubprocessStopper stopper) & { + subprocess_stopper_ = std::move(stopper); + return *this; + } + Command SetStopper(SubprocessStopper stopper) && { + return std::move(SetStopper(std::move(stopper))); + } + + // Specify the environment for the subprocesses to be started. By default + // subprocesses inherit the parent's environment. + Command& SetEnvironment(std::vector env) & { + env_ = std::move(env); + return *this; + } + Command SetEnvironment(std::vector env) && { + return std::move(SetEnvironment(std::move(env))); + } + + Command& AddEnvironmentVariable(std::string_view env_var, + std::string_view value) &; + Command AddEnvironmentVariable(std::string_view env_var, + std::string_view value) &&; + + // Specify an environment variable to be unset from the parent's + // environment for the subprocesses to be started. + Command& UnsetFromEnvironment(std::string_view env_var) &; + Command UnsetFromEnvironment(std::string_view env_var) &&; + + // Adds a single parameter to the command. All arguments are concatenated into + // a single string to form a parameter. If one of those arguments is a + // SharedFD a duplicate of it will be used and won't be closed until the + // object is destroyed. To add multiple parameters to the command the function + // must be called multiple times, one per parameter. + template + Command& AddParameter(Args... args) & { + std::stringstream ss; + BuildParameter(&ss, args...); + command_.push_back(ss.str()); + return *this; + } + template + Command AddParameter(Args... args) && { + return std::move(AddParameter(std::forward(args)...)); + } + Command& AddParameter(std::string arg) &; + Command AddParameter(std::string arg) &&; + + // Similar to AddParameter, except the args are appended to the last (most + // recently-added) parameter in the command. + template + Command& AppendToLastParameter(Args... args) & { + CHECK(!command_.empty()) << "There is no parameter to append to."; + std::stringstream ss; + BuildParameter(&ss, args...); + command_[command_.size() - 1] += ss.str(); + return *this; + } + template + Command AppendToLastParameter(Args... args) && { + return std::move(AppendToLastParameter(std::forward(args)...)); + } + + // Redirects the standard IO of the command. + Command& RedirectStdIO(Subprocess::StdIOChannel channel, + SharedFD shared_fd) &; + Command RedirectStdIO(Subprocess::StdIOChannel channel, + SharedFD shared_fd) &&; + Command& RedirectStdIO(Subprocess::StdIOChannel subprocess_channel, + Subprocess::StdIOChannel parent_channel) &; + Command RedirectStdIO(Subprocess::StdIOChannel subprocess_channel, + Subprocess::StdIOChannel parent_channel) &&; + + Command& SetWorkingDirectory(const std::string& path) &; + Command SetWorkingDirectory(const std::string& path) &&; + Command& SetWorkingDirectory(SharedFD dirfd) &; + Command SetWorkingDirectory(SharedFD dirfd) &&; + + Command& AddPrerequisite(const std::function()>& prerequisite) &; + Command AddPrerequisite(const std::function()>& prerequisite) &&; + + // Starts execution of the command. This method can be called multiple times, + // effectively staring multiple (possibly concurrent) instances. + Subprocess Start(SubprocessOptions options = SubprocessOptions()) const; + + std::string GetShortName() const { + // This is safe because the constructor guarantees the name of the binary to + // be at index 0 on the vector + return command_[0]; + } + + std::string ToString() const; + + // Generates the contents for a bash script that can be used to run this + // command. Note that this command must not require any file descriptors + // or stdio redirects as those would not be available when the bash script + // is run. + std::string AsBashScript(const std::string& redirected_stdio_path = "") const; + + private: + friend std::ostream& operator<<(std::ostream& out, const Command& command); + std::optional executable_; // When unset, use command_[0] + std::vector command_; + std::vector()>> prerequisites_; + std::map inherited_fds_{}; + std::map redirects_{}; + std::vector env_{}; + SubprocessStopper subprocess_stopper_; + SharedFD working_directory_; +}; +std::ostream& operator<<(std::ostream& out, const Command& command); + +} // namespace cuttlefish diff --git a/base/cvd/cuttlefish/process/command_subprocess.h b/base/cvd/cuttlefish/process/command_subprocess.h index 651ac93a855..d81f8c5b0d5 100644 --- a/base/cvd/cuttlefish/process/command_subprocess.h +++ b/base/cvd/cuttlefish/process/command_subprocess.h @@ -15,307 +15,7 @@ */ #pragma once -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "absl/log/check.h" - -#include "cuttlefish/common/libs/fs/shared_fd.h" - -namespace cuttlefish { - -enum class StopperResult { - kStopFailure, /* Failed to stop the subprocess. */ - kStopCrash, /* Attempted to stop the subprocess cleanly, but that failed. */ - kStopSuccess, /* The subprocess exited in the expected way. */ -}; - -class Subprocess; -using SubprocessStopper = std::function; -// Kills a process by sending it the SIGKILL signal. -StopperResult KillSubprocess(Subprocess* subprocess); -/* Creates a `SubprocessStopper` that first tries `nice_stopper` then falls back - * to `KillSubprocess` if that fails. */ -SubprocessStopper KillSubprocessFallback(std::function); -SubprocessStopper KillSubprocessFallback(SubprocessStopper nice_stopper); - -// Keeps track of a running (sub)process. Allows to wait for its completion. -// It's an error to wait twice for the same subprocess. -class Subprocess { - public: - enum class StdIOChannel { - kStdIn = 0, - kStdOut = 1, - kStdErr = 2, - }; - - Subprocess(pid_t pid, SubprocessStopper stopper = KillSubprocess) - : pid_(pid), started_(pid > 0), stopper_(stopper) {} - // The default implementation won't do because we need to reset the pid of the - // moved object. - Subprocess(Subprocess&&); - ~Subprocess() = default; - Subprocess& operator=(Subprocess&&); - // Waits for the subprocess to complete. Returns zero if completed - // successfully, non-zero otherwise. - int Wait(); - // Same as waitid(2) - int Wait(siginfo_t* infop, int options); - // Whether the command started successfully. It only says whether the call to - // fork() succeeded or not, it says nothing about exec or successful - // completion of the command, that's what Wait is for. - bool Started() const { return started_; } - pid_t pid() const { return pid_; } - StopperResult Stop() { return stopper_(this); } - - Result SendSignal(int signal); - Result SendSignalToGroup(int signal); - - private: - // Copy is disabled to avoid waiting twice for the same pid (the first wait - // frees the pid, which allows the kernel to reuse it so we may end up waiting - // for the wrong process) - Subprocess(const Subprocess&) = delete; - Subprocess& operator=(const Subprocess&) = delete; - std::atomic pid_ = -1; - bool started_ = false; - SubprocessStopper stopper_; -}; - -class SubprocessOptions { - public: - SubprocessOptions() - : verbose_(true), exit_with_parent_(true), in_group_(false) {} - SubprocessOptions& Verbose(bool verbose) &; - SubprocessOptions Verbose(bool verbose) &&; - SubprocessOptions& ExitWithParent(bool exit_with_parent) &; - SubprocessOptions ExitWithParent(bool exit_with_parent) &&; - SubprocessOptions& SandboxArguments(std::vector) &; - SubprocessOptions SandboxArguments(std::vector) &&; - // The subprocess runs as head of its own process group. - SubprocessOptions& InGroup(bool in_group) &; - SubprocessOptions InGroup(bool in_group) &&; - - SubprocessOptions& Strace(std::string strace_output_path) &; - SubprocessOptions Strace(std::string strace_output_path) &&; - - bool Verbose() const { return verbose_; } - bool ExitWithParent() const { return exit_with_parent_; } - bool InGroup() const { return in_group_; } - const std::string& Strace() const { return strace_; } - - private: - bool verbose_; - bool exit_with_parent_; - bool in_group_; - std::string strace_; -}; - -// An executable command. Multiple subprocesses can be started from the same -// command object. This class owns any file descriptors that the subprocess -// should inherit. -class Command { - private: - template - // For every type other than SharedFD (for which there is a specialisation) - void BuildParameter(std::stringstream* stream, T t) { - *stream << t; - } - // Special treatment for SharedFD - void BuildParameter(std::stringstream* stream, SharedFD shared_fd); - // Special treatment for bool so it uses true/false instead of 1/0 - void BuildParameter(std::stringstream* stream, bool arg); - template - void BuildParameter(std::stringstream* stream, T t, Args... args) { - BuildParameter(stream, t); - BuildParameter(stream, args...); - } - - public: - // Constructs a command object from the path to an executable binary and an - // optional subprocess stopper. When not provided, stopper defaults to sending - // SIGKILL to the subprocess. - Command(std::string executable, SubprocessStopper stopper = KillSubprocess); - Command(Command&&) = default; - // The default copy constructor is unsafe because it would mean multiple - // closing of the inherited file descriptors. If needed it can be implemented - // using dup(2) - Command(const Command&) = delete; - Command& operator=(const Command&) = delete; - ~Command(); - - const std::string& Executable() const { - return executable_ ? *executable_ : command_[0]; - } - - Command& SetExecutable(std::string executable) & { - executable_ = std::move(executable); - return *this; - } - Command SetExecutable(std::string executable) && { - return std::move(SetExecutable(executable)); - } - - Command& SetName(std::string name) & { - command_[0] = std::move(name); - return *this; - } - Command SetName(std::string name) && { - return std::move(SetName(std::move(name))); - } - - Command& SetExecutableAndName(std::string name) & { - return SetExecutable(name).SetName(std::move(name)); - } - - Command SetExecutableAndName(std::string name) && { - return std::move(SetExecutableAndName(std::move(name))); - } - - Command& SetStopper(SubprocessStopper stopper) & { - subprocess_stopper_ = std::move(stopper); - return *this; - } - Command SetStopper(SubprocessStopper stopper) && { - return std::move(SetStopper(std::move(stopper))); - } - - // Specify the environment for the subprocesses to be started. By default - // subprocesses inherit the parent's environment. - Command& SetEnvironment(std::vector env) & { - env_ = std::move(env); - return *this; - } - Command SetEnvironment(std::vector env) && { - return std::move(SetEnvironment(std::move(env))); - } - - Command& AddEnvironmentVariable(std::string_view env_var, - std::string_view value) &; - Command AddEnvironmentVariable(std::string_view env_var, - std::string_view value) &&; - - // Specify an environment variable to be unset from the parent's - // environment for the subprocesses to be started. - Command& UnsetFromEnvironment(std::string_view env_var) &; - Command UnsetFromEnvironment(std::string_view env_var) &&; - - // Adds a single parameter to the command. All arguments are concatenated into - // a single string to form a parameter. If one of those arguments is a - // SharedFD a duplicate of it will be used and won't be closed until the - // object is destroyed. To add multiple parameters to the command the function - // must be called multiple times, one per parameter. - template - Command& AddParameter(Args... args) & { - std::stringstream ss; - BuildParameter(&ss, args...); - command_.push_back(ss.str()); - return *this; - } - template - Command AddParameter(Args... args) && { - return std::move(AddParameter(std::forward(args)...)); - } - Command& AddParameter(std::string arg) &; - Command AddParameter(std::string arg) &&; - - // Similar to AddParameter, except the args are appended to the last (most - // recently-added) parameter in the command. - template - Command& AppendToLastParameter(Args... args) & { - CHECK(!command_.empty()) << "There is no parameter to append to."; - std::stringstream ss; - BuildParameter(&ss, args...); - command_[command_.size() - 1] += ss.str(); - return *this; - } - template - Command AppendToLastParameter(Args... args) && { - return std::move(AppendToLastParameter(std::forward(args)...)); - } - - // Redirects the standard IO of the command. - Command& RedirectStdIO(Subprocess::StdIOChannel channel, - SharedFD shared_fd) &; - Command RedirectStdIO(Subprocess::StdIOChannel channel, - SharedFD shared_fd) &&; - Command& RedirectStdIO(Subprocess::StdIOChannel subprocess_channel, - Subprocess::StdIOChannel parent_channel) &; - Command RedirectStdIO(Subprocess::StdIOChannel subprocess_channel, - Subprocess::StdIOChannel parent_channel) &&; - - Command& SetWorkingDirectory(const std::string& path) &; - Command SetWorkingDirectory(const std::string& path) &&; - Command& SetWorkingDirectory(SharedFD dirfd) &; - Command SetWorkingDirectory(SharedFD dirfd) &&; - - Command& AddPrerequisite(const std::function()>& prerequisite) &; - Command AddPrerequisite(const std::function()>& prerequisite) &&; - - // Starts execution of the command. This method can be called multiple times, - // effectively staring multiple (possibly concurrent) instances. - Subprocess Start(SubprocessOptions options = SubprocessOptions()) const; - - std::string GetShortName() const { - // This is safe because the constructor guarantees the name of the binary to - // be at index 0 on the vector - return command_[0]; - } - - std::string ToString() const; - - // Generates the contents for a bash script that can be used to run this - // command. Note that this command must not require any file descriptors - // or stdio redirects as those would not be available when the bash script - // is run. - std::string AsBashScript(const std::string& redirected_stdio_path = "") const; - - private: - friend std::ostream& operator<<(std::ostream& out, const Command& command); - std::optional executable_; // When unset, use command_[0] - std::vector command_; - std::vector()>> prerequisites_; - std::map inherited_fds_{}; - std::map redirects_{}; - std::vector env_{}; - SubprocessStopper subprocess_stopper_; - SharedFD working_directory_; -}; -std::ostream& operator<<(std::ostream& out, const Command& command); - -/** - * Returns the exit status on success, negative values on error - * - * If failed in fork() or exec(), returns -1. - * If the child exited from an unhandled signal, returns -1. - * Otherwise, returns the exit status. - * - * TODO: Changes return type to Result - * - * For now, too many callsites expects int, and needs quite a lot of changes - * if we change the return type. - */ -int Execute(std::vector commands); - -/** - * Similar as the two above but returns CF_ERR instead of -1, and siginfo_t - * instead of the exit status. - */ -Result Execute(std::vector commands, - SubprocessOptions subprocess_options, - int wait_options); - -} // namespace cuttlefish +#include "cuttlefish/process/command.h" // IWYU pragma: export +#include "cuttlefish/process/execute.h" // IWYU pragma: export +#include "cuttlefish/process/subprocess.h" // IWYU pragma: export +#include "cuttlefish/process/subprocess_options.h" // IWYU pragma: export diff --git a/base/cvd/cuttlefish/process/execute.cc b/base/cvd/cuttlefish/process/execute.cc new file mode 100644 index 00000000000..f2282209db2 --- /dev/null +++ b/base/cvd/cuttlefish/process/execute.cc @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "cuttlefish/process/execute.h" + +#include +#include // IWYU pragma: keep + +#include +#include +#include + +#include "cuttlefish/process/command.h" +#include "cuttlefish/process/subprocess.h" +#include "cuttlefish/result/expect.h" +#include "cuttlefish/result/result_type.h" + +namespace cuttlefish { + +int Execute(std::vector commands) { + // NOLINTNEXTLINE(misc-include-cleaner): provides siginfo_t + const Result result = + Execute(std::move(commands), SubprocessOptions(), WEXITED); + if (result.ok() && result->si_code == CLD_EXITED) { + return result->si_status; // NOLINT(misc-include-cleaner): + } else { + return -1; + } +} + +// NOLINTNEXTLINE(misc-include-cleaner): provides siginfo_t +Result Execute(std::vector command, + SubprocessOptions subprocess_options, + int wait_options) { + Command cmd(std::move(command[0])); + for (size_t i = 1; i < command.size(); ++i) { + cmd.AddParameter(std::move(command[i])); + } + Subprocess subprocess = cmd.Start(std::move(subprocess_options)); + CF_EXPECT(subprocess.Started(), "Subprocess failed to start."); + + siginfo_t info; + CF_EXPECT_EQ(subprocess.Wait(&info, wait_options), 0); + + return info; +} + +} // namespace cuttlefish diff --git a/base/cvd/cuttlefish/process/execute.h b/base/cvd/cuttlefish/process/execute.h new file mode 100644 index 00000000000..000e0d5046e --- /dev/null +++ b/base/cvd/cuttlefish/process/execute.h @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#pragma once + +#include + +#include +#include + +#include "cuttlefish/common/libs/fs/shared_fd.h" +#include "cuttlefish/process/subprocess_options.h" + +namespace cuttlefish { + +/** + * Returns the exit status on success, negative values on error + * + * If failed in fork() or exec(), returns -1. + * If the child exited from an unhandled signal, returns -1. + * Otherwise, returns the exit status. + * + * TODO: Changes return type to Result + * + * For now, too many callsites expects int, and needs quite a lot of changes + * if we change the return type. + */ +int Execute(std::vector commands); + +/** + * Similar as the two above but returns CF_ERR instead of -1, and siginfo_t + * instead of the exit status. + */ +Result Execute(std::vector commands, + SubprocessOptions subprocess_options, + int wait_options); + +} // namespace cuttlefish diff --git a/base/cvd/cuttlefish/process/subprocess.cc b/base/cvd/cuttlefish/process/subprocess.cc new file mode 100644 index 00000000000..45c93099339 --- /dev/null +++ b/base/cvd/cuttlefish/process/subprocess.cc @@ -0,0 +1,177 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "cuttlefish/process/subprocess.h" + +#include +#include +#include +#include +#include +#include + +#include + +#include "absl/log/log.h" + +#include "cuttlefish/result/expect.h" +#include "cuttlefish/result/result_type.h" + +extern char** environ; + +namespace cuttlefish { + +Subprocess::Subprocess(Subprocess&& subprocess) + : pid_(subprocess.pid_.load()), + started_(subprocess.started_), + stopper_(subprocess.stopper_) { + // Make sure the moved object no longer controls this subprocess + subprocess.pid_ = -1; + subprocess.started_ = false; +} + +Subprocess& Subprocess::operator=(Subprocess&& other) { + pid_ = other.pid_.load(); + started_ = other.started_; + stopper_ = other.stopper_; + + other.pid_ = -1; + other.started_ = false; + return *this; +} + +int Subprocess::Wait() { + if (pid_ < 0) { + LOG(ERROR) + << "Attempt to wait on invalid pid(has it been waited on already?): " + << pid_; + return -1; + } + int wstatus = 0; + auto pid = pid_.load(); // Wait will set pid_ to -1 after waiting + auto wait_ret = waitpid(pid, &wstatus, 0); + if (wait_ret < 0) { + auto error = errno; + LOG(ERROR) << "Error on call to waitpid: " << strerror(error); + return wait_ret; + } + int retval = 0; + if (WIFEXITED(wstatus)) { + pid_ = -1; + retval = WEXITSTATUS(wstatus); + if (retval) { + VLOG(0) << "Subprocess " << pid << " exited with error code: " << retval; + } + } else if (WIFSIGNALED(wstatus)) { + pid_ = -1; + int sig_num = WTERMSIG(wstatus); + LOG(ERROR) << "Subprocess " << pid << " was interrupted by a signal '" + << strsignal(sig_num) << "' (" << sig_num << ")"; + retval = -1; + } + return retval; +} +// NOLINTNEXTLINE(misc-include-cleaner): +int Subprocess::Wait(siginfo_t* infop, int options) { + if (pid_ < 0) { + LOG(ERROR) + << "Attempt to wait on invalid pid(has it been waited on already?): " + << pid_; + return -1; + } + *infop = {}; + // NOLINTNEXTLINE(misc-include-cleaner): + auto retval = TEMP_FAILURE_RETRY(waitid(P_PID, pid_, infop, options)); + // We don't want to wait twice for the same process + bool exited = infop->si_code == CLD_EXITED || infop->si_code == CLD_DUMPED; + bool reaped = !(options & WNOWAIT); + if (exited && reaped) { + pid_ = -1; + } + return retval; +} + +static Result SendSignalImpl(const int signal, const pid_t pid, + bool to_group, const bool started) { + if (pid == -1) { + return CF_ERR(strerror(ESRCH)); + } + CF_EXPECTF(started == true, + "The Subprocess object lost the ownership" + "of the process {}.", + pid); + int ret_code = 0; + if (to_group) { + ret_code = killpg(getpgid(pid), signal); + } else { + ret_code = kill(pid, signal); + } + CF_EXPECTF(ret_code == 0, "kill/killpg returns {} with errno: {}", ret_code, + strerror(errno)); + return {}; +} + +Result Subprocess::SendSignal(const int signal) { + CF_EXPECT(SendSignalImpl(signal, pid_, /* to_group */ false, started_)); + return {}; +} + +Result Subprocess::SendSignalToGroup(const int signal) { + CF_EXPECT(SendSignalImpl(signal, pid_, /* to_group */ true, started_)); + return {}; +} + +StopperResult KillSubprocess(Subprocess* subprocess) { + auto pid = subprocess->pid(); + if (pid > 0) { + auto pgid = getpgid(pid); + if (pgid < 0) { + auto error = errno; + LOG(WARNING) << "Error obtaining process group id of process with pid=" + << pid << ": " << strerror(error); + // Send the kill signal anyways, because pgid will be -1 it will be sent + // to the process and not a (non-existent) group + } + bool is_group_head = pid == pgid; + auto kill_ret = (is_group_head ? killpg : kill)(pid, SIGKILL); + if (kill_ret == 0) { + return StopperResult::kStopSuccess; + } + auto kill_cmd = is_group_head ? "killpg(" : "kill("; + PLOG(ERROR) << kill_cmd << pid << ", SIGKILL) failed: "; + return StopperResult::kStopFailure; + } + return StopperResult::kStopSuccess; +} + +SubprocessStopper KillSubprocessFallback(std::function nice) { + return KillSubprocessFallback([nice](Subprocess*) { return nice(); }); +} + +SubprocessStopper KillSubprocessFallback(SubprocessStopper nice_stopper) { + return [nice_stopper](Subprocess* process) { + auto nice_result = nice_stopper(process); + if (nice_result == StopperResult::kStopFailure) { + auto harsh_result = KillSubprocess(process); + return harsh_result == StopperResult::kStopSuccess + ? StopperResult::kStopCrash + : harsh_result; + } + return nice_result; + }; +} + +} // namespace cuttlefish diff --git a/base/cvd/cuttlefish/process/subprocess.h b/base/cvd/cuttlefish/process/subprocess.h new file mode 100644 index 00000000000..e279ff0ff97 --- /dev/null +++ b/base/cvd/cuttlefish/process/subprocess.h @@ -0,0 +1,86 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#pragma once + +#include +#include + +#include +#include + +#include "cuttlefish/result/result_type.h" + +namespace cuttlefish { + +enum class StopperResult { + kStopFailure, /* Failed to stop the subprocess. */ + kStopCrash, /* Attempted to stop the subprocess cleanly, but that failed. */ + kStopSuccess, /* The subprocess exited in the expected way. */ +}; + +class Subprocess; +using SubprocessStopper = std::function; +// Kills a process by sending it the SIGKILL signal. +StopperResult KillSubprocess(Subprocess* subprocess); +/* Creates a `SubprocessStopper` that first tries `nice_stopper` then falls back + * to `KillSubprocess` if that fails. */ +SubprocessStopper KillSubprocessFallback(std::function); +SubprocessStopper KillSubprocessFallback(SubprocessStopper nice_stopper); + +// Keeps track of a running (sub)process. Allows to wait for its completion. +// It's an error to wait twice for the same subprocess. +class Subprocess { + public: + enum class StdIOChannel { + kStdIn = 0, + kStdOut = 1, + kStdErr = 2, + }; + + Subprocess(pid_t pid, SubprocessStopper stopper = KillSubprocess) + : pid_(pid), started_(pid > 0), stopper_(stopper) {} + // The default implementation won't do because we need to reset the pid of the + // moved object. + Subprocess(Subprocess&&); + ~Subprocess() = default; + Subprocess& operator=(Subprocess&&); + // Waits for the subprocess to complete. Returns zero if completed + // successfully, non-zero otherwise. + int Wait(); + // Same as waitid(2) + int Wait(siginfo_t* infop, int options); + // Whether the command started successfully. It only says whether the call to + // fork() succeeded or not, it says nothing about exec or successful + // completion of the command, that's what Wait is for. + bool Started() const { return started_; } + pid_t pid() const { return pid_; } + StopperResult Stop() { return stopper_(this); } + + Result SendSignal(int signal); + Result SendSignalToGroup(int signal); + + private: + // Copy is disabled to avoid waiting twice for the same pid (the first wait + // frees the pid, which allows the kernel to reuse it so we may end up waiting + // for the wrong process) + Subprocess(const Subprocess&) = delete; + Subprocess& operator=(const Subprocess&) = delete; + std::atomic pid_ = -1; + bool started_ = false; + SubprocessStopper stopper_; +}; + +} // namespace cuttlefish diff --git a/base/cvd/cuttlefish/process/subprocess_options.cc b/base/cvd/cuttlefish/process/subprocess_options.cc new file mode 100644 index 00000000000..5533c932944 --- /dev/null +++ b/base/cvd/cuttlefish/process/subprocess_options.cc @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "cuttlefish/process/subprocess_options.h" + +#include +#include + +namespace cuttlefish { + +SubprocessOptions& SubprocessOptions::Verbose(bool verbose) & { + verbose_ = verbose; + return *this; +} +SubprocessOptions SubprocessOptions::Verbose(bool verbose) && { + verbose_ = verbose; + return std::move(*this); +} + +#ifdef __linux__ +SubprocessOptions& SubprocessOptions::ExitWithParent(bool exit_with_parent) & { + exit_with_parent_ = exit_with_parent; + return *this; +} +SubprocessOptions SubprocessOptions::ExitWithParent(bool exit_with_parent) && { + exit_with_parent_ = exit_with_parent; + return std::move(*this); +} +#endif + +SubprocessOptions& SubprocessOptions::InGroup(bool in_group) & { + in_group_ = in_group; + return *this; +} +SubprocessOptions SubprocessOptions::InGroup(bool in_group) && { + in_group_ = in_group; + return std::move(*this); +} + +SubprocessOptions& SubprocessOptions::Strace(std::string s) & { + strace_ = std::move(s); + return *this; +} +SubprocessOptions SubprocessOptions::Strace(std::string s) && { + strace_ = std::move(s); + return std::move(*this); +} + +} // namespace cuttlefish diff --git a/base/cvd/cuttlefish/process/subprocess_options.h b/base/cvd/cuttlefish/process/subprocess_options.h new file mode 100644 index 00000000000..9454bfe1b9c --- /dev/null +++ b/base/cvd/cuttlefish/process/subprocess_options.h @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#pragma once + +#include + +namespace cuttlefish { + +class SubprocessOptions { + public: + SubprocessOptions() + : verbose_(true), exit_with_parent_(true), in_group_(false) {} + SubprocessOptions& Verbose(bool verbose) &; + SubprocessOptions Verbose(bool verbose) &&; +#ifdef __linux__ + SubprocessOptions& ExitWithParent(bool exit_with_parent) &; + SubprocessOptions ExitWithParent(bool exit_with_parent) &&; +#endif + // The subprocess runs as head of its own process group. + SubprocessOptions& InGroup(bool in_group) &; + SubprocessOptions InGroup(bool in_group) &&; + + SubprocessOptions& Strace(std::string strace_output_path) &; + SubprocessOptions Strace(std::string strace_output_path) &&; + + bool Verbose() const { return verbose_; } + bool ExitWithParent() const { return exit_with_parent_; } + bool InGroup() const { return in_group_; } + const std::string& Strace() const { return strace_; } + + private: + bool verbose_; + bool exit_with_parent_; + bool in_group_; + std::string strace_; +}; + +} // namespace cuttlefish From 12f44cefe656666aa70950c903522b93202ba3ca Mon Sep 17 00:00:00 2001 From: "A. Cody Schuffelen" Date: Mon, 13 Jul 2026 14:45:43 -0700 Subject: [PATCH 3/9] Remove execute.h re-export from command_subprocess.h Bug: b/533572315 --- base/cvd/allocd/BUILD.bazel | 6 +++--- base/cvd/allocd/alloc_iproute2.cpp | 2 +- base/cvd/allocd/alloc_netlink.cpp | 2 +- base/cvd/allocd/alloc_utils.cpp | 2 +- base/cvd/cuttlefish/host/commands/assemble_cvd/BUILD.bazel | 4 +++- .../host/commands/assemble_cvd/boot_image_utils.cc | 1 + .../host/commands/assemble_cvd/super_image_mixer.cc | 2 +- .../host/commands/assemble_cvd/vendor_dlkm_utils.cc | 1 + .../cuttlefish/host/commands/cvd/cli/commands/BUILD.bazel | 2 +- base/cvd/cuttlefish/host/commands/cvd/cli/commands/setup.cc | 2 +- .../cuttlefish/host/commands/process_restarter/BUILD.bazel | 3 ++- base/cvd/cuttlefish/host/commands/process_restarter/main.cc | 3 ++- base/cvd/cuttlefish/host/commands/run_cvd/BUILD.bazel | 1 + .../host/commands/run_cvd/server_loop_impl_snapshot.cpp | 1 + base/cvd/cuttlefish/host/libs/config/BUILD.bazel | 5 +++-- base/cvd/cuttlefish/host/libs/config/config_utils.cpp | 2 +- base/cvd/cuttlefish/host/libs/config/data_image.cpp | 1 + base/cvd/cuttlefish/host/libs/config/esp.cpp | 2 +- base/cvd/cuttlefish/host/libs/config/esp/BUILD.bazel | 4 ++-- base/cvd/cuttlefish/host/libs/config/esp/esp_builder.cc | 2 +- base/cvd/cuttlefish/host/libs/config/esp/make_fat_image.cc | 2 +- base/cvd/cuttlefish/host/libs/image_aggregator/BUILD.bazel | 2 +- .../cuttlefish/host/libs/image_aggregator/sparse_image.cc | 2 +- base/cvd/cuttlefish/host/libs/vm_manager/BUILD.bazel | 1 + base/cvd/cuttlefish/host/libs/vm_manager/crosvm_manager.cpp | 1 + base/cvd/cuttlefish/host/libs/web/BUILD.bazel | 2 +- base/cvd/cuttlefish/host/libs/web/oauth2_consent.cpp | 2 +- base/cvd/cuttlefish/process/BUILD.bazel | 1 - base/cvd/cuttlefish/process/command_subprocess.h | 1 - base/cvd/cuttlefish/process/execute.cc | 4 ++-- base/cvd/cuttlefish/process/execute.h | 6 +++--- 31 files changed, 41 insertions(+), 31 deletions(-) diff --git a/base/cvd/allocd/BUILD.bazel b/base/cvd/allocd/BUILD.bazel index faeb995749c..a2812d472d3 100644 --- a/base/cvd/allocd/BUILD.bazel +++ b/base/cvd/allocd/BUILD.bazel @@ -40,7 +40,7 @@ cf_cc_library( "//cuttlefish/common/libs/utils:network", "//cuttlefish/host/commands/cvd/utils:common", "//cuttlefish/host/libs/config:logging", - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:execute", "//cuttlefish/result", "@abseil-cpp//absl/base:no_destructor", "@abseil-cpp//absl/log", @@ -55,7 +55,7 @@ cf_cc_library( hdrs = ["alloc_driver.h"], depend_on_what_you_use_enabled = False, deps = [ - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:execute", "//cuttlefish/result", "@abseil-cpp//absl/log", "@abseil-cpp//absl/strings", @@ -71,7 +71,7 @@ cf_cc_library( deps = [ "//allocd/net:netlink", "//cuttlefish/common/libs/fs", - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:execute", "//cuttlefish/result", "//libbase", "@abseil-cpp//absl/log", diff --git a/base/cvd/allocd/alloc_iproute2.cpp b/base/cvd/allocd/alloc_iproute2.cpp index ee9cbe95435..8df0408c605 100644 --- a/base/cvd/allocd/alloc_iproute2.cpp +++ b/base/cvd/allocd/alloc_iproute2.cpp @@ -19,7 +19,7 @@ #include "absl/strings/str_cat.h" #include "allocd/alloc_driver.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/execute.h" #include "cuttlefish/result/result.h" namespace cuttlefish { diff --git a/base/cvd/allocd/alloc_netlink.cpp b/base/cvd/allocd/alloc_netlink.cpp index f29d5c63c3a..454cb037fcd 100644 --- a/base/cvd/allocd/alloc_netlink.cpp +++ b/base/cvd/allocd/alloc_netlink.cpp @@ -43,7 +43,7 @@ #include "allocd/net/netlink_client.h" #include "allocd/net/netlink_request.h" #include "cuttlefish/common/libs/fs/shared_fd.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/execute.h" #include "cuttlefish/result/result.h" namespace cuttlefish { diff --git a/base/cvd/allocd/alloc_utils.cpp b/base/cvd/allocd/alloc_utils.cpp index 037b236f2e1..d0a6ca4a9fa 100644 --- a/base/cvd/allocd/alloc_utils.cpp +++ b/base/cvd/allocd/alloc_utils.cpp @@ -37,7 +37,7 @@ #include "cuttlefish/common/libs/utils/files.h" #include "cuttlefish/common/libs/utils/network.h" #include "cuttlefish/host/commands/cvd/utils/common.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/execute.h" #include "cuttlefish/result/result.h" #ifdef __linux__ diff --git a/base/cvd/cuttlefish/host/commands/assemble_cvd/BUILD.bazel b/base/cvd/cuttlefish/host/commands/assemble_cvd/BUILD.bazel index 17b95c9c3ac..53e65127b34 100644 --- a/base/cvd/cuttlefish/host/commands/assemble_cvd/BUILD.bazel +++ b/base/cvd/cuttlefish/host/commands/assemble_cvd/BUILD.bazel @@ -139,6 +139,7 @@ cf_cc_library( "//cuttlefish/io:string", "//cuttlefish/io:write_exact", "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:execute", "//cuttlefish/result", "//libbase", "@abseil-cpp//absl/log", @@ -599,7 +600,7 @@ cf_cc_library( "//cuttlefish/host/libs/config:fetcher_config", "//cuttlefish/host/libs/config:file_source", "//cuttlefish/host/libs/config:known_paths", - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:execute", "//cuttlefish/result", "//libbase", "@abseil-cpp//absl/log", @@ -641,6 +642,7 @@ cf_cc_library( "//cuttlefish/host/libs/config:known_paths", "//cuttlefish/io:shared_fd", "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:execute", "//cuttlefish/result", "//libbase", "@abseil-cpp//absl/log", diff --git a/base/cvd/cuttlefish/host/commands/assemble_cvd/boot_image_utils.cc b/base/cvd/cuttlefish/host/commands/assemble_cvd/boot_image_utils.cc index b8c50971c8b..b72157a6582 100644 --- a/base/cvd/cuttlefish/host/commands/assemble_cvd/boot_image_utils.cc +++ b/base/cvd/cuttlefish/host/commands/assemble_cvd/boot_image_utils.cc @@ -50,6 +50,7 @@ #include "cuttlefish/io/string.h" #include "cuttlefish/io/write_exact.h" #include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/execute.h" #include "cuttlefish/result/result.h" namespace cuttlefish { diff --git a/base/cvd/cuttlefish/host/commands/assemble_cvd/super_image_mixer.cc b/base/cvd/cuttlefish/host/commands/assemble_cvd/super_image_mixer.cc index 3d2d8bb5bab..dd6f65fa9c5 100644 --- a/base/cvd/cuttlefish/host/commands/assemble_cvd/super_image_mixer.cc +++ b/base/cvd/cuttlefish/host/commands/assemble_cvd/super_image_mixer.cc @@ -39,7 +39,7 @@ #include "cuttlefish/host/libs/config/fetcher_config.h" #include "cuttlefish/host/libs/config/file_source.h" #include "cuttlefish/host/libs/config/known_paths.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/execute.h" #include "cuttlefish/result/result.h" namespace cuttlefish { diff --git a/base/cvd/cuttlefish/host/commands/assemble_cvd/vendor_dlkm_utils.cc b/base/cvd/cuttlefish/host/commands/assemble_cvd/vendor_dlkm_utils.cc index a6fc8202231..cad6ea92681 100644 --- a/base/cvd/cuttlefish/host/commands/assemble_cvd/vendor_dlkm_utils.cc +++ b/base/cvd/cuttlefish/host/commands/assemble_cvd/vendor_dlkm_utils.cc @@ -45,6 +45,7 @@ #include "cuttlefish/host/libs/config/known_paths.h" #include "cuttlefish/io/shared_fd.h" #include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/execute.h" #include "cuttlefish/result/result.h" namespace cuttlefish { diff --git a/base/cvd/cuttlefish/host/commands/cvd/cli/commands/BUILD.bazel b/base/cvd/cuttlefish/host/commands/cvd/cli/commands/BUILD.bazel index e43be088919..a32f305d518 100644 --- a/base/cvd/cuttlefish/host/commands/cvd/cli/commands/BUILD.bazel +++ b/base/cvd/cuttlefish/host/commands/cvd/cli/commands/BUILD.bazel @@ -511,7 +511,7 @@ cf_cc_library( "//cuttlefish/host/commands/cvd/cli:help_format", "//cuttlefish/host/commands/cvd/cli/commands:command_handler", "//cuttlefish/host/libs/vm_manager", - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:execute", "//cuttlefish/result", "@abseil-cpp//absl/strings", ], diff --git a/base/cvd/cuttlefish/host/commands/cvd/cli/commands/setup.cc b/base/cvd/cuttlefish/host/commands/cvd/cli/commands/setup.cc index 1dac5e4f8b4..943cceb77c1 100644 --- a/base/cvd/cuttlefish/host/commands/cvd/cli/commands/setup.cc +++ b/base/cvd/cuttlefish/host/commands/cvd/cli/commands/setup.cc @@ -25,7 +25,7 @@ #include "cuttlefish/host/commands/cvd/cli/command_request.h" #include "cuttlefish/host/commands/cvd/cli/help_format.h" #include "cuttlefish/host/libs/vm_manager/host_configuration.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/execute.h" #include "cuttlefish/result/result.h" namespace cuttlefish { diff --git a/base/cvd/cuttlefish/host/commands/process_restarter/BUILD.bazel b/base/cvd/cuttlefish/host/commands/process_restarter/BUILD.bazel index 802b6a31cdf..8cc2fa84f44 100644 --- a/base/cvd/cuttlefish/host/commands/process_restarter/BUILD.bazel +++ b/base/cvd/cuttlefish/host/commands/process_restarter/BUILD.bazel @@ -17,7 +17,8 @@ cf_cc_binary( "//cuttlefish/flag_parser", "//cuttlefish/host/libs/config:cuttlefish_config", "//cuttlefish/host/libs/config:logging", - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:execute", + "//cuttlefish/process:subprocess_options", "//cuttlefish/result", "//libbase", "@abseil-cpp//absl/log", diff --git a/base/cvd/cuttlefish/host/commands/process_restarter/main.cc b/base/cvd/cuttlefish/host/commands/process_restarter/main.cc index f95416a7eff..838d314324a 100644 --- a/base/cvd/cuttlefish/host/commands/process_restarter/main.cc +++ b/base/cvd/cuttlefish/host/commands/process_restarter/main.cc @@ -29,7 +29,8 @@ #include "cuttlefish/host/commands/process_restarter/parser.h" #include "cuttlefish/host/libs/config/cuttlefish_config.h" #include "cuttlefish/host/libs/config/logging.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/execute.h" +#include "cuttlefish/process/subprocess_options.h" #include "cuttlefish/result/result.h" namespace cuttlefish { diff --git a/base/cvd/cuttlefish/host/commands/run_cvd/BUILD.bazel b/base/cvd/cuttlefish/host/commands/run_cvd/BUILD.bazel index 2d69ead74ec..08209683c9f 100644 --- a/base/cvd/cuttlefish/host/commands/run_cvd/BUILD.bazel +++ b/base/cvd/cuttlefish/host/commands/run_cvd/BUILD.bazel @@ -156,6 +156,7 @@ cf_cc_library( "//cuttlefish/host/libs/vm_manager", "//cuttlefish/posix:strerror", "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:execute", "//cuttlefish/result", "//libbase", "@abseil-cpp//absl/log", diff --git a/base/cvd/cuttlefish/host/commands/run_cvd/server_loop_impl_snapshot.cpp b/base/cvd/cuttlefish/host/commands/run_cvd/server_loop_impl_snapshot.cpp index 5d66a329888..afbc33e838b 100644 --- a/base/cvd/cuttlefish/host/commands/run_cvd/server_loop_impl_snapshot.cpp +++ b/base/cvd/cuttlefish/host/commands/run_cvd/server_loop_impl_snapshot.cpp @@ -42,6 +42,7 @@ #include "cuttlefish/host/libs/config/vmm_mode.h" #include "cuttlefish/host/libs/process_monitor/process_monitor.h" #include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/execute.h" #include "cuttlefish/result/result.h" #ifndef WEXITED diff --git a/base/cvd/cuttlefish/host/libs/config/BUILD.bazel b/base/cvd/cuttlefish/host/libs/config/BUILD.bazel index d23dfa782de..601c249c2db 100644 --- a/base/cvd/cuttlefish/host/libs/config/BUILD.bazel +++ b/base/cvd/cuttlefish/host/libs/config/BUILD.bazel @@ -76,7 +76,7 @@ cf_cc_library( "//cuttlefish/common/libs/utils:in_sandbox", "//cuttlefish/common/libs/utils:random", "//cuttlefish/host/libs/config:config_constants", - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:execute", "//libbase", "@abseil-cpp//absl/log", "@abseil-cpp//absl/strings", @@ -165,6 +165,7 @@ cf_cc_library( "//cuttlefish/host/libs/config/esp:make_fat_image", "//cuttlefish/host/libs/image_aggregator:mbr", "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:execute", "//cuttlefish/process:managed_stdio", "//cuttlefish/result", "//libbase", @@ -208,7 +209,7 @@ cf_cc_library( "//cuttlefish/common/libs/utils:files", "//cuttlefish/common/libs/utils:host_info", "//cuttlefish/host/libs/config/esp:esp_builder", - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:execute", "//libbase", "@abseil-cpp//absl/log", "@abseil-cpp//absl/strings", diff --git a/base/cvd/cuttlefish/host/libs/config/config_utils.cpp b/base/cvd/cuttlefish/host/libs/config/config_utils.cpp index e9f0a283fb5..b3031da32ad 100644 --- a/base/cvd/cuttlefish/host/libs/config/config_utils.cpp +++ b/base/cvd/cuttlefish/host/libs/config/config_utils.cpp @@ -31,7 +31,7 @@ #include "cuttlefish/common/libs/utils/in_sandbox.h" #include "cuttlefish/common/libs/utils/random.h" #include "cuttlefish/host/libs/config/config_constants.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/execute.h" namespace cuttlefish { diff --git a/base/cvd/cuttlefish/host/libs/config/data_image.cpp b/base/cvd/cuttlefish/host/libs/config/data_image.cpp index 1916f4939dd..38ad1d26516 100644 --- a/base/cvd/cuttlefish/host/libs/config/data_image.cpp +++ b/base/cvd/cuttlefish/host/libs/config/data_image.cpp @@ -40,6 +40,7 @@ #include "cuttlefish/host/libs/config/openwrt_args.h" #include "cuttlefish/host/libs/image_aggregator/mbr.h" #include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/execute.h" #include "cuttlefish/process/managed_stdio.h" #include "cuttlefish/result/result.h" diff --git a/base/cvd/cuttlefish/host/libs/config/esp.cpp b/base/cvd/cuttlefish/host/libs/config/esp.cpp index 8e207c542f0..d9cf91babfc 100644 --- a/base/cvd/cuttlefish/host/libs/config/esp.cpp +++ b/base/cvd/cuttlefish/host/libs/config/esp.cpp @@ -33,7 +33,7 @@ #include "cuttlefish/common/libs/utils/files.h" #include "cuttlefish/common/libs/utils/host_info.h" #include "cuttlefish/host/libs/config/esp/esp_builder.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/execute.h" namespace cuttlefish { diff --git a/base/cvd/cuttlefish/host/libs/config/esp/BUILD.bazel b/base/cvd/cuttlefish/host/libs/config/esp/BUILD.bazel index 053030ae04a..875a7eba43b 100644 --- a/base/cvd/cuttlefish/host/libs/config/esp/BUILD.bazel +++ b/base/cvd/cuttlefish/host/libs/config/esp/BUILD.bazel @@ -14,7 +14,7 @@ cf_cc_library( "//cuttlefish/common/libs/fs", "//cuttlefish/common/libs/utils:files", "//cuttlefish/host/libs/config:known_paths", - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:execute", "//cuttlefish/result:expect", "//cuttlefish/result:result_type", ], @@ -28,7 +28,7 @@ cf_cc_library( "//cuttlefish/common/libs/utils:files", "//cuttlefish/host/libs/config:known_paths", "//cuttlefish/host/libs/config/esp:make_fat_image", - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:execute", "@abseil-cpp//absl/log", ], ) diff --git a/base/cvd/cuttlefish/host/libs/config/esp/esp_builder.cc b/base/cvd/cuttlefish/host/libs/config/esp/esp_builder.cc index fd4aa2174cd..a3f5c2225eb 100644 --- a/base/cvd/cuttlefish/host/libs/config/esp/esp_builder.cc +++ b/base/cvd/cuttlefish/host/libs/config/esp/esp_builder.cc @@ -26,7 +26,7 @@ #include "cuttlefish/common/libs/utils/files.h" #include "cuttlefish/host/libs/config/esp/make_fat_image.h" #include "cuttlefish/host/libs/config/known_paths.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/execute.h" namespace cuttlefish { diff --git a/base/cvd/cuttlefish/host/libs/config/esp/make_fat_image.cc b/base/cvd/cuttlefish/host/libs/config/esp/make_fat_image.cc index 18f892a1de3..bd6ed407d12 100644 --- a/base/cvd/cuttlefish/host/libs/config/esp/make_fat_image.cc +++ b/base/cvd/cuttlefish/host/libs/config/esp/make_fat_image.cc @@ -24,7 +24,7 @@ #include "cuttlefish/common/libs/fs/shared_fd.h" #include "cuttlefish/common/libs/utils/files.h" #include "cuttlefish/host/libs/config/known_paths.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/execute.h" #include "cuttlefish/result/expect.h" #include "cuttlefish/result/result_type.h" diff --git a/base/cvd/cuttlefish/host/libs/image_aggregator/BUILD.bazel b/base/cvd/cuttlefish/host/libs/image_aggregator/BUILD.bazel index 6d500a0489e..d10c59d5b34 100644 --- a/base/cvd/cuttlefish/host/libs/image_aggregator/BUILD.bazel +++ b/base/cvd/cuttlefish/host/libs/image_aggregator/BUILD.bazel @@ -134,7 +134,7 @@ cf_cc_library( "//cuttlefish/host/libs/config:known_paths", "//cuttlefish/host/libs/image_aggregator:disk_image", "//cuttlefish/posix:rename", - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:execute", "//cuttlefish/result", "//libbase", "@android_system_core//:libsparse", diff --git a/base/cvd/cuttlefish/host/libs/image_aggregator/sparse_image.cc b/base/cvd/cuttlefish/host/libs/image_aggregator/sparse_image.cc index 91b7bc90817..988679caf45 100644 --- a/base/cvd/cuttlefish/host/libs/image_aggregator/sparse_image.cc +++ b/base/cvd/cuttlefish/host/libs/image_aggregator/sparse_image.cc @@ -30,7 +30,7 @@ #include "cuttlefish/common/libs/utils/files.h" #include "cuttlefish/host/libs/config/known_paths.h" #include "cuttlefish/posix/rename.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/execute.h" #include "cuttlefish/result/result.h" namespace cuttlefish { diff --git a/base/cvd/cuttlefish/host/libs/vm_manager/BUILD.bazel b/base/cvd/cuttlefish/host/libs/vm_manager/BUILD.bazel index 1e90261fe9e..d724b8a94a9 100644 --- a/base/cvd/cuttlefish/host/libs/vm_manager/BUILD.bazel +++ b/base/cvd/cuttlefish/host/libs/vm_manager/BUILD.bazel @@ -56,6 +56,7 @@ cf_cc_library( "//cuttlefish/host/libs/feature:inject", "//cuttlefish/posix:strerror", "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:execute", "//cuttlefish/process:managed_stdio", "//cuttlefish/result", "//libbase", diff --git a/base/cvd/cuttlefish/host/libs/vm_manager/crosvm_manager.cpp b/base/cvd/cuttlefish/host/libs/vm_manager/crosvm_manager.cpp index a963181e9c4..f16029087cd 100644 --- a/base/cvd/cuttlefish/host/libs/vm_manager/crosvm_manager.cpp +++ b/base/cvd/cuttlefish/host/libs/vm_manager/crosvm_manager.cpp @@ -53,6 +53,7 @@ #include "cuttlefish/host/libs/vm_manager/vhost_user.h" #include "cuttlefish/posix/strerror.h" #include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/execute.h" #include "cuttlefish/result/result.h" namespace cuttlefish { diff --git a/base/cvd/cuttlefish/host/libs/web/BUILD.bazel b/base/cvd/cuttlefish/host/libs/web/BUILD.bazel index 65a73e7b68f..0b455b6c824 100644 --- a/base/cvd/cuttlefish/host/libs/web/BUILD.bazel +++ b/base/cvd/cuttlefish/host/libs/web/BUILD.bazel @@ -244,7 +244,7 @@ cf_cc_library( "//cuttlefish/host/libs/web/http_client", "//cuttlefish/host/libs/web/http_client:http_json", "//cuttlefish/host/libs/web/http_client:url_escape", - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:execute", "//cuttlefish/result", "@abseil-cpp//absl/strings", "@fmt", diff --git a/base/cvd/cuttlefish/host/libs/web/oauth2_consent.cpp b/base/cvd/cuttlefish/host/libs/web/oauth2_consent.cpp index d4685858303..e23d8849a8c 100644 --- a/base/cvd/cuttlefish/host/libs/web/oauth2_consent.cpp +++ b/base/cvd/cuttlefish/host/libs/web/oauth2_consent.cpp @@ -46,7 +46,7 @@ #include "cuttlefish/host/libs/web/http_client/http_client.h" #include "cuttlefish/host/libs/web/http_client/http_json.h" #include "cuttlefish/host/libs/web/http_client/url_escape.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/execute.h" #include "cuttlefish/result/result.h" namespace cuttlefish { diff --git a/base/cvd/cuttlefish/process/BUILD.bazel b/base/cvd/cuttlefish/process/BUILD.bazel index 89d3df849b1..336e9623352 100644 --- a/base/cvd/cuttlefish/process/BUILD.bazel +++ b/base/cvd/cuttlefish/process/BUILD.bazel @@ -30,7 +30,6 @@ cf_cc_library( hdrs = ["command_subprocess.h"], deps = [ "//cuttlefish/process:command", - "//cuttlefish/process:execute", "//cuttlefish/process:subprocess", "//cuttlefish/process:subprocess_options", ], diff --git a/base/cvd/cuttlefish/process/command_subprocess.h b/base/cvd/cuttlefish/process/command_subprocess.h index d81f8c5b0d5..8838be89078 100644 --- a/base/cvd/cuttlefish/process/command_subprocess.h +++ b/base/cvd/cuttlefish/process/command_subprocess.h @@ -16,6 +16,5 @@ #pragma once #include "cuttlefish/process/command.h" // IWYU pragma: export -#include "cuttlefish/process/execute.h" // IWYU pragma: export #include "cuttlefish/process/subprocess.h" // IWYU pragma: export #include "cuttlefish/process/subprocess_options.h" // IWYU pragma: export diff --git a/base/cvd/cuttlefish/process/execute.cc b/base/cvd/cuttlefish/process/execute.cc index f2282209db2..6a25323e646 100644 --- a/base/cvd/cuttlefish/process/execute.cc +++ b/base/cvd/cuttlefish/process/execute.cc @@ -30,10 +30,10 @@ namespace cuttlefish { -int Execute(std::vector commands) { +int Execute(std::vector command) { // NOLINTNEXTLINE(misc-include-cleaner): provides siginfo_t const Result result = - Execute(std::move(commands), SubprocessOptions(), WEXITED); + Execute(std::move(command), SubprocessOptions(), WEXITED); if (result.ok() && result->si_code == CLD_EXITED) { return result->si_status; // NOLINT(misc-include-cleaner): } else { diff --git a/base/cvd/cuttlefish/process/execute.h b/base/cvd/cuttlefish/process/execute.h index 000e0d5046e..c2d18e77c07 100644 --- a/base/cvd/cuttlefish/process/execute.h +++ b/base/cvd/cuttlefish/process/execute.h @@ -37,13 +37,13 @@ namespace cuttlefish { * For now, too many callsites expects int, and needs quite a lot of changes * if we change the return type. */ -int Execute(std::vector commands); +int Execute(std::vector command); /** - * Similar as the two above but returns CF_ERR instead of -1, and siginfo_t + * Similar as the one above but returns CF_ERR instead of -1, and siginfo_t * instead of the exit status. */ -Result Execute(std::vector commands, +Result Execute(std::vector command, SubprocessOptions subprocess_options, int wait_options); From 629a1dc3e3a1f555e104ed4b7ce0125215e111a5 Mon Sep 17 00:00:00 2001 From: "A. Cody Schuffelen" Date: Mon, 13 Jul 2026 15:25:15 -0700 Subject: [PATCH 4/9] Remove subprocess_options.h re-export from command_subprocess.h Bug: b/533572315 --- base/cvd/cuttlefish/host/commands/run_cvd/BUILD.bazel | 1 + .../host/commands/run_cvd/server_loop_impl_snapshot.cpp | 1 + base/cvd/cuttlefish/host/commands/start/BUILD.bazel | 1 + base/cvd/cuttlefish/host/commands/start/flag_forwarder.cc | 1 + base/cvd/cuttlefish/host/libs/vm_manager/BUILD.bazel | 1 + base/cvd/cuttlefish/host/libs/vm_manager/crosvm_manager.cpp | 1 + base/cvd/cuttlefish/process/BUILD.bazel | 5 +++-- base/cvd/cuttlefish/process/command_subprocess.h | 5 ++--- base/cvd/cuttlefish/process/managed_stdio.cc | 4 +++- base/cvd/cuttlefish/process/managed_stdio.h | 3 ++- 10 files changed, 16 insertions(+), 7 deletions(-) diff --git a/base/cvd/cuttlefish/host/commands/run_cvd/BUILD.bazel b/base/cvd/cuttlefish/host/commands/run_cvd/BUILD.bazel index 08209683c9f..75fde6efa76 100644 --- a/base/cvd/cuttlefish/host/commands/run_cvd/BUILD.bazel +++ b/base/cvd/cuttlefish/host/commands/run_cvd/BUILD.bazel @@ -157,6 +157,7 @@ cf_cc_library( "//cuttlefish/posix:strerror", "//cuttlefish/process:command_subprocess", "//cuttlefish/process:execute", + "//cuttlefish/process:subprocess_options", "//cuttlefish/result", "//libbase", "@abseil-cpp//absl/log", diff --git a/base/cvd/cuttlefish/host/commands/run_cvd/server_loop_impl_snapshot.cpp b/base/cvd/cuttlefish/host/commands/run_cvd/server_loop_impl_snapshot.cpp index afbc33e838b..469de0dbc13 100644 --- a/base/cvd/cuttlefish/host/commands/run_cvd/server_loop_impl_snapshot.cpp +++ b/base/cvd/cuttlefish/host/commands/run_cvd/server_loop_impl_snapshot.cpp @@ -43,6 +43,7 @@ #include "cuttlefish/host/libs/process_monitor/process_monitor.h" #include "cuttlefish/process/command_subprocess.h" #include "cuttlefish/process/execute.h" +#include "cuttlefish/process/subprocess_options.h" #include "cuttlefish/result/result.h" #ifndef WEXITED diff --git a/base/cvd/cuttlefish/host/commands/start/BUILD.bazel b/base/cvd/cuttlefish/host/commands/start/BUILD.bazel index eeb90cf1655..8a538ff7135 100644 --- a/base/cvd/cuttlefish/host/commands/start/BUILD.bazel +++ b/base/cvd/cuttlefish/host/commands/start/BUILD.bazel @@ -39,6 +39,7 @@ cf_cc_binary( "//cuttlefish/posix:symlink", "//cuttlefish/process:command_subprocess", "//cuttlefish/process:managed_stdio", + "//cuttlefish/process:subprocess_options", "//libbase", "@abseil-cpp//absl/base:no_destructor", "@abseil-cpp//absl/log", diff --git a/base/cvd/cuttlefish/host/commands/start/flag_forwarder.cc b/base/cvd/cuttlefish/host/commands/start/flag_forwarder.cc index 688916223f1..906b934794c 100644 --- a/base/cvd/cuttlefish/host/commands/start/flag_forwarder.cc +++ b/base/cvd/cuttlefish/host/commands/start/flag_forwarder.cc @@ -34,6 +34,7 @@ #include "cuttlefish/common/libs/utils/gflags_xml_parser.h" #include "cuttlefish/process/command_subprocess.h" #include "cuttlefish/process/managed_stdio.h" +#include "cuttlefish/process/subprocess_options.h" namespace cuttlefish { diff --git a/base/cvd/cuttlefish/host/libs/vm_manager/BUILD.bazel b/base/cvd/cuttlefish/host/libs/vm_manager/BUILD.bazel index d724b8a94a9..e86bdfbea67 100644 --- a/base/cvd/cuttlefish/host/libs/vm_manager/BUILD.bazel +++ b/base/cvd/cuttlefish/host/libs/vm_manager/BUILD.bazel @@ -58,6 +58,7 @@ cf_cc_library( "//cuttlefish/process:command_subprocess", "//cuttlefish/process:execute", "//cuttlefish/process:managed_stdio", + "//cuttlefish/process:subprocess_options", "//cuttlefish/result", "//libbase", "@abseil-cpp//absl/log", diff --git a/base/cvd/cuttlefish/host/libs/vm_manager/crosvm_manager.cpp b/base/cvd/cuttlefish/host/libs/vm_manager/crosvm_manager.cpp index f16029087cd..739ee178b91 100644 --- a/base/cvd/cuttlefish/host/libs/vm_manager/crosvm_manager.cpp +++ b/base/cvd/cuttlefish/host/libs/vm_manager/crosvm_manager.cpp @@ -54,6 +54,7 @@ #include "cuttlefish/posix/strerror.h" #include "cuttlefish/process/command_subprocess.h" #include "cuttlefish/process/execute.h" +#include "cuttlefish/process/subprocess_options.h" #include "cuttlefish/result/result.h" namespace cuttlefish { diff --git a/base/cvd/cuttlefish/process/BUILD.bazel b/base/cvd/cuttlefish/process/BUILD.bazel index 336e9623352..9b14421185f 100644 --- a/base/cvd/cuttlefish/process/BUILD.bazel +++ b/base/cvd/cuttlefish/process/BUILD.bazel @@ -31,7 +31,6 @@ cf_cc_library( deps = [ "//cuttlefish/process:command", "//cuttlefish/process:subprocess", - "//cuttlefish/process:subprocess_options", ], ) @@ -66,7 +65,9 @@ cf_cc_library( depend_on_what_you_use_enabled = False, deps = [ "//cuttlefish/common/libs/fs", - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:command", + "//cuttlefish/process:subprocess", + "//cuttlefish/process:subprocess_options", "//cuttlefish/result", "//libbase", "@abseil-cpp//absl/log", diff --git a/base/cvd/cuttlefish/process/command_subprocess.h b/base/cvd/cuttlefish/process/command_subprocess.h index 8838be89078..f684cdd48b7 100644 --- a/base/cvd/cuttlefish/process/command_subprocess.h +++ b/base/cvd/cuttlefish/process/command_subprocess.h @@ -15,6 +15,5 @@ */ #pragma once -#include "cuttlefish/process/command.h" // IWYU pragma: export -#include "cuttlefish/process/subprocess.h" // IWYU pragma: export -#include "cuttlefish/process/subprocess_options.h" // IWYU pragma: export +#include "cuttlefish/process/command.h" // IWYU pragma: export +#include "cuttlefish/process/subprocess.h" // IWYU pragma: export diff --git a/base/cvd/cuttlefish/process/managed_stdio.cc b/base/cvd/cuttlefish/process/managed_stdio.cc index 41d399d69d3..939ffb0d24a 100644 --- a/base/cvd/cuttlefish/process/managed_stdio.cc +++ b/base/cvd/cuttlefish/process/managed_stdio.cc @@ -27,7 +27,9 @@ #include "cuttlefish/common/libs/fs/shared_buf.h" #include "cuttlefish/common/libs/fs/shared_fd.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/command.h" +#include "cuttlefish/process/subprocess.h" +#include "cuttlefish/process/subprocess_options.h" #include "cuttlefish/result/result.h" namespace cuttlefish { diff --git a/base/cvd/cuttlefish/process/managed_stdio.h b/base/cvd/cuttlefish/process/managed_stdio.h index bb29f43e080..4bcc644afd2 100644 --- a/base/cvd/cuttlefish/process/managed_stdio.h +++ b/base/cvd/cuttlefish/process/managed_stdio.h @@ -17,7 +17,8 @@ #include -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/command.h" +#include "cuttlefish/process/subprocess_options.h" #include "cuttlefish/result/result.h" namespace cuttlefish { From 01511f5fe999ae64a1de49ebefd0c881a643fd1f Mon Sep 17 00:00:00 2001 From: "A. Cody Schuffelen" Date: Mon, 13 Jul 2026 15:50:10 -0700 Subject: [PATCH 5/9] Move Subprocess::StdIOChannel to Command::StdIoChannel This did not have interactions with anything else in Subprocess. Bug: b/533572315 --- .../commands/assemble_cvd/boot_image_utils.cc | 4 ++-- .../host/commands/cvd/cli/commands/start.cpp | 16 ++++++-------- .../launch/input_connections_provider.cc | 19 ++++++++-------- .../run_cvd/launch/log_tee_creator.cpp | 12 +++++----- .../commands/run_cvd/launch/log_tee_creator.h | 2 +- .../launch/vhost_user_media_devices.cpp | 4 ++-- .../cuttlefish/host/commands/start/main.cc | 2 +- .../host/libs/vm_manager/crosvm_manager.cpp | 14 +++++------- base/cvd/cuttlefish/process/command.cc | 19 ++++++++-------- base/cvd/cuttlefish/process/command.h | 22 +++++++++++-------- base/cvd/cuttlefish/process/managed_stdio.cc | 6 ++--- base/cvd/cuttlefish/process/subprocess.h | 6 ----- 12 files changed, 59 insertions(+), 67 deletions(-) diff --git a/base/cvd/cuttlefish/host/commands/assemble_cvd/boot_image_utils.cc b/base/cvd/cuttlefish/host/commands/assemble_cvd/boot_image_utils.cc index b72157a6582..09a37a45d36 100644 --- a/base/cvd/cuttlefish/host/commands/assemble_cvd/boot_image_utils.cc +++ b/base/cvd/cuttlefish/host/commands/assemble_cvd/boot_image_utils.cc @@ -70,7 +70,7 @@ Result RunMkBootFs(const std::string& input_dir, int success = Command(HostBinaryPath("mkbootfs")) .AddParameter(input_dir) - .RedirectStdIO(Subprocess::StdIOChannel::kStdOut, output_fd) + .RedirectStdIO(Command::StdIoChannel::kStdOut, output_fd) .Start() .Wait(); CF_EXPECT_EQ(success, 0, "`mkbootfs` failed."); @@ -184,7 +184,7 @@ Result UnpackRamdisk(const std::string& original_ramdisk_path, Command(CpioBinary()) .AddParameter("-idu") .SetWorkingDirectory(ramdisk_stage_dir) - .RedirectStdIO(Subprocess::StdIOChannel::kStdIn, input) + .RedirectStdIO(Command::StdIoChannel::kStdIn, input) .Start() .Wait(); return {}; diff --git a/base/cvd/cuttlefish/host/commands/cvd/cli/commands/start.cpp b/base/cvd/cuttlefish/host/commands/cvd/cli/commands/start.cpp index 3cc0db3f348..a22f911afad 100644 --- a/base/cvd/cuttlefish/host/commands/cvd/cli/commands/start.cpp +++ b/base/cvd/cuttlefish/host/commands/cvd/cli/commands/start.cpp @@ -299,15 +299,13 @@ Result ConstructCvdNonHelpCommand( .command_name = bin_file}; Command non_help_command = CF_EXPECT(ConstructCommand(construct_cmd_param)); if (output_fd->IsOpen()) { - non_help_command.RedirectStdIO(Subprocess::StdIOChannel::kStdOut, - output_fd); - non_help_command.RedirectStdIO(Subprocess::StdIOChannel::kStdErr, - output_fd); + non_help_command.RedirectStdIO(Command::StdIoChannel::kStdOut, output_fd); + non_help_command.RedirectStdIO(Command::StdIoChannel::kStdErr, output_fd); } else { // Print everything to stderr, cvd needs to print JSON to stdout which // would be unparseable with the subcommand's output. - non_help_command.RedirectStdIO(Subprocess::StdIOChannel::kStdOut, - Subprocess::StdIOChannel::kStdErr); + non_help_command.RedirectStdIO(Command::StdIoChannel::kStdOut, + Command::StdIoChannel::kStdErr); } return non_help_command; } @@ -610,11 +608,11 @@ Result CvdStartCommandHandler::LaunchSingleInstance( .command_name = "run_cvd"}; Command command = CF_EXPECT(ConstructCommand(construct_cmd_param)); - command.RedirectStdIO(Subprocess::StdIOChannel::kStdOut, - Subprocess::StdIOChannel::kStdErr); + command.RedirectStdIO(Command::StdIoChannel::kStdOut, + Command::StdIoChannel::kStdErr); SharedFD dev_null = SharedFD::Open("/dev/null", O_RDONLY); if (dev_null->IsOpen()) { - command.RedirectStdIO(Subprocess::StdIOChannel::kStdIn, dev_null); + command.RedirectStdIO(Command::StdIoChannel::kStdIn, dev_null); } else { LOG(ERROR) << "Failed to open /dev/null: " << dev_null->StrError(); } diff --git a/base/cvd/cuttlefish/host/commands/run_cvd/launch/input_connections_provider.cc b/base/cvd/cuttlefish/host/commands/run_cvd/launch/input_connections_provider.cc index 3e6a1a4a97a..e3b2ee4399e 100644 --- a/base/cvd/cuttlefish/host/commands/run_cvd/launch/input_connections_provider.cc +++ b/base/cvd/cuttlefish/host/commands/run_cvd/launch/input_connections_provider.cc @@ -92,9 +92,8 @@ Command NewVhostUserInputCommand(const DeviceSockets& device_sockets, cmd.AddParameter("--verbosity=DEBUG"); cmd.AddParameter("--socket-fd=", device_sockets.vhu_server); cmd.AddParameter("--device-config=", spec); - cmd.RedirectStdIO(Subprocess::StdIOChannel::kStdIn, - device_sockets.device_end); - cmd.RedirectStdIO(Subprocess::StdIOChannel::kStdOut, + cmd.RedirectStdIO(Command::StdIoChannel::kStdIn, device_sockets.device_end); + cmd.RedirectStdIO(Command::StdIoChannel::kStdOut, SharedFD::Open("/dev/null", O_WRONLY)); return cmd; } @@ -132,7 +131,7 @@ class VhostInputDevices : public CommandSource, NewVhostUserInputCommand(rotary_sockets_, DefaultRotaryDeviceSpec()); Command rotary_log_tee = CF_EXPECT(log_tee_.CreateLogTee(rotary_cmd, "vhost_user_rotary", - Subprocess::StdIOChannel::kStdErr), + Command::StdIoChannel::kStdErr), "Failed to create log tee command for rotary device"); commands.emplace_back(std::move(rotary_cmd)); commands.emplace_back(std::move(rotary_log_tee)); @@ -142,7 +141,7 @@ class VhostInputDevices : public CommandSource, NewVhostUserInputCommand(mouse_sockets_, DefaultMouseSpec()); Command mouse_log_tee = CF_EXPECT(log_tee_.CreateLogTee(mouse_cmd, "vhost_user_mouse", - Subprocess::StdIOChannel::kStdErr), + Command::StdIoChannel::kStdErr), "Failed to create log tee command for mouse device"); commands.emplace_back(std::move(mouse_cmd)); commands.emplace_back(std::move(mouse_log_tee)); @@ -153,7 +152,7 @@ class VhostInputDevices : public CommandSource, NewVhostUserInputCommand(gamepad_sockets_, DefaultGamepadSpec()); Command gamepad_log_tee = CF_EXPECT(log_tee_.CreateLogTee(gamepad_cmd, "vhost_user_gamepad", - Subprocess::StdIOChannel::kStdErr), + Command::StdIoChannel::kStdErr), "Failed to create log tee command for gamepad device"); commands.emplace_back(std::move(gamepad_cmd)); commands.emplace_back(std::move(gamepad_log_tee)); @@ -165,7 +164,7 @@ class VhostInputDevices : public CommandSource, NewVhostUserInputCommand(keyboard_sockets_, keyboard_spec); Command keyboard_log_tee = CF_EXPECT(log_tee_.CreateLogTee(keyboard_cmd, "vhost_user_keyboard", - Subprocess::StdIOChannel::kStdErr), + Command::StdIoChannel::kStdErr), "Failed to create log tee command for keyboard device"); commands.emplace_back(std::move(keyboard_cmd)); commands.emplace_back(std::move(keyboard_log_tee)); @@ -174,7 +173,7 @@ class VhostInputDevices : public CommandSource, NewVhostUserInputCommand(switches_sockets_, DefaultSwitchesSpec()); Command switches_log_tee = CF_EXPECT(log_tee_.CreateLogTee(switches_cmd, "vhost_user_switches", - Subprocess::StdIOChannel::kStdErr), + Command::StdIoChannel::kStdErr), "Failed to create log tee command for switches device"); commands.emplace_back(std::move(switches_cmd)); commands.emplace_back(std::move(switches_log_tee)); @@ -202,7 +201,7 @@ class VhostInputDevices : public CommandSource, Command touchscreen_log_tee = CF_EXPECTF( log_tee_.CreateLogTee(touchscreen_cmd, fmt::format("vhost_user_touchscreen_{}", i), - Subprocess::StdIOChannel::kStdErr), + Command::StdIoChannel::kStdErr), "Failed to create log tee for touchscreen device", i); commands.emplace_back(std::move(touchscreen_cmd)); commands.emplace_back(std::move(touchscreen_log_tee)); @@ -229,7 +228,7 @@ class VhostInputDevices : public CommandSource, Command touchpad_log_tee = CF_EXPECTF(log_tee_.CreateLogTee( touchpad_cmd, fmt::format("vhost_user_touchpad_{}", i), - Subprocess::StdIOChannel::kStdErr), + Command::StdIoChannel::kStdErr), "Failed to create log tee for touchpad {}", i); commands.emplace_back(std::move(touchpad_cmd)); commands.emplace_back(std::move(touchpad_log_tee)); diff --git a/base/cvd/cuttlefish/host/commands/run_cvd/launch/log_tee_creator.cpp b/base/cvd/cuttlefish/host/commands/run_cvd/launch/log_tee_creator.cpp index d266724a655..4d1071cd71b 100644 --- a/base/cvd/cuttlefish/host/commands/run_cvd/launch/log_tee_creator.cpp +++ b/base/cvd/cuttlefish/host/commands/run_cvd/launch/log_tee_creator.cpp @@ -31,7 +31,7 @@ namespace { Result CreateLogTeeImpl( Command& cmd, const CuttlefishConfig::InstanceSpecific& instance, std::string process_name, - const std::vector& log_channels) { + const std::vector& log_channels) { auto name_with_ext = process_name + "_logs.fifo"; auto logs_path = instance.PerInstanceInternalPath(name_with_ext.c_str()); auto logs = CF_EXPECT(SharedFD::Fifo(logs_path, 0666)); @@ -53,13 +53,13 @@ Result LogTeeCreator::CreateFullLogTee(Command& cmd, std::string process_name) { return CF_EXPECT(CreateLogTeeImpl( cmd, instance_, std::move(process_name), - {Subprocess::StdIOChannel::kStdOut, Subprocess::StdIOChannel::kStdErr})); + {Command::StdIoChannel::kStdOut, Command::StdIoChannel::kStdErr})); } -Result LogTeeCreator::CreateLogTee( - Command& cmd, std::string process_name, - Subprocess::StdIOChannel log_channel) { - CF_EXPECT(log_channel != Subprocess::StdIOChannel::kStdIn, +Result LogTeeCreator::CreateLogTee(Command& cmd, + std::string process_name, + Command::StdIoChannel log_channel) { + CF_EXPECT(log_channel != Command::StdIoChannel::kStdIn, "Invalid channel for log tee: stdin"); return CF_EXPECT( CreateLogTeeImpl(cmd, instance_, std::move(process_name), {log_channel})); diff --git a/base/cvd/cuttlefish/host/commands/run_cvd/launch/log_tee_creator.h b/base/cvd/cuttlefish/host/commands/run_cvd/launch/log_tee_creator.h index 36a1ea43ee4..db9ae240913 100644 --- a/base/cvd/cuttlefish/host/commands/run_cvd/launch/log_tee_creator.h +++ b/base/cvd/cuttlefish/host/commands/run_cvd/launch/log_tee_creator.h @@ -35,7 +35,7 @@ class LogTeeCreator { // Creates a log tee command for specified channel of the given command. Result CreateLogTee(Command& cmd, std::string process_name, - Subprocess::StdIOChannel log_channel); + Command::StdIoChannel log_channel); private: const CuttlefishConfig::InstanceSpecific instance_; diff --git a/base/cvd/cuttlefish/host/commands/run_cvd/launch/vhost_user_media_devices.cpp b/base/cvd/cuttlefish/host/commands/run_cvd/launch/vhost_user_media_devices.cpp index 8ccb7cea3b0..b6e76746abe 100644 --- a/base/cvd/cuttlefish/host/commands/run_cvd/launch/vhost_user_media_devices.cpp +++ b/base/cvd/cuttlefish/host/commands/run_cvd/launch/vhost_user_media_devices.cpp @@ -38,7 +38,7 @@ namespace cuttlefish { namespace { -using Subprocess::StdIOChannel::kStdErr; +using Command::StdIoChannel::kStdErr; Command NewCommand(const std::string& binary_path, const std::string& socket_path, @@ -49,7 +49,7 @@ Command NewCommand(const std::string& binary_path, if (!lens_facing.empty()) { cmd.AddParameter("--lens-facing=", lens_facing); } - cmd.RedirectStdIO(Subprocess::StdIOChannel::kStdOut, + cmd.RedirectStdIO(Command::StdIoChannel::kStdOut, SharedFD::Open("/dev/null", O_WRONLY)); return cmd; } diff --git a/base/cvd/cuttlefish/host/commands/start/main.cc b/base/cvd/cuttlefish/host/commands/start/main.cc index ca0d64bced6..3e0a4c3232e 100644 --- a/base/cvd/cuttlefish/host/commands/start/main.cc +++ b/base/cvd/cuttlefish/host/commands/start/main.cc @@ -114,7 +114,7 @@ Subprocess StartRunner(SharedFD runner_stdin, for (const auto& arg : argv) { run_cmd.AddParameter(arg); } - run_cmd.RedirectStdIO(Subprocess::StdIOChannel::kStdIn, runner_stdin); + run_cmd.RedirectStdIO(Command::StdIoChannel::kStdIn, runner_stdin); run_cmd.SetWorkingDirectory(instance.instance_dir()); return run_cmd.Start(); } diff --git a/base/cvd/cuttlefish/host/libs/vm_manager/crosvm_manager.cpp b/base/cvd/cuttlefish/host/libs/vm_manager/crosvm_manager.cpp index 739ee178b91..54871a6107f 100644 --- a/base/cvd/cuttlefish/host/libs/vm_manager/crosvm_manager.cpp +++ b/base/cvd/cuttlefish/host/libs/vm_manager/crosvm_manager.cpp @@ -417,9 +417,9 @@ Result BuildVhostUserGpu( CF_EXPECT(MaybeConfigureVulkanIcd(config, &gpu_device_cmd.Cmd())); - gpu_device_cmd.Cmd().RedirectStdIO(Subprocess::StdIOChannel::kStdOut, + gpu_device_cmd.Cmd().RedirectStdIO(Command::StdIoChannel::kStdOut, gpu_device_logs); - gpu_device_cmd.Cmd().RedirectStdIO(Subprocess::StdIOChannel::kStdErr, + gpu_device_cmd.Cmd().RedirectStdIO(Command::StdIoChannel::kStdErr, gpu_device_logs); return VhostUserDeviceCommands{ @@ -1022,18 +1022,16 @@ Result> CrosvmManager::StartCommands( "Unhandled GPU capture binary: " << instance.gpu_capture_binary()); } - gpu_capture_command.RedirectStdIO(Subprocess::StdIOChannel::kStdOut, + gpu_capture_command.RedirectStdIO(Command::StdIoChannel::kStdOut, gpu_capture_logs); - gpu_capture_command.RedirectStdIO(Subprocess::StdIOChannel::kStdErr, + gpu_capture_command.RedirectStdIO(Command::StdIoChannel::kStdErr, gpu_capture_logs); commands.emplace_back(std::move(gpu_capture_log_tee_cmd)); commands.emplace_back(std::move(gpu_capture_command)); } else { - crosvm_cmd.Cmd().RedirectStdIO(Subprocess::StdIOChannel::kStdOut, - crosvm_logs); - crosvm_cmd.Cmd().RedirectStdIO(Subprocess::StdIOChannel::kStdErr, - crosvm_logs); + crosvm_cmd.Cmd().RedirectStdIO(Command::StdIoChannel::kStdOut, crosvm_logs); + crosvm_cmd.Cmd().RedirectStdIO(Command::StdIoChannel::kStdErr, crosvm_logs); commands.emplace_back(std::move(crosvm_cmd.Cmd()), true); } diff --git a/base/cvd/cuttlefish/process/command.cc b/base/cvd/cuttlefish/process/command.cc index 67db29af77c..7197c7dd47f 100644 --- a/base/cvd/cuttlefish/process/command.cc +++ b/base/cvd/cuttlefish/process/command.cc @@ -65,9 +65,8 @@ namespace { // If a redirected-to file descriptor was already closed, it's possible that // some inherited file descriptor duped to this file descriptor and the redirect // would override that. This function makes sure that doesn't happen. -bool validate_redirects( - const std::map& redirects, - const std::map& inherited_fds) { +bool validate_redirects(const std::map& redirects, + const std::map& inherited_fds) { // Add the redirected IO channels to a set as integers. This allows converting // the enum values into integers instead of the other way around. std::set int_redirects; @@ -85,7 +84,7 @@ bool validate_redirects( return true; } -void do_redirects(const std::map& redirects) { +void do_redirects(const std::map& redirects) { for (const auto& entry : redirects) { auto std_channel = static_cast(entry.first); auto fd = entry.second; @@ -177,7 +176,7 @@ Command Command::AddParameter(std::string arg) && { return std::move(*this); } -Command& Command::RedirectStdIO(Subprocess::StdIOChannel channel, +Command& Command::RedirectStdIO(Command::StdIoChannel channel, SharedFD shared_fd) & { CHECK(shared_fd->IsOpen()); CHECK(redirects_.count(channel) == 0) @@ -188,18 +187,18 @@ Command& Command::RedirectStdIO(Subprocess::StdIOChannel channel, redirects_[channel] = dup_fd; return *this; } -Command Command::RedirectStdIO(Subprocess::StdIOChannel channel, +Command Command::RedirectStdIO(Command::StdIoChannel channel, SharedFD shared_fd) && { RedirectStdIO(channel, shared_fd); return std::move(*this); } -Command& Command::RedirectStdIO(Subprocess::StdIOChannel subprocess_channel, - Subprocess::StdIOChannel parent_channel) & { +Command& Command::RedirectStdIO(Command::StdIoChannel subprocess_channel, + Command::StdIoChannel parent_channel) & { return RedirectStdIO(subprocess_channel, SharedFD::Dup(static_cast(parent_channel))); } -Command Command::RedirectStdIO(Subprocess::StdIOChannel subprocess_channel, - Subprocess::StdIOChannel parent_channel) && { +Command Command::RedirectStdIO(Command::StdIoChannel subprocess_channel, + Command::StdIoChannel parent_channel) && { RedirectStdIO(subprocess_channel, parent_channel); return std::move(*this); } diff --git a/base/cvd/cuttlefish/process/command.h b/base/cvd/cuttlefish/process/command.h index 2f066180bfb..33e85125f16 100644 --- a/base/cvd/cuttlefish/process/command.h +++ b/base/cvd/cuttlefish/process/command.h @@ -52,6 +52,12 @@ class Command { } public: + enum class StdIoChannel { + kStdIn = 0, + kStdOut = 1, + kStdErr = 2, + }; + // Constructs a command object from the path to an executable binary and an // optional subprocess stopper. When not provided, stopper defaults to sending // SIGKILL to the subprocess. @@ -155,14 +161,12 @@ class Command { } // Redirects the standard IO of the command. - Command& RedirectStdIO(Subprocess::StdIOChannel channel, - SharedFD shared_fd) &; - Command RedirectStdIO(Subprocess::StdIOChannel channel, - SharedFD shared_fd) &&; - Command& RedirectStdIO(Subprocess::StdIOChannel subprocess_channel, - Subprocess::StdIOChannel parent_channel) &; - Command RedirectStdIO(Subprocess::StdIOChannel subprocess_channel, - Subprocess::StdIOChannel parent_channel) &&; + Command& RedirectStdIO(StdIoChannel channel, SharedFD shared_fd) &; + Command RedirectStdIO(StdIoChannel channel, SharedFD shared_fd) &&; + Command& RedirectStdIO(StdIoChannel subprocess_channel, + StdIoChannel parent_channel) &; + Command RedirectStdIO(StdIoChannel subprocess_channel, + StdIoChannel parent_channel) &&; Command& SetWorkingDirectory(const std::string& path) &; Command SetWorkingDirectory(const std::string& path) &&; @@ -196,7 +200,7 @@ class Command { std::vector command_; std::vector()>> prerequisites_; std::map inherited_fds_{}; - std::map redirects_{}; + std::map redirects_{}; std::vector env_{}; SubprocessStopper subprocess_stopper_; SharedFD working_directory_; diff --git a/base/cvd/cuttlefish/process/managed_stdio.cc b/base/cvd/cuttlefish/process/managed_stdio.cc index 939ffb0d24a..a232d2bb9b9 100644 --- a/base/cvd/cuttlefish/process/managed_stdio.cc +++ b/base/cvd/cuttlefish/process/managed_stdio.cc @@ -77,7 +77,7 @@ int RunWithManagedStdio(Command cmd_tmp, const std::string* stdin_str, << cmd.GetShortName() << "\""; return -1; } - cmd.RedirectStdIO(Subprocess::StdIOChannel::kStdIn, pipe_read); + cmd.RedirectStdIO(Command::StdIoChannel::kStdIn, pipe_read); stdin_thread = std::thread([pipe_write, stdin_str, &io_error]() { int written = WriteAll(pipe_write, *stdin_str); if (written < 0) { @@ -93,7 +93,7 @@ int RunWithManagedStdio(Command cmd_tmp, const std::string* stdin_str, << cmd.GetShortName() << "\""; return -1; } - cmd.RedirectStdIO(Subprocess::StdIOChannel::kStdOut, pipe_write); + cmd.RedirectStdIO(Command::StdIoChannel::kStdOut, pipe_write); stdout_thread = std::thread([pipe_read, stdout_str, &io_error]() { int read = ReadAll(pipe_read, stdout_str); if (read < 0) { @@ -109,7 +109,7 @@ int RunWithManagedStdio(Command cmd_tmp, const std::string* stdin_str, << cmd.GetShortName() << "\""; return -1; } - cmd.RedirectStdIO(Subprocess::StdIOChannel::kStdErr, pipe_write); + cmd.RedirectStdIO(Command::StdIoChannel::kStdErr, pipe_write); stderr_thread = std::thread([pipe_read, stderr_str, &io_error]() { int read = ReadAll(pipe_read, stderr_str); if (read < 0) { diff --git a/base/cvd/cuttlefish/process/subprocess.h b/base/cvd/cuttlefish/process/subprocess.h index e279ff0ff97..74e70e2588d 100644 --- a/base/cvd/cuttlefish/process/subprocess.h +++ b/base/cvd/cuttlefish/process/subprocess.h @@ -44,12 +44,6 @@ SubprocessStopper KillSubprocessFallback(SubprocessStopper nice_stopper); // It's an error to wait twice for the same subprocess. class Subprocess { public: - enum class StdIOChannel { - kStdIn = 0, - kStdOut = 1, - kStdErr = 2, - }; - Subprocess(pid_t pid, SubprocessStopper stopper = KillSubprocess) : pid_(pid), started_(pid > 0), stopper_(stopper) {} // The default implementation won't do because we need to reset the pid of the From e292fc6a9c3bfd33434f555632563af63d7945d9 Mon Sep 17 00:00:00 2001 From: "A. Cody Schuffelen" Date: Mon, 13 Jul 2026 16:05:27 -0700 Subject: [PATCH 6/9] Remove subprocess.h re-export from command_subprocess.h Bug: b/533572315 --- base/cvd/cuttlefish/host/commands/cvd/utils/BUILD.bazel | 1 + .../cuttlefish/host/commands/cvd/utils/subprocess_waiter.cpp | 1 + base/cvd/cuttlefish/host/commands/run_cvd/launch/BUILD.bazel | 3 +++ base/cvd/cuttlefish/host/commands/run_cvd/launch/cvdalloc.cpp | 1 + base/cvd/cuttlefish/host/commands/run_cvd/launch/modem.cpp | 1 + base/cvd/cuttlefish/host/commands/run_cvd/launch/streamer.cpp | 1 + base/cvd/cuttlefish/host/commands/start/BUILD.bazel | 3 ++- base/cvd/cuttlefish/host/commands/start/main.cc | 3 ++- base/cvd/cuttlefish/host/libs/process_monitor/BUILD.bazel | 3 ++- .../cuttlefish/host/libs/process_monitor/process_monitor.cc | 2 +- .../cvd/cuttlefish/host/libs/process_monitor/process_monitor.h | 2 +- base/cvd/cuttlefish/process/BUILD.bazel | 1 - base/cvd/cuttlefish/process/command_subprocess.h | 3 +-- 13 files changed, 17 insertions(+), 8 deletions(-) diff --git a/base/cvd/cuttlefish/host/commands/cvd/utils/BUILD.bazel b/base/cvd/cuttlefish/host/commands/cvd/utils/BUILD.bazel index e014a4bc560..92589e08b03 100644 --- a/base/cvd/cuttlefish/host/commands/cvd/utils/BUILD.bazel +++ b/base/cvd/cuttlefish/host/commands/cvd/utils/BUILD.bazel @@ -58,6 +58,7 @@ cf_cc_library( deps = [ "//cuttlefish/posix:strerror", "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:subprocess", "//cuttlefish/result", ], ) diff --git a/base/cvd/cuttlefish/host/commands/cvd/utils/subprocess_waiter.cpp b/base/cvd/cuttlefish/host/commands/cvd/utils/subprocess_waiter.cpp index bbba1ef5c24..cd0b72415bf 100644 --- a/base/cvd/cuttlefish/host/commands/cvd/utils/subprocess_waiter.cpp +++ b/base/cvd/cuttlefish/host/commands/cvd/utils/subprocess_waiter.cpp @@ -20,6 +20,7 @@ #include "cuttlefish/posix/strerror.h" #include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/subprocess.h" #include "cuttlefish/result/result.h" namespace cuttlefish { diff --git a/base/cvd/cuttlefish/host/commands/run_cvd/launch/BUILD.bazel b/base/cvd/cuttlefish/host/commands/run_cvd/launch/BUILD.bazel index c1e2c15ee73..061964f74b7 100644 --- a/base/cvd/cuttlefish/host/commands/run_cvd/launch/BUILD.bazel +++ b/base/cvd/cuttlefish/host/commands/run_cvd/launch/BUILD.bazel @@ -129,6 +129,7 @@ cf_cc_library( "//cuttlefish/host/libs/vm_manager", "//cuttlefish/posix:strerror", "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:subprocess", "//cuttlefish/result", "//libbase", "@abseil-cpp//absl/log", @@ -292,6 +293,7 @@ cf_cc_library( "//cuttlefish/host/libs/config:known_paths", "//cuttlefish/host/libs/feature", "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:subprocess", "//cuttlefish/result", "//libbase", "@abseil-cpp//absl/log", @@ -495,6 +497,7 @@ cf_cc_library( "//cuttlefish/host/libs/feature", "//cuttlefish/posix:strerror", "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:subprocess", "//cuttlefish/result", "//libbase", "@abseil-cpp//absl/log", diff --git a/base/cvd/cuttlefish/host/commands/run_cvd/launch/cvdalloc.cpp b/base/cvd/cuttlefish/host/commands/run_cvd/launch/cvdalloc.cpp index bcf0691fbe2..a59611a1f29 100644 --- a/base/cvd/cuttlefish/host/commands/run_cvd/launch/cvdalloc.cpp +++ b/base/cvd/cuttlefish/host/commands/run_cvd/launch/cvdalloc.cpp @@ -41,6 +41,7 @@ #include "cuttlefish/host/libs/vm_manager/vm_manager.h" #include "cuttlefish/posix/strerror.h" #include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/subprocess.h" #include "cuttlefish/result/result.h" namespace cuttlefish { diff --git a/base/cvd/cuttlefish/host/commands/run_cvd/launch/modem.cpp b/base/cvd/cuttlefish/host/commands/run_cvd/launch/modem.cpp index aad636bd9ba..baa7f150a88 100644 --- a/base/cvd/cuttlefish/host/commands/run_cvd/launch/modem.cpp +++ b/base/cvd/cuttlefish/host/commands/run_cvd/launch/modem.cpp @@ -29,6 +29,7 @@ #include "cuttlefish/host/libs/config/known_paths.h" #include "cuttlefish/host/libs/feature/command_source.h" #include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/subprocess.h" #include "cuttlefish/result/result.h" namespace cuttlefish { diff --git a/base/cvd/cuttlefish/host/commands/run_cvd/launch/streamer.cpp b/base/cvd/cuttlefish/host/commands/run_cvd/launch/streamer.cpp index cce48f3817a..5229d83f29a 100644 --- a/base/cvd/cuttlefish/host/commands/run_cvd/launch/streamer.cpp +++ b/base/cvd/cuttlefish/host/commands/run_cvd/launch/streamer.cpp @@ -46,6 +46,7 @@ #include "cuttlefish/host/libs/feature/kernel_log_pipe_provider.h" #include "cuttlefish/posix/strerror.h" #include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/subprocess.h" #include "cuttlefish/result/result.h" namespace cuttlefish { diff --git a/base/cvd/cuttlefish/host/commands/start/BUILD.bazel b/base/cvd/cuttlefish/host/commands/start/BUILD.bazel index 8a538ff7135..725480fd2c6 100644 --- a/base/cvd/cuttlefish/host/commands/start/BUILD.bazel +++ b/base/cvd/cuttlefish/host/commands/start/BUILD.bazel @@ -37,9 +37,10 @@ cf_cc_binary( "//cuttlefish/host/libs/vm_manager", "//cuttlefish/posix:readlink", "//cuttlefish/posix:symlink", - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:command", "//cuttlefish/process:managed_stdio", "//cuttlefish/process:subprocess_options", + "//cuttlefish/process:subprocess", "//libbase", "@abseil-cpp//absl/base:no_destructor", "@abseil-cpp//absl/log", diff --git a/base/cvd/cuttlefish/host/commands/start/main.cc b/base/cvd/cuttlefish/host/commands/start/main.cc index 3e0a4c3232e..fc9669a9572 100644 --- a/base/cvd/cuttlefish/host/commands/start/main.cc +++ b/base/cvd/cuttlefish/host/commands/start/main.cc @@ -48,8 +48,9 @@ #include "cuttlefish/host/libs/log_names/log_names.h" #include "cuttlefish/posix/readlink.h" #include "cuttlefish/posix/symlink.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/command.h" #include "cuttlefish/process/managed_stdio.h" +#include "cuttlefish/process/subprocess.h" namespace cuttlefish { namespace { diff --git a/base/cvd/cuttlefish/host/libs/process_monitor/BUILD.bazel b/base/cvd/cuttlefish/host/libs/process_monitor/BUILD.bazel index d9134d13f00..1372a98c2ba 100644 --- a/base/cvd/cuttlefish/host/libs/process_monitor/BUILD.bazel +++ b/base/cvd/cuttlefish/host/libs/process_monitor/BUILD.bazel @@ -19,7 +19,8 @@ cf_cc_library( "//cuttlefish/host/libs/config:known_paths", "//cuttlefish/host/libs/feature", "//cuttlefish/posix:strerror", - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:command", + "//cuttlefish/process:subprocess", "//cuttlefish/result", "//libbase", "@abseil-cpp//absl/log", diff --git a/base/cvd/cuttlefish/host/libs/process_monitor/process_monitor.cc b/base/cvd/cuttlefish/host/libs/process_monitor/process_monitor.cc index 8162c6143d9..4966ec93893 100644 --- a/base/cvd/cuttlefish/host/libs/process_monitor/process_monitor.cc +++ b/base/cvd/cuttlefish/host/libs/process_monitor/process_monitor.cc @@ -43,7 +43,7 @@ #include "cuttlefish/host/libs/command_util/util.h" #include "cuttlefish/host/libs/config/known_paths.h" #include "cuttlefish/posix/strerror.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/subprocess.h" #include "cuttlefish/result/result.h" namespace cuttlefish { diff --git a/base/cvd/cuttlefish/host/libs/process_monitor/process_monitor.h b/base/cvd/cuttlefish/host/libs/process_monitor/process_monitor.h index 94b0a91e2f9..2a6a889b9f9 100644 --- a/base/cvd/cuttlefish/host/libs/process_monitor/process_monitor.h +++ b/base/cvd/cuttlefish/host/libs/process_monitor/process_monitor.h @@ -25,7 +25,7 @@ #include "cuttlefish/common/libs/transport/channel_sharedfd.h" #include "cuttlefish/host/libs/feature/command_source.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/command.h" #include "cuttlefish/result/result.h" namespace cuttlefish { diff --git a/base/cvd/cuttlefish/process/BUILD.bazel b/base/cvd/cuttlefish/process/BUILD.bazel index 9b14421185f..2587d4bd9bb 100644 --- a/base/cvd/cuttlefish/process/BUILD.bazel +++ b/base/cvd/cuttlefish/process/BUILD.bazel @@ -30,7 +30,6 @@ cf_cc_library( hdrs = ["command_subprocess.h"], deps = [ "//cuttlefish/process:command", - "//cuttlefish/process:subprocess", ], ) diff --git a/base/cvd/cuttlefish/process/command_subprocess.h b/base/cvd/cuttlefish/process/command_subprocess.h index f684cdd48b7..51152e24c1f 100644 --- a/base/cvd/cuttlefish/process/command_subprocess.h +++ b/base/cvd/cuttlefish/process/command_subprocess.h @@ -15,5 +15,4 @@ */ #pragma once -#include "cuttlefish/process/command.h" // IWYU pragma: export -#include "cuttlefish/process/subprocess.h" // IWYU pragma: export +#include "cuttlefish/process/command.h" // IWYU pragma: export From 908af7519e470437077f7e7e6022a7cd399957aa Mon Sep 17 00:00:00 2001 From: "A. Cody Schuffelen" Date: Mon, 13 Jul 2026 16:10:26 -0700 Subject: [PATCH 7/9] Redirect dependencies of command_subprocess.h to command.h All other re-exported headers have been removed. Bug: b/533572315 --- .../cuttlefish/common/libs/utils/BUILD.bazel | 6 +-- .../cuttlefish/common/libs/utils/archive.cpp | 2 +- .../common/libs/utils/disk_usage.cpp | 2 +- .../libs/utils/wait_for_unix_socket.cpp | 2 +- .../host/commands/assemble_cvd/BUILD.bazel | 10 ++-- .../commands/assemble_cvd/boot_image_utils.cc | 2 +- .../commands/assemble_cvd/graphics_flags.cc | 2 +- .../commands/assemble_cvd/guest_config.cc | 2 +- .../assemble_cvd/vendor_dlkm_utils.cc | 2 +- .../host/commands/cvd/cli/BUILD.bazel | 4 +- .../commands/cvd/cli/commands/BUILD.bazel | 12 ++--- .../commands/cvd/cli/commands/bugreport.cpp | 2 +- .../commands/cvd/cli/commands/display.cpp | 2 +- .../host/commands/cvd/cli/commands/env.cpp | 2 +- .../cvd/cli/commands/host_tool_target.cpp | 2 +- .../commands/cvd/cli/commands/snapshot.cpp | 2 +- .../host/commands/cvd/cli/commands/snapshot.h | 2 +- .../host/commands/cvd/cli/commands/start.cpp | 2 +- .../host/commands/cvd/cli/commands/start.h | 2 +- .../cuttlefish/host/commands/cvd/cli/utils.h | 2 +- .../host/commands/cvd/fetch/BUILD.bazel | 2 +- .../host/commands/cvd/fetch/auto_login.cc | 2 +- .../host/commands/cvd/instances/BUILD.bazel | 6 +-- .../commands/cvd/instances/local_instance.cpp | 2 +- .../commands/cvd/instances/status_fetcher.cpp | 2 +- .../host/commands/cvd/instances/stop.cpp | 2 +- .../host/commands/cvd/utils/BUILD.bazel | 4 +- .../commands/cvd/utils/subprocess_waiter.cpp | 2 +- .../commands/cvd/utils/subprocess_waiter.h | 2 +- .../host/commands/health/BUILD.bazel | 2 +- .../host/commands/health/health.cpp | 2 +- .../host/commands/host_bugreport/BUILD.bazel | 2 +- .../host/commands/host_bugreport/main.cc | 2 +- .../host/commands/powerbtn_cvd/BUILD.bazel | 2 +- .../commands/powerbtn_cvd/powerbtn_cvd.cc | 2 +- .../host/commands/run_cvd/BUILD.bazel | 4 +- .../commands/run_cvd/boot_state_machine.cc | 2 +- .../host/commands/run_cvd/launch/BUILD.bazel | 54 +++++++++---------- .../host/commands/run_cvd/launch/casimir.cpp | 2 +- .../run_cvd/launch/casimir_control_server.cpp | 2 +- .../run_cvd/launch/console_forwarder.cpp | 2 +- .../launch/control_env_proxy_server.cpp | 2 +- .../host/commands/run_cvd/launch/cvdalloc.cpp | 2 +- .../launch/input_connections_provider.cc | 2 +- .../run_cvd/launch/kernel_log_monitor.cpp | 2 +- .../run_cvd/launch/log_tee_creator.cpp | 2 +- .../commands/run_cvd/launch/log_tee_creator.h | 2 +- .../run_cvd/launch/logcat_receiver.cpp | 2 +- .../host/commands/run_cvd/launch/mcu.cpp | 2 +- .../host/commands/run_cvd/launch/metrics.cpp | 2 +- .../host/commands/run_cvd/launch/modem.cpp | 2 +- .../commands/run_cvd/launch/netsim_server.cpp | 2 +- .../commands/run_cvd/launch/nfc_connector.cpp | 2 +- .../run_cvd/launch/openwrt_control_server.cpp | 2 +- .../commands/run_cvd/launch/root_canal.cpp | 2 +- .../launch/screen_recording_server.cpp | 2 +- .../commands/run_cvd/launch/secure_env.cpp | 2 +- .../run_cvd/launch/sensors_simulator.cpp | 2 +- .../host/commands/run_cvd/launch/streamer.cpp | 2 +- .../commands/run_cvd/launch/ti50_emulator.cpp | 2 +- .../run_cvd/launch/tombstone_receiver.cpp | 2 +- .../commands/run_cvd/launch/uwb_connector.cpp | 2 +- .../run_cvd/launch/vhal_proxy_server.cpp | 2 +- .../run_cvd/launch/vhost_device_vsock.cpp | 2 +- .../launch/vhost_user_media_devices.cpp | 2 +- .../run_cvd/launch/wmediumd_server.cpp | 2 +- .../commands/run_cvd/server_loop_impl.cpp | 2 +- .../run_cvd/server_loop_impl_snapshot.cpp | 2 +- .../host/commands/start/BUILD.bazel | 2 +- .../host/commands/start/flag_forwarder.cc | 2 +- base/cvd/cuttlefish/host/libs/avb/BUILD.bazel | 2 +- base/cvd/cuttlefish/host/libs/avb/avb.cpp | 2 +- base/cvd/cuttlefish/host/libs/avb/avb.h | 2 +- .../cuttlefish/host/libs/config/BUILD.bazel | 2 +- .../host/libs/config/adb/BUILD.bazel | 2 +- .../host/libs/config/adb/launch.cpp | 2 +- .../host/libs/config/data_image.cpp | 2 +- .../host/libs/config/fastboot/BUILD.bazel | 2 +- .../host/libs/config/fastboot/launch.cpp | 2 +- .../cuttlefish/host/libs/feature/BUILD.bazel | 2 +- .../host/libs/feature/command_source.h | 2 +- .../host/libs/image_aggregator/BUILD.bazel | 4 +- .../host/libs/image_aggregator/qcow2.cc | 2 +- .../cuttlefish/host/libs/metrics/BUILD.bazel | 2 +- .../host/libs/metrics/metrics_transmitter.cc | 2 +- .../host/libs/vm_manager/BUILD.bazel | 2 +- .../host/libs/vm_manager/crosvm_builder.cpp | 2 +- .../host/libs/vm_manager/crosvm_builder.h | 2 +- .../vm_manager/crosvm_display_controller.cpp | 2 +- .../host/libs/vm_manager/crosvm_manager.cpp | 2 +- .../host/libs/vm_manager/gem5_manager.cpp | 2 +- .../host/libs/vm_manager/qemu_manager.cpp | 2 +- .../host/libs/vm_manager/vhost_user.h | 2 +- .../host/libs/vm_manager/vhost_user_block.cpp | 2 +- .../cuttlefish/host/libs/web/cas/BUILD.bazel | 2 +- .../host/libs/web/cas/cas_downloader.cpp | 2 +- base/cvd/cuttlefish/process/BUILD.bazel | 8 --- .../cuttlefish/process/command_subprocess.h | 18 ------- 98 files changed, 139 insertions(+), 165 deletions(-) delete mode 100644 base/cvd/cuttlefish/process/command_subprocess.h diff --git a/base/cvd/cuttlefish/common/libs/utils/BUILD.bazel b/base/cvd/cuttlefish/common/libs/utils/BUILD.bazel index ca6a66dee14..00017d0ae1f 100644 --- a/base/cvd/cuttlefish/common/libs/utils/BUILD.bazel +++ b/base/cvd/cuttlefish/common/libs/utils/BUILD.bazel @@ -10,7 +10,7 @@ cf_cc_library( hdrs = ["archive.h"], depend_on_what_you_use_enabled = False, deps = [ - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:command", "//cuttlefish/process:managed_stdio", "//cuttlefish/result", "//libbase", @@ -75,7 +75,7 @@ cf_cc_library( hdrs = ["disk_usage.h"], depend_on_what_you_use_enabled = False, deps = [ - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:command", "//cuttlefish/process:managed_stdio", "//cuttlefish/result", "//libbase", @@ -466,7 +466,7 @@ cf_cc_library( deps = [ "//cuttlefish/common/libs/utils:files", "//cuttlefish/common/libs/utils:wait_for_file", - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:command", "//cuttlefish/process:managed_stdio", "//cuttlefish/result", "@abseil-cpp//absl/log", diff --git a/base/cvd/cuttlefish/common/libs/utils/archive.cpp b/base/cvd/cuttlefish/common/libs/utils/archive.cpp index 4a72ba82e29..d50e2e9ef92 100644 --- a/base/cvd/cuttlefish/common/libs/utils/archive.cpp +++ b/base/cvd/cuttlefish/common/libs/utils/archive.cpp @@ -27,7 +27,7 @@ #include "absl/strings/str_split.h" #include "absl/strings/strip.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/command.h" #include "cuttlefish/process/managed_stdio.h" #include "cuttlefish/result/result.h" diff --git a/base/cvd/cuttlefish/common/libs/utils/disk_usage.cpp b/base/cvd/cuttlefish/common/libs/utils/disk_usage.cpp index 717aa8c287f..0a1b0a4e6b5 100644 --- a/base/cvd/cuttlefish/common/libs/utils/disk_usage.cpp +++ b/base/cvd/cuttlefish/common/libs/utils/disk_usage.cpp @@ -25,7 +25,7 @@ #include "absl/strings/numbers.h" #include "absl/strings/str_split.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/command.h" #include "cuttlefish/process/managed_stdio.h" #include "cuttlefish/result/result.h" diff --git a/base/cvd/cuttlefish/common/libs/utils/wait_for_unix_socket.cpp b/base/cvd/cuttlefish/common/libs/utils/wait_for_unix_socket.cpp index 07574d75c38..7a3fa10d8e1 100644 --- a/base/cvd/cuttlefish/common/libs/utils/wait_for_unix_socket.cpp +++ b/base/cvd/cuttlefish/common/libs/utils/wait_for_unix_socket.cpp @@ -24,7 +24,7 @@ #include "cuttlefish/common/libs/utils/files.h" #include "cuttlefish/common/libs/utils/wait_for_file.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/command.h" #include "cuttlefish/process/managed_stdio.h" #include "cuttlefish/result/result.h" diff --git a/base/cvd/cuttlefish/host/commands/assemble_cvd/BUILD.bazel b/base/cvd/cuttlefish/host/commands/assemble_cvd/BUILD.bazel index 53e65127b34..f184ac2c5e2 100644 --- a/base/cvd/cuttlefish/host/commands/assemble_cvd/BUILD.bazel +++ b/base/cvd/cuttlefish/host/commands/assemble_cvd/BUILD.bazel @@ -101,7 +101,7 @@ cf_cc_library( "//cuttlefish/host/libs/config:kernel_args", "//cuttlefish/host/libs/config:mkenvimage_slim", "//cuttlefish/host/libs/vm_manager", - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:command", "//cuttlefish/result", "//libbase", "@abseil-cpp//absl/log", @@ -138,7 +138,7 @@ cf_cc_library( "//cuttlefish/io:shared_fd", "//cuttlefish/io:string", "//cuttlefish/io:write_exact", - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:command", "//cuttlefish/process:execute", "//cuttlefish/result", "//libbase", @@ -420,7 +420,7 @@ cf_cc_library( "//cuttlefish/pretty:optional", "//cuttlefish/pretty:string", "//cuttlefish/pretty:struct", - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:command", "//cuttlefish/process:managed_stdio", "//cuttlefish/result", "//libbase", @@ -449,7 +449,7 @@ cf_cc_library( "//cuttlefish/host/libs/config:guest_hwui_renderer", "//cuttlefish/host/libs/config:guest_renderer_preload", "//cuttlefish/host/libs/config:vmm_mode", - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:command", "//cuttlefish/process:managed_stdio", "//cuttlefish/result", "//libbase", @@ -641,7 +641,7 @@ cf_cc_library( "//cuttlefish/host/libs/config:config_utils", "//cuttlefish/host/libs/config:known_paths", "//cuttlefish/io:shared_fd", - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:command", "//cuttlefish/process:execute", "//cuttlefish/result", "//libbase", diff --git a/base/cvd/cuttlefish/host/commands/assemble_cvd/boot_image_utils.cc b/base/cvd/cuttlefish/host/commands/assemble_cvd/boot_image_utils.cc index 09a37a45d36..79bdfd12bc6 100644 --- a/base/cvd/cuttlefish/host/commands/assemble_cvd/boot_image_utils.cc +++ b/base/cvd/cuttlefish/host/commands/assemble_cvd/boot_image_utils.cc @@ -49,7 +49,7 @@ #include "cuttlefish/io/shared_fd.h" #include "cuttlefish/io/string.h" #include "cuttlefish/io/write_exact.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/command.h" #include "cuttlefish/process/execute.h" #include "cuttlefish/result/result.h" diff --git a/base/cvd/cuttlefish/host/commands/assemble_cvd/graphics_flags.cc b/base/cvd/cuttlefish/host/commands/assemble_cvd/graphics_flags.cc index 19e43b1945e..3bfd1f02035 100644 --- a/base/cvd/cuttlefish/host/commands/assemble_cvd/graphics_flags.cc +++ b/base/cvd/cuttlefish/host/commands/assemble_cvd/graphics_flags.cc @@ -40,7 +40,7 @@ #include "cuttlefish/host/libs/config/guest_hwui_renderer.h" #include "cuttlefish/host/libs/config/guest_renderer_preload.h" #include "cuttlefish/host/libs/config/vmm_mode.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/command.h" #include "cuttlefish/process/managed_stdio.h" #include "cuttlefish/result/result.h" diff --git a/base/cvd/cuttlefish/host/commands/assemble_cvd/guest_config.cc b/base/cvd/cuttlefish/host/commands/assemble_cvd/guest_config.cc index cf4c9b3f2a8..240784dc8c9 100644 --- a/base/cvd/cuttlefish/host/commands/assemble_cvd/guest_config.cc +++ b/base/cvd/cuttlefish/host/commands/assemble_cvd/guest_config.cc @@ -47,7 +47,7 @@ #include "cuttlefish/host/libs/config/gpu_mode.h" #include "cuttlefish/pretty/optional.h" #include "cuttlefish/pretty/string.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/command.h" #include "cuttlefish/process/managed_stdio.h" #include "cuttlefish/result/result.h" diff --git a/base/cvd/cuttlefish/host/commands/assemble_cvd/vendor_dlkm_utils.cc b/base/cvd/cuttlefish/host/commands/assemble_cvd/vendor_dlkm_utils.cc index cad6ea92681..552cda5e6ac 100644 --- a/base/cvd/cuttlefish/host/commands/assemble_cvd/vendor_dlkm_utils.cc +++ b/base/cvd/cuttlefish/host/commands/assemble_cvd/vendor_dlkm_utils.cc @@ -44,7 +44,7 @@ #include "cuttlefish/host/libs/config/config_utils.h" #include "cuttlefish/host/libs/config/known_paths.h" #include "cuttlefish/io/shared_fd.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/command.h" #include "cuttlefish/process/execute.h" #include "cuttlefish/result/result.h" diff --git a/base/cvd/cuttlefish/host/commands/cvd/cli/BUILD.bazel b/base/cvd/cuttlefish/host/commands/cvd/cli/BUILD.bazel index ed652145d37..d796556a93b 100644 --- a/base/cvd/cuttlefish/host/commands/cvd/cli/BUILD.bazel +++ b/base/cvd/cuttlefish/host/commands/cvd/cli/BUILD.bazel @@ -159,7 +159,7 @@ cf_cc_library( "//cuttlefish/host/libs/metrics:device_metrics_orchestration", "//cuttlefish/posix:strerror", "//cuttlefish/posix:symlink", - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:command", "//cuttlefish/result", "//libbase", "@abseil-cpp//absl/log", @@ -189,7 +189,7 @@ cf_cc_library( "//cuttlefish/host/commands/cvd/instances:config_path", "//cuttlefish/host/commands/cvd/utils", "//cuttlefish/host/libs/config:config_constants", - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:command", "//cuttlefish/process:managed_stdio", "//cuttlefish/result", "//libbase", diff --git a/base/cvd/cuttlefish/host/commands/cvd/cli/commands/BUILD.bazel b/base/cvd/cuttlefish/host/commands/cvd/cli/commands/BUILD.bazel index a32f305d518..a702b1c155b 100644 --- a/base/cvd/cuttlefish/host/commands/cvd/cli/commands/BUILD.bazel +++ b/base/cvd/cuttlefish/host/commands/cvd/cli/commands/BUILD.bazel @@ -34,7 +34,7 @@ cf_cc_library( "//cuttlefish/host/libs/log_names", "//cuttlefish/host/libs/zip:zip_file", "//cuttlefish/host/libs/zip/libzip_cc:archive", - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:command", "//cuttlefish/process:managed_stdio", "//cuttlefish/result", "//libbase", @@ -105,7 +105,7 @@ cf_cc_library( "//cuttlefish/host/commands/cvd/instances", "//cuttlefish/host/commands/cvd/instances:instance_manager", "//cuttlefish/host/commands/cvd/utils", - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:command", "//cuttlefish/result", "@abseil-cpp//absl/strings", ], @@ -125,7 +125,7 @@ cf_cc_library( "//cuttlefish/host/commands/cvd/instances", "//cuttlefish/host/commands/cvd/instances:instance_manager", "//cuttlefish/host/commands/cvd/utils", - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:command", "//cuttlefish/process:managed_stdio", "//cuttlefish/result", "//libbase", @@ -200,7 +200,7 @@ cf_cc_library( deps = [ "//cuttlefish/common/libs/utils:files", "//cuttlefish/host/commands/cvd/utils", - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:command", "//cuttlefish/process:managed_stdio", "//cuttlefish/result", "//libbase", @@ -391,7 +391,7 @@ cf_cc_library( "//cuttlefish/host/commands/cvd/instances", "//cuttlefish/host/commands/cvd/instances:instance_manager", "//cuttlefish/host/commands/cvd/utils", - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:command", "//cuttlefish/result", "//libbase", "@abseil-cpp//absl/log", @@ -429,7 +429,7 @@ cf_cc_library( "//cuttlefish/host/libs/log_names", "//cuttlefish/host/libs/metrics:device_metrics_orchestration", "//cuttlefish/posix:symlink", - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:command", "//cuttlefish/process:managed_stdio", "//cuttlefish/result", "//libbase", diff --git a/base/cvd/cuttlefish/host/commands/cvd/cli/commands/bugreport.cpp b/base/cvd/cuttlefish/host/commands/cvd/cli/commands/bugreport.cpp index ddd11c98264..50a69cd7b12 100644 --- a/base/cvd/cuttlefish/host/commands/cvd/cli/commands/bugreport.cpp +++ b/base/cvd/cuttlefish/host/commands/cvd/cli/commands/bugreport.cpp @@ -41,7 +41,7 @@ #include "cuttlefish/host/libs/log_names/log_names.h" #include "cuttlefish/host/libs/zip/libzip_cc/archive.h" #include "cuttlefish/host/libs/zip/zip_file.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/command.h" #include "cuttlefish/process/managed_stdio.h" #include "cuttlefish/result/result.h" diff --git a/base/cvd/cuttlefish/host/commands/cvd/cli/commands/display.cpp b/base/cvd/cuttlefish/host/commands/cvd/cli/commands/display.cpp index 261c9413861..065b6052880 100644 --- a/base/cvd/cuttlefish/host/commands/cvd/cli/commands/display.cpp +++ b/base/cvd/cuttlefish/host/commands/cvd/cli/commands/display.cpp @@ -36,7 +36,7 @@ #include "cuttlefish/host/commands/cvd/cli/utils.h" #include "cuttlefish/host/commands/cvd/instances/instance_manager.h" #include "cuttlefish/host/commands/cvd/utils/common.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/command.h" #include "cuttlefish/result/result.h" namespace cuttlefish { diff --git a/base/cvd/cuttlefish/host/commands/cvd/cli/commands/env.cpp b/base/cvd/cuttlefish/host/commands/cvd/cli/commands/env.cpp index aaabdd2f4a3..559218abee2 100644 --- a/base/cvd/cuttlefish/host/commands/cvd/cli/commands/env.cpp +++ b/base/cvd/cuttlefish/host/commands/cvd/cli/commands/env.cpp @@ -31,7 +31,7 @@ #include "cuttlefish/host/commands/cvd/cli/utils.h" #include "cuttlefish/host/commands/cvd/instances/instance_manager.h" #include "cuttlefish/host/commands/cvd/utils/common.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/command.h" #include "cuttlefish/process/managed_stdio.h" #include "cuttlefish/result/result.h" diff --git a/base/cvd/cuttlefish/host/commands/cvd/cli/commands/host_tool_target.cpp b/base/cvd/cuttlefish/host/commands/cvd/cli/commands/host_tool_target.cpp index 570132cd188..f55bdf0e063 100644 --- a/base/cvd/cuttlefish/host/commands/cvd/cli/commands/host_tool_target.cpp +++ b/base/cvd/cuttlefish/host/commands/cvd/cli/commands/host_tool_target.cpp @@ -28,7 +28,7 @@ #include "cuttlefish/common/libs/utils/files.h" #include "cuttlefish/host/commands/cvd/utils/common.h" #include "cuttlefish/host/commands/cvd/utils/flags_collector.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/command.h" #include "cuttlefish/process/managed_stdio.h" #include "cuttlefish/result/result.h" diff --git a/base/cvd/cuttlefish/host/commands/cvd/cli/commands/snapshot.cpp b/base/cvd/cuttlefish/host/commands/cvd/cli/commands/snapshot.cpp index 37978a7a53a..10ec75df1e6 100644 --- a/base/cvd/cuttlefish/host/commands/cvd/cli/commands/snapshot.cpp +++ b/base/cvd/cuttlefish/host/commands/cvd/cli/commands/snapshot.cpp @@ -36,7 +36,7 @@ #include "cuttlefish/host/commands/cvd/instances/instance_manager.h" #include "cuttlefish/host/commands/cvd/instances/local_instance_group.h" #include "cuttlefish/host/commands/cvd/utils/common.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/command.h" #include "cuttlefish/result/result.h" namespace cuttlefish { diff --git a/base/cvd/cuttlefish/host/commands/cvd/cli/commands/snapshot.h b/base/cvd/cuttlefish/host/commands/cvd/cli/commands/snapshot.h index 026ac14500f..f62e1103480 100644 --- a/base/cvd/cuttlefish/host/commands/cvd/cli/commands/snapshot.h +++ b/base/cvd/cuttlefish/host/commands/cvd/cli/commands/snapshot.h @@ -20,7 +20,7 @@ #include "cuttlefish/host/commands/cvd/cli/commands/command_handler.h" #include "cuttlefish/host/commands/cvd/instances/instance_manager.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/command.h" #include "cuttlefish/result/result.h" namespace cuttlefish { diff --git a/base/cvd/cuttlefish/host/commands/cvd/cli/commands/start.cpp b/base/cvd/cuttlefish/host/commands/cvd/cli/commands/start.cpp index a22f911afad..5603969c1bd 100644 --- a/base/cvd/cuttlefish/host/commands/cvd/cli/commands/start.cpp +++ b/base/cvd/cuttlefish/host/commands/cvd/cli/commands/start.cpp @@ -75,7 +75,7 @@ #include "cuttlefish/host/libs/log_names/log_names.h" #include "cuttlefish/host/libs/metrics/device_metrics_orchestration.h" #include "cuttlefish/posix/symlink.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/command.h" #include "cuttlefish/result/result.h" namespace cuttlefish { diff --git a/base/cvd/cuttlefish/host/commands/cvd/cli/commands/start.h b/base/cvd/cuttlefish/host/commands/cvd/cli/commands/start.h index 8908cb59a05..2f1d60a45c0 100644 --- a/base/cvd/cuttlefish/host/commands/cvd/cli/commands/start.h +++ b/base/cvd/cuttlefish/host/commands/cvd/cli/commands/start.h @@ -24,7 +24,7 @@ #include "cuttlefish/host/commands/cvd/instances/instance_manager.h" #include "cuttlefish/host/commands/cvd/instances/local_instance_group.h" #include "cuttlefish/host/commands/cvd/utils/subprocess_waiter.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/command.h" namespace cuttlefish { diff --git a/base/cvd/cuttlefish/host/commands/cvd/cli/utils.h b/base/cvd/cuttlefish/host/commands/cvd/cli/utils.h index a3349163b35..f0a216e8030 100644 --- a/base/cvd/cuttlefish/host/commands/cvd/cli/utils.h +++ b/base/cvd/cuttlefish/host/commands/cvd/cli/utils.h @@ -23,7 +23,7 @@ #include "cuttlefish/flag_parser/flag.h" #include "cuttlefish/host/commands/cvd/cli/command_request.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/command.h" #include "cuttlefish/result/result.h" namespace cuttlefish { diff --git a/base/cvd/cuttlefish/host/commands/cvd/fetch/BUILD.bazel b/base/cvd/cuttlefish/host/commands/cvd/fetch/BUILD.bazel index 757d2593d12..1fef0f6fc3d 100644 --- a/base/cvd/cuttlefish/host/commands/cvd/fetch/BUILD.bazel +++ b/base/cvd/cuttlefish/host/commands/cvd/fetch/BUILD.bazel @@ -21,7 +21,7 @@ cf_cc_library( "//cuttlefish/host/commands/cvd/fetch:build_api_credentials", "//cuttlefish/host/commands/cvd/fetch:build_api_flags", "//cuttlefish/host/libs/web:oauth2_consent", - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:command", "//cuttlefish/process:managed_stdio", "//cuttlefish/result", ], diff --git a/base/cvd/cuttlefish/host/commands/cvd/fetch/auto_login.cc b/base/cvd/cuttlefish/host/commands/cvd/fetch/auto_login.cc index 79832b0b3f2..09e20886c15 100644 --- a/base/cvd/cuttlefish/host/commands/cvd/fetch/auto_login.cc +++ b/base/cvd/cuttlefish/host/commands/cvd/fetch/auto_login.cc @@ -23,7 +23,7 @@ #include "cuttlefish/host/commands/cvd/fetch/build_api_credentials.h" #include "cuttlefish/host/commands/cvd/fetch/build_api_flags.h" #include "cuttlefish/host/libs/web/oauth2_consent.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/command.h" #include "cuttlefish/process/managed_stdio.h" #include "cuttlefish/result/result.h" diff --git a/base/cvd/cuttlefish/host/commands/cvd/instances/BUILD.bazel b/base/cvd/cuttlefish/host/commands/cvd/instances/BUILD.bazel index 121566495ca..17299c9aed6 100644 --- a/base/cvd/cuttlefish/host/commands/cvd/instances/BUILD.bazel +++ b/base/cvd/cuttlefish/host/commands/cvd/instances/BUILD.bazel @@ -126,7 +126,7 @@ cf_cc_library( "//cuttlefish/host/libs/log_names", "//cuttlefish/host/libs/screen_recording_controls", "//cuttlefish/posix:symlink", - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:command", "//cuttlefish/process:managed_stdio", "//cuttlefish/result", "//libbase", @@ -170,7 +170,7 @@ cf_cc_library( "//cuttlefish/host/libs/metrics:device_metrics_orchestration", "//cuttlefish/host/libs/screen_recording_controls", "//cuttlefish/posix:symlink", - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:command", "//cuttlefish/process:managed_stdio", "//cuttlefish/result", "//libbase", @@ -228,7 +228,7 @@ cf_cc_library( "//cuttlefish/host/commands/cvd/utils", "//cuttlefish/host/libs/config:config_constants", "//cuttlefish/posix:strerror", - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:command", "//cuttlefish/process:managed_stdio", "//cuttlefish/result", "//libbase", diff --git a/base/cvd/cuttlefish/host/commands/cvd/instances/local_instance.cpp b/base/cvd/cuttlefish/host/commands/cvd/instances/local_instance.cpp index 40383b2c629..f26d11225ac 100644 --- a/base/cvd/cuttlefish/host/commands/cvd/instances/local_instance.cpp +++ b/base/cvd/cuttlefish/host/commands/cvd/instances/local_instance.cpp @@ -36,7 +36,7 @@ #include "cuttlefish/host/libs/command_util/util.h" #include "cuttlefish/host/libs/config/cuttlefish_config.h" #include "cuttlefish/host/libs/screen_recording_controls/screen_recording_controls.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/command.h" #include "cuttlefish/process/managed_stdio.h" namespace cuttlefish { diff --git a/base/cvd/cuttlefish/host/commands/cvd/instances/status_fetcher.cpp b/base/cvd/cuttlefish/host/commands/cvd/instances/status_fetcher.cpp index 1d57807a32a..942a9cb1721 100644 --- a/base/cvd/cuttlefish/host/commands/cvd/instances/status_fetcher.cpp +++ b/base/cvd/cuttlefish/host/commands/cvd/instances/status_fetcher.cpp @@ -35,7 +35,7 @@ #include "cuttlefish/host/commands/cvd/cli/utils.h" #include "cuttlefish/host/commands/cvd/instances/cvd_persistent_data.pb.h" #include "cuttlefish/host/libs/config/config_constants.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/command.h" #include "cuttlefish/process/managed_stdio.h" namespace cuttlefish { diff --git a/base/cvd/cuttlefish/host/commands/cvd/instances/stop.cpp b/base/cvd/cuttlefish/host/commands/cvd/instances/stop.cpp index b32fdcff202..0481182a551 100644 --- a/base/cvd/cuttlefish/host/commands/cvd/instances/stop.cpp +++ b/base/cvd/cuttlefish/host/commands/cvd/instances/stop.cpp @@ -40,7 +40,7 @@ #include "cuttlefish/host/commands/cvd/utils/common.h" #include "cuttlefish/host/libs/config/config_constants.h" #include "cuttlefish/posix/strerror.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/command.h" #include "cuttlefish/process/managed_stdio.h" #include "cuttlefish/result/result.h" diff --git a/base/cvd/cuttlefish/host/commands/cvd/utils/BUILD.bazel b/base/cvd/cuttlefish/host/commands/cvd/utils/BUILD.bazel index 92589e08b03..febe536311a 100644 --- a/base/cvd/cuttlefish/host/commands/cvd/utils/BUILD.bazel +++ b/base/cvd/cuttlefish/host/commands/cvd/utils/BUILD.bazel @@ -57,7 +57,7 @@ cf_cc_library( copts = COPTS + ["-Werror=sign-compare"], deps = [ "//cuttlefish/posix:strerror", - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:command", "//cuttlefish/process:subprocess", "//cuttlefish/result", ], @@ -78,7 +78,7 @@ cf_cc_library( "//cuttlefish/host/commands/cvd/utils:flags_collector", "//cuttlefish/host/commands/cvd/utils:interrupt_listener", "//cuttlefish/host/commands/cvd/utils:subprocess_waiter", - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:command", "//cuttlefish/result", "//libbase", ], diff --git a/base/cvd/cuttlefish/host/commands/cvd/utils/subprocess_waiter.cpp b/base/cvd/cuttlefish/host/commands/cvd/utils/subprocess_waiter.cpp index cd0b72415bf..c67afc185db 100644 --- a/base/cvd/cuttlefish/host/commands/cvd/utils/subprocess_waiter.cpp +++ b/base/cvd/cuttlefish/host/commands/cvd/utils/subprocess_waiter.cpp @@ -19,7 +19,7 @@ #include #include "cuttlefish/posix/strerror.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/command.h" #include "cuttlefish/process/subprocess.h" #include "cuttlefish/result/result.h" diff --git a/base/cvd/cuttlefish/host/commands/cvd/utils/subprocess_waiter.h b/base/cvd/cuttlefish/host/commands/cvd/utils/subprocess_waiter.h index 8f2a6e30516..052e43970e7 100644 --- a/base/cvd/cuttlefish/host/commands/cvd/utils/subprocess_waiter.h +++ b/base/cvd/cuttlefish/host/commands/cvd/utils/subprocess_waiter.h @@ -19,7 +19,7 @@ #include #include -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/command.h" #include "cuttlefish/result/result.h" namespace cuttlefish { diff --git a/base/cvd/cuttlefish/host/commands/health/BUILD.bazel b/base/cvd/cuttlefish/host/commands/health/BUILD.bazel index b16aaeb65b6..2a8fc42cea2 100644 --- a/base/cvd/cuttlefish/host/commands/health/BUILD.bazel +++ b/base/cvd/cuttlefish/host/commands/health/BUILD.bazel @@ -13,7 +13,7 @@ cf_cc_binary( deps = [ "//cuttlefish/common/libs/utils:tee_logging", "//cuttlefish/host/libs/config:cuttlefish_config", - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:command", "//cuttlefish/process:managed_stdio", "//libbase", "@abseil-cpp//absl/log", diff --git a/base/cvd/cuttlefish/host/commands/health/health.cpp b/base/cvd/cuttlefish/host/commands/health/health.cpp index 6a1f9c9b4e2..49f93ff256b 100644 --- a/base/cvd/cuttlefish/host/commands/health/health.cpp +++ b/base/cvd/cuttlefish/host/commands/health/health.cpp @@ -23,7 +23,7 @@ #include "cuttlefish/common/libs/utils/tee_logging.h" #include "cuttlefish/host/libs/config/cuttlefish_config.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/command.h" #include "cuttlefish/process/managed_stdio.h" std::string GetControlSocketPath(const cuttlefish::CuttlefishConfig& config) { diff --git a/base/cvd/cuttlefish/host/commands/host_bugreport/BUILD.bazel b/base/cvd/cuttlefish/host/commands/host_bugreport/BUILD.bazel index df753ec4367..c1f26b0a1c5 100644 --- a/base/cvd/cuttlefish/host/commands/host_bugreport/BUILD.bazel +++ b/base/cvd/cuttlefish/host/commands/host_bugreport/BUILD.bazel @@ -17,7 +17,7 @@ cf_cc_binary( "//cuttlefish/host/libs/log_names", "//cuttlefish/host/libs/zip:zip_file", "//cuttlefish/posix:strerror", - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:command", "//cuttlefish/result", "//libbase", "@abseil-cpp//absl/log", diff --git a/base/cvd/cuttlefish/host/commands/host_bugreport/main.cc b/base/cvd/cuttlefish/host/commands/host_bugreport/main.cc index 0bf58843ebb..1436bf8ed15 100644 --- a/base/cvd/cuttlefish/host/commands/host_bugreport/main.cc +++ b/base/cvd/cuttlefish/host/commands/host_bugreport/main.cc @@ -33,7 +33,7 @@ #include "cuttlefish/host/libs/log_names/log_names.h" #include "cuttlefish/host/libs/zip/zip_file.h" #include "cuttlefish/posix/strerror.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/command.h" #include "cuttlefish/result/result.h" DEFINE_string(output, "host_bugreport.zip", "Where to write the output"); diff --git a/base/cvd/cuttlefish/host/commands/powerbtn_cvd/BUILD.bazel b/base/cvd/cuttlefish/host/commands/powerbtn_cvd/BUILD.bazel index e6fa2ffe613..382856840e6 100644 --- a/base/cvd/cuttlefish/host/commands/powerbtn_cvd/BUILD.bazel +++ b/base/cvd/cuttlefish/host/commands/powerbtn_cvd/BUILD.bazel @@ -14,7 +14,7 @@ cf_cc_binary( "//cuttlefish/common/libs/fs", "//cuttlefish/common/libs/utils:tee_logging", "//cuttlefish/host/libs/config:cuttlefish_config", - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:command", "//cuttlefish/process:managed_stdio", "//cuttlefish/result", "//libbase", diff --git a/base/cvd/cuttlefish/host/commands/powerbtn_cvd/powerbtn_cvd.cc b/base/cvd/cuttlefish/host/commands/powerbtn_cvd/powerbtn_cvd.cc index 089d30091db..3fe19bdd0fc 100644 --- a/base/cvd/cuttlefish/host/commands/powerbtn_cvd/powerbtn_cvd.cc +++ b/base/cvd/cuttlefish/host/commands/powerbtn_cvd/powerbtn_cvd.cc @@ -21,7 +21,7 @@ #include "cuttlefish/common/libs/utils/tee_logging.h" #include "cuttlefish/host/libs/config/cuttlefish_config.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/command.h" #include "cuttlefish/process/managed_stdio.h" #include "cuttlefish/result/result.h" diff --git a/base/cvd/cuttlefish/host/commands/run_cvd/BUILD.bazel b/base/cvd/cuttlefish/host/commands/run_cvd/BUILD.bazel index 75fde6efa76..33bc4b3acfc 100644 --- a/base/cvd/cuttlefish/host/commands/run_cvd/BUILD.bazel +++ b/base/cvd/cuttlefish/host/commands/run_cvd/BUILD.bazel @@ -28,7 +28,7 @@ cf_cc_library( "//cuttlefish/host/libs/feature", "//cuttlefish/host/libs/vm_manager", "//cuttlefish/posix:strerror", - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:command", "//cuttlefish/result", "//libbase", "@abseil-cpp//absl/log", @@ -155,7 +155,7 @@ cf_cc_library( "//cuttlefish/host/libs/process_monitor", "//cuttlefish/host/libs/vm_manager", "//cuttlefish/posix:strerror", - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:command", "//cuttlefish/process:execute", "//cuttlefish/process:subprocess_options", "//cuttlefish/result", diff --git a/base/cvd/cuttlefish/host/commands/run_cvd/boot_state_machine.cc b/base/cvd/cuttlefish/host/commands/run_cvd/boot_state_machine.cc index fb52ec22b1f..7062c988c73 100644 --- a/base/cvd/cuttlefish/host/commands/run_cvd/boot_state_machine.cc +++ b/base/cvd/cuttlefish/host/commands/run_cvd/boot_state_machine.cc @@ -67,7 +67,7 @@ #include "cuttlefish/host/libs/feature/kernel_log_pipe_provider.h" #include "cuttlefish/host/libs/vm_manager/vm_manager.h" #include "cuttlefish/posix/strerror.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/command.h" #include "cuttlefish/result/result.h" using grpc::ClientContext; diff --git a/base/cvd/cuttlefish/host/commands/run_cvd/launch/BUILD.bazel b/base/cvd/cuttlefish/host/commands/run_cvd/launch/BUILD.bazel index 061964f74b7..e1a69222c69 100644 --- a/base/cvd/cuttlefish/host/commands/run_cvd/launch/BUILD.bazel +++ b/base/cvd/cuttlefish/host/commands/run_cvd/launch/BUILD.bazel @@ -53,7 +53,7 @@ cf_cc_library( "//cuttlefish/host/libs/config:cuttlefish_config", "//cuttlefish/host/libs/config:known_paths", "//cuttlefish/host/libs/feature", - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:command", "//cuttlefish/result", ], ) @@ -67,7 +67,7 @@ cf_cc_library( "//cuttlefish/host/libs/config:cuttlefish_config", "//cuttlefish/host/libs/config:known_paths", "//cuttlefish/host/libs/feature", - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:command", "//cuttlefish/result", ], ) @@ -92,7 +92,7 @@ cf_cc_library( "//cuttlefish/host/libs/config:cuttlefish_config", "//cuttlefish/host/libs/config:known_paths", "//cuttlefish/host/libs/feature", - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:command", "//cuttlefish/result", ], ) @@ -106,7 +106,7 @@ cf_cc_library( "//cuttlefish/host/libs/config:cuttlefish_config", "//cuttlefish/host/libs/config:known_paths", "//cuttlefish/host/libs/feature", - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:command", "//cuttlefish/result", "@fruit", ], @@ -128,7 +128,7 @@ cf_cc_library( "//cuttlefish/host/libs/feature", "//cuttlefish/host/libs/vm_manager", "//cuttlefish/posix:strerror", - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:command", "//cuttlefish/process:subprocess", "//cuttlefish/result", "//libbase", @@ -189,7 +189,7 @@ cf_cc_library( "//cuttlefish/host/libs/config:guest_os", "//cuttlefish/host/libs/config:known_paths", "//cuttlefish/host/libs/feature", - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:command", "//cuttlefish/result", "//libbase", "@fmt", @@ -211,7 +211,7 @@ cf_cc_library( "//cuttlefish/host/libs/feature", "//cuttlefish/host/libs/feature:inject", "//cuttlefish/posix:strerror", - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:command", "//cuttlefish/result", "//libbase", "@abseil-cpp//absl/log:check", @@ -227,7 +227,7 @@ cf_cc_library( "//cuttlefish/common/libs/fs", "//cuttlefish/host/libs/config:config_utils", "//cuttlefish/host/libs/config:cuttlefish_config", - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:command", "//cuttlefish/result", "@fruit", ], @@ -243,7 +243,7 @@ cf_cc_library( "//cuttlefish/host/libs/config:cuttlefish_config", "//cuttlefish/host/libs/config:known_paths", "//cuttlefish/host/libs/feature", - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:command", "//cuttlefish/result", ], ) @@ -261,7 +261,7 @@ cf_cc_library( "//cuttlefish/host/libs/config:cuttlefish_config", "//cuttlefish/host/libs/feature", "//cuttlefish/host/libs/vm_manager", - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:command", "//cuttlefish/result", "//libbase", "@abseil-cpp//absl/strings", @@ -278,7 +278,7 @@ cf_cc_library( "//cuttlefish/host/libs/config:cuttlefish_config", "//cuttlefish/host/libs/config:known_paths", "//cuttlefish/host/libs/feature", - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:command", ], ) @@ -292,7 +292,7 @@ cf_cc_library( "//cuttlefish/host/libs/config:cuttlefish_config", "//cuttlefish/host/libs/config:known_paths", "//cuttlefish/host/libs/feature", - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:command", "//cuttlefish/process:subprocess", "//cuttlefish/result", "//libbase", @@ -311,7 +311,7 @@ cf_cc_library( "//cuttlefish/host/libs/config:cuttlefish_config", "//cuttlefish/host/libs/config:known_paths", "//cuttlefish/host/libs/feature", - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:command", "//cuttlefish/result", "@fruit", ], @@ -327,7 +327,7 @@ cf_cc_library( "//cuttlefish/host/libs/config:cuttlefish_config", "//cuttlefish/host/libs/config:known_paths", "//cuttlefish/host/libs/feature", - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:command", "//cuttlefish/result", ], ) @@ -368,7 +368,7 @@ cf_cc_library( "//cuttlefish/host/libs/config:known_paths", "//cuttlefish/host/libs/feature", "//cuttlefish/host/libs/log_names", - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:command", "//cuttlefish/result", "@fruit", ], @@ -397,7 +397,7 @@ cf_cc_library( "//cuttlefish/host/libs/config:cuttlefish_config", "//cuttlefish/host/libs/config:known_paths", "//cuttlefish/host/libs/feature", - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:command", "//cuttlefish/result", "@fruit", ], @@ -411,7 +411,7 @@ cf_cc_library( "//cuttlefish/host/commands/run_cvd/launch:grpc_socket_creator", "//cuttlefish/host/libs/config:known_paths", "//cuttlefish/host/libs/feature", - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:command", "//cuttlefish/result", ], ) @@ -429,7 +429,7 @@ cf_cc_library( "//cuttlefish/host/libs/config:known_paths", "//cuttlefish/host/libs/config:secure_hals", "//cuttlefish/host/libs/feature", - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:command", "//cuttlefish/result", ], ) @@ -445,7 +445,7 @@ cf_cc_library( "//cuttlefish/host/libs/config:cuttlefish_config", "//cuttlefish/host/libs/config:known_paths", "//cuttlefish/host/libs/feature", - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:command", "//cuttlefish/result", ], ) @@ -496,7 +496,7 @@ cf_cc_library( "//cuttlefish/host/libs/config:known_paths", "//cuttlefish/host/libs/feature", "//cuttlefish/posix:strerror", - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:command", "//cuttlefish/process:subprocess", "//cuttlefish/result", "//libbase", @@ -519,7 +519,7 @@ cf_cc_library( "//cuttlefish/host/libs/config:cuttlefish_config", "//cuttlefish/host/libs/feature", "//cuttlefish/host/libs/vm_manager", - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:command", "//cuttlefish/result", "//libbase", "@abseil-cpp//absl/log", @@ -540,7 +540,7 @@ cf_cc_library( "//cuttlefish/host/libs/config:known_paths", "//cuttlefish/host/libs/feature", "//cuttlefish/posix:strerror", - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:command", "//cuttlefish/result", "//libbase", "@abseil-cpp//absl/log", @@ -557,7 +557,7 @@ cf_cc_library( "//cuttlefish/host/libs/config:config_utils", "//cuttlefish/host/libs/config:cuttlefish_config", "//cuttlefish/host/libs/feature", - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:command", "//cuttlefish/result", ], ) @@ -572,7 +572,7 @@ cf_cc_library( "//cuttlefish/host/libs/config:known_paths", "//cuttlefish/host/libs/feature", "//cuttlefish/host/libs/vhal_proxy_server", - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:command", "@fmt", ], ) @@ -591,7 +591,7 @@ cf_cc_library( "//cuttlefish/host/libs/config:known_paths", "//cuttlefish/host/libs/feature", "//cuttlefish/host/libs/vm_manager", - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:command", "//cuttlefish/result", "//libbase", "@abseil-cpp//absl/log", @@ -614,7 +614,7 @@ cf_cc_library( "//cuttlefish/host/libs/config:guest_os", "//cuttlefish/host/libs/config:known_paths", "//cuttlefish/host/libs/feature", - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:command", "//cuttlefish/result", "//libbase", "@abseil-cpp//absl/log", @@ -654,7 +654,7 @@ cf_cc_library( "//cuttlefish/host/libs/config:known_paths", "//cuttlefish/host/libs/feature", "//cuttlefish/host/libs/vm_manager", - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:command", "//cuttlefish/result", "@fruit", ], diff --git a/base/cvd/cuttlefish/host/commands/run_cvd/launch/casimir.cpp b/base/cvd/cuttlefish/host/commands/run_cvd/launch/casimir.cpp index 1c485e6aa26..b9d97d058aa 100644 --- a/base/cvd/cuttlefish/host/commands/run_cvd/launch/casimir.cpp +++ b/base/cvd/cuttlefish/host/commands/run_cvd/launch/casimir.cpp @@ -24,7 +24,7 @@ #include "cuttlefish/host/libs/config/cuttlefish_config.h" #include "cuttlefish/host/libs/config/known_paths.h" #include "cuttlefish/host/libs/feature/command_source.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/command.h" #include "cuttlefish/result/result.h" namespace cuttlefish { diff --git a/base/cvd/cuttlefish/host/commands/run_cvd/launch/casimir_control_server.cpp b/base/cvd/cuttlefish/host/commands/run_cvd/launch/casimir_control_server.cpp index 2db23b7a4cc..3ac5e8d3ca1 100644 --- a/base/cvd/cuttlefish/host/commands/run_cvd/launch/casimir_control_server.cpp +++ b/base/cvd/cuttlefish/host/commands/run_cvd/launch/casimir_control_server.cpp @@ -23,7 +23,7 @@ #include "cuttlefish/host/libs/config/cuttlefish_config.h" #include "cuttlefish/host/libs/config/known_paths.h" #include "cuttlefish/host/libs/feature/command_source.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/command.h" #include "cuttlefish/result/result.h" namespace cuttlefish { diff --git a/base/cvd/cuttlefish/host/commands/run_cvd/launch/console_forwarder.cpp b/base/cvd/cuttlefish/host/commands/run_cvd/launch/console_forwarder.cpp index 0a2790fb079..079284575de 100644 --- a/base/cvd/cuttlefish/host/commands/run_cvd/launch/console_forwarder.cpp +++ b/base/cvd/cuttlefish/host/commands/run_cvd/launch/console_forwarder.cpp @@ -23,7 +23,7 @@ #include "cuttlefish/host/libs/config/cuttlefish_config.h" #include "cuttlefish/host/libs/config/known_paths.h" #include "cuttlefish/host/libs/feature/command_source.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/command.h" #include "cuttlefish/result/result.h" namespace cuttlefish { diff --git a/base/cvd/cuttlefish/host/commands/run_cvd/launch/control_env_proxy_server.cpp b/base/cvd/cuttlefish/host/commands/run_cvd/launch/control_env_proxy_server.cpp index 828f7946827..66488a4d06f 100644 --- a/base/cvd/cuttlefish/host/commands/run_cvd/launch/control_env_proxy_server.cpp +++ b/base/cvd/cuttlefish/host/commands/run_cvd/launch/control_env_proxy_server.cpp @@ -29,7 +29,7 @@ #include "cuttlefish/host/libs/config/known_paths.h" #include "cuttlefish/host/libs/feature/command_source.h" #include "cuttlefish/host/libs/feature/feature.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/command.h" #include "cuttlefish/result/result.h" namespace cuttlefish { diff --git a/base/cvd/cuttlefish/host/commands/run_cvd/launch/cvdalloc.cpp b/base/cvd/cuttlefish/host/commands/run_cvd/launch/cvdalloc.cpp index a59611a1f29..495b9ad2a4f 100644 --- a/base/cvd/cuttlefish/host/commands/run_cvd/launch/cvdalloc.cpp +++ b/base/cvd/cuttlefish/host/commands/run_cvd/launch/cvdalloc.cpp @@ -40,7 +40,7 @@ #include "cuttlefish/host/libs/feature/feature.h" #include "cuttlefish/host/libs/vm_manager/vm_manager.h" #include "cuttlefish/posix/strerror.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/command.h" #include "cuttlefish/process/subprocess.h" #include "cuttlefish/result/result.h" diff --git a/base/cvd/cuttlefish/host/commands/run_cvd/launch/input_connections_provider.cc b/base/cvd/cuttlefish/host/commands/run_cvd/launch/input_connections_provider.cc index e3b2ee4399e..e62906f2ace 100644 --- a/base/cvd/cuttlefish/host/commands/run_cvd/launch/input_connections_provider.cc +++ b/base/cvd/cuttlefish/host/commands/run_cvd/launch/input_connections_provider.cc @@ -40,7 +40,7 @@ #include "cuttlefish/host/libs/config/known_paths.h" #include "cuttlefish/host/libs/feature/command_source.h" #include "cuttlefish/host/libs/feature/feature.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/command.h" #include "cuttlefish/result/result.h" namespace cuttlefish { diff --git a/base/cvd/cuttlefish/host/commands/run_cvd/launch/kernel_log_monitor.cpp b/base/cvd/cuttlefish/host/commands/run_cvd/launch/kernel_log_monitor.cpp index 42cc0116091..a720e6d7af8 100644 --- a/base/cvd/cuttlefish/host/commands/run_cvd/launch/kernel_log_monitor.cpp +++ b/base/cvd/cuttlefish/host/commands/run_cvd/launch/kernel_log_monitor.cpp @@ -38,7 +38,7 @@ #include "cuttlefish/host/libs/feature/inject.h" #include "cuttlefish/host/libs/feature/kernel_log_pipe_provider.h" #include "cuttlefish/posix/strerror.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/command.h" #include "cuttlefish/result/result.h" namespace cuttlefish { diff --git a/base/cvd/cuttlefish/host/commands/run_cvd/launch/log_tee_creator.cpp b/base/cvd/cuttlefish/host/commands/run_cvd/launch/log_tee_creator.cpp index 4d1071cd71b..b2c54ec48bd 100644 --- a/base/cvd/cuttlefish/host/commands/run_cvd/launch/log_tee_creator.cpp +++ b/base/cvd/cuttlefish/host/commands/run_cvd/launch/log_tee_creator.cpp @@ -22,7 +22,7 @@ #include "cuttlefish/common/libs/fs/shared_fd.h" #include "cuttlefish/host/libs/config/config_utils.h" #include "cuttlefish/host/libs/config/cuttlefish_config.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/command.h" #include "cuttlefish/result/result.h" namespace cuttlefish { diff --git a/base/cvd/cuttlefish/host/commands/run_cvd/launch/log_tee_creator.h b/base/cvd/cuttlefish/host/commands/run_cvd/launch/log_tee_creator.h index db9ae240913..913c7606987 100644 --- a/base/cvd/cuttlefish/host/commands/run_cvd/launch/log_tee_creator.h +++ b/base/cvd/cuttlefish/host/commands/run_cvd/launch/log_tee_creator.h @@ -20,7 +20,7 @@ #include "fruit/fruit.h" #include "cuttlefish/host/libs/config/cuttlefish_config.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/command.h" #include "cuttlefish/result/result.h" namespace cuttlefish { diff --git a/base/cvd/cuttlefish/host/commands/run_cvd/launch/logcat_receiver.cpp b/base/cvd/cuttlefish/host/commands/run_cvd/launch/logcat_receiver.cpp index ef225204d06..b35597ea39f 100644 --- a/base/cvd/cuttlefish/host/commands/run_cvd/launch/logcat_receiver.cpp +++ b/base/cvd/cuttlefish/host/commands/run_cvd/launch/logcat_receiver.cpp @@ -22,7 +22,7 @@ #include "cuttlefish/host/libs/config/cuttlefish_config.h" #include "cuttlefish/host/libs/config/known_paths.h" #include "cuttlefish/host/libs/feature/command_source.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/command.h" #include "cuttlefish/result/result.h" namespace cuttlefish { diff --git a/base/cvd/cuttlefish/host/commands/run_cvd/launch/mcu.cpp b/base/cvd/cuttlefish/host/commands/run_cvd/launch/mcu.cpp index 081b01fba79..cf742d9037f 100644 --- a/base/cvd/cuttlefish/host/commands/run_cvd/launch/mcu.cpp +++ b/base/cvd/cuttlefish/host/commands/run_cvd/launch/mcu.cpp @@ -33,7 +33,7 @@ #include "cuttlefish/host/libs/feature/command_source.h" #include "cuttlefish/host/libs/feature/feature.h" #include "cuttlefish/host/libs/vm_manager/vm_manager.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/command.h" #include "cuttlefish/result/result.h" // timeout for the MCU channels to be created after the start command is issued diff --git a/base/cvd/cuttlefish/host/commands/run_cvd/launch/metrics.cpp b/base/cvd/cuttlefish/host/commands/run_cvd/launch/metrics.cpp index d8364a599ed..7e01646a7fa 100644 --- a/base/cvd/cuttlefish/host/commands/run_cvd/launch/metrics.cpp +++ b/base/cvd/cuttlefish/host/commands/run_cvd/launch/metrics.cpp @@ -20,7 +20,7 @@ #include "cuttlefish/host/libs/config/cuttlefish_config.h" #include "cuttlefish/host/libs/config/known_paths.h" #include "cuttlefish/host/libs/feature/command_source.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/command.h" namespace cuttlefish { diff --git a/base/cvd/cuttlefish/host/commands/run_cvd/launch/modem.cpp b/base/cvd/cuttlefish/host/commands/run_cvd/launch/modem.cpp index baa7f150a88..84c27eb6676 100644 --- a/base/cvd/cuttlefish/host/commands/run_cvd/launch/modem.cpp +++ b/base/cvd/cuttlefish/host/commands/run_cvd/launch/modem.cpp @@ -28,7 +28,7 @@ #include "cuttlefish/host/libs/config/cuttlefish_config.h" #include "cuttlefish/host/libs/config/known_paths.h" #include "cuttlefish/host/libs/feature/command_source.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/command.h" #include "cuttlefish/process/subprocess.h" #include "cuttlefish/result/result.h" diff --git a/base/cvd/cuttlefish/host/commands/run_cvd/launch/netsim_server.cpp b/base/cvd/cuttlefish/host/commands/run_cvd/launch/netsim_server.cpp index 2c538f230b0..b9157139215 100644 --- a/base/cvd/cuttlefish/host/commands/run_cvd/launch/netsim_server.cpp +++ b/base/cvd/cuttlefish/host/commands/run_cvd/launch/netsim_server.cpp @@ -31,7 +31,7 @@ #include "cuttlefish/host/libs/config/known_paths.h" #include "cuttlefish/host/libs/feature/command_source.h" #include "cuttlefish/host/libs/feature/feature.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/command.h" #include "cuttlefish/result/result.h" namespace cuttlefish { diff --git a/base/cvd/cuttlefish/host/commands/run_cvd/launch/nfc_connector.cpp b/base/cvd/cuttlefish/host/commands/run_cvd/launch/nfc_connector.cpp index 136c36e7f70..dbb9f9eb454 100644 --- a/base/cvd/cuttlefish/host/commands/run_cvd/launch/nfc_connector.cpp +++ b/base/cvd/cuttlefish/host/commands/run_cvd/launch/nfc_connector.cpp @@ -26,7 +26,7 @@ #include "cuttlefish/host/libs/config/cuttlefish_config.h" #include "cuttlefish/host/libs/config/known_paths.h" #include "cuttlefish/host/libs/feature/command_source.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/command.h" #include "cuttlefish/result/result.h" constexpr const size_t kBufferSize = 1024; diff --git a/base/cvd/cuttlefish/host/commands/run_cvd/launch/openwrt_control_server.cpp b/base/cvd/cuttlefish/host/commands/run_cvd/launch/openwrt_control_server.cpp index 812d07c874d..8196210a6cd 100644 --- a/base/cvd/cuttlefish/host/commands/run_cvd/launch/openwrt_control_server.cpp +++ b/base/cvd/cuttlefish/host/commands/run_cvd/launch/openwrt_control_server.cpp @@ -31,7 +31,7 @@ #include "cuttlefish/host/libs/feature/command_source.h" #include "cuttlefish/host/libs/feature/feature.h" #include "cuttlefish/host/libs/log_names/log_names.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/command.h" #include "cuttlefish/result/result.h" namespace cuttlefish { diff --git a/base/cvd/cuttlefish/host/commands/run_cvd/launch/root_canal.cpp b/base/cvd/cuttlefish/host/commands/run_cvd/launch/root_canal.cpp index 875c3e06e31..4082cc5b213 100644 --- a/base/cvd/cuttlefish/host/commands/run_cvd/launch/root_canal.cpp +++ b/base/cvd/cuttlefish/host/commands/run_cvd/launch/root_canal.cpp @@ -29,7 +29,7 @@ #include "cuttlefish/host/libs/config/known_paths.h" #include "cuttlefish/host/libs/feature/command_source.h" #include "cuttlefish/host/libs/feature/feature.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/command.h" #include "cuttlefish/result/result.h" namespace cuttlefish { diff --git a/base/cvd/cuttlefish/host/commands/run_cvd/launch/screen_recording_server.cpp b/base/cvd/cuttlefish/host/commands/run_cvd/launch/screen_recording_server.cpp index dff25e3d8fa..5be81b230c0 100644 --- a/base/cvd/cuttlefish/host/commands/run_cvd/launch/screen_recording_server.cpp +++ b/base/cvd/cuttlefish/host/commands/run_cvd/launch/screen_recording_server.cpp @@ -21,7 +21,7 @@ #include "cuttlefish/host/commands/run_cvd/launch/grpc_socket_creator.h" #include "cuttlefish/host/libs/config/known_paths.h" #include "cuttlefish/host/libs/feature/command_source.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/command.h" #include "cuttlefish/result/result.h" namespace cuttlefish { diff --git a/base/cvd/cuttlefish/host/commands/run_cvd/launch/secure_env.cpp b/base/cvd/cuttlefish/host/commands/run_cvd/launch/secure_env.cpp index 8541e45ea05..c01e357e05e 100644 --- a/base/cvd/cuttlefish/host/commands/run_cvd/launch/secure_env.cpp +++ b/base/cvd/cuttlefish/host/commands/run_cvd/launch/secure_env.cpp @@ -25,7 +25,7 @@ #include "cuttlefish/host/libs/config/secure_hals.h" #include "cuttlefish/host/libs/feature/command_source.h" #include "cuttlefish/host/libs/feature/kernel_log_pipe_provider.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/command.h" #include "cuttlefish/result/result.h" namespace cuttlefish { diff --git a/base/cvd/cuttlefish/host/commands/run_cvd/launch/sensors_simulator.cpp b/base/cvd/cuttlefish/host/commands/run_cvd/launch/sensors_simulator.cpp index 777505799c7..23838065a44 100644 --- a/base/cvd/cuttlefish/host/commands/run_cvd/launch/sensors_simulator.cpp +++ b/base/cvd/cuttlefish/host/commands/run_cvd/launch/sensors_simulator.cpp @@ -24,7 +24,7 @@ #include "cuttlefish/host/libs/config/known_paths.h" #include "cuttlefish/host/libs/feature/command_source.h" #include "cuttlefish/host/libs/feature/kernel_log_pipe_provider.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/command.h" #include "cuttlefish/result/result.h" namespace cuttlefish { diff --git a/base/cvd/cuttlefish/host/commands/run_cvd/launch/streamer.cpp b/base/cvd/cuttlefish/host/commands/run_cvd/launch/streamer.cpp index 5229d83f29a..74d182d1e8e 100644 --- a/base/cvd/cuttlefish/host/commands/run_cvd/launch/streamer.cpp +++ b/base/cvd/cuttlefish/host/commands/run_cvd/launch/streamer.cpp @@ -45,7 +45,7 @@ #include "cuttlefish/host/libs/feature/feature.h" #include "cuttlefish/host/libs/feature/kernel_log_pipe_provider.h" #include "cuttlefish/posix/strerror.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/command.h" #include "cuttlefish/process/subprocess.h" #include "cuttlefish/result/result.h" diff --git a/base/cvd/cuttlefish/host/commands/run_cvd/launch/ti50_emulator.cpp b/base/cvd/cuttlefish/host/commands/run_cvd/launch/ti50_emulator.cpp index 614fe487299..50504a45f19 100644 --- a/base/cvd/cuttlefish/host/commands/run_cvd/launch/ti50_emulator.cpp +++ b/base/cvd/cuttlefish/host/commands/run_cvd/launch/ti50_emulator.cpp @@ -41,7 +41,7 @@ #include "cuttlefish/host/libs/feature/command_source.h" #include "cuttlefish/host/libs/feature/feature.h" #include "cuttlefish/host/libs/vm_manager/vm_manager.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/command.h" #include "cuttlefish/result/result.h" namespace cuttlefish { diff --git a/base/cvd/cuttlefish/host/commands/run_cvd/launch/tombstone_receiver.cpp b/base/cvd/cuttlefish/host/commands/run_cvd/launch/tombstone_receiver.cpp index 3d3e977ea65..42b6aa83c6a 100644 --- a/base/cvd/cuttlefish/host/commands/run_cvd/launch/tombstone_receiver.cpp +++ b/base/cvd/cuttlefish/host/commands/run_cvd/launch/tombstone_receiver.cpp @@ -29,7 +29,7 @@ #include "cuttlefish/host/libs/config/known_paths.h" #include "cuttlefish/host/libs/feature/command_source.h" #include "cuttlefish/posix/strerror.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/command.h" #include "cuttlefish/result/result.h" namespace cuttlefish { diff --git a/base/cvd/cuttlefish/host/commands/run_cvd/launch/uwb_connector.cpp b/base/cvd/cuttlefish/host/commands/run_cvd/launch/uwb_connector.cpp index f41bad190e1..ca39baf3a72 100644 --- a/base/cvd/cuttlefish/host/commands/run_cvd/launch/uwb_connector.cpp +++ b/base/cvd/cuttlefish/host/commands/run_cvd/launch/uwb_connector.cpp @@ -26,7 +26,7 @@ #include "cuttlefish/host/libs/config/config_utils.h" #include "cuttlefish/host/libs/config/cuttlefish_config.h" #include "cuttlefish/host/libs/feature/command_source.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/command.h" #include "cuttlefish/result/result.h" #define UCI_HEADER_SIZE 4 diff --git a/base/cvd/cuttlefish/host/commands/run_cvd/launch/vhal_proxy_server.cpp b/base/cvd/cuttlefish/host/commands/run_cvd/launch/vhal_proxy_server.cpp index 77517f7132a..77d44fbd597 100644 --- a/base/cvd/cuttlefish/host/commands/run_cvd/launch/vhal_proxy_server.cpp +++ b/base/cvd/cuttlefish/host/commands/run_cvd/launch/vhal_proxy_server.cpp @@ -27,7 +27,7 @@ #include "cuttlefish/host/libs/config/known_paths.h" #include "cuttlefish/host/libs/feature/command_source.h" #include "cuttlefish/host/libs/vhal_proxy_server/vhal_proxy_server_eth_addr.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/command.h" namespace cuttlefish { diff --git a/base/cvd/cuttlefish/host/commands/run_cvd/launch/vhost_device_vsock.cpp b/base/cvd/cuttlefish/host/commands/run_cvd/launch/vhost_device_vsock.cpp index 41dbf3effc7..848b8b5e312 100644 --- a/base/cvd/cuttlefish/host/commands/run_cvd/launch/vhost_device_vsock.cpp +++ b/base/cvd/cuttlefish/host/commands/run_cvd/launch/vhost_device_vsock.cpp @@ -38,7 +38,7 @@ #include "cuttlefish/host/libs/feature/command_source.h" #include "cuttlefish/host/libs/feature/feature.h" #include "cuttlefish/host/libs/vm_manager/vm_manager.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/command.h" #include "cuttlefish/result/result.h" namespace cuttlefish { diff --git a/base/cvd/cuttlefish/host/commands/run_cvd/launch/vhost_user_media_devices.cpp b/base/cvd/cuttlefish/host/commands/run_cvd/launch/vhost_user_media_devices.cpp index b6e76746abe..420b10f5a02 100644 --- a/base/cvd/cuttlefish/host/commands/run_cvd/launch/vhost_user_media_devices.cpp +++ b/base/cvd/cuttlefish/host/commands/run_cvd/launch/vhost_user_media_devices.cpp @@ -32,7 +32,7 @@ #include "cuttlefish/host/libs/config/known_paths.h" #include "cuttlefish/host/libs/feature/command_source.h" #include "cuttlefish/host/libs/feature/feature.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/command.h" #include "cuttlefish/result/result.h" namespace cuttlefish { diff --git a/base/cvd/cuttlefish/host/commands/run_cvd/launch/wmediumd_server.cpp b/base/cvd/cuttlefish/host/commands/run_cvd/launch/wmediumd_server.cpp index 19ce733f66f..32bd60fd150 100644 --- a/base/cvd/cuttlefish/host/commands/run_cvd/launch/wmediumd_server.cpp +++ b/base/cvd/cuttlefish/host/commands/run_cvd/launch/wmediumd_server.cpp @@ -32,7 +32,7 @@ #include "cuttlefish/host/libs/feature/command_source.h" #include "cuttlefish/host/libs/feature/feature.h" #include "cuttlefish/host/libs/vm_manager/vm_manager.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/command.h" #include "cuttlefish/result/result.h" namespace cuttlefish { diff --git a/base/cvd/cuttlefish/host/commands/run_cvd/server_loop_impl.cpp b/base/cvd/cuttlefish/host/commands/run_cvd/server_loop_impl.cpp index d7046673c5a..7acfb353238 100644 --- a/base/cvd/cuttlefish/host/commands/run_cvd/server_loop_impl.cpp +++ b/base/cvd/cuttlefish/host/commands/run_cvd/server_loop_impl.cpp @@ -50,7 +50,7 @@ #include "cuttlefish/host/libs/feature/command_source.h" #include "cuttlefish/host/libs/process_monitor/process_monitor.h" #include "cuttlefish/posix/strerror.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/command.h" #include "cuttlefish/result/result.h" namespace cuttlefish { diff --git a/base/cvd/cuttlefish/host/commands/run_cvd/server_loop_impl_snapshot.cpp b/base/cvd/cuttlefish/host/commands/run_cvd/server_loop_impl_snapshot.cpp index 469de0dbc13..cd5e0022178 100644 --- a/base/cvd/cuttlefish/host/commands/run_cvd/server_loop_impl_snapshot.cpp +++ b/base/cvd/cuttlefish/host/commands/run_cvd/server_loop_impl_snapshot.cpp @@ -41,7 +41,7 @@ #include "cuttlefish/host/libs/config/cuttlefish_config.h" #include "cuttlefish/host/libs/config/vmm_mode.h" #include "cuttlefish/host/libs/process_monitor/process_monitor.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/command.h" #include "cuttlefish/process/execute.h" #include "cuttlefish/process/subprocess_options.h" #include "cuttlefish/result/result.h" diff --git a/base/cvd/cuttlefish/host/commands/start/BUILD.bazel b/base/cvd/cuttlefish/host/commands/start/BUILD.bazel index 725480fd2c6..d8d71af8857 100644 --- a/base/cvd/cuttlefish/host/commands/start/BUILD.bazel +++ b/base/cvd/cuttlefish/host/commands/start/BUILD.bazel @@ -39,8 +39,8 @@ cf_cc_binary( "//cuttlefish/posix:symlink", "//cuttlefish/process:command", "//cuttlefish/process:managed_stdio", - "//cuttlefish/process:subprocess_options", "//cuttlefish/process:subprocess", + "//cuttlefish/process:subprocess_options", "//libbase", "@abseil-cpp//absl/base:no_destructor", "@abseil-cpp//absl/log", diff --git a/base/cvd/cuttlefish/host/commands/start/flag_forwarder.cc b/base/cvd/cuttlefish/host/commands/start/flag_forwarder.cc index 906b934794c..d31f742be18 100644 --- a/base/cvd/cuttlefish/host/commands/start/flag_forwarder.cc +++ b/base/cvd/cuttlefish/host/commands/start/flag_forwarder.cc @@ -32,7 +32,7 @@ #include "cuttlefish/common/libs/utils/contains.h" #include "cuttlefish/common/libs/utils/gflags_xml_parser.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/command.h" #include "cuttlefish/process/managed_stdio.h" #include "cuttlefish/process/subprocess_options.h" diff --git a/base/cvd/cuttlefish/host/libs/avb/BUILD.bazel b/base/cvd/cuttlefish/host/libs/avb/BUILD.bazel index 3483e1fb8cb..2bb15cd5dd6 100644 --- a/base/cvd/cuttlefish/host/libs/avb/BUILD.bazel +++ b/base/cvd/cuttlefish/host/libs/avb/BUILD.bazel @@ -12,7 +12,7 @@ cf_cc_library( "//cuttlefish/common/libs/fs", "//cuttlefish/common/libs/utils:files", "//cuttlefish/host/libs/config:known_paths", - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:command", "//cuttlefish/result", ], ) diff --git a/base/cvd/cuttlefish/host/libs/avb/avb.cpp b/base/cvd/cuttlefish/host/libs/avb/avb.cpp index e8f6eacc842..22fc8e30596 100644 --- a/base/cvd/cuttlefish/host/libs/avb/avb.cpp +++ b/base/cvd/cuttlefish/host/libs/avb/avb.cpp @@ -25,7 +25,7 @@ #include "cuttlefish/common/libs/fs/shared_fd.h" #include "cuttlefish/common/libs/utils/files.h" #include "cuttlefish/host/libs/config/known_paths.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/command.h" #include "cuttlefish/result/result.h" namespace cuttlefish { diff --git a/base/cvd/cuttlefish/host/libs/avb/avb.h b/base/cvd/cuttlefish/host/libs/avb/avb.h index a32a2284765..a2961177602 100644 --- a/base/cvd/cuttlefish/host/libs/avb/avb.h +++ b/base/cvd/cuttlefish/host/libs/avb/avb.h @@ -22,7 +22,7 @@ #include #include "cuttlefish/common/libs/fs/shared_fd.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/command.h" #include "cuttlefish/result/result.h" namespace cuttlefish { diff --git a/base/cvd/cuttlefish/host/libs/config/BUILD.bazel b/base/cvd/cuttlefish/host/libs/config/BUILD.bazel index 601c249c2db..219dff81f20 100644 --- a/base/cvd/cuttlefish/host/libs/config/BUILD.bazel +++ b/base/cvd/cuttlefish/host/libs/config/BUILD.bazel @@ -164,7 +164,7 @@ cf_cc_library( "//cuttlefish/host/libs/config:openwrt_args", "//cuttlefish/host/libs/config/esp:make_fat_image", "//cuttlefish/host/libs/image_aggregator:mbr", - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:command", "//cuttlefish/process:execute", "//cuttlefish/process:managed_stdio", "//cuttlefish/result", diff --git a/base/cvd/cuttlefish/host/libs/config/adb/BUILD.bazel b/base/cvd/cuttlefish/host/libs/config/adb/BUILD.bazel index e10f8abcc15..41337754034 100644 --- a/base/cvd/cuttlefish/host/libs/config/adb/BUILD.bazel +++ b/base/cvd/cuttlefish/host/libs/config/adb/BUILD.bazel @@ -24,7 +24,7 @@ cf_cc_library( "//cuttlefish/host/libs/config:cuttlefish_config", "//cuttlefish/host/libs/config:known_paths", "//cuttlefish/host/libs/feature", - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:command", "//cuttlefish/result", "//libbase", "@abseil-cpp//absl/log", diff --git a/base/cvd/cuttlefish/host/libs/config/adb/launch.cpp b/base/cvd/cuttlefish/host/libs/config/adb/launch.cpp index 4b031ecb676..e683dec6120 100644 --- a/base/cvd/cuttlefish/host/libs/config/adb/launch.cpp +++ b/base/cvd/cuttlefish/host/libs/config/adb/launch.cpp @@ -30,7 +30,7 @@ #include "cuttlefish/host/libs/feature/command_source.h" #include "cuttlefish/host/libs/feature/feature.h" #include "cuttlefish/host/libs/feature/kernel_log_pipe_provider.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/command.h" #include "cuttlefish/result/result.h" namespace cuttlefish { diff --git a/base/cvd/cuttlefish/host/libs/config/data_image.cpp b/base/cvd/cuttlefish/host/libs/config/data_image.cpp index 38ad1d26516..5df5e516770 100644 --- a/base/cvd/cuttlefish/host/libs/config/data_image.cpp +++ b/base/cvd/cuttlefish/host/libs/config/data_image.cpp @@ -39,7 +39,7 @@ #include "cuttlefish/host/libs/config/esp/make_fat_image.h" #include "cuttlefish/host/libs/config/openwrt_args.h" #include "cuttlefish/host/libs/image_aggregator/mbr.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/command.h" #include "cuttlefish/process/execute.h" #include "cuttlefish/process/managed_stdio.h" #include "cuttlefish/result/result.h" diff --git a/base/cvd/cuttlefish/host/libs/config/fastboot/BUILD.bazel b/base/cvd/cuttlefish/host/libs/config/fastboot/BUILD.bazel index d1a5f9f34cc..63d6b35c4a3 100644 --- a/base/cvd/cuttlefish/host/libs/config/fastboot/BUILD.bazel +++ b/base/cvd/cuttlefish/host/libs/config/fastboot/BUILD.bazel @@ -23,7 +23,7 @@ cf_cc_library( "//cuttlefish/host/libs/config:cuttlefish_config", "//cuttlefish/host/libs/config:known_paths", "//cuttlefish/host/libs/feature", - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:command", "//cuttlefish/result", "//libbase", "@abseil-cpp//absl/log", diff --git a/base/cvd/cuttlefish/host/libs/config/fastboot/launch.cpp b/base/cvd/cuttlefish/host/libs/config/fastboot/launch.cpp index 50d4a66f559..44a0b352434 100644 --- a/base/cvd/cuttlefish/host/libs/config/fastboot/launch.cpp +++ b/base/cvd/cuttlefish/host/libs/config/fastboot/launch.cpp @@ -30,7 +30,7 @@ #include "cuttlefish/host/libs/feature/command_source.h" #include "cuttlefish/host/libs/feature/feature.h" #include "cuttlefish/host/libs/feature/kernel_log_pipe_provider.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/command.h" #include "cuttlefish/result/result.h" namespace cuttlefish { diff --git a/base/cvd/cuttlefish/host/libs/feature/BUILD.bazel b/base/cvd/cuttlefish/host/libs/feature/BUILD.bazel index bfbe880922a..39d297476d7 100644 --- a/base/cvd/cuttlefish/host/libs/feature/BUILD.bazel +++ b/base/cvd/cuttlefish/host/libs/feature/BUILD.bazel @@ -16,7 +16,7 @@ cf_cc_library( deps = [ "//cuttlefish/common/libs/fs", "//cuttlefish/common/libs/utils:type_name", - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:command", "//cuttlefish/result", "//libbase", "@abseil-cpp//absl/log", diff --git a/base/cvd/cuttlefish/host/libs/feature/command_source.h b/base/cvd/cuttlefish/host/libs/feature/command_source.h index 2ad35ff898e..f47b496782b 100644 --- a/base/cvd/cuttlefish/host/libs/feature/command_source.h +++ b/base/cvd/cuttlefish/host/libs/feature/command_source.h @@ -21,7 +21,7 @@ #include "fruit/fruit.h" #include "cuttlefish/host/libs/feature/feature.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/command.h" #include "cuttlefish/result/result.h" namespace cuttlefish { diff --git a/base/cvd/cuttlefish/host/libs/image_aggregator/BUILD.bazel b/base/cvd/cuttlefish/host/libs/image_aggregator/BUILD.bazel index d10c59d5b34..5c670d4a680 100644 --- a/base/cvd/cuttlefish/host/libs/image_aggregator/BUILD.bazel +++ b/base/cvd/cuttlefish/host/libs/image_aggregator/BUILD.bazel @@ -96,7 +96,7 @@ cf_cc_library( "//cuttlefish/host/libs/image_aggregator:image_from_file", "//cuttlefish/host/libs/image_aggregator:mbr", "//cuttlefish/host/libs/image_aggregator:sparse_image", - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:command", "//cuttlefish/result", "//libbase", "@android_system_core//:libsparse", @@ -174,7 +174,7 @@ cf_cc_library( "//cuttlefish/common/libs/fs", "//cuttlefish/common/libs/utils:cf_endian", "//cuttlefish/host/libs/image_aggregator:disk_image", - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:command", "//cuttlefish/process:managed_stdio", "//cuttlefish/result", ], diff --git a/base/cvd/cuttlefish/host/libs/image_aggregator/qcow2.cc b/base/cvd/cuttlefish/host/libs/image_aggregator/qcow2.cc index 2616c310766..780366d08b2 100644 --- a/base/cvd/cuttlefish/host/libs/image_aggregator/qcow2.cc +++ b/base/cvd/cuttlefish/host/libs/image_aggregator/qcow2.cc @@ -22,7 +22,7 @@ #include "cuttlefish/common/libs/fs/shared_buf.h" #include "cuttlefish/common/libs/fs/shared_fd.h" #include "cuttlefish/common/libs/utils/cf_endian.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/command.h" #include "cuttlefish/process/managed_stdio.h" namespace cuttlefish { diff --git a/base/cvd/cuttlefish/host/libs/metrics/BUILD.bazel b/base/cvd/cuttlefish/host/libs/metrics/BUILD.bazel index 860d174691e..64e767f31e0 100644 --- a/base/cvd/cuttlefish/host/libs/metrics/BUILD.bazel +++ b/base/cvd/cuttlefish/host/libs/metrics/BUILD.bazel @@ -237,7 +237,7 @@ cf_cc_library( deps = [ "//cuttlefish/common/libs/utils:base64", "//cuttlefish/host/libs/metrics:metrics_environment", - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:command", "//cuttlefish/process:managed_stdio", "//cuttlefish/result", "//external_proto:cf_log_cc_proto", diff --git a/base/cvd/cuttlefish/host/libs/metrics/metrics_transmitter.cc b/base/cvd/cuttlefish/host/libs/metrics/metrics_transmitter.cc index 345a87c8db1..16d21b33a97 100644 --- a/base/cvd/cuttlefish/host/libs/metrics/metrics_transmitter.cc +++ b/base/cvd/cuttlefish/host/libs/metrics/metrics_transmitter.cc @@ -20,7 +20,7 @@ #include "cuttlefish/common/libs/utils/base64.h" #include "cuttlefish/host/libs/metrics/metrics_environment.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/command.h" #include "cuttlefish/process/managed_stdio.h" #include "cuttlefish/result/result.h" #include "external_proto/cf_log.pb.h" diff --git a/base/cvd/cuttlefish/host/libs/vm_manager/BUILD.bazel b/base/cvd/cuttlefish/host/libs/vm_manager/BUILD.bazel index e86bdfbea67..b095074e45d 100644 --- a/base/cvd/cuttlefish/host/libs/vm_manager/BUILD.bazel +++ b/base/cvd/cuttlefish/host/libs/vm_manager/BUILD.bazel @@ -55,7 +55,7 @@ cf_cc_library( "//cuttlefish/host/libs/feature", "//cuttlefish/host/libs/feature:inject", "//cuttlefish/posix:strerror", - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:command", "//cuttlefish/process:execute", "//cuttlefish/process:managed_stdio", "//cuttlefish/process:subprocess_options", diff --git a/base/cvd/cuttlefish/host/libs/vm_manager/crosvm_builder.cpp b/base/cvd/cuttlefish/host/libs/vm_manager/crosvm_builder.cpp index 1001e77a6bd..a7fe4a0a0a3 100644 --- a/base/cvd/cuttlefish/host/libs/vm_manager/crosvm_builder.cpp +++ b/base/cvd/cuttlefish/host/libs/vm_manager/crosvm_builder.cpp @@ -24,7 +24,7 @@ #include "cuttlefish/host/libs/config/cuttlefish_config.h" #include "cuttlefish/host/libs/config/known_paths.h" #include "cuttlefish/host/libs/vm_manager/crosvm_cpu.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/command.h" namespace cuttlefish { namespace { diff --git a/base/cvd/cuttlefish/host/libs/vm_manager/crosvm_builder.h b/base/cvd/cuttlefish/host/libs/vm_manager/crosvm_builder.h index 08407c4040a..3046314dff8 100644 --- a/base/cvd/cuttlefish/host/libs/vm_manager/crosvm_builder.h +++ b/base/cvd/cuttlefish/host/libs/vm_manager/crosvm_builder.h @@ -21,7 +21,7 @@ #include "json/value.h" #include "cuttlefish/host/libs/vm_manager/pci.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/command.h" #include "cuttlefish/result/result.h" namespace cuttlefish { diff --git a/base/cvd/cuttlefish/host/libs/vm_manager/crosvm_display_controller.cpp b/base/cvd/cuttlefish/host/libs/vm_manager/crosvm_display_controller.cpp index b9388a6787d..cfdc52e0e7a 100644 --- a/base/cvd/cuttlefish/host/libs/vm_manager/crosvm_display_controller.cpp +++ b/base/cvd/cuttlefish/host/libs/vm_manager/crosvm_display_controller.cpp @@ -24,7 +24,7 @@ #include "absl/strings/str_join.h" #include "cuttlefish/host/libs/config/cuttlefish_config.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/command.h" #include "cuttlefish/process/managed_stdio.h" #include "cuttlefish/result/result.h" diff --git a/base/cvd/cuttlefish/host/libs/vm_manager/crosvm_manager.cpp b/base/cvd/cuttlefish/host/libs/vm_manager/crosvm_manager.cpp index 54871a6107f..90f27e8bc4b 100644 --- a/base/cvd/cuttlefish/host/libs/vm_manager/crosvm_manager.cpp +++ b/base/cvd/cuttlefish/host/libs/vm_manager/crosvm_manager.cpp @@ -52,7 +52,7 @@ #include "cuttlefish/host/libs/vm_manager/qemu_manager.h" #include "cuttlefish/host/libs/vm_manager/vhost_user.h" #include "cuttlefish/posix/strerror.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/command.h" #include "cuttlefish/process/execute.h" #include "cuttlefish/process/subprocess_options.h" #include "cuttlefish/result/result.h" diff --git a/base/cvd/cuttlefish/host/libs/vm_manager/gem5_manager.cpp b/base/cvd/cuttlefish/host/libs/vm_manager/gem5_manager.cpp index 5bf81ff69bd..9ef3af30791 100644 --- a/base/cvd/cuttlefish/host/libs/vm_manager/gem5_manager.cpp +++ b/base/cvd/cuttlefish/host/libs/vm_manager/gem5_manager.cpp @@ -36,7 +36,7 @@ #include "cuttlefish/host/libs/config/cuttlefish_config.h" #include "cuttlefish/host/libs/config/gpu_mode.h" #include "cuttlefish/host/libs/feature/command_source.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/command.h" #include "cuttlefish/result/result.h" namespace cuttlefish { diff --git a/base/cvd/cuttlefish/host/libs/vm_manager/qemu_manager.cpp b/base/cvd/cuttlefish/host/libs/vm_manager/qemu_manager.cpp index 85cecf2f546..c0b74295eb4 100644 --- a/base/cvd/cuttlefish/host/libs/vm_manager/qemu_manager.cpp +++ b/base/cvd/cuttlefish/host/libs/vm_manager/qemu_manager.cpp @@ -45,7 +45,7 @@ #include "cuttlefish/host/libs/config/gpu_mode.h" #include "cuttlefish/host/libs/feature/command_source.h" #include "cuttlefish/host/libs/vm_manager/vhost_user.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/command.h" #include "cuttlefish/process/managed_stdio.h" #include "cuttlefish/result/result.h" diff --git a/base/cvd/cuttlefish/host/libs/vm_manager/vhost_user.h b/base/cvd/cuttlefish/host/libs/vm_manager/vhost_user.h index 55f6e0c78c4..f596dc5daba 100644 --- a/base/cvd/cuttlefish/host/libs/vm_manager/vhost_user.h +++ b/base/cvd/cuttlefish/host/libs/vm_manager/vhost_user.h @@ -19,7 +19,7 @@ #include #include "cuttlefish/host/libs/config/cuttlefish_config.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/command.h" namespace cuttlefish { namespace vm_manager { diff --git a/base/cvd/cuttlefish/host/libs/vm_manager/vhost_user_block.cpp b/base/cvd/cuttlefish/host/libs/vm_manager/vhost_user_block.cpp index 53253b73303..1eff36bbb83 100644 --- a/base/cvd/cuttlefish/host/libs/vm_manager/vhost_user_block.cpp +++ b/base/cvd/cuttlefish/host/libs/vm_manager/vhost_user_block.cpp @@ -32,7 +32,7 @@ #include "cuttlefish/host/libs/config/cuttlefish_config.h" #include "cuttlefish/host/libs/vm_manager/crosvm_builder.h" #include "cuttlefish/host/libs/vm_manager/vhost_user.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/command.h" #include "cuttlefish/result/result.h" namespace cuttlefish { diff --git a/base/cvd/cuttlefish/host/libs/web/cas/BUILD.bazel b/base/cvd/cuttlefish/host/libs/web/cas/BUILD.bazel index f03b53f243b..fe99a62a635 100644 --- a/base/cvd/cuttlefish/host/libs/web/cas/BUILD.bazel +++ b/base/cvd/cuttlefish/host/libs/web/cas/BUILD.bazel @@ -16,7 +16,7 @@ cf_cc_library( "//cuttlefish/common/libs/utils:json", "//cuttlefish/host/libs/web:android_build", "//cuttlefish/host/libs/web/cas:cas_flags", - "//cuttlefish/process:command_subprocess", + "//cuttlefish/process:command", "//cuttlefish/process:managed_stdio", "//cuttlefish/result", "//libbase", diff --git a/base/cvd/cuttlefish/host/libs/web/cas/cas_downloader.cpp b/base/cvd/cuttlefish/host/libs/web/cas/cas_downloader.cpp index bd3cd3463d2..932719d2458 100644 --- a/base/cvd/cuttlefish/host/libs/web/cas/cas_downloader.cpp +++ b/base/cvd/cuttlefish/host/libs/web/cas/cas_downloader.cpp @@ -39,7 +39,7 @@ #include "cuttlefish/common/libs/utils/json.h" #include "cuttlefish/host/libs/web/android_build.h" #include "cuttlefish/host/libs/web/cas/cas_flags.h" -#include "cuttlefish/process/command_subprocess.h" +#include "cuttlefish/process/command.h" #include "cuttlefish/process/managed_stdio.h" #include "cuttlefish/result/result.h" diff --git a/base/cvd/cuttlefish/process/BUILD.bazel b/base/cvd/cuttlefish/process/BUILD.bazel index 2587d4bd9bb..cfa3b053a6d 100644 --- a/base/cvd/cuttlefish/process/BUILD.bazel +++ b/base/cvd/cuttlefish/process/BUILD.bazel @@ -25,14 +25,6 @@ cf_cc_library( ], ) -cf_cc_library( - name = "command_subprocess", - hdrs = ["command_subprocess.h"], - deps = [ - "//cuttlefish/process:command", - ], -) - cf_cc_library( name = "envp_to_map", srcs = ["envp_to_map.cc"], diff --git a/base/cvd/cuttlefish/process/command_subprocess.h b/base/cvd/cuttlefish/process/command_subprocess.h deleted file mode 100644 index 51152e24c1f..00000000000 --- a/base/cvd/cuttlefish/process/command_subprocess.h +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#pragma once - -#include "cuttlefish/process/command.h" // IWYU pragma: export From 7a537a69965cf58317557e0abfae77c473532f59 Mon Sep 17 00:00:00 2001 From: "A. Cody Schuffelen" Date: Mon, 13 Jul 2026 16:26:27 -0700 Subject: [PATCH 8/9] Move proc_file_utils to //cuttlefish/process Bug: b/533572315 --- .../cuttlefish/common/libs/utils/BUILD.bazel | 29 +------------------ .../common/libs/utils/tee_logging.cpp | 2 +- .../host/commands/assemble_cvd/BUILD.bazel | 2 +- .../host/commands/assemble_cvd/clean.cc | 2 +- .../host/commands/cvd/instances/BUILD.bazel | 8 ++--- .../cvd/instances/run_cvd_proc_collector.cpp | 2 +- .../host/commands/cvd/instances/stop.cpp | 2 +- base/cvd/cuttlefish/process/BUILD.bazel | 29 ++++++++++++++++++- .../proc_file_utils.cc} | 8 +++-- .../libs/utils => process}/proc_file_utils.h | 0 .../proc_file_utils_test.cc} | 6 +--- 11 files changed, 45 insertions(+), 45 deletions(-) rename base/cvd/cuttlefish/{common/libs/utils/proc_file_utils.cpp => process/proc_file_utils.cc} (97%) rename base/cvd/cuttlefish/{common/libs/utils => process}/proc_file_utils.h (100%) rename base/cvd/cuttlefish/{common/libs/utils/proc_file_utils_test.cpp => process/proc_file_utils_test.cc} (91%) diff --git a/base/cvd/cuttlefish/common/libs/utils/BUILD.bazel b/base/cvd/cuttlefish/common/libs/utils/BUILD.bazel index 00017d0ae1f..f0fd3c402a9 100644 --- a/base/cvd/cuttlefish/common/libs/utils/BUILD.bazel +++ b/base/cvd/cuttlefish/common/libs/utils/BUILD.bazel @@ -249,33 +249,6 @@ cf_cc_test( deps = [":network"], ) -cf_cc_library( - name = "proc_file_utils", - srcs = ["proc_file_utils.cpp"], - hdrs = ["proc_file_utils.h"], - deps = [ - "//cuttlefish/common/libs/fs", - "//cuttlefish/common/libs/utils:files", - "//cuttlefish/posix:readlink", - "//cuttlefish/result", - "//libbase", - "@abseil-cpp//absl/log", - "@abseil-cpp//absl/strings", - "@fmt", - ], -) - -cf_cc_test( - name = "proc_file_utils_test", - srcs = ["proc_file_utils_test.cpp"], - depend_on_what_you_use_enabled = False, - deps = [ - "//cuttlefish/common/libs/utils:contains", - "//cuttlefish/common/libs/utils:proc_file_utils", - "//cuttlefish/result", - ], -) - cf_cc_library( name = "proto", hdrs = ["proto.h"], @@ -359,7 +332,7 @@ cf_cc_library( "//cuttlefish/common/libs/fs", "//cuttlefish/common/libs/utils:contains", "//cuttlefish/common/libs/utils:environment", - "//cuttlefish/common/libs/utils:proc_file_utils", + "//cuttlefish/process:proc_file_utils", "//cuttlefish/result", "//libbase", "@abseil-cpp//absl/log", diff --git a/base/cvd/cuttlefish/common/libs/utils/tee_logging.cpp b/base/cvd/cuttlefish/common/libs/utils/tee_logging.cpp index 58fa283d9d1..5fb3f87d489 100644 --- a/base/cvd/cuttlefish/common/libs/utils/tee_logging.cpp +++ b/base/cvd/cuttlefish/common/libs/utils/tee_logging.cpp @@ -45,7 +45,7 @@ #include "cuttlefish/common/libs/fs/shared_buf.h" #include "cuttlefish/common/libs/utils/environment.h" -#include "cuttlefish/common/libs/utils/proc_file_utils.h" +#include "cuttlefish/process/proc_file_utils.h" #include "cuttlefish/result/result.h" using absl::StrFormat; diff --git a/base/cvd/cuttlefish/host/commands/assemble_cvd/BUILD.bazel b/base/cvd/cuttlefish/host/commands/assemble_cvd/BUILD.bazel index f184ac2c5e2..661a0f6f7f4 100644 --- a/base/cvd/cuttlefish/host/commands/assemble_cvd/BUILD.bazel +++ b/base/cvd/cuttlefish/host/commands/assemble_cvd/BUILD.bazel @@ -173,9 +173,9 @@ cf_cc_library( deps = [ "//cuttlefish/common/libs/utils:files", "//cuttlefish/common/libs/utils:in_sandbox", - "//cuttlefish/common/libs/utils:proc_file_utils", "//cuttlefish/host/libs/config:config_utils", "//cuttlefish/posix:strerror", + "//cuttlefish/process:proc_file_utils", "//cuttlefish/result", "//libbase", "@abseil-cpp//absl/log", diff --git a/base/cvd/cuttlefish/host/commands/assemble_cvd/clean.cc b/base/cvd/cuttlefish/host/commands/assemble_cvd/clean.cc index b7a3a14f411..c035943c357 100644 --- a/base/cvd/cuttlefish/host/commands/assemble_cvd/clean.cc +++ b/base/cvd/cuttlefish/host/commands/assemble_cvd/clean.cc @@ -28,9 +28,9 @@ #include "cuttlefish/common/libs/utils/files.h" #include "cuttlefish/common/libs/utils/in_sandbox.h" -#include "cuttlefish/common/libs/utils/proc_file_utils.h" #include "cuttlefish/host/libs/config/config_utils.h" #include "cuttlefish/posix/strerror.h" +#include "cuttlefish/process/proc_file_utils.h" #include "cuttlefish/result/result.h" namespace cuttlefish { diff --git a/base/cvd/cuttlefish/host/commands/cvd/instances/BUILD.bazel b/base/cvd/cuttlefish/host/commands/cvd/instances/BUILD.bazel index 17299c9aed6..b987e69dc53 100644 --- a/base/cvd/cuttlefish/host/commands/cvd/instances/BUILD.bazel +++ b/base/cvd/cuttlefish/host/commands/cvd/instances/BUILD.bazel @@ -106,7 +106,6 @@ cf_cc_library( "//cuttlefish/common/libs/utils:files", "//cuttlefish/common/libs/utils:gflags_xml_parser", "//cuttlefish/common/libs/utils:json", - "//cuttlefish/common/libs/utils:proc_file_utils", "//cuttlefish/common/libs/utils:signals", "//cuttlefish/common/libs/utils:users", "//cuttlefish/host/commands/cvd/cli:command_request", @@ -128,6 +127,7 @@ cf_cc_library( "//cuttlefish/posix:symlink", "//cuttlefish/process:command", "//cuttlefish/process:managed_stdio", + "//cuttlefish/process:proc_file_utils", "//cuttlefish/result", "//libbase", "@abseil-cpp//absl/log", @@ -150,7 +150,6 @@ cf_cc_library( "//cuttlefish/common/libs/utils:contains", "//cuttlefish/common/libs/utils:files", "//cuttlefish/common/libs/utils:json", - "//cuttlefish/common/libs/utils:proc_file_utils", "//cuttlefish/common/libs/utils:signals", "//cuttlefish/common/libs/utils:users", "//cuttlefish/host/commands/cvd/cli:command_request", @@ -172,6 +171,7 @@ cf_cc_library( "//cuttlefish/posix:symlink", "//cuttlefish/process:command", "//cuttlefish/process:managed_stdio", + "//cuttlefish/process:proc_file_utils", "//cuttlefish/result", "//libbase", "@abseil-cpp//absl/log", @@ -205,9 +205,9 @@ cf_cc_library( deps = [ "//cuttlefish/common/libs/utils:contains", "//cuttlefish/common/libs/utils:files", - "//cuttlefish/common/libs/utils:proc_file_utils", "//cuttlefish/host/commands/cvd/utils:common", "//cuttlefish/host/libs/config:config_constants", + "//cuttlefish/process:proc_file_utils", "//cuttlefish/result", "//libbase", "@abseil-cpp//absl/log", @@ -222,7 +222,6 @@ cf_cc_library( deps = [ "//cuttlefish/common/libs/utils:contains", "//cuttlefish/common/libs/utils:files", - "//cuttlefish/common/libs/utils:proc_file_utils", "//cuttlefish/host/commands/cvd/instances:config_path", "//cuttlefish/host/commands/cvd/instances:run_cvd_proc_collector", "//cuttlefish/host/commands/cvd/utils", @@ -230,6 +229,7 @@ cf_cc_library( "//cuttlefish/posix:strerror", "//cuttlefish/process:command", "//cuttlefish/process:managed_stdio", + "//cuttlefish/process:proc_file_utils", "//cuttlefish/result", "//libbase", "@abseil-cpp//absl/log", diff --git a/base/cvd/cuttlefish/host/commands/cvd/instances/run_cvd_proc_collector.cpp b/base/cvd/cuttlefish/host/commands/cvd/instances/run_cvd_proc_collector.cpp index d7f6b3eec3b..41ae9c84c98 100644 --- a/base/cvd/cuttlefish/host/commands/cvd/instances/run_cvd_proc_collector.cpp +++ b/base/cvd/cuttlefish/host/commands/cvd/instances/run_cvd_proc_collector.cpp @@ -32,9 +32,9 @@ #include "cuttlefish/common/libs/utils/contains.h" #include "cuttlefish/common/libs/utils/files.h" -#include "cuttlefish/common/libs/utils/proc_file_utils.h" #include "cuttlefish/host/commands/cvd/utils/common.h" #include "cuttlefish/host/libs/config/config_constants.h" +#include "cuttlefish/process/proc_file_utils.h" namespace cuttlefish { namespace { diff --git a/base/cvd/cuttlefish/host/commands/cvd/instances/stop.cpp b/base/cvd/cuttlefish/host/commands/cvd/instances/stop.cpp index 0481182a551..e2e4ede9b0f 100644 --- a/base/cvd/cuttlefish/host/commands/cvd/instances/stop.cpp +++ b/base/cvd/cuttlefish/host/commands/cvd/instances/stop.cpp @@ -34,7 +34,6 @@ #include "cuttlefish/common/libs/utils/contains.h" #include "cuttlefish/common/libs/utils/files.h" -#include "cuttlefish/common/libs/utils/proc_file_utils.h" #include "cuttlefish/host/commands/cvd/instances/config_path.h" #include "cuttlefish/host/commands/cvd/instances/run_cvd_proc_collector.h" #include "cuttlefish/host/commands/cvd/utils/common.h" @@ -42,6 +41,7 @@ #include "cuttlefish/posix/strerror.h" #include "cuttlefish/process/command.h" #include "cuttlefish/process/managed_stdio.h" +#include "cuttlefish/process/proc_file_utils.h" #include "cuttlefish/result/result.h" namespace cuttlefish { diff --git a/base/cvd/cuttlefish/process/BUILD.bazel b/base/cvd/cuttlefish/process/BUILD.bazel index cfa3b053a6d..59c772c481a 100644 --- a/base/cvd/cuttlefish/process/BUILD.bazel +++ b/base/cvd/cuttlefish/process/BUILD.bazel @@ -1,4 +1,4 @@ -load("//cuttlefish/bazel:rules.bzl", "cf_build_test", "cf_cc_library") +load("//cuttlefish/bazel:rules.bzl", "cf_build_test", "cf_cc_library", "cf_cc_test") package( default_visibility = ["//:android_cuttlefish"], @@ -65,6 +65,33 @@ cf_cc_library( ], ) +cf_cc_library( + name = "proc_file_utils", + srcs = ["proc_file_utils.cc"], + hdrs = ["proc_file_utils.h"], + deps = [ + "//cuttlefish/common/libs/fs", + "//cuttlefish/common/libs/utils:files", + "//cuttlefish/posix:readlink", + "//cuttlefish/result", + "//libbase", + "@abseil-cpp//absl/log", + "@abseil-cpp//absl/strings", + "@fmt", + ], +) + +cf_cc_test( + name = "proc_file_utils_test", + srcs = ["proc_file_utils_test.cc"], + depend_on_what_you_use_enabled = False, + deps = [ + "//cuttlefish/common/libs/utils:contains", + "//cuttlefish/process:proc_file_utils", + "//cuttlefish/result", + ], +) + cf_cc_library( name = "subprocess", srcs = ["subprocess.cc"], diff --git a/base/cvd/cuttlefish/common/libs/utils/proc_file_utils.cpp b/base/cvd/cuttlefish/process/proc_file_utils.cc similarity index 97% rename from base/cvd/cuttlefish/common/libs/utils/proc_file_utils.cpp rename to base/cvd/cuttlefish/process/proc_file_utils.cc index a7706c5d7e1..2ef5ad5d3e3 100644 --- a/base/cvd/cuttlefish/common/libs/utils/proc_file_utils.cpp +++ b/base/cvd/cuttlefish/process/proc_file_utils.cc @@ -14,9 +14,11 @@ * limitations under the License. */ -#include "cuttlefish/common/libs/utils/proc_file_utils.h" +#include "cuttlefish/process/proc_file_utils.h" -#include +#include +#include // IWYU pragma: keep +#include #include #include @@ -33,6 +35,7 @@ #include "absl/strings/strip.h" #include "android-base/file.h" #include "fmt/core.h" +#include "fmt/format.h" #include "cuttlefish/common/libs/fs/shared_buf.h" #include "cuttlefish/common/libs/fs/shared_fd.h" @@ -45,6 +48,7 @@ namespace cuttlefish { // sometimes, files under /proc/ owned by a different user // e.g. /proc//exe static Result FileOwnerUid(const std::string& file_path) { + // NOLINTNEXTLINE(misc-include-cleaner): struct stat buf; CF_EXPECT_EQ(::stat(file_path.data(), &buf), 0); return buf.st_uid; diff --git a/base/cvd/cuttlefish/common/libs/utils/proc_file_utils.h b/base/cvd/cuttlefish/process/proc_file_utils.h similarity index 100% rename from base/cvd/cuttlefish/common/libs/utils/proc_file_utils.h rename to base/cvd/cuttlefish/process/proc_file_utils.h diff --git a/base/cvd/cuttlefish/common/libs/utils/proc_file_utils_test.cpp b/base/cvd/cuttlefish/process/proc_file_utils_test.cc similarity index 91% rename from base/cvd/cuttlefish/common/libs/utils/proc_file_utils_test.cpp rename to base/cvd/cuttlefish/process/proc_file_utils_test.cc index 3144643cabd..3c79bbfb3f7 100644 --- a/base/cvd/cuttlefish/common/libs/utils/proc_file_utils_test.cpp +++ b/base/cvd/cuttlefish/process/proc_file_utils_test.cc @@ -13,14 +13,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "cuttlefish/common/libs/utils/proc_file_utils.h" +#include "cuttlefish/process/proc_file_utils.h" -#include #include -#include -#include - #include "gtest/gtest.h" #include "cuttlefish/common/libs/utils/contains.h" From 82eb08e25e5247285234f276282651c23037fbf8 Mon Sep 17 00:00:00 2001 From: "A. Cody Schuffelen" Date: Wed, 15 Jul 2026 14:14:10 -0700 Subject: [PATCH 9/9] Rename StopperResult::kStop* to StopperResult::k* Bug: b/533572315 --- .../host/commands/cvd/utils/subprocess_waiter.cpp | 6 +++--- .../host/commands/run_cvd/launch/cvdalloc.cpp | 6 +++--- .../host/commands/run_cvd/launch/modem.cpp | 10 +++++----- .../host/commands/run_cvd/launch/streamer.cpp | 2 +- .../host/libs/process_monitor/process_monitor.cc | 4 ++-- .../host/libs/vm_manager/crosvm_builder.cpp | 4 ++-- .../host/libs/vm_manager/crosvm_manager.cpp | 4 ++-- .../host/libs/vm_manager/qemu_manager.cpp | 6 +++--- .../host/libs/vm_manager/vhost_user_block.cpp | 2 +- base/cvd/cuttlefish/process/subprocess.cc | 13 ++++++------- base/cvd/cuttlefish/process/subprocess.h | 6 +++--- 11 files changed, 31 insertions(+), 32 deletions(-) diff --git a/base/cvd/cuttlefish/host/commands/cvd/utils/subprocess_waiter.cpp b/base/cvd/cuttlefish/host/commands/cvd/utils/subprocess_waiter.cpp index c67afc185db..9cfae9441d2 100644 --- a/base/cvd/cuttlefish/host/commands/cvd/utils/subprocess_waiter.cpp +++ b/base/cvd/cuttlefish/host/commands/cvd/utils/subprocess_waiter.cpp @@ -65,11 +65,11 @@ Result SubprocessWaiter::Interrupt() { if (subprocess_) { auto stop_result = subprocess_->Stop(); switch (stop_result) { - case StopperResult::kStopFailure: + case StopperResult::kFailure: return CF_ERR("Failed to stop subprocess"); - case StopperResult::kStopCrash: + case StopperResult::kCrash: return CF_ERR("Stopper caused process to crash"); - case StopperResult::kStopSuccess: + case StopperResult::kSuccess: return {}; default: return CF_ERRF("Unknown stop result: {}", (uint64_t)stop_result); diff --git a/base/cvd/cuttlefish/host/commands/run_cvd/launch/cvdalloc.cpp b/base/cvd/cuttlefish/host/commands/run_cvd/launch/cvdalloc.cpp index 495b9ad2a4f..ab83eac0d97 100644 --- a/base/cvd/cuttlefish/host/commands/run_cvd/launch/cvdalloc.cpp +++ b/base/cvd/cuttlefish/host/commands/run_cvd/launch/cvdalloc.cpp @@ -120,16 +120,16 @@ StopperResult Cvdalloc::Stop() { LOG(INFO) << "cvdalloc (run_cvd): stop requested; teardown started"; if (!cvdalloc::Post(socket_).ok()) { LOG(INFO) << "cvdalloc (run_cvd): stop failed: couldn't Post"; - return StopperResult::kStopFailure; + return StopperResult::kFailure; } if (!cvdalloc::Wait(socket_, kCvdTeardownTimeout).ok()) { LOG(INFO) << "cvdalloc (run_cvd): stop failed: couldn't Wait"; - return StopperResult::kStopFailure; + return StopperResult::kFailure; } LOG(INFO) << "cvdalloc (run_cvd): teardown completed"; - return StopperResult::kStopSuccess; + return StopperResult::kSuccess; } fruit::Component> diff --git a/base/cvd/cuttlefish/host/commands/run_cvd/launch/modem.cpp b/base/cvd/cuttlefish/host/commands/run_cvd/launch/modem.cpp index 84c27eb6676..c7be1285ec8 100644 --- a/base/cvd/cuttlefish/host/commands/run_cvd/launch/modem.cpp +++ b/base/cvd/cuttlefish/host/commands/run_cvd/launch/modem.cpp @@ -40,27 +40,27 @@ static StopperResult StopModemSimulator(int id) { SharedFD::SocketLocalClient(socket_name, true, SOCK_STREAM); if (!monitor_sock->IsOpen()) { LOG(ERROR) << "The connection to modem simulator is closed"; - return StopperResult::kStopFailure; + return StopperResult::kFailure; } std::string msg("STOP"); if (monitor_sock->Write(msg.data(), msg.size()) < 0) { monitor_sock->Close(); LOG(ERROR) << "Failed to send 'STOP' to modem simulator"; - return StopperResult::kStopFailure; + return StopperResult::kFailure; } char buf[64] = {0}; if (monitor_sock->Read(buf, sizeof(buf)) <= 0) { monitor_sock->Close(); LOG(ERROR) << "Failed to read message from modem simulator"; - return StopperResult::kStopFailure; + return StopperResult::kFailure; } if (strcmp(buf, "OK")) { monitor_sock->Close(); LOG(ERROR) << "Read '" << buf << "' instead of 'OK' from modem simulator"; - return StopperResult::kStopFailure; + return StopperResult::kFailure; } - return StopperResult::kStopSuccess; + return StopperResult::kSuccess; } Result> ModemSimulator( diff --git a/base/cvd/cuttlefish/host/commands/run_cvd/launch/streamer.cpp b/base/cvd/cuttlefish/host/commands/run_cvd/launch/streamer.cpp index 74d182d1e8e..9571385ba48 100644 --- a/base/cvd/cuttlefish/host/commands/run_cvd/launch/streamer.cpp +++ b/base/cvd/cuttlefish/host/commands/run_cvd/launch/streamer.cpp @@ -238,7 +238,7 @@ class WebRtcServer : public virtual CommandSource, auto stopper = [webrtc_controller = webrtc_controller_]() mutable { (void)webrtc_controller.SendStopRecordingCommand(); - return StopperResult::kStopFailure; + return StopperResult::kFailure; }; Command webrtc(WebRtcBinary(), KillSubprocessFallback(stopper)); diff --git a/base/cvd/cuttlefish/host/libs/process_monitor/process_monitor.cc b/base/cvd/cuttlefish/host/libs/process_monitor/process_monitor.cc index 4966ec93893..24b1ce1f865 100644 --- a/base/cvd/cuttlefish/host/libs/process_monitor/process_monitor.cc +++ b/base/cvd/cuttlefish/host/libs/process_monitor/process_monitor.cc @@ -155,7 +155,7 @@ Result StopSubprocesses(std::vector& monitored) { VLOG(0) << "Stopping monitored subprocesses"; auto stop = [](const auto& it) { auto stop_result = it.proc->Stop(); - if (stop_result == StopperResult::kStopFailure) { + if (stop_result == StopperResult::kFailure) { LOG(WARNING) << "Error in stopping \"" << it.cmd->GetShortName() << "\""; return false; } @@ -165,7 +165,7 @@ Result StopSubprocesses(std::vector& monitored) { LOG(WARNING) << "Failed to wait for process " << it.cmd->GetShortName(); return false; } - if (stop_result == StopperResult::kStopCrash) { + if (stop_result == StopperResult::kCrash) { LogSubprocessExit(it.cmd->GetShortName(), infop); } return true; diff --git a/base/cvd/cuttlefish/host/libs/vm_manager/crosvm_builder.cpp b/base/cvd/cuttlefish/host/libs/vm_manager/crosvm_builder.cpp index a7fe4a0a0a3..ae4a01050d6 100644 --- a/base/cvd/cuttlefish/host/libs/vm_manager/crosvm_builder.cpp +++ b/base/cvd/cuttlefish/host/libs/vm_manager/crosvm_builder.cpp @@ -63,8 +63,8 @@ void CrosvmBuilder::AddControlSocket(const std::string& control_socket, Command stop_cmd(executable_path); stop_cmd.AddParameter("stop"); stop_cmd.AddParameter(control_socket); - return stop_cmd.Start().Wait() == 0 ? StopperResult::kStopSuccess - : StopperResult::kStopFailure; + return stop_cmd.Start().Wait() == 0 ? StopperResult::kSuccess + : StopperResult::kFailure; }; command_.SetStopper(KillSubprocessFallback(stopper)); command_.AddParameter("--socket=", control_socket); diff --git a/base/cvd/cuttlefish/host/libs/vm_manager/crosvm_manager.cpp b/base/cvd/cuttlefish/host/libs/vm_manager/crosvm_manager.cpp index 90f27e8bc4b..ca843d53002 100644 --- a/base/cvd/cuttlefish/host/libs/vm_manager/crosvm_manager.cpp +++ b/base/cvd/cuttlefish/host/libs/vm_manager/crosvm_manager.cpp @@ -308,7 +308,7 @@ Result BuildVhostUserGpu( // Ask nicely so that log_tee gets a chance to process all the logs. // TODO: b/335934714 - Make sure the process actually exits bool res = kill(proc->pid(), SIGINT) == 0; - return res ? StopperResult::kStopSuccess : StopperResult::kStopFailure; + return res ? StopperResult::kSuccess : StopperResult::kFailure; })); const std::string crosvm_path = CF_EXPECT(CrosvmPathForVhostUserGpu(config)); @@ -806,7 +806,7 @@ Result> CrosvmManager::StartCommands( // Ask nicely so that log_tee gets a chance to process all the logs. bool res = kill(proc->pid(), SIGINT) == 0; // TODO: b/335934714 - Make sure the process actually exits - return res ? StopperResult::kStopSuccess : StopperResult::kStopFailure; + return res ? StopperResult::kSuccess : StopperResult::kFailure; })); // /dev/hvc2 = serial logging diff --git a/base/cvd/cuttlefish/host/libs/vm_manager/qemu_manager.cpp b/base/cvd/cuttlefish/host/libs/vm_manager/qemu_manager.cpp index c0b74295eb4..16ff4f200c3 100644 --- a/base/cvd/cuttlefish/host/libs/vm_manager/qemu_manager.cpp +++ b/base/cvd/cuttlefish/host/libs/vm_manager/qemu_manager.cpp @@ -70,7 +70,7 @@ StopperResult Stop() { if (!monitor_sock->IsOpen()) { LOG(ERROR) << "The connection to qemu is closed, is it still running?"; - return StopperResult::kStopFailure; + return StopperResult::kFailure; } char msg[] = "{\"execute\":\"qmp_capabilities\"}{\"execute\":\"quit\"}"; ssize_t len = sizeof(msg) - 1; @@ -78,7 +78,7 @@ StopperResult Stop() { int tmp = monitor_sock->Write(msg, len); if (tmp < 0) { LOG(ERROR) << "Error writing to socket: " << monitor_sock->StrError(); - return StopperResult::kStopFailure; + return StopperResult::kFailure; } len -= tmp; } @@ -89,7 +89,7 @@ StopperResult Stop() { LOG(INFO) << "From qemu monitor: " << buff; } - return StopperResult::kStopSuccess; + return StopperResult::kSuccess; } Result> GetQemuVersion(const std::string& qemu_binary) { diff --git a/base/cvd/cuttlefish/host/libs/vm_manager/vhost_user_block.cpp b/base/cvd/cuttlefish/host/libs/vm_manager/vhost_user_block.cpp index 1eff36bbb83..de9b2a0a8ac 100644 --- a/base/cvd/cuttlefish/host/libs/vm_manager/vhost_user_block.cpp +++ b/base/cvd/cuttlefish/host/libs/vm_manager/vhost_user_block.cpp @@ -59,7 +59,7 @@ Result VhostUserBlockDevice( // Ask nicely so that log_tee gets a chance to process all the logs. // TODO: b/335934714 - Make sure the process actually exits bool res = kill(proc->pid(), SIGINT) == 0; - return res ? StopperResult::kStopSuccess : StopperResult::kStopFailure; + return res ? StopperResult::kSuccess : StopperResult::kFailure; })); const std::string crosvm_path = config.crosvm_binary(); diff --git a/base/cvd/cuttlefish/process/subprocess.cc b/base/cvd/cuttlefish/process/subprocess.cc index 45c93099339..c9528b0e7d3 100644 --- a/base/cvd/cuttlefish/process/subprocess.cc +++ b/base/cvd/cuttlefish/process/subprocess.cc @@ -148,13 +148,13 @@ StopperResult KillSubprocess(Subprocess* subprocess) { bool is_group_head = pid == pgid; auto kill_ret = (is_group_head ? killpg : kill)(pid, SIGKILL); if (kill_ret == 0) { - return StopperResult::kStopSuccess; + return StopperResult::kSuccess; } auto kill_cmd = is_group_head ? "killpg(" : "kill("; PLOG(ERROR) << kill_cmd << pid << ", SIGKILL) failed: "; - return StopperResult::kStopFailure; + return StopperResult::kFailure; } - return StopperResult::kStopSuccess; + return StopperResult::kSuccess; } SubprocessStopper KillSubprocessFallback(std::function nice) { @@ -164,11 +164,10 @@ SubprocessStopper KillSubprocessFallback(std::function nice) { SubprocessStopper KillSubprocessFallback(SubprocessStopper nice_stopper) { return [nice_stopper](Subprocess* process) { auto nice_result = nice_stopper(process); - if (nice_result == StopperResult::kStopFailure) { + if (nice_result == StopperResult::kFailure) { auto harsh_result = KillSubprocess(process); - return harsh_result == StopperResult::kStopSuccess - ? StopperResult::kStopCrash - : harsh_result; + return harsh_result == StopperResult::kSuccess ? StopperResult::kCrash + : harsh_result; } return nice_result; }; diff --git a/base/cvd/cuttlefish/process/subprocess.h b/base/cvd/cuttlefish/process/subprocess.h index 74e70e2588d..b30d2ec9845 100644 --- a/base/cvd/cuttlefish/process/subprocess.h +++ b/base/cvd/cuttlefish/process/subprocess.h @@ -26,9 +26,9 @@ namespace cuttlefish { enum class StopperResult { - kStopFailure, /* Failed to stop the subprocess. */ - kStopCrash, /* Attempted to stop the subprocess cleanly, but that failed. */ - kStopSuccess, /* The subprocess exited in the expected way. */ + kFailure, /* Failed to stop the subprocess. */ + kCrash, /* Attempted to stop the subprocess cleanly, but that failed. */ + kSuccess, /* The subprocess exited in the expected way. */ }; class Subprocess;