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/sun Call LogInit() for lo...



details:   https://anonhg.NetBSD.org/xsrc/rev/e6fc6a80ba4b
branches:  trunk
changeset: 10531:e6fc6a80ba4b
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Tue Aug 04 14:31:04 2020 +0000

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

diffstat:

 external/mit/xorg-server/dist/hw/sun/sunInit.c |  24 ++++++++++++++++++++++++
 external/mit/xorg-server/dist/hw/sun/sunIo.c   |   1 +
 2 files changed, 25 insertions(+), 0 deletions(-)

diffs (59 lines):

diff -r 595bbf2226ae -r e6fc6a80ba4b external/mit/xorg-server/dist/hw/sun/sunInit.c
--- a/external/mit/xorg-server/dist/hw/sun/sunInit.c    Sat Aug 01 20:21:00 2020 +0000
+++ b/external/mit/xorg-server/dist/hw/sun/sunInit.c    Tue Aug 04 14:31:04 2020 +0000
@@ -52,6 +52,14 @@
 #include    "fb.h"
 #include    "extinit.h"
 
+/* default log file paths */
+#ifndef DEFAULT_LOGDIR
+#define DEFAULT_LOGDIR "/var/log"
+#endif
+#ifndef DEFAULT_LOGPREFIX
+#define DEFAULT_LOGPREFIX "Xsun."
+#endif
+
 /* maximum pixmap depth */
 #ifndef SUNMAXDEPTH
 #define SUNMAXDEPTH 8
@@ -481,6 +489,8 @@
 {
     static int inited;
     if (!inited) {
+       const char *logfile;
+       char *lf;
 #ifndef i386
        struct rlimit rl;
 
@@ -495,6 +505,20 @@
            (void) setrlimit (RLIMIT_NOFILE, &rl);
        }
 #endif
+
+#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);
+
        sunKbdPriv.fd = open ("/dev/kbd", O_RDWR, 0);
        if (sunKbdPriv.fd < 0)
            FatalError ("Cannot open /dev/kbd, error %d\n", errno);
diff -r 595bbf2226ae -r e6fc6a80ba4b external/mit/xorg-server/dist/hw/sun/sunIo.c
--- a/external/mit/xorg-server/dist/hw/sun/sunIo.c      Sat Aug 01 20:21:00 2020 +0000
+++ b/external/mit/xorg-server/dist/hw/sun/sunIo.c      Tue Aug 04 14:31:04 2020 +0000
@@ -186,6 +186,7 @@
        sunDisableCursor (pScreen);
 #endif
     }
+    LogClose(error);
 }
 
 /* Called by GiveUp(). */



Home | Main Index | Thread Index | Old Index