changeset 2693:f4d0604cbcc4

[project @ 1997-02-18 15:25:21 by jwe]
author jwe
date Tue, 18 Feb 1997 15:25:23 +0000
parents 25fbbe6074e9
children 13f134a00f12
files ChangeLog doc/ChangeLog libcruft/ChangeLog liboctave/ChangeLog scripts/ChangeLog src/ChangeLog src/sighandlers.cc src/sighandlers.h src/toplev.cc test/ChangeLog
diffstat 10 files changed, 49 insertions(+), 31 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Feb 18 09:49:12 1997 +0000
+++ b/ChangeLog	Tue Feb 18 15:25:23 1997 +0000
@@ -1,7 +1,9 @@
-Tue Feb 18 00:33:36 1997  John W. Eaton  <jwe@bevo.che.wisc.edu>
+Tue Feb 18 09:22:04 1997  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
 	* Version 2.0.3 released.
 
+Tue Feb 18 00:33:36 1997  John W. Eaton  <jwe@bevo.che.wisc.edu>
+
 	* octMakefile.in (binary-dist): Strip src/octave and info/info.
 
 	* examples/oregonator.m, examples/oregonator.cc: New files.
--- a/doc/ChangeLog	Tue Feb 18 09:49:12 1997 +0000
+++ b/doc/ChangeLog	Tue Feb 18 15:25:23 1997 +0000
@@ -1,4 +1,4 @@
-Tue Feb 18 03:21:41 1997  John W. Eaton  <jwe@bevo.che.wisc.edu>
+Tue Feb 18 09:22:04 1997  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
 	* Version 2.0.3 released.
 
--- a/libcruft/ChangeLog	Tue Feb 18 09:49:12 1997 +0000
+++ b/libcruft/ChangeLog	Tue Feb 18 15:25:23 1997 +0000
@@ -1,4 +1,4 @@
-Tue Feb 18 03:21:36 1997  John W. Eaton  <jwe@bevo.che.wisc.edu>
+Tue Feb 18 09:22:04 1997  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
 	* Version 2.0.3 released.
 
--- a/liboctave/ChangeLog	Tue Feb 18 09:49:12 1997 +0000
+++ b/liboctave/ChangeLog	Tue Feb 18 15:25:23 1997 +0000
@@ -1,4 +1,4 @@
-Tue Feb 18 03:21:27 1997  John W. Eaton  <jwe@bevo.che.wisc.edu>
+Tue Feb 18 09:22:04 1997  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
 	* Version 2.0.3 released.
 
--- a/scripts/ChangeLog	Tue Feb 18 09:49:12 1997 +0000
+++ b/scripts/ChangeLog	Tue Feb 18 15:25:23 1997 +0000
@@ -1,4 +1,4 @@
-Tue Feb 18 03:21:24 1997  John W. Eaton  <jwe@bevo.che.wisc.edu>
+Tue Feb 18 09:22:04 1997  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
 	* Version 2.0.3 released.
 
--- a/src/ChangeLog	Tue Feb 18 09:49:12 1997 +0000
+++ b/src/ChangeLog	Tue Feb 18 15:25:23 1997 +0000
@@ -1,7 +1,16 @@
-Tue Feb 18 00:27:49 1997  John W. Eaton  <jwe@bevo.che.wisc.edu>
+Tue Feb 18 09:22:04 1997  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
 	* Version 2.0.3 released.
 
+Tue Feb 18 00:27:49 1997  John W. Eaton  <jwe@bevo.che.wisc.edu>
+
+	* toplev.cc (run_command_and_return_output):
+	Block SIGCHLD while running subprocess.
+	(cleanup_iprocstream): Unblock it here.
+
+	* sighandlers.h (BLOCK_SIGNAL, BLOCK_CHILD, UNBLOCK_CHILD): Move here.
+	* sighandlers.cc: From here.
+
 	* toplev.cc (system): Shift then mask exit status.
 
 	* help.cc (try_info): Shift first, then mask exit status.
--- a/src/sighandlers.cc	Tue Feb 18 09:49:12 1997 +0000
+++ b/src/sighandlers.cc	Tue Feb 18 15:25:23 1997 +0000
@@ -87,26 +87,6 @@
   do { } while (0)
 #endif
 
