syslogd/sysklogd-1.4.1-sysmap-prior-to-2.5.patch
OBS User autobuild 2904bd5cd4 Accepting request 25079 from Base:System
Copy from Base:System/syslogd based on submit request 25079 from user msmeissn

OBS-URL: https://build.opensuse.org/request/show/25079
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/syslogd?expand=0&rev=22
2009-11-27 13:54:43 +00:00

67 lines
1.8 KiB
Diff

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(+)
Index: klogd.c
===================================================================
--- klogd.c.orig 2009-11-24 18:12:56.937035000 +0100
+++ klogd.c 2009-11-24 18:12:57.166028000 +0100
@@ -275,6 +275,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
@@ -999,6 +1001,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)
@@ -1166,6 +1185,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 )