syslogd/sysklogd-1.4.1-sysmap-prior-to-2.5.patch

65 lines
1.7 KiB
Diff
Raw Normal View History

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(+)
--- klogd.c
+++ klogd.c 2009-08-12 12:19:17.333901686 +0000
@@ -285,6 +285,8 @@ _syscall3(int,ksyslog,int, type, char *,
#define ksyslog klogctl
#endif
+#include <sys/utsname.h>
+
#define LOG_BUFFER_SIZE 4096
#define LOG_LINE_LENGTH 1000
@@ -1014,6 +1016,23 @@ static void SetBufSize(void)
}
}
+#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)
@@ -1199,6 +1218,9 @@ int main(argc, argv)
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 )