summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco d'Itri <md@linux.it>2008-07-11 00:52:22 +0200
committerKay Sievers <kay.sievers@vrfy.org>2008-07-11 00:52:22 +0200
commit5dabec2a749265619198bc26a382277b109c931d (patch)
tree13c516f143981127663a6b0ea51ef2417190aaf4
parent0cd9f451ab8475e5a2b5c2aa53ed01e611eb8e9c (diff)
udevadm: settle - add verbose output when running into timeout
-rw-r--r--udevsettle.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/udevsettle.c b/udevsettle.c
index 4b66f89cd6..cb63a66bba 100644
--- a/udevsettle.c
+++ b/udevsettle.c
@@ -35,6 +35,38 @@
#define DEFAULT_TIMEOUT 180
#define LOOP_PER_SECOND 20
+static void print_queue(const char *dir)
+{
+ LIST_HEAD(files);
+ struct name_entry *item;
+
+ if (add_matching_files(&files, dir, NULL) < 0)
+ return;
+
+ printf("\n\nAfter the udevadm settle timeout, the events queue contains:\n\n");
+
+ list_for_each_entry(item, &files, node) {
+ char target[NAME_SIZE];
+ size_t len;
+ const char *filename = strrchr(item->name, '/');
+
+ if (filename == NULL)
+ continue;
+ filename++;
+ if (*filename == '\0')
+ continue;
+
+ len = readlink(item->name, target, sizeof(target));
+ if (len < 0)
+ continue;
+ target[len] = '\0';
+
+ printf("%s: %s\n", filename, target);
+ }
+
+ printf("\n\n");
+}
+
int udevsettle(int argc, char *argv[], char *envp[])
{
char queuename[PATH_SIZE];
@@ -97,6 +129,7 @@ int udevsettle(int argc, char *argv[], char *envp[])
}
if (loop <= 0) {
info("timeout waiting for queue\n");
+ print_queue(queuename);
goto exit;
}