summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--udevd.85
-rw-r--r--udevd.c20
-rw-r--r--udevd.xml7
3 files changed, 29 insertions, 3 deletions
diff --git a/udevd.8 b/udevd.8
index bb6d27fb41..aef2090236 100644
--- a/udevd.8
+++ b/udevd.8
@@ -14,7 +14,7 @@
udevd \- event managing daemon
.SH "SYNOPSIS"
.HP 6
-\fBudevd\fR [\fB\-\-daemon\fR] [\fB\-\-help\fR]
+\fBudevd\fR [\fB\-\-daemon\fR] [\fB\-\-verbose\fR] [\fB\-\-help\fR]
.HP 20
\fBudevcontrol \fR\fB\fIcommand\fR\fR
.SH "DESCRIPTION"
@@ -25,6 +25,9 @@ udevd listens to kernel uevents and passes the incoming events to udev. It ensur
\fB\-\-daemon\fR
Detach and run in the background.
.TP 3n
+\fB\-\-verbose\fR
+Print log messages to stdout.
+.TP 3n
\fB\-\-help\fR
Print usage.
.TP 3n
diff --git a/udevd.c b/udevd.c
index df6e222810..eb632bd852 100644
--- a/udevd.c
+++ b/udevd.c
@@ -45,6 +45,8 @@
#include "udevd.h"
#include "udev_selinux.h"
+static int verbose;
+
static struct udev_rules rules;
static int udevd_sock = -1;
static int uevent_netlink_sock = -1;
@@ -76,6 +78,13 @@ void log_message(int priority, const char *format, ...)
va_start(args, format);
vsyslog(priority, format, args);
va_end(args);
+
+ if (verbose) {
+ va_start(args, format);
+ vprintf(format, args);
+ va_end(args);
+ printf("\n");
+ }
}
#endif
@@ -921,6 +930,7 @@ int main(int argc, char *argv[], char *envp[])
int option;
static const struct option options[] = {
{ "daemon", 0, NULL, 'd' },
+ { "verbose", 0, NULL, 'v' },
{ "help", 0, NULL, 'h' },
{}
};
@@ -942,8 +952,13 @@ int main(int argc, char *argv[], char *envp[])
case 'd':
daemonize = 1;
break;
+ case 'v':
+ verbose = 1;
+ if (udev_log_priority < LOG_INFO)
+ udev_log_priority = LOG_INFO;
+ break;
case 'h':
- printf("Usage: udevd [--help] [--daemon]\n");
+ printf("Usage: udevd [--help] [--daemon] [--verbose]\n");
goto exit;
default:
goto exit;
@@ -1006,7 +1021,8 @@ int main(int argc, char *argv[], char *envp[])
fd = open("/dev/null", O_RDWR);
if (fd >= 0) {
dup2(fd, STDIN_FILENO);
- dup2(fd, STDOUT_FILENO);
+ if (!verbose)
+ dup2(fd, STDOUT_FILENO);
dup2(fd, STDERR_FILENO);
if (fd > STDERR_FILENO)
close(fd);
diff --git a/udevd.xml b/udevd.xml
index f0682ed00c..cc2a1bcd22 100644
--- a/udevd.xml
+++ b/udevd.xml
@@ -26,6 +26,7 @@
<cmdsynopsis>
<command>udevd</command>
<arg><option>--daemon</option></arg>
+ <arg><option>--verbose</option></arg>
<arg><option>--help</option></arg>
</cmdsynopsis>
<cmdsynopsis>
@@ -48,6 +49,12 @@
</listitem>
</varlistentry>
<varlistentry>
+ <term><option>--verbose</option></term>
+ <listitem>
+ <para>Print log messages to stdout.</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
<term><option>--help</option></term>
<listitem>
<para>Print usage.</para>