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

X Strike Force XFree86 SVN commit: r2240 - in trunk/debian: . patches



Author: branden
Date: 2005-04-10 14:12:41 -0500 (Sun, 10 Apr 2005)
New Revision: 2240

Added:
   trunk/debian/patches/099x_xdm_support_logfile_rotation.diff
Modified:
   trunk/debian/CHANGESETS
   trunk/debian/changelog
   trunk/debian/xdm.logrotate
Log:
Make xdm support log rotation properly.
+ Write patch #099x.
  - Implement new ReopenLogFile() and ReopenLogFileNotify() functions.
    ReopenLogFileNotify() is a signal handler for SIGUSR2.
  - Move the definition of the WRITES() macro from error.c to dm_error.h
    so that dm.c can use it as well.
  - Document xdm's signal handling in its manpage.
+ Update xdm's logrotate configuration to add a postrotate script which
  signals xdm with SIGUSR2.
(Closes: #303688)


Modified: trunk/debian/CHANGESETS
===================================================================
--- trunk/debian/CHANGESETS	2005-04-08 05:43:35 UTC (rev 2239)
+++ trunk/debian/CHANGESETS	2005-04-10 19:12:41 UTC (rev 2240)
@@ -75,4 +75,16 @@
 (Closes: #285871)
     2238
 
+Make xdm support log rotation properly.
++ Write patch #099x.
+  - Implement new ReopenLogFile() and ReopenLogFileNotify() functions.
+    ReopenLogFileNotify() is a signal handler for SIGUSR2.
+  - Move the definition of the WRITES() macro from error.c to dm_error.h
+    so that dm.c can use it as well.
+  - Document xdm's signal handling in its manpage.
++ Update xdm's logrotate configuration to add a postrotate script which
+  signals xdm with SIGUSR2.
+(Closes: #303688)
+    2240
+
 vim:set ai et sts=4 sw=4 tw=80:

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2005-04-08 05:43:35 UTC (rev 2239)
+++ trunk/debian/changelog	2005-04-10 19:12:41 UTC (rev 2240)
@@ -59,8 +59,19 @@
     + Delay compression of log files until after they've been rotated.
     (Closes: #285871)
 
- -- Branden Robinson <branden@debian.org>  Fri,  8 Apr 2005 00:16:35 -0500
+  * Make xdm support log rotation properly.
+    + Write patch #099x.
+      - Implement new ReopenLogFile() and ReopenLogFileNotify() functions.
+        ReopenLogFileNotify() is a signal handler for SIGUSR2.
+      - Move the definition of the WRITES() macro from error.c to dm_error.h
+        so that dm.c can use it as well.
+      - Document xdm's signal handling in its manpage.
+    + Update xdm's logrotate configuration to add a postrotate script which
+      signals xdm with SIGUSR2.
+   (Closes: #303688)
 
+ -- Branden Robinson <branden@debian.org>  Sun, 10 Apr 2005 14:11:43 -0500
+
 xfree86 (4.3.0.dfsg.1-12) unstable; urgency=medium
 
   * Urgency set to medium due to fix for release-critical bug #295175

Added: trunk/debian/patches/099x_xdm_support_logfile_rotation.diff
===================================================================
--- trunk/debian/patches/099x_xdm_support_logfile_rotation.diff	2005-04-08 05:43:35 UTC (rev 2239)
+++ trunk/debian/patches/099x_xdm_support_logfile_rotation.diff	2005-04-10 19:12:41 UTC (rev 2240)
@@ -0,0 +1,171 @@
+$Id$
+
+Implement new ReopenLogFile() and ReopenLogFileNotify() functions to
+facilitate log rotation.  ReopenLogFileNotify() is a signal handler for
+SIGUSR2.  See Debian #303688.
+
+Move the definition of the WRITES() macro from error.c to dm_error.h so
+that dm.c can use it as well.
+
+This patch by Branden Robinson.
+
+Not submitted upstream to XFree86 or X.Org.
+
+diff -urN xc/programs/xdm~/dm.c xc/programs/xdm/dm.c
+--- xc/programs/xdm~/dm.c	2005-04-08 23:56:37.758486000 -0500
++++ xc/programs/xdm/dm.c	2005-04-08 23:57:01.167468815 -0500
+@@ -78,8 +78,10 @@
+ extern FILE    *fdopen();
+ #endif
+ 
+-static SIGVAL	StopAll (int n), RescanNotify (int n);
++static SIGVAL	StopAll (int n), RescanNotify (int n),
++		ReopenLogFileNotify (int n);
+ static void	RescanServers (void);
++static void	ReopenLogFile (void);
+ static void	RestartDisplay (struct display *d, int forceReserver);
+ static void	ScanServers (void);
+ static void	SetAccessFileTime (void);
+@@ -88,6 +90,7 @@
+ static void	TerminateProcess (int pid, int signal);
+ 
+ volatile int	Rescan;
++volatile int	Reopen;
+ static long	ServersModTime, ConfigModTime, AccessFileModTime;
+ 
+ int nofork_session = 0;
+@@ -201,6 +204,7 @@
+     AddOtherEntropy();
+ #endif
+     (void) Signal (SIGHUP, RescanNotify);
++    (void) Signal (SIGUSR2, ReopenLogFileNotify);
+ #ifndef UNRELIABLE_SIGNALS
+     (void) Signal (SIGCHLD, ChildNotify);
+ #endif
+@@ -211,6 +215,11 @@
+ #endif
+ 	   AnyDisplaysLeft ())
+     {
++	if (Reopen)
++	{
++	    ReopenLogFile ();
++	    Reopen = 0;
++	}
+ 	if (Rescan)
+ 	{
+ 	    RescanServers ();
+@@ -235,6 +244,7 @@
+     int olderrno = errno;
+ 
+     Debug ("caught SIGHUP\n");
++    Reopen = 1;
+     Rescan = 1;
+ #ifdef SIGNALS_RESET_WHEN_CAUGHT
+     (void) Signal (SIGHUP, RescanNotify);
+@@ -242,6 +252,26 @@
+     errno = olderrno;
+ }
+ 
++/*
++ * Handle a SIGUSR2: set variable that will instruct the main loop to
++ * reopen the log file.
++ */
++static void
++ReopenLogFileNotify (int n)
++{
++#ifdef SIGNALS_RESET_WHEN_CAUGHT
++    int olderrno = errno;
++#endif
++
++    /* Debug() is not safe inside a signal handler. */
++    WRITES(STDERR_FILENO, "ReopenLogFileNotify handling SIGUSR2\n");
++    Reopen = 1;
++#ifdef SIGNALS_RESET_WHEN_CAUGHT
++    (void) Signal (SIGUSR2, ReopenLogFileNotify);
++    errno = olderrno;
++#endif
++}
++
+ static void
+ ScanServers (void)
+ {
+@@ -309,6 +339,14 @@
+ }
+ 
+ static void
++ReopenLogFile (void)
++{
++    Debug ("closing standard error file descriptor %d\n", STDERR_FILENO);
++    close (STDERR_FILENO);
++    InitErrorLog ();
++}
++
++static void
+ SetConfigFileTime (void)
+ {
+     struct stat	statb;
+diff -urN xc/programs/xdm~/dm_error.h xc/programs/xdm/dm_error.h
+--- xc/programs/xdm~/dm_error.h	2005-04-08 23:06:12.000000000 -0500
++++ xc/programs/xdm/dm_error.h	2005-04-08 23:58:20.156409226 -0500
+@@ -44,6 +44,8 @@
+ # define GCC_PRINTFLIKE(fmt,var) /*nothing*/
+ #endif
+ 
++#define WRITES(fd, buf) write(fd, buf, strlen(buf))
++
+ extern void Debug        (char * fmt, ...) GCC_PRINTFLIKE(1,2);
+ extern void InitErrorLog (void);
+ extern void LogError     (char * fmt, ...) GCC_PRINTFLIKE(1,2);
+diff -urN xc/programs/xdm~/error.c xc/programs/xdm/error.c
+--- xc/programs/xdm~/error.c	2005-04-08 23:06:12.000000000 -0500
++++ xc/programs/xdm/error.c	2005-04-08 23:58:20.153409228 -0500
+@@ -49,8 +49,6 @@
+ #include "dm.h"
+ #include "dm_error.h"
+ 
+-#define WRITES(fd, buf) write(fd, buf, strlen(buf))
+-
+ void
+ LogInfo(char * fmt, ...)
+ {
+diff -urN xc/programs/xdm~/xdm.man xc/programs/xdm/xdm.man
+--- xc/programs/xdm~/xdm.man	2005-04-08 23:56:37.774486000 -0500
++++ xc/programs/xdm/xdm.man	2005-04-08 23:57:01.170468812 -0500
+@@ -1338,6 +1338,37 @@
+ multiple window systems on the same hardware, you'll probably be more
+ interested in
+ .I xinit.
++.SH "ASYNCHRONOUS EVENTS"
++.B xdm
++uses
++.B SIGALRM
++and
++.B SIGUSR1
++for its own inter-process communication purposes, managing the relationship
++between the parent
++.B xdm
++process and its children.
++Sending these signals to any
++.B xdm
++process may result in unexpected behavior.
++.TP
++.B SIGHUP
++causes
++.B xdm
++to rescan its configuration files and reopen its log file.
++.TP
++.B SIGTERM
++causes
++.B xdm
++to terminate its children and shut down.
++.TP
++.B SIGUSR2
++causes
++.B xdm
++to reopen its log file.
++This is useful if log rotation is desired, but
++.B SIGHUP
++is too disruptive.
+ .SH FILES
+ .TP 20
+ .I __projectroot__/lib/X11/xdm/xdm-config


Property changes on: trunk/debian/patches/099x_xdm_support_logfile_rotation.diff
___________________________________________________________________
Name: svn:keywords
   + Id

Modified: trunk/debian/xdm.logrotate
===================================================================
--- trunk/debian/xdm.logrotate	2005-04-08 05:43:35 UTC (rev 2239)
+++ trunk/debian/xdm.logrotate	2005-04-10 19:12:41 UTC (rev 2240)
@@ -7,6 +7,11 @@
     delaycompress
     notifempty
     missingok
+    postrotate
+        if [ -r /var/run/xdm.pid ]; then \
+            kill -s USR2 $(cat /var/run/xdm.pid); \
+        fi
+    endscript
 }
 
 # vim:set ai et sts=4 sw=4 tw=80:



Reply to: