| 348 | | hoster(mp) |
| 349 | | struct pmsg *mp; |
| 350 | | { |
| 351 | | struct pmsg *mp2; |
| 352 | | int num; |
| 353 | | int i; |
| 354 | | struct hst **hostlist; |
| 355 | | struct hst *hp; |
| 356 | | char *p; |
| 357 | | |
| 358 | | |
| 359 | | |
| 360 | | |
| 361 | | |
| 362 | | upkint(mp, &num); |
| 363 | | if (pvmdebmask & PDMSTARTUP) {
|
| 364 | | pvmlogprintf("hoster() %d to start\n", num); |
| 365 | | } |
| 366 | | if (num > 0) { |
| 367 | | hostlist = TALLOC(num, struct hst *, "hsts");
|
| 368 | | for (i = 0; i < num; i++) { |
| 369 | | hp = TALLOC(1, struct hst, "hst");
|
| 370 | | hostlist[i] = hp; |
| 371 | | hp->h_flag = 0; |
| 372 | | hp->h_result = 0; |
| 373 | | if (upkint(mp, &hp->h_tid) |
| 374 | | || upkstralloc(mp, &hp->h_sopts) |
| 375 | | || upkstralloc(mp, &hp->h_login) |
| 376 | | || upkstralloc(mp, &hp->h_cmd) |
| 377 | | || upkstralloc(mp, &hp->h_wincmd) |
| 378 | | || upkstralloc(mp, &hp->h_vmid)) { |
| 379 | | pvmlogerror("hoster() bad message format\n"); |
| 380 | | pvmbailout(0); |
| 381 | | } |
| 382 | | |
| 383 | | if (!strcmp(hp->h_wincmd,"")) { |
| 384 | | PVM_FREE(hp->h_wincmd);
|
| 385 | | hp->h_wincmd = 0; |
| 386 | | } |
| 387 | | |
| 388 | | if (!strcmp(hp->h_vmid,"")) { |
| 389 | | PVM_FREE(hp->h_vmid);
|
| 390 | | hp->h_vmid = 0; |
| 391 | | } |
| 392 | | if (pvmdebmask & PDMSTARTUP) {
|
| 393 | | pvmlogprintf("%d. t%x %s so=\"%s\"\n", i, |
| 394 | | hp->h_tid, |
| 395 | | hp->h_login, |
| 396 | | hp->h_sopts); |
| 397 | | } |
| 398 | | if (p = CINDEX(hp->h_login, '@')) {
|
| 399 | | hp->h_name = STRALLOC(p + 1);
|
| 400 | | *p = 0; |
| 401 | | p = STRALLOC(hp->h_login);
|
| 402 | | PVM_FREE(hp->h_login);
|
| 403 | | hp->h_login = p; |
| 404 | | |
| 405 | | } else { |
| 406 | | hp->h_name = hp->h_login; |
| 407 | | hp->h_login = 0; |
| 408 | | } |
| 409 | | if (!strcmp(hp->h_sopts, "pw")) |
| 410 | | hp->h_flag |= HST_PASSWORD;
|
| 411 | | if (!strcmp(hp->h_sopts, "ms")) |
| 412 | | hp->h_flag |= HST_MANUAL;
|
| 413 | | } |
| 414 | | } |
| 415 | | |
| 416 | | |
| 417 | | |
| 418 | | |
| 419 | | |
| 420 | | pl_startup(num, hostlist); |
| 421 | | |
| 422 | | |
| 423 | | |
| 424 | | |
| 425 | | |
| 426 | | mp2 = mesg_new(0); |
| 427 | | mp2->m_dst = mp->m_src; |
| 428 | | mp2->m_tag = DM_STARTACK;
|
| 429 | | mp2->m_wid = mp->m_wid; |
| 430 | | pkint(mp2, num); |
| 431 | | for (i = 0; i < num; i++) { |
| 432 | | pkint(mp2, hostlist[i]->h_tid); |
| 433 | | pkstr(mp2, hostlist[i]->h_result |
| 434 | | ? hostlist[i]->h_result : "PvmDSysErr"); |
| 435 | | } |
| 436 | | if (pvmdebmask & PDMSTARTUP)
|
| 437 | | pvmlogerror("hoster() pvmd' sending back host table\n"); |
| 438 | | sendmessage(mp2); |
| 439 | | work(); |
| 440 | | return 0; |
| 441 | | } |