[PATCH xserver 1/1] os: Pass the FatalError message to OsVendorFatalError

Jeremy Huddleston jeremyhu at apple.com
Fri Feb 17 13:47:51 PST 2012


Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
---
 hw/dmx/dmxinit.c             |    2 +-
 hw/dmx/dmxlog.c              |    3 ---
 hw/kdrive/src/kdrive.c       |    2 +-
 hw/vfb/InitOutput.c          |    2 +-
 hw/xfree86/common/xf86Init.c |    2 +-
 hw/xnest/Init.c              |    2 +-
 hw/xquartz/darwin.c          |    2 +-
 hw/xwin/winerror.c           |    2 +-
 include/os.h                 |    2 +-
 os/log.c                     |   16 ++++++++++------
 test/ddxstubs.c              |    2 +-
 11 files changed, 19 insertions(+), 18 deletions(-)

diff --git a/hw/dmx/dmxinit.c b/hw/dmx/dmxinit.c
index 57c2425..9388833 100644
--- a/hw/dmx/dmxinit.c
+++ b/hw/dmx/dmxinit.c
@@ -855,7 +855,7 @@ void OsVendorInit(void)
  * OsVendorVErrorFProc will cause \a VErrorF() (which is called by the
  * two routines mentioned here, as well as by others) to use the
  * referenced routine instead of \a vfprintf().) */
-void OsVendorFatalError(void)
+void OsVendorFatalError(const char *f, va_list args)
 {
 }
 
diff --git a/hw/dmx/dmxlog.c b/hw/dmx/dmxlog.c
index 94b8035..0ebe9f9 100644
--- a/hw/dmx/dmxlog.c
+++ b/hw/dmx/dmxlog.c
@@ -102,9 +102,6 @@ static void VFatalError(const char *format, va_list args)
 {
     VErrorF(format, args);
     ErrorF("\n");
-#ifdef DDXOSFATALERROR
-    OsVendorFatalError();
-#endif
     AbortServer();
     /*NOTREACHED*/
 }
diff --git a/hw/kdrive/src/kdrive.c b/hw/kdrive/src/kdrive.c
index f6cc351..5d69830 100644
--- a/hw/kdrive/src/kdrive.c
+++ b/hw/kdrive/src/kdrive.c
@@ -1167,7 +1167,7 @@ KdInitOutput (ScreenInfo    *pScreenInfo,
 }
 
 void
-OsVendorFatalError(void)
+OsVendorFatalError(const char *f, va_list args)
 {
 }
 
diff --git a/hw/vfb/InitOutput.c b/hw/vfb/InitOutput.c
index e1af5a4..71c7b6d 100644
--- a/hw/vfb/InitOutput.c
+++ b/hw/vfb/InitOutput.c
@@ -219,7 +219,7 @@ OsVendorInit(void)
 }
 
 void
-OsVendorFatalError(void)
+OsVendorFatalError(const char *f, va_list args)
 {
 }
 
diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index 5263b5f..56550c9 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -1036,7 +1036,7 @@ AbortDDX(enum ExitCode error)
 }
 
 void
-OsVendorFatalError(void)
+OsVendorFatalError(const char *f, va_list args)
 {
 #ifdef VENDORSUPPORT
     ErrorF("\nPlease refer to your Operating System Vendor support pages\n"
diff --git a/hw/xnest/Init.c b/hw/xnest/Init.c
index af57518..b7e76b5 100644
--- a/hw/xnest/Init.c
+++ b/hw/xnest/Init.c
@@ -138,7 +138,7 @@ void OsVendorInit(void)
     return;
 }
 
-void OsVendorFatalError(void)
+void OsVendorFatalError(const char *f, va_list args)
 {
     return;
 }
diff --git a/hw/xquartz/darwin.c b/hw/xquartz/darwin.c
index 465a96d..5d2da03 100644
--- a/hw/xquartz/darwin.c
+++ b/hw/xquartz/darwin.c
@@ -605,7 +605,7 @@ void InitOutput( ScreenInfo *pScreenInfo, int argc, char **argv )
 /*
  * OsVendorFatalError
  */
-void OsVendorFatalError( void )
+void OsVendorFatalError(const char *f, va_list args)
 {
     ErrorF( "   OsVendorFatalError\n" );
 }
diff --git a/hw/xwin/winerror.c b/hw/xwin/winerror.c
index 0440d13..82ab382 100644
--- a/hw/xwin/winerror.c
+++ b/hw/xwin/winerror.c
@@ -71,7 +71,7 @@ OsVendorVErrorF (const char *pszFormat, va_list va_args)
  * Attempt to do last-ditch, safe, important cleanup here.
  */
 void
-OsVendorFatalError (void)
+OsVendorFatalError (const char *f, va_list args)
 {
   /* Don't give duplicate warning if UseMsg was called */
   if (g_fSilentFatalError)
diff --git a/include/os.h b/include/os.h
index 48ce329..ae7a6f1 100644
--- a/include/os.h
+++ b/include/os.h
@@ -296,7 +296,7 @@ extern _X_EXPORT void OsInit(void);
 
 extern _X_EXPORT void OsCleanup(Bool);
 
-extern _X_EXPORT void OsVendorFatalError(void);
+extern _X_EXPORT void OsVendorFatalError(const char *f, va_list args) _X_ATTRIBUTE_PRINTF(1,0);;
 
 extern _X_EXPORT void OsVendorInit(void);
 
diff --git a/os/log.c b/os/log.c
index 671a01b..cdff7d1 100644
--- a/os/log.c
+++ b/os/log.c
@@ -585,6 +585,7 @@ void
 FatalError(const char *f, ...)
 {
     va_list args;
+    va_list args2;
     static Bool beenhere = FALSE;
 
     if (beenhere)
@@ -592,20 +593,23 @@ FatalError(const char *f, ...)
     else
 	ErrorF("\nFatal server error:\n");
 
-    va_start(args, f);
+    /* Make a copy for OsVendorFatalError */
+    va_copy(args2, args);
+
 #ifdef __APPLE__
     {
-        va_list args2;
-        va_copy(args2, args);
-        (void)vsnprintf(__crashreporter_info_buff__, sizeof(__crashreporter_info_buff__), f, args2);
-        va_end(args2);
+        va_list apple_args;
+        va_copy(apple_args, args);
+        (void)vsnprintf(__crashreporter_info_buff__, sizeof(__crashreporter_info_buff__), f, apple_args);
+        va_end(apple_args);
     }
 #endif
     VErrorF(f, args);
     va_end(args);
     ErrorF("\n");
     if (!beenhere)
-	OsVendorFatalError();
+	OsVendorFatalError(f, args2);
+    va_end(args2);
     if (!beenhere) {
 	beenhere = TRUE;
 	AbortServer();
diff --git a/test/ddxstubs.c b/test/ddxstubs.c
index baf2a7a..afaadfc 100644
--- a/test/ddxstubs.c
+++ b/test/ddxstubs.c
@@ -43,7 +43,7 @@ void ProcessInputEvents(void) {
 void OsVendorInit(void) {
 }
 
-void OsVendorFatalError(void) {
+void OsVendorFatalError(const char *f, va_list args) {
 }
 
 void AbortDDX(enum ExitCode error) {
-- 
1.7.9



More information about the xorg-devel mailing list