1414 * limitations under the License.
1515 */
1616
17- #include < sys/types.h>
18-
1917#include < stdint.h>
18+ #include < sys/types.h>
2019
2120#include < cinttypes>
2221#include < csignal>
3534#include " cuttlefish/common/libs/fs/shared_fd.h"
3635#include " cuttlefish/common/libs/utils/environment.h"
3736#include " cuttlefish/common/libs/utils/files.h"
37+ #include " cuttlefish/common/libs/utils/tee_logging.h"
3838#include " cuttlefish/flag_parser/flag.h"
3939#include " cuttlefish/flag_parser/gflags_compat.h"
40- #include " cuttlefish/common/libs/utils/tee_logging.h"
4140#include " cuttlefish/host/libs/command_util/runner/defs.h"
4241#include " cuttlefish/host/libs/command_util/util.h"
4342#include " cuttlefish/host/libs/config/cuttlefish_config.h"
@@ -58,12 +57,14 @@ std::set<std::string> FallbackDirs() {
5857 std::string parent_path = StringFromEnv (" HOME" , " ." );
5958 paths.insert (parent_path + " /cuttlefish_assembly" );
6059
61- std::unique_ptr<DIR , int (*)(DIR *)> dir (opendir (parent_path.c_str ()), closedir);
60+ std::unique_ptr<DIR , int (*)(DIR *)> dir (opendir (parent_path.c_str ()),
61+ closedir);
6262 if (!dir) {
6363 return paths;
6464 }
6565
66- for (auto entity = readdir (dir.get ()); entity != nullptr ; entity = readdir (dir.get ())) {
66+ for (auto entity = readdir (dir.get ()); entity != nullptr ;
67+ entity = readdir (dir.get ())) {
6768 std::string subdir (entity->d_name );
6869 if (!absl::StartsWith (subdir, " cuttlefish_runtime." )) {
6970 continue ;
@@ -98,7 +99,7 @@ std::set<pid_t> GetCandidateProcessGroups(const std::set<std::string>& dirs) {
9899 }
99100 int64_t pid;
100101 std::set<pid_t > ret{};
101- while (fscanf (cmd_out.get (), " %" PRId64, &pid) != EOF ) {
102+ while (fscanf (cmd_out.get (), " %" PRId64, &pid) != EOF ) {
102103 pid_t pgid = getpgid (static_cast <pid_t >(pid));
103104 if (pgid < 0 ) {
104105 LOG (ERROR ) << " Unable to get process group of " << pid << " : "
@@ -116,7 +117,7 @@ int FallBackStop(const std::set<std::string>& dirs) {
116117 auto exit_code = 0 ;
117118
118119 auto process_groups = GetCandidateProcessGroups (dirs);
119- for (auto pgid: process_groups) {
120+ for (auto pgid : process_groups) {
120121 LOG (INFO ) << " Sending SIGKILL to process group " << pgid;
121122 auto retval = killpg (pgid, SIGKILL );
122123 if (retval < 0 ) {
@@ -222,7 +223,8 @@ int StopCvdMain(const std::int32_t wait_for_launcher,
222223 for (const auto & instance : instances) {
223224 unsigned id;
224225 if (!absl::SimpleAtoi (instance.id (), &id)) {
225- LOG (ERROR ) << " Failed to parse instance ID \" " << instance.id () << " \" as unsigned" ;
226+ LOG (ERROR ) << " Failed to parse instance ID \" " << instance.id ()
227+ << " \" as unsigned" ;
226228 exit_code |= 1 ;
227229 continue ;
228230 }
@@ -250,8 +252,8 @@ int StopCvdMain(const std::int32_t wait_for_launcher,
250252 return exit_code;
251253}
252254
253- } // namespace
254- } // namespace cuttlefish
255+ } // namespace
256+ } // namespace cuttlefish
255257
256258int main (int argc, char ** argv) {
257259 const auto [wait_for_launcher, clear_instance_dirs, instance_nums, helpxml] =
@@ -271,9 +273,10 @@ int main(int argc, char** argv) {
271273
272274 if (cuttlefish::CuttlefishConfig::Get () &&
273275 cuttlefish::CuttlefishConfig::Get ()->enable_metrics () ==
274- cuttlefish::CuttlefishConfig::Answer::kYes ) {
276+ cuttlefish::CuttlefishConfig::Answer::kYes ) {
275277 cuttlefish::MetricsReceiver::LogMetricsVMStop ();
276278 }
277279
278- return cuttlefish::StopCvdMain (wait_for_launcher, clear_instance_dirs, instance_nums);
280+ return cuttlefish::StopCvdMain (wait_for_launcher, clear_instance_dirs,
281+ instance_nums);
279282}
0 commit comments