-Fix problem with server portion of ctrl-c bug

-Have blade plugin propogate ctrl-c induced abort to mpa processes


git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@1134 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
jbjohnso 2008-04-21 15:37:39 +00:00
parent b622d3ee7c
commit c779a9fb05
2 changed files with 11 additions and 2 deletions

View File

@ -9,6 +9,7 @@ use xCAT::Usage;
use IO::Socket;
use SNMP;
use strict;
my %mm_comm_pids;
use XML::Simple;
if ($^O =~ /^linux/i) {
@ -1276,6 +1277,13 @@ sub preprocess_request {
sub process_request {
$SIG{INT} = $SIG{TERM} = sub {
foreach (keys %mm_comm_pids) {
kill 2, $_;
}
exit 0;
};
my $request = shift;
my $callback = shift;
my $doreq = shift;
@ -1384,7 +1392,7 @@ sub process_request {
my $children = 0;
$SIG{CHLD} = sub { while (waitpid(-1, WNOHANG) > 0) { $children--; } };
$SIG{CHLD} = sub { my $cpid; while ($cpid = waitpid(-1, WNOHANG) > 0) { delete $mm_comm_pids{$cpid}; $children--; } };
my $inputs = new IO::Select;;
foreach my $info (@$moreinfo) {
$info=~/^\[(.*)\]\[(.*)\]\[(.*)\]/;
@ -1424,6 +1432,7 @@ sub process_request {
dompa($pfd,$mpa,\%mpahash,$command,-args=>\@exargs);
exit(0);
}
$mm_comm_pids{$cpid} = 1;
close ($pfd);
$sub_fds->add($cfd);
}

View File

@ -784,7 +784,7 @@ sub dispatch_request {
}
my $childrn=0;
$SIG{CHLD} = sub {my $cpid; while ($cpid =waitpid(-1, WNOHANG) > 0) { undef $dispatched_children{$cpid}; $childrn--; } };
$SIG{CHLD} = sub {my $cpid; while ($cpid =waitpid(-1, WNOHANG) > 0) { delete $dispatched_children{$cpid}; $childrn--; } };
foreach (@{$reqs}) {
my $pfd;
my $parfd; #use a private variable so it won't trounce itself recursively