Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[xsrc/trunk]: xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k Call LogInit(...



details:   https://anonhg.NetBSD.org/xsrc/rev/c218d709db8a
branches:  trunk
changeset: 10605:c218d709db8a
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Sun Nov 01 11:40:53 2020 +0000

description:
Call LogInit() for logging to /var/log/X68k.%s.log as Xorg and Xsun servers.

diffstat:

 external/mit/xorg-server/dist/hw/netbsd/x68k/x68kInit.c |  29 ++++++++++++++++-
 1 files changed, 28 insertions(+), 1 deletions(-)

diffs (53 lines):

diff -r 09c6db37c39d -r c218d709db8a external/mit/xorg-server/dist/hw/netbsd/x68k/x68kInit.c
--- a/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kInit.c   Sun Nov 01 11:12:58 2020 +0000
+++ b/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kInit.c   Sun Nov 01 11:40:53 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: x68kInit.c,v 1.8 2020/08/01 20:09:03 tsutsui Exp $ */
+/* $NetBSD: x68kInit.c,v 1.9 2020/11/01 11:40:53 tsutsui Exp $ */
 /*-------------------------------------------------------------------------
  * Copyright (c) 1996 Yasushi Yamasaki
  * All rights reserved.
@@ -75,9 +75,35 @@
 
 static int nscreens;
 
+/* default log file paths */
+#ifndef DEFAULT_LOGDIR
+#define DEFAULT_LOGDIR "/var/log"
+#endif
+#ifndef DEFAULT_LOGPREFIX
+#define DEFAULT_LOGPREFIX "X68K."
+#endif
+
 void
 OsVendorInit(void)
 {
+    static int inited;
+
+    if (!inited) {
+       const char *logfile;
+       char *lf;
+
+#define LOGSUFFIX ".log"
+#define LOGOLDSUFFIX ".old"
+       logfile = DEFAULT_LOGDIR "/" DEFAULT_LOGPREFIX;
+       if (asprintf(&lf, "%s%%s" LOGSUFFIX, logfile) == -1)
+           FatalError("Cannot allocate space for the log file name\n");
+       LogInit(lf, LOGOLDSUFFIX);
+#undef LOGSUFFIX
+#undef LOGOLDSUFFIX
+       free(lf);
+
+       inited = 1;
+    }
 }
 
 #ifdef GLXEXT
@@ -178,6 +204,7 @@
         fb = x68kGetFbProcRec(i);
         (*fb->close)(screen);
     }
+    LogClose(error);
 }
 
 /*-------------------------------------------------------------------------



Home | Main Index | Thread Index | Old Index