I'm running across more and more software which expects SIGPWR to be defined.

In Linux, SIGPWR is a synonym for SIGLOST on sparc, on alpha it's a synonym for SIGINFO (unique to alpha, and SIGLOST is not defined), and almost all other arches do not define SIGLOST at all and define SIGPWR on it's own. Only one arch (parisc) defines both SIGLOST and SIGPWR separately.

Neither SIGPWR nor SIGLOST are defined by POSIX. Since we already define SIGLOST, and no signal value <SIGRTMIN is undefined, this patch follows the lead of Linux sparc and defines SIGPWR as a synonym for SIGLOST.

IIUC in strsig.cc, only the first signal passed to _s2 will be listed by 'kill -l' but both are accepted. To match Linux behaviour I chose to make SIGPWR primary.

Patch attached.


Yaakov

2010-02-25  Yaakov Selkowitz  <[email protected]>

        * include/cygwin/signal.h: Define SIGPWR as synonym for SIGLOST.
        * strsig.cc: Ditto.
        * include/cygwin/version.h: Bump CYGWIN_VERSION_API_MINOR.

Index: strsig.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/strsig.cc,v
retrieving revision 1.5
diff -u -r1.5 strsig.cc
--- strsig.cc   11 Sep 2008 06:22:31 -0000      1.5
+++ strsig.cc   26 Feb 2010 05:13:23 -0000
@@ -49,7 +49,8 @@
   _s(SIGVTALRM, "Virtual timer expired"),      /* 26 */ \
   _s(SIGPROF, "Profiling timer expired"),      /* 27 */ \
   _s(SIGWINCH, "Window changed"),              /* 28 */ \
-  _s(SIGLOST, "Resource lost"),                        /* 29 */ \
+  _s2(SIGPWR, "Power failure",                         /* 29 */ \
+      SIGLOST, "Resource lost"),                        \
   _s(SIGUSR1, "User defined signal 1"),                /* 30 */ \
   _s(SIGUSR2, "User defined signal 2"),                /* 31 */ \
   _s2(SIGRTMIN, "Real-time signal 0",          /* 32 */ \
Index: include/cygwin/signal.h
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/include/cygwin/signal.h,v
retrieving revision 1.17
diff -u -r1.17 signal.h
--- include/cygwin/signal.h     11 Sep 2008 06:22:31 -0000      1.17
+++ include/cygwin/signal.h     26 Feb 2010 05:13:24 -0000
@@ -250,6 +250,7 @@
 #define        SIGPROF 27      /* profiling time alarm */
 #define        SIGWINCH 28     /* window changed */
 #define        SIGLOST 29      /* resource lost (eg, record-lock lost) */
+#define        SIGPWR  SIGLOST /* power failure */
 #define        SIGUSR1 30      /* user defined signal 1 */
 #define        SIGUSR2 31      /* user defined signal 2 */
 
Index: include/cygwin/version.h
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/include/cygwin/version.h,v
retrieving revision 1.309
diff -u -r1.309 version.h
--- include/cygwin/version.h    8 Feb 2010 09:52:40 -0000       1.309
+++ include/cygwin/version.h    26 Feb 2010 05:13:24 -0000
@@ -376,12 +376,13 @@
       220: Export accept4, SOCK_CLOEXEC, SOCK_NONBLOCK.
       221: Export strfmon.
       222: CW_INT_SETLOCALE added.
+      223: SIGPWR added.
      */
 
      /* Note that we forgot to bump the api for ualarm, strtoll, strtoull */
 
 #define CYGWIN_VERSION_API_MAJOR 0
-#define CYGWIN_VERSION_API_MINOR 222
+#define CYGWIN_VERSION_API_MINOR 223
 
      /* There is also a compatibity version number associated with the
        shared memory regions.  It is incremented when incompatible

Reply via email to