OLD | NEW |
1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <string> | 5 #include <string> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include <base/at_exit.h> | 8 #include <base/at_exit.h> |
9 #include <base/command_line.h> | 9 #include <base/command_line.h> |
10 #include <base/file_util.h> | 10 #include <base/file_util.h> |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 GError *error = NULL; | 67 GError *error = NULL; |
68 | 68 |
69 bus = dbus_g_bus_get(DBUS_BUS_SYSTEM, &error); | 69 bus = dbus_g_bus_get(DBUS_BUS_SYSTEM, &error); |
70 if (!bus) { | 70 if (!bus) { |
71 LOG(FATAL) << "Failed to get bus"; | 71 LOG(FATAL) << "Failed to get bus"; |
72 } | 72 } |
73 proxy = dbus_g_proxy_new_for_name(bus, | 73 proxy = dbus_g_proxy_new_for_name(bus, |
74 DBUS_SERVICE_DBUS, | 74 DBUS_SERVICE_DBUS, |
75 DBUS_PATH_DBUS, | 75 DBUS_PATH_DBUS, |
76 DBUS_INTERFACE_DBUS); | 76 DBUS_INTERFACE_DBUS); |
77 | |
78 guint32 request_name_ret; | 77 guint32 request_name_ret; |
79 if (!org_freedesktop_DBus_request_name(proxy, | 78 if (!org_freedesktop_DBus_request_name(proxy, |
80 kUpdateEngineServiceName, | 79 kUpdateEngineServiceName, |
81 0, | 80 0, |
82 &request_name_ret, | 81 &request_name_ret, |
83 &error)) { | 82 &error)) { |
84 LOG(FATAL) << "Failed to get name: " << error->message; | 83 LOG(FATAL) << "Failed to get name: " << error->message; |
85 } | 84 } |
86 if (request_name_ret != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) { | 85 if (request_name_ret != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) { |
87 g_warning("Got result code %u from requesting name", request_name_ret); | 86 g_warning("Got result code %u from requesting name", request_name_ret); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 logging::APPEND_TO_OLD_LOG_FILE); | 138 logging::APPEND_TO_OLD_LOG_FILE); |
140 if (FLAGS_logtostderr) { | 139 if (FLAGS_logtostderr) { |
141 return; | 140 return; |
142 } | 141 } |
143 const string log_file = SetupLogFile("/var/log"); | 142 const string log_file = SetupLogFile("/var/log"); |
144 logging::InitLogging(log_file.c_str(), | 143 logging::InitLogging(log_file.c_str(), |
145 logging::LOG_ONLY_TO_FILE, | 144 logging::LOG_ONLY_TO_FILE, |
146 logging::DONT_LOCK_LOG_FILE, | 145 logging::DONT_LOCK_LOG_FILE, |
147 logging::APPEND_TO_OLD_LOG_FILE); | 146 logging::APPEND_TO_OLD_LOG_FILE); |
148 } | 147 } |
| 148 |
149 } // namespace {} | 149 } // namespace {} |
150 } // namespace chromeos_update_engine | 150 } // namespace chromeos_update_engine |
151 | 151 |
152 int main(int argc, char** argv) { | 152 int main(int argc, char** argv) { |
153 ::g_type_init(); | 153 ::g_type_init(); |
154 g_thread_init(NULL); | 154 g_thread_init(NULL); |
155 dbus_g_thread_init(); | 155 dbus_g_thread_init(); |
156 base::AtExitManager exit_manager; // Required for base/rand_util.h. | 156 base::AtExitManager exit_manager; // Required for base/rand_util.h. |
157 chromeos_update_engine::Terminator::Init(); | 157 chromeos_update_engine::Terminator::Init(); |
158 chromeos_update_engine::Subprocess::Init(); | 158 chromeos_update_engine::Subprocess::Init(); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 g_main_loop_run(loop); | 208 g_main_loop_run(loop); |
209 | 209 |
210 // Cleanup: | 210 // Cleanup: |
211 g_main_loop_unref(loop); | 211 g_main_loop_unref(loop); |
212 update_attempter.set_dbus_service(NULL); | 212 update_attempter.set_dbus_service(NULL); |
213 g_object_unref(G_OBJECT(service)); | 213 g_object_unref(G_OBJECT(service)); |
214 | 214 |
215 LOG(INFO) << "Chrome OS Update Engine terminating"; | 215 LOG(INFO) << "Chrome OS Update Engine terminating"; |
216 return 0; | 216 return 0; |
217 } | 217 } |
OLD | NEW |