This patch puts the kernel version in the banner, on Linux, and also whether
or not it's tainted (providing it's a sufficiently recent kernel). Thanks
to Mike Harris for this patch (slightly altered to remove RH_CUSTOM, etc).

--- xc/programs/Xserver/hw/xfree86/common/Imakefile.orig        Fri Jan 10 19:19:19
2003
+++ xc/programs/Xserver/hw/xfree86/common/Imakefile     Fri Jan 10 19:21:34 2003
@@ -183,6 +183,9 @@
 CUSTOMVERSION = XFree86CustomVersion
  CUSTOMVERDEF = -DXF86_CUSTOM_VERSION='$(CUSTOMVERSION)'
 #endif
+#if defined(KernelVersionInBanner)
+   KERNELVER = -DXF86_KERNEL_VER_IN_BANNER
+#endif
 #if defined(BuilderString)
   BUILDERSTRING = BuilderString
   BUILDERMSG = -DBUILDERSTRING='$(BUILDERSTRING)'
@@ -208,7 +211,7 @@
 AllTarget($(OFILES))
 
 SpecialCObjectRule(xf86Bus,NullParameter,$(BUGMSG) $(VGAINCLUDES))
-SpecialCObjectRule(xf86Init,$(ICONFIGFILES),$(OSNAMEDEF) $(BUILDERMSG)
$(BUGMSG) $(CUSTOMVERDEF) $(XORGREL_DEF) $(EXT_DEFINES) $(BETADEFS)
$(MDEBUGDEFS))
+SpecialCObjectRule(xf86Init,$(ICONFIGFILES),$(OSNAMEDEF) $(BUILDERMSG)
$(BUGMSG) $(CUSTOMVERDEF) $(XORGREL_DEF) $(EXT_DEFINES) $(BETADEFS)
$(MDEBUGDEFS) $(KERNELVER))
 SpecialCObjectRule(xf86Events,$(ICONFIGFILES),$(EXT_DEFINES) $(MDEBUGDEFS))
 SpecialCObjectRule(xf86Globals,$(ICONFIGFILES),$(EXT_DEFINES)
$(MODPATHDEFINES) $(LOGDEFINES))
 SpecialCObjectRule(xf86Config,$(ICONFIGFILES),$(XCONFIGDEFINES))
--- xc/programs/Xserver/hw/xfree86/common/xf86Init.c.orig       Fri Jan 10
19:10:13 2003
+++ xc/programs/Xserver/hw/xfree86/common/xf86Init.c    Fri Jan 10 19:21:09
2003
@@ -66,6 +66,9 @@
 static void xf86PrintBanner(void);
 static void xf86PrintMarkers(void);
 static void xf86RunVtInit(void);
+#ifdef XF86_KERNEL_VER_IN_BANNER
+static void xf86PrintOSKernelString(void);
+#endif
 
 #ifdef DO_CHECK_BETA
 static int extraDays = 0;
@@ -116,6 +119,40 @@
        0
 };
 
+#ifdef XF86_KERNEL_VER_IN_BANNER
+/* The following function is an "ugly hack". mharris told me to say so. */
+#define KVERMAXBUF 1024
+static void
+xf86PrintOSKernelString(void)
+{
+  int tainted = -1;
+  char *buf;
+  FILE *infile;
+  
+  if ((buf = (char *) calloc(1, KVERMAXBUF)) != NULL)
+  {
+    if ((infile = fopen("/proc/sys/kernel/tainted", "r")) != NULL)
+    {
+       fgets(buf, KVERMAXBUF, infile);
+       fclose(infile);
+       tainted = atoi(buf);
+     }
+     if ((infile = fopen("/proc/version", "r")) != NULL)
+     {
+       if (fgets(buf, KVERMAXBUF, infile) == NULL)
+         sprintf(buf, "(unable to determine)");
+       else
+         buf[strlen(buf) - 1] = '\0';
+       fclose(infile);
+      }
+  }
+  ErrorF("OS Kernel: %s %s%s\n", buf, (tainted & 0x01) ? "T" : "",
+                                      (tainted & 0x02) ? "F" : "");
+  free(buf);
+}
+#endif
+            
+
 static Bool
 xf86CreateRootWindow(WindowPtr pWin)
 {
@@ -1681,6 +1718,9 @@
 #ifdef XFree86LOADER
   ErrorF("Module Loader present\n");
 #endif
+#ifdef XF86_KERNEL_VER_IN_BANNER
+  xf86PrintOSKernelString();
+#endif
 }
 
 static void
-- 
Treasurer, GOLUM, Inc.
http://www.golum.org

_______________________________________________
Devel mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/devel

Reply via email to