[libvirt] Fix cygwin build

Daniel Veillard veillard at redhat.com
Tue Mar 8 08:07:37 UTC 2011


  In virLogEmergencyDumpAll I was using SIGBUS and SIGUSR2, and
apparently they arent; defined on cygwin signal.h header. I decided to
make the code conditional for all of them and not just those two for
portability sake. I resisted doing this on the daemon side because as
far as I know we don't compile it on WIN32. So I just pushed the
following under the build breaking rule,

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel at veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/
-------------- next part --------------
commit d299e1d08eadb8bfc5d53087e41f33189a9c8f17
Author: Daniel Veillard <veillard at redhat.com>
Date:   Tue Mar 8 16:01:25 2011 +0800

    Fix build on cygwin
    
    Apparently some signals found on Unix are not exposed, this led
    to a compilation failure
    * src/util/logging.c: make code related to each signal dependant
      upon the definition of that signal

diff --git a/src/util/logging.c b/src/util/logging.c
index 956e046..6490376 100644
--- a/src/util/logging.c
+++ b/src/util/logging.c
@@ -316,24 +316,36 @@ virLogEmergencyDumpAll(int signum) {
 
     virLogLock();
     switch (signum) {
+#ifdef SIGFPE
         case SIGFPE:
             virLogDumpAllFD( "Caught signal Floating-point exception", -1);
             break;
+#endif
+#ifdef SIGSEGV
         case SIGSEGV:
             virLogDumpAllFD( "Caught Segmentation violation", -1);
             break;
+#endif
+#ifdef SIGILL
         case SIGILL:
             virLogDumpAllFD( "Caught illegal instruction", -1);
             break;
+#endif
+#ifdef SIGABRT
         case SIGABRT:
             virLogDumpAllFD( "Caught abort signal", -1);
             break;
+#endif
+#ifdef SIGBUS
         case SIGBUS:
             virLogDumpAllFD( "Caught bus error", -1);
             break;
+#endif
+#ifdef SIGUSR2
         case SIGUSR2:
             virLogDumpAllFD( "Caught User-defined signal 2", -1);
             break;
+#endif
         default:
             virLogDumpAllFD( "Caught unexpected signal", -1);
             break;


More information about the libvir-list mailing list