mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-06-13 18:00:38 +00:00
fix issue for using waitpid for openbmc perl (#5208)
This commit is contained in:
@ -953,8 +953,8 @@ sub process_request {
|
||||
|
||||
while (1) {
|
||||
last if ($child_num == 0 and !@nodes_login);
|
||||
my $cpid;
|
||||
while (($cpid = waitpid(-1, WNOHANG)) > 0) {
|
||||
my $cpid = waitpid(-1, WNOHANG);
|
||||
if ($cpid > 0) {
|
||||
if ($login_pid_node{$cpid}) {
|
||||
$child_num--;
|
||||
my $node = $login_pid_node{$cpid};
|
||||
@ -964,7 +964,12 @@ sub process_request {
|
||||
}
|
||||
delete $login_pid_node{$cpid};
|
||||
}
|
||||
} elsif ($cpid == 0) {
|
||||
select(undef, undef, undef, 0.01);
|
||||
} elsif ($cpid < 0 and !@nodes_login) {
|
||||
last;
|
||||
}
|
||||
|
||||
if (@nodes_login) {
|
||||
if ($child_num < $max_child_num) {
|
||||
my $node = shift @nodes_login;
|
||||
@ -1073,23 +1078,26 @@ rmdir \"/tmp/\$userid\" \n";
|
||||
while (my ($response, $handle_id) = $async->wait_for_next_response) {
|
||||
deal_with_response($handle_id, $response);
|
||||
}
|
||||
while ((my $cpid = waitpid(-1, WNOHANG)) > 0) {
|
||||
if ($child_node_map{$cpid}) {
|
||||
my $node = $child_node_map{$cpid};
|
||||
my $rc = $? >> 8;
|
||||
if ($rc != 0) {
|
||||
$wait_node_num--;
|
||||
} else {
|
||||
if ($status_info{ $node_info{$node}{cur_status} }->{process}) {
|
||||
$status_info{ $node_info{$node}{cur_status} }->{process}->($node, undef);
|
||||
} else {
|
||||
xCAT::SvrUtils::sendmsg([1,"Internal error, check the process handler for current status "
|
||||
.$node_info{$node}{cur_status}."."], $callback, $node);
|
||||
$wait_node_num--;
|
||||
}
|
||||
|
||||
if (%child_node_map) {
|
||||
while ((my $cpid = waitpid(-1, WNOHANG)) > 0) {
|
||||
if ($child_node_map{$cpid}) {
|
||||
my $node = $child_node_map{$cpid};
|
||||
my $rc = $? >> 8;
|
||||
if ($rc != 0) {
|
||||
$wait_node_num--;
|
||||
} else {
|
||||
if ($status_info{ $node_info{$node}{cur_status} }->{process}) {
|
||||
$status_info{ $node_info{$node}{cur_status} }->{process}->($node, undef);
|
||||
} else {
|
||||
xCAT::SvrUtils::sendmsg([1,"Internal error, check the process handler for current status "
|
||||
.$node_info{$node}{cur_status}."."], $callback, $node);
|
||||
$wait_node_num--;
|
||||
}
|
||||
|
||||
}
|
||||
delete $child_node_map{$cpid};
|
||||
}
|
||||
delete $child_node_map{$cpid};
|
||||
}
|
||||
}
|
||||
my @del;
|
||||
|
Reference in New Issue
Block a user