commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r917508 - in /commons/sandbox/runtime/trunk/src/main/native: build/org/apache/commons/runtime/ant/FormattedEchoTask.java build/org/apache/commons/runtime/ant/IfTask.java os/unix/signals.c os/win32/signals.c
Date Mon, 01 Mar 2010 13:05:44 GMT
Author: mturk
Date: Mon Mar  1 13:05:44 2010
New Revision: 917508

URL: http://svn.apache.org/viewvc?rev=917508&view=rev
Log:
Add signals restore instead doing that inside signal

Modified:
    commons/sandbox/runtime/trunk/src/main/native/build/org/apache/commons/runtime/ant/FormattedEchoTask.java
    commons/sandbox/runtime/trunk/src/main/native/build/org/apache/commons/runtime/ant/IfTask.java
    commons/sandbox/runtime/trunk/src/main/native/os/unix/signals.c
    commons/sandbox/runtime/trunk/src/main/native/os/win32/signals.c

Modified: commons/sandbox/runtime/trunk/src/main/native/build/org/apache/commons/runtime/ant/FormattedEchoTask.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/build/org/apache/commons/runtime/ant/FormattedEchoTask.java?rev=917508&r1=917507&r2=917508&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/build/org/apache/commons/runtime/ant/FormattedEchoTask.java
(original)
+++ commons/sandbox/runtime/trunk/src/main/native/build/org/apache/commons/runtime/ant/FormattedEchoTask.java
Mon Mar  1 13:05:44 2010
@@ -24,6 +24,8 @@
 import org.apache.tools.ant.taskdefs.Echo;
 
 /**
+ * Extends standard echo task with formatted output.
+ * message parts are separated with double colon.
  */
 public class FormattedEchoTask extends Echo
 {
@@ -74,5 +76,5 @@
         }
         super.execute();
     }
-
 }
+

Modified: commons/sandbox/runtime/trunk/src/main/native/build/org/apache/commons/runtime/ant/IfTask.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/build/org/apache/commons/runtime/ant/IfTask.java?rev=917508&r1=917507&r2=917508&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/build/org/apache/commons/runtime/ant/IfTask.java
(original)
+++ commons/sandbox/runtime/trunk/src/main/native/build/org/apache/commons/runtime/ant/IfTask.java
Mon Mar  1 13:05:44 2010
@@ -45,7 +45,7 @@
     public void addThen(Sequential s)
     {
         if (thenTask != null) {
-            throw new BuildException("Only one nested <then> allowed inside <if>");
   
+            throw new BuildException("Only one nested <then> allowed inside <if>");
         }
         thenTask = s;
     }
@@ -53,7 +53,7 @@
     public void addElse(Sequential s)
     {
         if (elseTask != null) {
-            throw new BuildException("Only one nested <else> allowed inside <if>");
   
+            throw new BuildException("Only one nested <else> allowed inside <if>");
         }
         elseTask = s;
     }
@@ -67,11 +67,11 @@
         throws BuildException
     {
         if (countConditions() > 1) {
-            throw new BuildException("Only one nested condition allowed inside <if>");
               
+            throw new BuildException("Only one nested condition allowed inside <if>");
         }
         if (countConditions() < 1) {
-            throw new BuildException("One nested condition required inside <if>");
               
-        }        
+            throw new BuildException("One nested condition required inside <if>");
+        }
         Condition c = (Condition)getConditions().nextElement();
         return c.eval();
     }
@@ -80,16 +80,16 @@
         throws BuildException
     {
         if (countConditions() > 1) {
-            throw new BuildException("Only one nested condition allowed inside <if>");
               
+            throw new BuildException("Only one nested condition allowed inside <if>");
         }
         if (countConditions() < 1) {
-            throw new BuildException("One nested condition required inside <if>");
               
+            throw new BuildException("One nested condition required inside <if>");
         }
         Condition c = (Condition)getConditions().nextElement();
         if (c.eval()) {
             if (thenTask != null) {
-                thenTask.execute();    
-            }    
+                thenTask.execute();
+            }
         }
         else {
             boolean eval = false;
@@ -97,13 +97,14 @@
                 IfTask ei = (IfTask)(elifTasks.elementAt(i));
                 if (ei.eval()) {
                     eval = true;
-                    ei.execute();    
-                }    
-            }    
+                    ei.execute();
+                    break;
+                }
+            }
             if (!eval && elseTask != null) {
-                elseTask.execute();    
+                elseTask.execute();
             }
         }
     }
