summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrunsch <brunsch@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2001-03-06 02:57:55 +0000
committerbrunsch <brunsch@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2001-03-06 02:57:55 +0000
commit3c039f47935cf401e58858712d8533229ad6bb13 (patch)
tree3294bf09e1ce7517ba033876468e5f1784c7b87f
parent8028639d1b56cd9fd2ede64b1eabd5b27bc2a563 (diff)
downloadATCD-3c039f47935cf401e58858712d8533229ad6bb13.tar.gz
ChangeLogTag:Mon Mar 5 18:54:42 2001 Darrell Brunsch <brunsch@uci.edu>
-rw-r--r--ChangeLog8
-rw-r--r--ChangeLogs/ChangeLog-02a8
-rw-r--r--ChangeLogs/ChangeLog-03a8
-rw-r--r--bin/PerlACE/Process_Unix.pm68
4 files changed, 90 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index a270eccfea6..3c6bf4ff795 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+Mon Mar 5 18:54:42 2001 Darrell Brunsch <brunsch@uci.edu>
+
+ * bin/PerlACE/Process_Unix.pm:
+
+ Updated the signal detection to not pay attention to TERM and
+ KILL. Will print out better output when signals cause a process
+ to exit during most calls like Kill () or TerminateWaitKill ().
+
Mon Mar 5 13:56:33 2001 Douglas C. Schmidt <schmidt@tango.cs.wustl.edu>
* ace/Synch_T.{h,i}: Added a new ACE_Guard constructor that
diff --git a/ChangeLogs/ChangeLog-02a b/ChangeLogs/ChangeLog-02a
index a270eccfea6..3c6bf4ff795 100644
--- a/ChangeLogs/ChangeLog-02a
+++ b/ChangeLogs/ChangeLog-02a
@@ -1,3 +1,11 @@
+Mon Mar 5 18:54:42 2001 Darrell Brunsch <brunsch@uci.edu>
+
+ * bin/PerlACE/Process_Unix.pm:
+
+ Updated the signal detection to not pay attention to TERM and
+ KILL. Will print out better output when signals cause a process
+ to exit during most calls like Kill () or TerminateWaitKill ().
+
Mon Mar 5 13:56:33 2001 Douglas C. Schmidt <schmidt@tango.cs.wustl.edu>
* ace/Synch_T.{h,i}: Added a new ACE_Guard constructor that
diff --git a/ChangeLogs/ChangeLog-03a b/ChangeLogs/ChangeLog-03a
index a270eccfea6..3c6bf4ff795 100644
--- a/ChangeLogs/ChangeLog-03a
+++ b/ChangeLogs/ChangeLog-03a
@@ -1,3 +1,11 @@
+Mon Mar 5 18:54:42 2001 Darrell Brunsch <brunsch@uci.edu>
+
+ * bin/PerlACE/Process_Unix.pm:
+
+ Updated the signal detection to not pay attention to TERM and
+ KILL. Will print out better output when signals cause a process
+ to exit during most calls like Kill () or TerminateWaitKill ().
+
Mon Mar 5 13:56:33 2001 Douglas C. Schmidt <schmidt@tango.cs.wustl.edu>
* ace/Synch_T.{h,i}: Added a new ACE_Guard constructor that
diff --git a/bin/PerlACE/Process_Unix.pm b/bin/PerlACE/Process_Unix.pm
index 4133ea84fa2..0f2c4591550 100644
--- a/bin/PerlACE/Process_Unix.pm
+++ b/bin/PerlACE/Process_Unix.pm
@@ -6,6 +6,7 @@ use strict;
use POSIX "sys_wait_h";
use Cwd;
use File::Basename;
+use Config;
###############################################################################
@@ -36,6 +37,26 @@ for(my $i = 0; $i <= $#ARGV; $i++) {
###############################################################################
+### Grab signal names
+
+my @signame;
+
+if (defined $Config{sig_name}) {
+ my $i = 0;
+ foreach my $name (split (' ', $Config{sig_name})) {
+ $signame[$i] = $name;
+ $i++;
+ }
+}
+else {
+ my $i;
+ for ($i = 0; $i < 255; ++$i) {
+ $signame[$i] = $i;
+ }
+}
+
+###############################################################################
+
### Constructor and Destructor
sub new
@@ -236,6 +257,47 @@ sub TerminateWaitKill ($)
return $self->WaitKill ($timeout);
}
+# really only for internal use
+sub check_return_value ($)
+{
+ my $self = shift;
+ my $rc = shift;
+
+ if ($rc == 0) {
+ return 0;
+ }
+ elsif ($rc == 0xff00) {
+ print STDERR "ERROR: <", $self->{EXECUTABLE},
+ "> failed: $!\n";
+ return ($rc >> 8);
+ }
+ elsif (($rc & 0xff) == 0) {
+ $rc >>= 8;
+ return $rc;
+ }
+
+ my $dump = 0;
+
+ if ($rc & 0x80) {
+ $rc &= ~0x80;
+ $dump = 1;
+ }
+
+ # check for KILL or TERM
+ if ($rc == 9 || $rc == 15) {
+ return 0;
+ }
+
+ print STDERR "ERROR: <", $self->{EXECUTABLE},
+ "> exited with ";
+
+ print STDERR "coredump from " if ($dump == 1);
+
+ print STDERR "signal $rc : ", $signame[$rc], "\n";
+
+ return 0;
+}
+
sub Kill ()
{
my $self = shift;
@@ -243,6 +305,7 @@ sub Kill ()
if ($self->{RUNNING}) {
kill ('KILL', $self->{PROCESS});
waitpid ($self->{PROCESS}, 0);
+ $self->check_return_value ($?);
}
$self->{RUNNING} = 0;
@@ -263,8 +326,8 @@ sub TimedWait ($)
while ($timeout-- != 0) {
my $pid = waitpid ($self->{PROCESS}, &WNOHANG);
if ($pid != 0 && $? != -1) {
- return $?;
- }
+ return $self->check_return_value ($?);
+ }
sleep 1;
}
@@ -272,3 +335,4 @@ sub TimedWait ($)
}
1;
+