-// The following signal blocking stuff is stolen from bash:
-
-#define BLOCK_SIGNAL(sig, nvar, ovar) \
-  do \
-    { \
-      sigemptyset (&nvar); \
-      sigaddset (&nvar, sig); \
-      sigemptyset (&ovar); \
-      sigprocmask (SIG_BLOCK, &nvar, &ovar); \
-    } \
-  while (0)
-
-#if defined (HAVE_POSIX_SIGNALS)
-#define BLOCK_CHILD(nvar, ovar) BLOCK_SIGNAL (SIGCHLD, nvar, ovar)
-#define UNBLOCK_CHILD(ovar) sigprocmask (SIG_SETMASK, &ovar, 0)
-#else
-#define BLOCK_CHILD(nvar, ovar) ovar = sigblock (sigmask (SIGCHLD))
-#define UNBLOCK_CHILD(ovar) sigsetmask (ovar)
-#endif
-
 void
 octave_save_signal_mask (void)
 {
--- a/src/sighandlers.h	Tue Feb 18 09:49:12 1997 +0000
+++ b/src/sighandlers.h	Tue Feb 18 15:25:23 1997 +0000
@@ -37,6 +37,26 @@
 #define BADSIG (RETSIGTYPE (*)(int))-1
 #endif
 
+// The following signal blocking stuff is stolen from bash:
+
+#define BLOCK_SIGNAL(sig, nvar, ovar) \
+  do \
+    { \
+      sigemptyset (&nvar); \
+      sigaddset (&nvar, sig); \
+      sigemptyset (&ovar); \
+      sigprocmask (SIG_BLOCK, &nvar, &ovar); \
+    } \
+  while (0)
+
+#if defined (HAVE_POSIX_SIGNALS)
+#define BLOCK_CHILD(nvar, ovar) BLOCK_SIGNAL (SIGCHLD, nvar, ovar)
+#define UNBLOCK_CHILD(ovar) sigprocmask (SIG_SETMASK, &ovar, 0)
+#else
+#define BLOCK_CHILD(nvar, ovar) ovar = sigblock (sigmask (SIGCHLD))
+#define UNBLOCK_CHILD(ovar) sigsetmask (ovar)
+#endif
+
 typedef RETSIGTYPE sig_handler (int);
 
 // All we need to do is declare pointers to this, so we don't need to
--- a/src/toplev.cc	Tue Feb 18 09:49:12 1997 +0000
+++ b/src/toplev.cc	Tue Feb 18 15:25:23 1997 +0000
@@ -70,6 +70,7 @@
 #include "pt-plot.h"
 #include "sighandlers.h"
 #include "sysdep.h"
+#include "syswait.h"
 #include "toplev.h"
 #include "unwind-prot.h"
 #include "utils.h"
@@ -649,9 +650,13 @@
 
 // Execute a shell command.
 
+static sigset_t signal_set, old_signal_set;
+
 static void
 cleanup_iprocstream (void *p)
 {
+  UNBLOCK_CHILD (old_signal_set);
+
   delete (iprocstream *) p;
 }
 
@@ -660,6 +665,8 @@
 {
   octave_value_list retval;
 
+  BLOCK_CHILD (signal_set, old_signal_set);
+
   iprocstream *cmd = new iprocstream (cmd_str.c_str ());
 
   add_unwind_protect (cleanup_iprocstream, cmd);
@@ -680,8 +687,8 @@
       // process exited normally, extract the actual exit status of
       // the command.  Otherwise, return 127 as a failure code.
 
-      if ((status & 0xff) == 0)
-	status = (status >> 8) & 0xff;
+      if (WIFEXITED (status))
+	status = WEXITSTATUS (status);
 
       output_buf << ends;
 
@@ -787,8 +794,8 @@
 	      // status of the command.  Otherwise, return 127 as a
 	      // failure code.
 
-	      if ((status & 0xff) == 0)
-		status = (status >> 8) & 0xff;
+	      if (WIFEXITED (status))
+		status = WEXITSTATUS (status);
 
 	      retval = (double) status;
 	    }
--- a/test/ChangeLog	Tue Feb 18 09:49:12 1997 +0000
+++ b/test/ChangeLog	Tue Feb 18 15:25:23 1997 +0000
@@ -1,4 +1,4 @@
-Tue Feb 18 03:20:53 1997  John W. Eaton  <jwe@bevo.che.wisc.edu>
+Tue Feb 18 09:22:04 1997  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
 	* Version 2.0.3 released.