summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2008-12-08 16:48:54 +0100
committerKay Sievers <kay.sievers@vrfy.org>2008-12-08 16:48:54 +0100
commitb76ad2e537e8672ace442eb27439521c9b107b09 (patch)
tree5ea1bca4ace4f69dc588901a0abd678668bc2d3f
parent5d89ef7bf94d8a708a1159be22eb1cf458a1d101 (diff)
udevadm: settle - allow --timeout=0 and --quiet
-rw-r--r--udev/udevadm-settle.c25
-rw-r--r--udev/udevadm.xml9
2 files changed, 24 insertions, 10 deletions
diff --git a/udev/udevadm-settle.c b/udev/udevadm-settle.c
index a274e089d4..5bb3d22a49 100644
--- a/udev/udevadm-settle.c
+++ b/udev/udevadm-settle.c
@@ -37,10 +37,12 @@ int udevadm_settle(struct udev *udev, int argc, char *argv[])
{
static const struct option options[] = {
{ "timeout", required_argument, NULL, 't' },
+ { "quiet", no_argument, NULL, 'q' },
{ "help", no_argument, NULL, 'h' },
{}
};
int timeout = DEFAULT_TIMEOUT;
+ int quiet = 0;
struct udev_queue *udev_queue = NULL;
int loop;
int rc = 0;
@@ -51,21 +53,24 @@ int udevadm_settle(struct udev *udev, int argc, char *argv[])
int option;
int seconds;
- option = getopt_long(argc, argv, "t:h", options, NULL);
+ option = getopt_long(argc, argv, "t:qh", options, NULL);
if (option == -1)
break;
switch (option) {
case 't':
seconds = atoi(optarg);
- if (seconds > 0)
+ if (seconds >= 0)
timeout = seconds;
else
fprintf(stderr, "invalid timeout value\n");
dbg(udev, "timeout=%i\n", timeout);
break;
+ case 'q':
+ quiet = 1;
+ break;
case 'h':
- printf("Usage: udevadm settle [--help] [--timeout=<seconds>]\n\n");
+ printf("Usage: udevadm settle [--help] [--timeout=<seconds>] [--quiet]\n\n");
goto exit;
}
}
@@ -82,12 +87,14 @@ int udevadm_settle(struct udev *udev, int argc, char *argv[])
if (loop <= 0) {
struct udev_list_entry *list_entry;
- info(udev, "timeout waiting for udev queue\n");
- printf("\ndevadm settle timeout of %i seconds reached, the event queue contains:\n", timeout);
- udev_list_entry_foreach(list_entry, udev_queue_get_queued_list_entry(udev_queue))
- printf(" '%s' [%s]\n",
- udev_list_entry_get_name(list_entry),
- udev_list_entry_get_value(list_entry));
+ if (!quiet) {
+ info(udev, "timeout waiting for udev queue\n");
+ printf("\ndevadm settle timeout of %i seconds reached, the event queue contains:\n", timeout);
+ udev_list_entry_foreach(list_entry, udev_queue_get_queued_list_entry(udev_queue))
+ printf(" %s (%s)\n",
+ udev_list_entry_get_name(list_entry),
+ udev_list_entry_get_value(list_entry));
+ }
rc = 1;
}
exit:
diff --git a/udev/udevadm.xml b/udev/udevadm.xml
index b7687d5dd1..ebc4aa150f 100644
--- a/udev/udevadm.xml
+++ b/udev/udevadm.xml
@@ -220,7 +220,14 @@
<term><option>--timeout=<replaceable>seconds</replaceable></option></term>
<listitem>
<para>Maximum number of seconds to wait for the event queue to become empty.
- The default value is 180 seconds.</para>
+ The default value is 180 seconds. A value of 0 will check if the queue is empty
+ and always return immediately.</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><option>--quiet</option></term>
+ <listitem>
+ <para>Do not print any output, like the remaining queue entries when reachin the timeout.</para>
</listitem>
</varlistentry>
<varlistentry>