From: Olaf Hering <olh@suse.de>
To: linux-hotplug@vger.kernel.org
Subject: [PATCH] send udev debug output to stdout instead of syslog
Date: Mon, 24 Nov 2003 18:16:38 +0000 [thread overview]
Message-ID: <marc-linux-hotplug-106969789516122@msgid-missing> (raw)
This patch let udev talk to stderr instead of flooding the syslog.
The string UDEVDBG is maybe not the best choice.
diff -x SCCS -purNx 'klibc*' /dev/shm/udev-007/udev.c udev-007/udev.c
--- /dev/shm/udev-007/udev.c 2003-11-12 06:46:29.000000000 +0100
+++ udev-007/udev.c 2003-11-24 13:41:11.000000000 +0100
@@ -116,7 +116,15 @@ static void get_dirs(void)
strncpy(udev_config_permission_filename, udev_config_dir, sizeof(udev_config_permission_filename));
strncat(udev_config_permission_filename, udev_permission, sizeof(udev_config_permission_filename));
}
-
+int dgb_to_stdout;
+void init_dbg(void)
+{
+ if(getenv("UDEVDBG")) {
+ fprintf(stderr,"log to stderr\n");
+ dgb_to_stdout=1;
+ }
+ return;
+}
int main(int argc, char **argv, char **envp)
{
char *action;
@@ -127,6 +135,8 @@ int main(int argc, char **argv, char **e
main_argv = argv;
main_envp = envp;
+ init_dbg();
+
dbg("version %s", UDEV_VERSION);
if (argc != 2) {
diff -x SCCS -purNx 'klibc*' /dev/shm/udev-007/udev.h udev-007/udev.h
--- /dev/shm/udev-007/udev.h 2003-11-23 23:08:51.000000000 +0100
+++ udev-007/udev.h 2003-11-24 13:48:53.000000000 +0100
@@ -28,9 +28,14 @@
#ifdef DEBUG
#include <syslog.h>
+extern int dgb_to_stdout;
#define dbg(format, arg...) \
do { \
+ if(dgb_to_stdout) { \
+ fprintf (stderr , "%s: " format "\n", __FUNCTION__ , ## arg); \
+ } else { \
log_message (LOG_DEBUG , "%s: " format , __FUNCTION__ , ## arg); \
+ } \
} while (0)
#else
#define dbg(format, arg...) do { } while (0)
@@ -40,7 +45,11 @@
#ifdef DEBUG_PARSER
#define dbg_parse(format, arg...) \
do { \
+ if(dgb_to_stdout) { \
+ fprintf (stderr , "%s: " format "\n", __FUNCTION__ , ## arg); \
+ } else { \
log_message (LOG_DEBUG , "%s: " format , __FUNCTION__ , ## arg); \
+ } \
} while (0)
#else
#define dbg_parse(format, arg...) do { } while (0)
--
USB is for mice, FireWire is for men!
sUse lINUX ag, n√úRNBERG
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
next reply other threads:[~2003-11-24 18:16 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-11-24 18:16 Olaf Hering [this message]
2003-11-24 22:32 ` [PATCH] send udev debug output to stdout instead of syslog Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=marc-linux-hotplug-106969789516122@msgid-missing \
--to=olh@suse.de \
--cc=linux-hotplug@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).