CVS commit: xsrc/external/mit/libXxf86dga/dist/src

2021-01-23 Thread Izumi Tsutsui
Module Name:xsrc
Committed By:   tsutsui
Date:   Sat Jan 23 14:41:04 UTC 2021

Modified Files:
xsrc/external/mit/libXxf86dga/dist/src: XF86DGA.c

Log Message:
Fix "no output of xdpyinfo(1) on redirect or pipe" problem.

XF86cleanup() in libXxf86dga invoked via atexit(3)
(or __attribute__((__destructor__)) in NetBSD xsrc)
calls _exit(2) directly so fflush(3) via normal exit(3)
is not called.  Analyzed by rin@, ryo@, and soda@:
 https://mail-index.netbsd.org/tech-x11/2021/01/20/msg002192.html

Should be pulled up to netbsd-9.

XXX1: The original XF86cleanup() is not async-signale-safe.
XXX2: XF86DGAGetVideo() implicitly overrides signal handlers.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 xsrc/external/mit/libXxf86dga/dist/src/XF86DGA.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: xsrc/external/mit/libXxf86dga/dist/src/XF86DGA.c
diff -u xsrc/external/mit/libXxf86dga/dist/src/XF86DGA.c:1.2 xsrc/external/mit/libXxf86dga/dist/src/XF86DGA.c:1.3
--- xsrc/external/mit/libXxf86dga/dist/src/XF86DGA.c:1.2	Fri Jan  4 18:59:45 2019
+++ xsrc/external/mit/libXxf86dga/dist/src/XF86DGA.c	Sat Jan 23 14:41:04 2021
@@ -650,14 +650,14 @@ static void
 #ifdef __NetBSD__
 __attribute__ ((__destructor__))
 #endif
-XF86cleanup(int sig)
+XF86cleanup_atexit(void)
 {
 ScrPtr sp;
 int i;
 static char beenhere = 0;
 
 if (beenhere)
-	_exit(3);
+	return;
 beenhere = 1;
 
 for (i = 0; i < numScrs; i++) {
@@ -665,6 +665,14 @@ XF86cleanup(int sig)
 	XF86DGADirectVideo(sp->display, sp->screen, 0);
 	XSync(sp->display, False);
 }
+}
+
+static void
+XF86cleanup(int sig)
+{
+/* XXX FIXME XF86cleanup_atexit() is not async-signal-safe */
+XF86cleanup_atexit();
+
 _exit(3);
 }
 
@@ -707,7 +715,7 @@ XF86DGAGetVideo(
 if (!beenHere) {
 	beenHere = 1;
 #ifndef __NetBSD__
-	atexit((void(*)(void))XF86cleanup);
+	atexit((void(*)(void))XF86cleanup_atexit);
 #endif
 	/* one shot XF86cleanup attempts */
 	signal(SIGSEGV, XF86cleanup);



CVS commit: xsrc/external/mit/libXxf86dga/dist/src

2019-01-04 Thread Christos Zoulas
Module Name:xsrc
Committed By:   christos
Date:   Fri Jan  4 18:59:45 UTC 2019

Modified Files:
xsrc/external/mit/libXxf86dga/dist/src: XF86DGA.c

Log Message:
use a destructor instead of atexit(3) to prevent SEGV's after dlclose.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.4 -r1.2 xsrc/external/mit/libXxf86dga/dist/src/XF86DGA.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: xsrc/external/mit/libXxf86dga/dist/src/XF86DGA.c
diff -u xsrc/external/mit/libXxf86dga/dist/src/XF86DGA.c:1.1.1.4 xsrc/external/mit/libXxf86dga/dist/src/XF86DGA.c:1.2
--- xsrc/external/mit/libXxf86dga/dist/src/XF86DGA.c:1.1.1.4	Fri May 31 05:19:59 2013
+++ xsrc/external/mit/libXxf86dga/dist/src/XF86DGA.c	Fri Jan  4 13:59:45 2019
@@ -647,6 +647,9 @@ XF86DGADirectVideo(
 
 
 static void
+#ifdef __NetBSD__
+__attribute__ ((__destructor__))
+#endif
 XF86cleanup(int sig)
 {
 ScrPtr sp;
@@ -703,7 +706,9 @@ XF86DGAGetVideo(
 
 if (!beenHere) {
 	beenHere = 1;
+#ifndef __NetBSD__
 	atexit((void(*)(void))XF86cleanup);
+#endif
 	/* one shot XF86cleanup attempts */
 	signal(SIGSEGV, XF86cleanup);
 #ifdef SIGBUS