1305 target->checking_subtree = false;
1306 return true;
1307 }
1308 }
1309 target->checking_subtree = false;
1310 return false;
1311 }
1312
1313 /*
1314 * await_parallel(waitflg)
1315 *
1316 * Waits for parallel children to exit and finishes their processing.
1317 * If waitflg is false, the function returns after update_delay.
1318 *
1319 * Parameters:
1320 * waitflg dwight
1321 */
1322 void
1323 await_parallel(Boolean waitflg)
1324 {
1325 #ifdef _CHECK_UPDATE_H
1326 static int number_of_unknown_children = 0;
1327 #endif /* _CHECK_UPDATE_H */
1328 Boolean nohang;
1329 pid_t pid;
1330 int status;
1331 Running rp;
1332 int waiterr;
1333
1334 nohang = false;
1335 for ( ; ; ) {
1336 if (!nohang) {
1337 (void) alarm((int) update_delay);
1338 }
1339 pid = waitpid((pid_t)-1,
1340 &status,
1341 nohang ? WNOHANG : 0);
1342 waiterr = errno;
1343 if (!nohang) {
1344 (void) alarm(0);
1345 }
1346 if (pid <= 0) {
1347 if (waiterr == EINTR) {
1348 if (waitflg) {
1349 continue;
1350 } else {
1351 return;
1352 }
1353 } else {
1354 return;
1355 }
1356 }
1357 for (rp = running_list;
1358 (rp != NULL) && (rp->pid != pid);
1359 rp = rp->next) {
1360 ;
1361 }
1362 if (rp == NULL) {
1363 #ifdef _CHECK_UPDATE_H
1364 /* Ignore first child - it is check_update */
1365 if (number_of_unknown_children <= 0) {
1366 number_of_unknown_children = 1;
1367 return;
1368 }
1369 #endif /* _CHECK_UPDATE_H */
1370 if (send_mtool_msgs) {
1371 continue;
1372 } else {
1373 fatal(catgets(catd, 1, 128, "Internal error: returned child pid not in running_list"));
1374 }
1375 } else {
1376 rp->state = (WIFEXITED(status) && WEXITSTATUS(status) == 0) ? build_ok : build_failed;
1377 }
1378 nohang = true;
1379 parallel_process_cnt--;
1380
1381 #if defined (TEAMWARE_MAKE_CMN) && defined (MAXJOBS_ADJUST_RFE4694000)
1382 if (job_adjust_mode == ADJUST_M2) {
1383 if (m2_release_job()) {
1384 job_adjust_error();
1385 }
1386 }
1387 #endif
1388 }
1389 }
|
1305 target->checking_subtree = false;
1306 return true;
1307 }
1308 }
1309 target->checking_subtree = false;
1310 return false;
1311 }
1312
1313 /*
1314 * await_parallel(waitflg)
1315 *
1316 * Waits for parallel children to exit and finishes their processing.
1317 * If waitflg is false, the function returns after update_delay.
1318 *
1319 * Parameters:
1320 * waitflg dwight
1321 */
1322 void
1323 await_parallel(Boolean waitflg)
1324 {
1325 Boolean nohang;
1326 pid_t pid;
1327 int status;
1328 Running rp;
1329 int waiterr;
1330
1331 nohang = false;
1332 for ( ; ; ) {
1333 if (!nohang) {
1334 (void) alarm((int) update_delay);
1335 }
1336 pid = waitpid((pid_t)-1,
1337 &status,
1338 nohang ? WNOHANG : 0);
1339 waiterr = errno;
1340 if (!nohang) {
1341 (void) alarm(0);
1342 }
1343 if (pid <= 0) {
1344 if (waiterr == EINTR) {
1345 if (waitflg) {
1346 continue;
1347 } else {
1348 return;
1349 }
1350 } else {
1351 return;
1352 }
1353 }
1354 for (rp = running_list;
1355 (rp != NULL) && (rp->pid != pid);
1356 rp = rp->next) {
1357 ;
1358 }
1359 if (rp == NULL) {
1360 if (send_mtool_msgs) {
1361 continue;
1362 } else {
1363 fatal(catgets(catd, 1, 128, "Internal error: returned child pid not in running_list"));
1364 }
1365 } else {
1366 rp->state = (WIFEXITED(status) && WEXITSTATUS(status) == 0) ? build_ok : build_failed;
1367 }
1368 nohang = true;
1369 parallel_process_cnt--;
1370
1371 #if defined (TEAMWARE_MAKE_CMN) && defined (MAXJOBS_ADJUST_RFE4694000)
1372 if (job_adjust_mode == ADJUST_M2) {
1373 if (m2_release_job()) {
1374 job_adjust_error();
1375 }
1376 }
1377 #endif
1378 }
1379 }
|