OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium 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 "tools/android/forwarder2/daemon.h" | 5 #include "tools/android/forwarder2/daemon.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <fcntl.h> | 8 #include <fcntl.h> |
9 #include <signal.h> | 9 #include <signal.h> |
10 #include <sys/file.h> | 10 #include <sys/file.h> |
11 #include <sys/stat.h> | 11 #include <sys/stat.h> |
12 #include <sys/types.h> | 12 #include <sys/types.h> |
13 #include <sys/wait.h> | 13 #include <sys/wait.h> |
14 #include <unistd.h> | 14 #include <unistd.h> |
15 | 15 |
16 #include <cstdlib> | 16 #include <cstdlib> |
17 #include <cstring> | 17 #include <cstring> |
18 #include <string> | 18 #include <string> |
19 | 19 |
20 #include "base/basictypes.h" | 20 #include "base/basictypes.h" |
21 #include "base/file_util.h" | 21 #include "base/file_util.h" |
22 #include "base/files/file_path.h" | 22 #include "base/files/file_path.h" |
23 #include "base/logging.h" | 23 #include "base/logging.h" |
24 #include "base/memory/scoped_ptr.h" | 24 #include "base/memory/scoped_ptr.h" |
25 #include "base/posix/eintr_wrapper.h" | 25 #include "base/posix/eintr_wrapper.h" |
26 #include "base/safe_strerror_posix.h" | 26 #include "base/safe_strerror_posix.h" |
27 #include "base/string_number_conversions.h" | 27 #include "base/strings/string_number_conversions.h" |
28 #include "base/stringprintf.h" | 28 #include "base/strings/stringprintf.h" |
29 #include "tools/android/forwarder2/common.h" | 29 #include "tools/android/forwarder2/common.h" |
30 #include "tools/android/forwarder2/socket.h" | 30 #include "tools/android/forwarder2/socket.h" |
31 | 31 |
32 namespace forwarder2 { | 32 namespace forwarder2 { |
33 namespace { | 33 namespace { |
34 | 34 |
35 const int kBufferSize = 256; | 35 const int kBufferSize = 256; |
36 | 36 |
37 // Timeout constant used for polling when connecting to the daemon's Unix Domain | 37 // Timeout constant used for polling when connecting to the daemon's Unix Domain |
38 // Socket and also when waiting for its death when it is killed. | 38 // Socket and also when waiting for its death when it is killed. |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 return true; | 278 return true; |
279 } | 279 } |
280 usleep(kIdleTimeMSec * 1000); | 280 usleep(kIdleTimeMSec * 1000); |
281 } | 281 } |
282 LOG(ERROR) << "Timed out while killing daemon. " | 282 LOG(ERROR) << "Timed out while killing daemon. " |
283 "It might still be tearing down."; | 283 "It might still be tearing down."; |
284 return false; | 284 return false; |
285 } | 285 } |
286 | 286 |
287 } // namespace forwarder2 | 287 } // namespace forwarder2 |
OLD | NEW |