summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2018-06-13 20:39:32 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2018-06-13 20:39:32 +0000
commit4aa84212034bd68279b84d35f2b5b59a8515a1f3 (patch)
treeb956c43e9ae21cc27e5f9855292ba79c97d28e67
parentb7761b2673df3f8647cc6ebc589a9d5ce232e466 (diff)
parentfdafb3d0ec67b40894ce0dd597d3142cc98ab943 (diff)
downloadsystem_core-4aa84212034bd68279b84d35f2b5b59a8515a1f3.tar.gz
system_core-4aa84212034bd68279b84d35f2b5b59a8515a1f3.tar.bz2
system_core-4aa84212034bd68279b84d35f2b5b59a8515a1f3.zip
Merge "init: Add warning in init first stage mount"
-rw-r--r--init/uevent_listener.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/init/uevent_listener.cpp b/init/uevent_listener.cpp
index 24b14c44d..81486e108 100644
--- a/init/uevent_listener.cpp
+++ b/init/uevent_listener.cpp
@@ -23,7 +23,11 @@
#include <memory>
+#include <android-base/chrono_utils.h>
+#include <android-base/file.h>
#include <android-base/logging.h>
+#include <android-base/scopeguard.h>
+#include <android-base/stringprintf.h>
#include <cutils/uevent.h>
namespace android {
@@ -130,9 +134,19 @@ ListenerAction UeventListener::RegenerateUeventsForDir(DIR* d,
int fd = openat(dfd, "uevent", O_WRONLY);
if (fd >= 0) {
+ android::base::Timer t;
write(fd, "add\n", 4);
+ const std::string fd_path = android::base::StringPrintf("/proc/self/fd/%d", fd);
+ std::string uevent_file_path;
+ android::base::Readlink(fd_path, &uevent_file_path);
close(fd);
+ auto guard = android::base::make_scope_guard([&t, &uevent_file_path]() {
+ if (t.duration() > 50ms) {
+ LOG(WARNING) << "ReadUevent took " << t << " on '" << uevent_file_path << "'";
+ }
+ });
+
Uevent uevent;
while (ReadUevent(&uevent)) {
if (callback(uevent) == ListenerAction::kStop) return ListenerAction::kStop;