-
 }
+

Modified: commons/sandbox/runtime/trunk/src/main/native/os/unix/signals.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/unix/signals.c?rev=917508&r1=917507&r2=917508&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/unix/signals.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/unix/signals.c Mon Mar  1 13:05:44 2010
@@ -138,6 +138,61 @@
 
 #endif
 
+static int sync_signals[] = {
+#ifdef SIGABRT
+    SIGABRT,
+#endif
+#ifdef SIGBUS
+    SIGBUS,
+#endif
+#ifdef SIGEMT
+    SIGEMT,
+#endif
+#ifdef SIGFPE
+    SIGFPE,
+#endif
+#ifdef SIGILL
+    SIGILL,
+#endif
+#ifdef SIGIOT
+    SIGIOT,
+#endif
+#ifdef SIGPIPE
+    SIGPIPE,
+#endif
+#ifdef SIGSEGV
+    SIGSEGV,
+#endif
+#ifdef SIGSYS
+    SIGSYS,
+#endif
+#ifdef SIGTRAP
+    SIGTRAP,
+#endif
+    /* the rest of the signals removed from the mask in this function
+     * absolutely must be removed; you cannot block synchronous signals
+     * (requirement of pthreads API)
+     *
+     * SIGUSR2 is being removed from the mask for the convenience of
+     * Purify users (Solaris, HP-UX, SGI) since Purify uses SIGUSR2
+     */
+#ifdef SIGUSR2
+    SIGUSR2,
+#endif
+    -1
+};
+
+static void removeSyncSignals(sigset_t *sig_mask)
+{
+    int i;
+
+    for (i = 0; sync_signals[i] > 0; i++) {
+        /* Block most signals during SIGSEGV handling
+         */
+        sigdelset(sig_mask, sync_signals[i]);
+    }
+}
+
 static int initialized = 0;
 int acr_SignalsInit()
 {
@@ -274,14 +329,7 @@
         act.sa_handler = avoid_zombies;
     }
 #endif
-    if (func == SIG_DFL) {
-        if (_signalset[signo]->sa_handler != SIG_ERR)
-            rc = sigaction(signo, _signalset[signo], &oact);
-        else
-            errno = EACCES;
-    }
-    else
-        rc = sigaction(signo, &act, &oact);
+    rc = sigaction(signo, &act, &oact);
     if (rc < 0)
         return SIG_ERR;
     else
@@ -388,3 +436,21 @@
     return rv;
 }
 
+ACR_DECLARE(int) ACR_SignalRestore(int signo)
+{
+    int rc = -1;
+    struct sigaction oact;
+
+    if (signo < 1 || signo > ACR_NUMSIG) {
+        return EINVAL;
+    }
+    if (_signalset[signo]->sa_handler != SIG_ERR)
+        rc = sigaction(signo, _signalset[signo], &oact);
+    else
+        errno = EACCES;
+    if (rc < 0)
+        return errno;
+    else
+        return 0;
+}
+

Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/signals.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/signals.c?rev=917508&r1=917507&r2=917508&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/signals.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/signals.c Mon Mar  1 13:05:44 2010
@@ -888,6 +888,19 @@
     return sigprocmask(SIG_UNBLOCK, &sig_mask, NULL);
 }
 
+ACR_DECLARE(int) ACR_SignalRestore(int signo)
+{
+    /* Restoring signals set by JVM is noop on Windows.
+     * XXX: Is there an API for getting the list of
+     *      ConsoleHandlers? 
+     */
+    if (signo < 1 || signo > ACR_NUMSIG) {
+        return ACR_EINVAL;
+    }
+    else
+        return 0;
+}
+
 int acr_SignalsCleanup(void)
 {
     int rc = ACR_SUCCESS;



Mime
View raw message