File sysklogd-1.4.1-sysmap-prior-to-2.5.patch of Package syslogd

From: Jeff Mahoney <jeffm@suse.com>
Subject: klogd: Silence System.map and symbol lookup warnings with modern kernels
References: bnc#505421

 klogd complains about not being able to parse the version of System.map and
 about not being able to load the kernel module symbol table.

 Since kernels starting with 2.5 accurately report their own symbol table in
 Oopses, this is no longer necessary. The warnings are a harmless annoyance,
 but an annoyance nonetheless.

 This patch detects if the running kernel is newer newer than 2.5.0 and
 disables the symbol lookup on startup, thus avoiding the warnings.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
 klogd.c |   22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

--- sysklogd-1.4.1/klogd.c
+++ sysklogd-1.4.1/klogd.c	2009-08-12 14:19:17.333901686 +0200
@@ -275,6 +275,8 @@
 #define ksyslog klogctl
 #endif
 
+#include <sys/utsname.h>
+
 #define LOG_BUFFER_SIZE 4096
 #define LOG_LINE_LENGTH 1000
 
@@ -999,6 +1001,23 @@
 	}
 }
 
+#ifndef KERNEL_VERSION
+#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
+#endif
+
+static int
+need_lookup(void)
+{
+	struct utsname utsname;
+	int major, minor, patch;
+	if (uname(&utsname) < 0) {
+		Syslog(LOG_ERR, "Cannot get kernel version information.");
+		return 0;
+	}
+	sscanf(utsname.release, "%d.%d.%d", &major, &minor, &patch);
+
+	return (KERNEL_VERSION(major, minor, patch) < KERNEL_VERSION(2,5,0));
+}
 
 int main(argc, argv)
 
@@ -1166,6 +1185,9 @@
 	else
 		openlog("kernel", 0, LOG_KERN);
 
+	/* We don't need lookups on kernels > 2.4 */
+	if (symbol_lookup)
+		symbol_lookup = need_lookup();
 
 	/* Handle one-shot logging. */
 	if ( one_shot )
openSUSE Build Service is sponsored by