| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium OS Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "update_engine/utils.h" | 5 #include "update_engine/utils.h" |
| 6 | 6 |
| 7 #include <sys/mount.h> | 7 #include <sys/mount.h> |
| 8 #include <sys/resource.h> | 8 #include <sys/resource.h> |
| 9 #include <sys/stat.h> | 9 #include <sys/stat.h> |
| 10 #include <sys/types.h> | 10 #include <sys/types.h> |
| 11 #include <sys/wait.h> | 11 #include <sys/wait.h> |
| 12 #include <dirent.h> | 12 #include <dirent.h> |
| 13 #include <errno.h> | 13 #include <errno.h> |
| 14 #include <fcntl.h> | 14 #include <fcntl.h> |
| 15 #include <stdio.h> | 15 #include <stdio.h> |
| 16 #include <stdlib.h> | 16 #include <stdlib.h> |
| 17 #include <string.h> | 17 #include <string.h> |
| 18 #include <unistd.h> | 18 #include <unistd.h> |
| 19 | 19 |
| 20 #include <algorithm> | 20 #include <algorithm> |
| 21 | 21 |
| 22 #include <base/eintr_wrapper.h> | 22 #include <base/eintr_wrapper.h> |
| 23 #include <base/file_path.h> | 23 #include <base/file_path.h> |
| 24 #include <base/file_util.h> | 24 #include <base/file_util.h> |
| 25 #include <base/rand_util.h> | 25 #include <base/rand_util.h> |
| 26 #include <base/string_util.h> | 26 #include <base/string_util.h> |
| 27 #include <base/logging.h> | 27 #include <base/logging.h> |
| 28 #include <cros_boot_mode/boot_mode.h> | 28 #include <cros_boot_mode/boot_mode.h> |
| 29 #include <google/protobuf/stubs/common.h> |
| 29 #include <rootdev/rootdev.h> | 30 #include <rootdev/rootdev.h> |
| 30 | 31 |
| 31 #include "update_engine/file_writer.h" | 32 #include "update_engine/file_writer.h" |
| 32 #include "update_engine/omaha_request_params.h" | 33 #include "update_engine/omaha_request_params.h" |
| 33 #include "update_engine/subprocess.h" | 34 #include "update_engine/subprocess.h" |
| 34 | 35 |
| 35 using std::min; | 36 using std::min; |
| 36 using std::string; | 37 using std::string; |
| 37 using std::vector; | 38 using std::vector; |
| 38 | 39 |
| (...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 544 ProcessPriority priority_rhs) { | 545 ProcessPriority priority_rhs) { |
| 545 return static_cast<int>(priority_rhs) - static_cast<int>(priority_lhs); | 546 return static_cast<int>(priority_rhs) - static_cast<int>(priority_lhs); |
| 546 } | 547 } |
| 547 | 548 |
| 548 int FuzzInt(int value, unsigned int range) { | 549 int FuzzInt(int value, unsigned int range) { |
| 549 int min = value - range / 2; | 550 int min = value - range / 2; |
| 550 int max = value + range - range / 2; | 551 int max = value + range - range / 2; |
| 551 return base::RandInt(min, max); | 552 return base::RandInt(min, max); |
| 552 } | 553 } |
| 553 | 554 |
| 555 gboolean GlibRunClosure(gpointer data) { |
| 556 google::protobuf::Closure* callback = |
| 557 reinterpret_cast<google::protobuf::Closure*>(data); |
| 558 callback->Run(); |
| 559 return FALSE; |
| 560 } |
| 561 |
| 554 const char* const kStatefulPartition = "/mnt/stateful_partition"; | 562 const char* const kStatefulPartition = "/mnt/stateful_partition"; |
| 555 | 563 |
| 556 } // namespace utils | 564 } // namespace utils |
| 557 | 565 |
| 558 } // namespace chromeos_update_engine | 566 } // namespace chromeos_update_engine |
| OLD | NEW |