home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / unix / volume27 / distributed-c-2.1 / part11 < prev    next >
Text File  |  1993-12-22  |  84KB  |  2,195 lines

  1. Newsgroups: comp.sources.unix
  2. From: pleierc@informatik.tu-muenchen.de (Christoph Pleier)
  3. Subject: v27i185: distributed-c-2.1 - Distributed C Development Environment, V2.1, Part11/18
  4. References: <1.756634932.28500@gw.home.vix.com>
  5. Sender: unix-sources-moderator@gw.home.vix.com
  6. Approved: vixie@gw.home.vix.com
  7.  
  8. Submitted-By: pleierc@informatik.tu-muenchen.de (Christoph Pleier)
  9. Posting-Number: Volume 27, Issue 185
  10. Archive-Name: distributed-c-2.1/part11
  11.  
  12. #! /bin/sh
  13. # This is a shell archive.  Remove anything before this line, then unpack
  14. # it by saving it into a file and typing "sh file".  To overwrite existing
  15. # files, type "sh file -c".  You can also feed this as standard input via
  16. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  17. # will see the following message at the end:
  18. #        "End of archive 11 (of 18)."
  19. # Contents:  config/ReadSymbtab.c config/symb_system.c
  20. #   dcadmin/Location.c dcadmin/main.c dclocate/BuildLists.c
  21. # Wrapped by vixie@gw.home.vix.com on Thu Dec 23 00:12:03 1993
  22. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  23. if test -f 'config/ReadSymbtab.c' -a "${1}" != "-c" ; then 
  24.   echo shar: Will not clobber existing file \"'config/ReadSymbtab.c'\"
  25. else
  26. echo shar: Extracting \"'config/ReadSymbtab.c'\" \(16007 characters\)
  27. sed "s/^X//" >'config/ReadSymbtab.c' <<'END_OF_FILE'
  28. X/***************************************************************************
  29. X *                                                                         *
  30. X * @@@@  @@@ @@@@@ @@@@@ @@@@@ @@@ @@@@  @   @ @@@@@ @@@@@ @@@@       @@@  *
  31. X * @   @  @  @       @   @   @  @  @   @ @   @   @   @     @   @     @   @ *
  32. X * @   @  @  @@@@@   @   @@@@@  @  @@@@@ @   @   @   @@@@@ @   @     @     *
  33. X * @   @  @      @   @   @ @    @  @   @ @   @   @   @     @   @     @   @ *
  34. X * @@@@  @@@ @@@@@   @   @  @  @@@ @@@@  @@@@@   @   @@@@@ @@@@       @@@  *
  35. X *                                                                         *
  36. X *              A compiler for distributed programming with C              *
  37. X *                                                                         *
  38. X *                        R e a d S y m b t a b . c                        *
  39. X *                                                                         *
  40. X *                            Package : Configuration Files Parsers        *
  41. X *                            Version : 1.0                                *
  42. X *                       CreationDate : 02.03.92                           *
  43. X *                         LastUpDate : 04.03.92                           *
  44. X *                                                                         *
  45. X *             All routines needed for loading a symbol table.             *
  46. X *                                                                         *
  47. X *               Copyright (C) 1992-1994 by Christoph Pleier               *
  48. X *                          All rights reserved!                           *
  49. X ***************************************************************************/
  50. X
  51. X/*
  52. X * This file is part of the Distributed C Development Environment (DCDE).
  53. X * DCDE is free software; you can redistribute it and/or modify
  54. X * it under the terms written in the README-file. 
  55. X * DCDE is distributed in the hope that it will be useful,
  56. X * but WITHOUT ANY WARRANTY; without even the implied warranty of
  57. X * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
  58. X * See the file README for more details.
  59. X */
  60. X
  61. X#include <stdio.h>
  62. X#include <stdlib.h>
  63. X#include "cfgparsers.h"
  64. X
  65. X/******************************************************************************
  66. X * get_symbtab_entry()                                                        *
  67. X *                                                                            *
  68. X * Searches the symbol table entry corresponding to 'name'. Displays an error *
  69. X * and terminates if no matching symbol found.                                *
  70. X *                                                                            *
  71. X * Return values: pointer to found symbol table entry upon success /          *
  72. X *                exit upon error                                             *
  73. X ******************************************************************************/
  74. Xstatic SYMBTABEL *
  75. Xget_symbtab_entry(name)
  76. Xchar *name;
  77. X{
  78. X    SYMBTABEL *symbol;
  79. X
  80. X    symbol = lookup_symbtabel(name);
  81. X
  82. X    if (symbol)
  83. X    return(symbol);
  84. X
  85. X    fprintf(stderr, "Panic: symbol \"%s\" not found in symbol table!\n", name);
  86. X    fprintf(stderr, "Terminating.\n");
  87. X    exit(-1);
  88. X} /* get_symbtab_entry */
  89. X
  90. X/******************************************************************************
  91. X * ReadIDENTLIST()                                                            *
  92. X *                                                                            *
  93. X * Reads a IDENTLIST from file 'filep'.                                       *
  94. X *                                                                            *
  95. X * Return values: pointer to generated list upon success / NULL upon error    *
  96. X ******************************************************************************/
  97. XIDENTLIST *
  98. XReadIDENTLIST(filep)
  99. XFILE *filep;
  100. X{
  101. X    register IDENTLIST *idl, *idlfirst = NULL, *idllast;
  102. X    int count;
  103. X    char str[100];
  104. X    SYMBTABEL *symbol;
  105. X
  106. X    fscanf(filep, "%d\n", &count);
  107. X
  108. X    while(count--) {
  109. X    fscanf(filep, "%s\n", str);
  110. X    symbol = get_symbtab_entry(str);
  111. X
  112. X        idl = (IDENTLIST *) Malloc(sizeof(IDENTLIST));
  113. X    idl->symbol = symbol;
  114. X    idl->next   = NULL;
  115. X
  116. X    if (!idlfirst)
  117. X        idlfirst = idllast = idl;
  118. X    else {
  119. X        idllast->next = idl;
  120. X        idllast = idl;
  121. X    }
  122. X    }
  123. X
  124. X    return(idlfirst);
  125. X} /* ReadIDENTLIST */
  126. X
  127. X/******************************************************************************
  128. X * ReadACCFSINFO()                                                            *
  129. X *                                                                            *
  130. X * Reads a ACCFSINFO from file 'filep'.                                       *
  131. X *                                                                            *
  132. X * Return values: pointer to generated list upon success / NULL upon error    *
  133. X ******************************************************************************/
  134. XACCFSINFO *
  135. XReadACCFSINFO(filep)
  136. XFILE *filep;
  137. X{
  138. X    register ACCFSINFO *afs, *afsfirst = NULL, *afslast;
  139. X    int count;
  140. X    float time;
  141. X    char str[100];
  142. X    SYMBTABEL *symbol;
  143. X
  144. X    fscanf(filep, "%d\n", &count);
  145. X
  146. X    while(count--) {
  147. X    fscanf(filep, "%s %f\n", str, &time);
  148. X    symbol = get_symbtab_entry(str);
  149. X
  150. X    afs = (ACCFSINFO *) Malloc(sizeof(ACCFSINFO));
  151. X    afs->filesystem = symbol;
  152. X    afs->acc_time   = time;
  153. X    afs->next       = NULL;
  154. X
  155. X    if (!afsfirst)
  156. X        afsfirst = afslast = afs;
  157. X    else {
  158. X        afslast->next = afs;
  159. X        afslast = afs;
  160. X    }
  161. X    }
  162. X
  163. X    return(afsfirst);
  164. X} /* ReadACCFSINFO */
  165. X
  166. X/******************************************************************************
  167. X * ReadFSSPECINFO()                                                           *
  168. X *                                                                            *
  169. X * Reads a FSSPECINFO from file 'filep'.                                      *
  170. X *                                                                            *
  171. X * Return values: pointer to generated list upon success / NULL upon error    *
  172. X ******************************************************************************/
  173. XFSSPECINFO *
  174. XReadFSSPECINFO(filep)
  175. XFILE *filep;
  176. X{
  177. X    register FSSPECINFO *fssp, *fsspfirst = NULL, *fssplast;
  178. X    int count;
  179. X    float freq, quant;
  180. X    char str[100];
  181. X    SYMBTABEL *symbol;
  182. X
  183. X    fscanf(filep, "%d\n", &count);
  184. X
  185. X    while(count--) {
  186. X    fscanf(filep, "%s %f %f\n", str, &freq, &quant);
  187. X    symbol = get_symbtab_entry(str);
  188. X
  189. X    fssp = (FSSPECINFO *) Malloc(sizeof(FSSPECINFO));
  190. X    fssp->filesys   = symbol;
  191. X    fssp->frequency = freq;
  192. X    fssp->quantity  = quant;
  193. X    fssp->next      = NULL;
  194. X
  195. X    if (!fsspfirst)
  196. X        fsspfirst = fssplast = fssp;
  197. X    else {
  198. X        fssplast->next = fssp;
  199. X        fssplast = fssp;
  200. X    }
  201. X    }
  202. X
  203. X    return(fsspfirst);
  204. X} /* ReadFSSPECINFO */
  205. X
  206. X/******************************************************************************
  207. X * ReadCOMMPINFO()                                                            *
  208. X *                                                                            *
  209. X * Reads a COMMPINFO from file 'filep'.                                       *
  210. X *                                                                            *
  211. X * Return values: pointer to generated list upon success / NULL upon error    *
  212. X ******************************************************************************/
  213. XCOMMPINFO *
  214. XReadCOMMPINFO(filep)
  215. XFILE *filep;
  216. X{
  217. X    register COMMPINFO *commp, *commpfirst = NULL, *commplast;
  218. X    int count;
  219. X    float freq, quant;
  220. X    char str[100];
  221. X    SYMBTABEL *symbol;
  222. X
  223. X    fscanf(filep, "%d\n", &count);
  224. X
  225. X    while(count--) {
  226. X    fscanf(filep, "%s %f %f\n", str, &freq, &quant);
  227. X    symbol = get_symbtab_entry(str);
  228. X
  229. X    commp = (COMMPINFO *) Malloc(sizeof(COMMPINFO));
  230. X    commp->Process   = symbol;
  231. X    commp->frequency = freq;
  232. X    commp->quantity  = quant;
  233. X    commp->next      = NULL;
  234. X
  235. X    if (!commpfirst)
  236. X        commpfirst = commplast = commp;
  237. X    else {
  238. X        commplast->next = commp;
  239. X        commplast = commp;
  240. X    }
  241. X    }
  242. X
  243. X    return(commpfirst);
  244. X} /* ReadCOMMPINFO */
  245. X
  246. X/******************************************************************************
  247. X * ReadPATTRINFO()                                                            *
  248. X *                                                                            *
  249. X * Reads a PATTRINFO from file 'filep'.                                       *
  250. X *                                                                            *
  251. X * Return values: pointer to generated list upon success / NULL upon error    *
  252. X ******************************************************************************/
  253. XPATTRINFO *
  254. XReadPATTRINFO(filep)
  255. XFILE *filep;
  256. X{
  257. X    register PATTRINFO *pattr, *pattrfirst = NULL, *pattrlast;
  258. X    int count, type;
  259. X
  260. X    fscanf(filep, "%d\n", &count);
  261. X
  262. X    while(count--) {
  263. X    pattr = (PATTRINFO *) Malloc(sizeof(PATTRINFO));
  264. X    fscanf(filep, "%d\n", &type); 
  265. X    pattr->type = type;
  266. X    switch(type) {
  267. X    case PA_PHYS_MEM:
  268. X            fscanf(filep, "%d %f\n",
  269. X                &(pattr->mode),
  270. X                &(pattr->info.phys_mem_size));
  271. X            break;
  272. X        case PA_VIRT_MEM:
  273. X            fscanf(filep, "%d %f\n",
  274. X                &(pattr->mode),
  275. X                &(pattr->info.virt_mem_size));
  276. X            break;
  277. X        case PA_VECTORIZATION:
  278. X            fscanf(filep, "%d\n", &(pattr->mode));
  279. X            break;
  280. X        case PA_PARALLELIZATION:
  281. X            fscanf(filep, "%d\n", &(pattr->mode));
  282. X            break;
  283. X    } /* switch */
  284. X    if (!pattrfirst)
  285. X        pattrfirst = pattrlast = pattr;
  286. X    else {
  287. X        pattrlast->next = pattr;
  288. X        pattrlast = pattr;
  289. X    }
  290. X    }
  291. X
  292. X    return(pattrfirst);
  293. X} /* ReadPATTRINFO */
  294. X
  295. X/******************************************************************************
  296. X * ReadPHOSTLIST()                                                            *
  297. X *                                                                            *
  298. X * Reads a PHOSTLIST from file 'filep'.                                       *
  299. X *                                                                            *
  300. X * Return values: pointer to generated list upon success / NULL upon error    *
  301. X ******************************************************************************/
  302. XPHOSTLIST *
  303. XReadPHOSTLIST(filep)
  304. XFILE *filep;
  305. X{
  306. X    register PHOSTLIST *phost, *phostfirst = NULL, *phostlast;
  307. X    int count, preferred, wished_val;
  308. X    float load, overall;
  309. X    char str[100];
  310. X    SYMBTABEL *symbol;
  311. X
  312. X    fscanf(filep, "%d\n", &count);
  313. X
  314. X    while(count--) {
  315. X        fscanf(filep, "%s %d %d %f %f\n", str, &preferred, &wished_val, &load, &overall);
  316. X    symbol = get_symbtab_entry(str);
  317. X
  318. X    phost = (PHOSTLIST *) Malloc(sizeof(PHOSTLIST));
  319. X    phost->Host          = symbol;
  320. X    phost->preferred     = preferred;
  321. X    phost->wished_val    = wished_val;
  322. X    phost->load          = load;
  323. X    phost->overall_index = overall;
  324. X
  325. X    if (!phostfirst)
  326. X        phostfirst = phostlast = phost;
  327. X    else {
  328. X        phostlast->next = phost;
  329. X        phostlast = phost;
  330. X    }
  331. X    }
  332. X
  333. X    return(phostfirst);
  334. X} /* ReadPHOSTLIST */
  335. X
  336. X/******************************************************************************
  337. X * ReadCOSTINFO()                                                             *
  338. X *                                                                            *
  339. X * Reads a COSTINFO from file 'filep'.                                        *
  340. X *                                                                            *
  341. X * Return values: pointer to generated list upon success / NULL upon error    *
  342. X ******************************************************************************/
  343. XCOSTINFO *
  344. XReadCOSTINFO(filep)
  345. XFILE *filep;
  346. X{
  347. X    register COSTINFO *costl, *costlfirst = NULL, *costllast;
  348. X    int count;
  349. X    char str[100];
  350. X    SYMBTABEL *symbol;
  351. X
  352. X    fscanf(filep, "%d\n", &count);
  353. X
  354. X    while(count--) {
  355. X    costl = (COSTINFO *) Malloc(sizeof(COSTINFO));
  356. X        fscanf(filep, "%s %f %f\n", str, &(costl->crea_val), &(costl->comm_val));
  357. X    costl->dest_host = get_symbtab_entry(str);
  358. X
  359. X    if (!costlfirst)
  360. X        costlfirst = costllast = costl;
  361. X    else {
  362. X        costllast->next = costl;
  363. X        costllast = costl;
  364. X    }
  365. X    }
  366. X
  367. X    return(costlfirst);
  368. X} /* ReadCOSTINFO */
  369. X
  370. X/******************************************************************************
  371. X * ReadSYMBTABEL()                                                            *
  372. X *                                                                            *
  373. X * Reads a SYMBTABEL from file 'filep'                                        *
  374. X *                                                                            *
  375. X * Return values: pointer to read element upon success / NULL upon error      *
  376. X ******************************************************************************/
  377. XSYMBTABEL *
  378. XReadSYMBTABEL(filep, symbol)
  379. XFILE *filep;
  380. XSYMBTABEL *symbol;
  381. X{
  382. X    char str1[100], str2[100], str3[100];
  383. X    int i1, i2, i3, i4, i5;
  384. X
  385. X    switch(symbol->type) {
  386. X    case UNDEFINED:
  387. X    break;
  388. X    case S_HOST:
  389. X    fscanf(filep, "%s %s %f %f %f %d %d %d %d %d %s\n", 
  390. X        str1, str2, 
  391. X        &(symbol->info.Host.phys_mem), 
  392. X        &(symbol->info.Host.virt_mem),
  393. X        &(symbol->info.Host.perf_index), 
  394. X        &i1, &i2, &i3, &i4, &i5, str3);
  395. X    symbol->info.Host.os                 = get_symbtab_entry(str1);
  396. X    symbol->info.Host.type               = get_symbtab_entry(str2);
  397. X    symbol->info.Host.multiprocessor     = (short) i1;
  398. X        symbol->info.Host.processors         = (short) i2;
  399. X    symbol->info.Host.memory_type        = (short) i3;
  400. X    symbol->info.Host.has_par_compiler   = (short) i4;
  401. X    symbol->info.Host.is_vector_computer = (short) i5;
  402. X    symbol->info.Host.ex_storage         = get_symbtab_entry(str3);
  403. X    symbol->info.Host.p_devices          = ReadIDENTLIST(filep);
  404. X        symbol->info.Host.f_systems          = ReadACCFSINFO(filep);
  405. X        symbol->info.Host.costinfo           = ReadCOSTINFO(filep);
  406. X        symbol->info.Host.compinfo           = NULL;
  407. X        symbol->info.Host.prob_load          = 0;
  408. X        symbol->info.Host.pcreated           = 0;
  409. X    break;
  410. X    case S_COMPUTER_TYPE:
  411. X    case S_OPERATING_SYSTEM:
  412. X    break;
  413. X    case S_FIXED_DISK:
  414. X    fscanf(filep, "%s %f %f\n", 
  415. X        str1, &(symbol->info.disk.size), &(symbol->info.disk.speed));
  416. X    symbol->info.disk.location = get_symbtab_entry(str1);
  417. X    break;
  418. X    case S_PROCESS:
  419. X    fscanf(filep, "%f\n", &(symbol->info.Process.intensity_index));
  420. X    symbol->info.Process.pref_hosts  = ReadIDENTLIST(filep);
  421. X        symbol->info.Process.rest_hosts  = ReadIDENTLIST(filep);
  422. X        symbol->info.Process.peri_dev    = ReadIDENTLIST(filep);
  423. X        symbol->info.Process.filesystems = ReadFSSPECINFO(filep);
  424. X        symbol->info.Process.commps      = ReadCOMMPINFO(filep);
  425. X        symbol->info.Process.others      = ReadPATTRINFO(filep);
  426. X        symbol->info.Process.phostlist   = ReadPHOSTLIST(filep);
  427. X    break;
  428. X    default:
  429. X    fprintf(stderr, "Panic: unknown symbol table entry found in ReadSYMBTABEL()\n");
  430. X        fprintf(stderr, "Symbol name is \"%s\". Terminating.\n", symbol->name);
  431. X        exit(-1);
  432. X    } /* switch */
  433. X
  434. X    return(symbol);
  435. X} /* ReadSYMBTABEL */
  436. X
  437. X/******************************************************************************
  438. X * ReadSymbtab()                                                              *
  439. X *                                                                            *
  440. X * Reads a complete symbol table from file 'filename'.                        *
  441. X *                                                                            *
  442. X * Return values: OK upon success / ERROR upon error                          *
  443. X ******************************************************************************/
  444. Xint
  445. XReadSymbtab(filep)
  446. XFILE *filep;
  447. X{
  448. X    int count, count2, type;
  449. X    SYMBTABEL *symbol;
  450. X    char str[100];
  451. X
  452. X    fscanf(filep, "%d\n", &count);
  453. X    count2 = count;
  454. X
  455. X    while(count--) {
  456. X        fscanf(filep, "%s %d\n", str, &type);
  457. X    symbol = enter_symbtabel(str);
  458. X    symbol->type = type;
  459. X    }
  460. X
  461. X    while(count2--) {
  462. X        fscanf(filep, "%s %d\n", str, &type);
  463. X    symbol = get_symbtab_entry(str);
  464. X    if (symbol->type != type) {
  465. X            fprintf(stderr,"Panic: wrong symbol type found. Terminating.\n");
  466. X            return(ERROR);
  467. X    }
  468. X    ReadSYMBTABEL(filep, symbol);
  469. X    }
  470. X    return(OK);
  471. X} /* ReadSymbtab */
  472. END_OF_FILE
  473. if test 16007 -ne `wc -c <'config/ReadSymbtab.c'`; then
  474.     echo shar: \"'config/ReadSymbtab.c'\" unpacked with wrong size!
  475. fi
  476. # end of 'config/ReadSymbtab.c'
  477. fi
  478. if test -f 'config/symb_system.c' -a "${1}" != "-c" ; then 
  479.   echo shar: Will not clobber existing file \"'config/symb_system.c'\"
  480. else
  481. echo shar: Extracting \"'config/symb_system.c'\" \(16203 characters\)
  482. sed "s/^X//" >'config/symb_system.c' <<'END_OF_FILE'
  483. X/***************************************************************************
  484. X *                                                                         *
  485. X * @@@@  @@@ @@@@@ @@@@@ @@@@@ @@@ @@@@  @   @ @@@@@ @@@@@ @@@@       @@@  *
  486. X * @   @  @  @       @   @   @  @  @   @ @   @   @   @     @   @     @   @ *
  487. X * @   @  @  @@@@@   @   @@@@@  @  @@@@@ @   @   @   @@@@@ @   @     @     *
  488. X * @   @  @      @   @   @ @    @  @   @ @   @   @   @     @   @     @   @ *
  489. X * @@@@  @@@ @@@@@   @   @  @  @@@ @@@@  @@@@@   @   @@@@@ @@@@       @@@  *
  490. X *                                                                         *
  491. X *              A compiler for distributed programming with C              *
  492. X *                                                                         *
  493. X *                        s y m b _ s y s t e m . c                        *
  494. X *                                                                         *
  495. X *                            Package : Configuration Files Parsers        *
  496. X *                            Version : 1.0                                *
  497. X *                       CreationDate : 26.02.92                           *
  498. X *                         LastUpDate : 26.02.92                           *
  499. X *                                                                         *
  500. X * All routines needed to manage the symbol table during parsing of system *
  501. X * configuration files.                                                    *
  502. X *                                                                         *
  503. X *               Copyright (C) 1992-1994 by Christoph Pleier               *
  504. X *                          All rights reserved!                           *
  505. X ***************************************************************************/
  506. X
  507. X/*
  508. X * This file is part of the Distributed C Development Environment (DCDE).
  509. X * DCDE is free software; you can redistribute it and/or modify
  510. X * it under the terms written in the README-file. 
  511. X * DCDE is distributed in the hope that it will be useful,
  512. X * but WITHOUT ANY WARRANTY; without even the implied warranty of
  513. X * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
  514. X * See the file README for more details.
  515. X */
  516. X
  517. X#include <stdio.h>
  518. X#include "cfgparsers.h"
  519. X
  520. X/******************************************************************************
  521. X * enter_disk_definition()                                                    *
  522. X *                                                                            *
  523. X * Enters the disk definition 'symbol' in the symbol table including all      *
  524. X * informations.                                                              *
  525. X *                                                                            *
  526. X * Return values: pointer to entered element upon success / NULL upon error   *
  527. X ******************************************************************************/
  528. XSYMBTABEL *
  529. Xenter_disk_definition(symbol, location, size, speed)
  530. XSYMBTABEL *symbol, *location;
  531. Xfloat size, speed;
  532. X{
  533. X    /* check symbol */
  534. X    if (symbol->type != UNDEFINED) {
  535. X    printf("Error: line %d at \"%s\": redefinition: \"%s\"\n",
  536. X        yylineno, yytext, symbol->name);
  537. X    return(NULL);
  538. X    }
  539. X
  540. X    symbol->type = S_FIXED_DISK;
  541. X    symbol->info.disk.location    = location;
  542. X    symbol->info.disk.size        = size;
  543. X    symbol->info.disk.speed       = speed;
  544. X    symbol->info.disk.wasprepared = FALSE;
  545. X    symbol->info.disk.wascleaned  = FALSE;
  546. X
  547. X    return(symbol);
  548. X} /* enter_disk_definition */
  549. X
  550. X/******************************************************************************
  551. X * enter_host_specification()                                                 *
  552. X *                                                                            *
  553. X * Enters the host definitions specified by 'idents' in the symbol table      *
  554. X * including all informations.                                                *
  555. X *                                                                            *
  556. X * Return values: pointer to first element upon success / NULL upon error     *
  557. X ******************************************************************************/
  558. XSYMBTABEL *
  559. Xenter_host_specification(idents, os_def, compu_spec, p_def, compi_spec, files_def)
  560. XIDENTLIST *idents;
  561. XSYMBTABEL *os_def;
  562. XCOMPSPEINFO *compu_spec;
  563. XIDENTLIST *p_def;
  564. XTARGETINFO *compi_spec;
  565. XACCFSINFO *files_def;
  566. X{
  567. X    register IDENTLIST *idl;
  568. X    SYMBTABEL *symbol;
  569. X
  570. X    for(idl = idents; idl; idl = idl->next) {
  571. X
  572. X    symbol = idl->symbol;
  573. X
  574. X    /* check symbol */
  575. X        if (symbol->type != S_HOST) {
  576. X        printf("Error: line %d at \"%s\": \"%s\" is not a host name\n",
  577. X            yylineno, yytext, symbol->name);
  578. X        exit(ERROR);
  579. X        }
  580. X
  581. X    symbol->info.Host.os                 = os_def;
  582. X    symbol->info.Host.type               = compu_spec->type;
  583. X    symbol->info.Host.phys_mem           = compu_spec->phys_mem;
  584. X    symbol->info.Host.virt_mem           = compu_spec->virt_mem;
  585. X    symbol->info.Host.perf_index         = compu_spec->perf_index;
  586. X    symbol->info.Host.multiprocessor     = compu_spec->multiprocessor;
  587. X    symbol->info.Host.processors         = compu_spec->processors;
  588. X    symbol->info.Host.memory_type        = compu_spec->memory_type;
  589. X    symbol->info.Host.has_par_compiler   = compu_spec->has_par_compiler;
  590. X    symbol->info.Host.is_vector_computer = compu_spec->is_vector_computer;
  591. X    symbol->info.Host.p_devices          = p_def;
  592. X    symbol->info.Host.f_systems          = files_def;
  593. X    symbol->info.Host.compinfo           = compi_spec;
  594. X    symbol->info.Host.ex_storage         = compu_spec->ex_storage;
  595. X    symbol->info.Host.istarget           = FALSE;
  596. X    symbol->info.Host.wasmade            = FALSE;
  597. X    symbol->info.Host.costinfo           = NULL;
  598. X    symbol->info.Host.prob_load          = 0.0;
  599. X    symbol->info.Host.pcreated           = 0;
  600. X
  601. X    }
  602. X
  603. X    Free((char *) compu_spec);
  604. X
  605. X    return(idents->symbol);
  606. X} /* enter_host_specification */
  607. X
  608. X/******************************************************************************
  609. X * enter_cost_definition()                                                    *
  610. X *                                                                            *
  611. X * Enters a cost definition in the symbol table.                              *
  612. X *                                                                            *
  613. X * Return values: pointer to entered element upon success / NULL upon error   *
  614. X ******************************************************************************/
  615. XSYMBTABEL *
  616. Xenter_cost_definition(src_symb, dest_symb, crea_val, comm_val)
  617. XSYMBTABEL *src_symb, *dest_symb;
  618. Xfloat crea_val, comm_val;
  619. X{
  620. X    COSTINFO *ptr;
  621. X
  622. X    /* check symbols */
  623. X    if (src_symb->type != S_HOST) {
  624. X    printf("Error: line %d at \"%s\": symbol \"%s\" not defined as host\n",
  625. X        yylineno, yytext, src_symb->name);
  626. X    return(NULL);
  627. X    }
  628. X    if (dest_symb->type != S_HOST) {
  629. X    printf("Error: line %d at \"%s\": symbol \"%s\" not defined as host\n",
  630. X        yylineno, yytext, dest_symb->name);
  631. X    return(NULL);
  632. X    }
  633. X
  634. X    ptr = (COSTINFO *) Malloc(sizeof(COSTINFO));
  635. X    ptr->dest_host = dest_symb;
  636. X    ptr->crea_val  = crea_val;
  637. X    ptr->comm_val  = comm_val;
  638. X    ptr->next      = src_symb->info.Host.costinfo;
  639. X    src_symb->info.Host.costinfo = ptr;
  640. X
  641. X    return(src_symb);
  642. X} /* enter_cost_definition */
  643. X
  644. X/******************************************************************************
  645. X * generate_targetinfo()                                                      *
  646. X *                                                                            *
  647. X * Generates and initializes a target information element.                    *
  648. X *                                                                            *
  649. X * Return values: pointer to new element upon success / NULL upon error       *
  650. X ******************************************************************************/
  651. XTARGETINFO *
  652. Xgenerate_targetinfo(type, os, cc, cflags, ldflags, libs)
  653. XSYMBTABEL *type, *os;
  654. Xchar *cc, *cflags, *ldflags, *libs;
  655. X{
  656. X    register TARGETINFO *ptr;
  657. X
  658. X    /* check type */
  659. X    if (type->type != S_COMPUTER_TYPE) {
  660. X    printf("Error: line %d at \"%s\": \"%s\" is not a computer type\n",
  661. X        yylineno, yytext, type->name);
  662. X    exit(ERROR);
  663. X    }
  664. X
  665. X    /* check os */
  666. X    if (os->type != S_OPERATING_SYSTEM) {
  667. X    printf("Error: line %d at \"%s\": \"%s\" is not an operating system\n",
  668. X        yylineno, yytext, type->name);
  669. X    exit(ERROR);
  670. X    }
  671. X
  672. X    ptr = (TARGETINFO *) Malloc(sizeof(TARGETINFO));
  673. X    ptr->type      = type->name;
  674. X    ptr->os        = os->name;
  675. X    ptr->cc        = cc;
  676. X    ptr->cflags    = cflags;
  677. X    ptr->ldflags   = ldflags;
  678. X    ptr->libs      = libs;
  679. X    ptr->next      = NULL;
  680. X    return(ptr);
  681. X} /* generate_targetinfo */
  682. X
  683. X/******************************************************************************
  684. X * chain_targetinfos()                                                        *
  685. X *                                                                            *
  686. X * Chains targetinfo 't2' to the end of targetinfo 't1'.                      *
  687. X *                                                                            *
  688. X * Return values: pointer to resulting targetinfo upon success /              *
  689. X *                NULL upon error                                             *
  690. X ******************************************************************************/
  691. XTARGETINFO *
  692. Xchain_targetinfos(t1, t2)
  693. XTARGETINFO *t1, *t2;
  694. X{
  695. X    register TARGETINFO *ptr;
  696. X
  697. X    for(ptr = t1; ptr->next; ptr = ptr->next)
  698. X    ;
  699. X    ptr->next = t2;
  700. X    return(t1);
  701. X} /* chain_targetinfos */
  702. X
  703. X/******************************************************************************
  704. X * generate_accfs_info()                                                      *
  705. X *                                                                            *
  706. X * Generates and initializes a accessible filesystem info.                    *
  707. X *                                                                            *
  708. X * Return values: pointer to new element upon success / NULL upon error       *
  709. X ******************************************************************************/
  710. XACCFSINFO *
  711. Xgenerate_accfs_info(fs_symbol, acc_time)
  712. XSYMBTABEL *fs_symbol;
  713. Xfloat acc_time;
  714. X{
  715. X    register ACCFSINFO *ptr;
  716. X
  717. X    /* check type */
  718. X    if (fs_symbol->type != S_FIXED_DISK) {
  719. X    printf("Error: line %d at \"%s\": \"%s\" is not a fixed disk\n",
  720. X        yylineno, yytext, fs_symbol->name);
  721. X    exit(ERROR);
  722. X    }
  723. X
  724. X    ptr = (ACCFSINFO *) Malloc(sizeof(ACCFSINFO));
  725. X    ptr->filesystem = fs_symbol;
  726. X    ptr->acc_time   = acc_time;
  727. X    ptr->next       = NULL;
  728. X
  729. X    return(ptr);
  730. X} /* generate_accfs_info */
  731. X
  732. X/******************************************************************************
  733. X * chain_accfs_infos()                                                        *
  734. X *                                                                            *
  735. X * Chains accessible filesystems info 'accfs2' to the end of info 'accfs1'.   *
  736. X *                                                                            *
  737. X * Return values: pointer to resulting targetinfo upon success /              *
  738. X *                NULL upon error                                             *
  739. X ******************************************************************************/
  740. XACCFSINFO *
  741. Xchain_accfs_infos(accfs1, accfs2)
  742. XACCFSINFO *accfs1, *accfs2;
  743. X{
  744. X    register ACCFSINFO *ptr;
  745. X
  746. X    for(ptr = accfs1; ptr->next; ptr = ptr->next)
  747. X    ;
  748. X    ptr->next = accfs2;
  749. X    return(accfs1);
  750. X} /* chain_accfs_infos */
  751. X
  752. X/******************************************************************************
  753. X * generate_multi_info()                                                      *
  754. X *                                                                            *
  755. X * Generates and initializes the multiprocessor_specification_info.           *
  756. X *                                                                            *
  757. X * Return values: pointer to new created element upon success /               *
  758. X *                NULL upon error                                             *
  759. X ******************************************************************************/
  760. XMULTIINFO *
  761. Xgenerate_multi_info(proc_num, mem_type)
  762. Xfloat proc_num;
  763. Xshort mem_type;
  764. X{
  765. X    MULTIINFO *ptr;
  766. X
  767. X    ptr = (MULTIINFO *) Malloc(sizeof(MULTIINFO));
  768. X
  769. X    ptr->proc_num = (short) proc_num;
  770. X    ptr->mem_type = mem_type;
  771. X
  772. X    return(ptr);
  773. X} /* generate_multi_info */
  774. X
  775. X/******************************************************************************
  776. X * generate_opt_comp_attr_info()                                              *
  777. X *                                                                            *
  778. X * Generates and initializes the optional_computer_attribute_info.            *
  779. X *                                                                            *
  780. X * Return values: pointer to new created element upon success /               *
  781. X *                NULL upon error                                             *
  782. X ******************************************************************************/
  783. XOPTCOMPINFO *
  784. Xgenerate_opt_comp_attr_info(multiinfo, attr)
  785. XMULTIINFO *multiinfo;
  786. Xshort attr;
  787. X{
  788. X    OPTCOMPINFO *ptr;
  789. X
  790. X    ptr = (OPTCOMPINFO *) Malloc(sizeof(OPTCOMPINFO));
  791. X    ptr->multiinfo    = NULL;
  792. X    ptr->is_vector    = FALSE;
  793. X    ptr->has_par_comp = FALSE;
  794. X
  795. X    if (multiinfo)
  796. X        ptr->multiinfo = multiinfo;
  797. X    else {
  798. X    switch(attr) {
  799. X    case VECTOR_COMPUTER:
  800. X            ptr->is_vector = TRUE;
  801. X        break;
  802. X    case PAR_COMPILER:
  803. X            ptr->has_par_comp = TRUE;
  804. X        break;
  805. X    } /* switch */
  806. X    }
  807. X
  808. X    return(ptr);
  809. X} /* generate_opt_comp_attr_info */
  810. X
  811. X/******************************************************************************
  812. X * add_opt_comp_attr_info()                                                   *
  813. X *                                                                            *
  814. X * Adds the optional_computer_attribute_list_info of attr2 to attr1.          *
  815. X *                                                                            *
  816. X * Return values: pointer to new created element upon success /               *
  817. X *                NULL upon error                                             *
  818. X ******************************************************************************/
  819. XOPTCOMPINFO *
  820. Xadd_opt_comp_attr_info(attr1, attr2)
  821. XOPTCOMPINFO *attr1, *attr2;
  822. X{
  823. X    if (attr2->multiinfo)
  824. X        attr1->multiinfo = attr2->multiinfo;
  825. X    if (attr2->is_vector)
  826. X        attr1->is_vector = TRUE;
  827. X    if (attr2->has_par_comp)
  828. X        attr1->has_par_comp = TRUE;
  829. X
  830. X    return(attr1);
  831. X} /* add_opt_comp_attr_info */
  832. X
  833. X/******************************************************************************
  834. X * generate_comp_spec_info()                                                  *
  835. X *                                                                            *
  836. X * Generates and initializes the computer_specification_info.                 *
  837. X *                                                                            *
  838. X * Return values: pointer to new created element upon success /               *
  839. X *                NULL upon error                                             *
  840. X ******************************************************************************/
  841. XCOMPSPEINFO *
  842. Xgenerate_comp_spec_info(type, p_mem, v_mem, perf, opt_attrs, store)
  843. XSYMBTABEL *type, *store;
  844. Xfloat p_mem, v_mem, perf;
  845. XOPTCOMPINFO *opt_attrs;
  846. X
  847. X{
  848. X    COMPSPEINFO *ptr;
  849. X
  850. X    ptr = (COMPSPEINFO *) Malloc(sizeof(COMPSPEINFO));
  851. X
  852. X    ptr->type               = type;
  853. X    ptr->phys_mem           = p_mem;
  854. X    ptr->virt_mem           = v_mem;
  855. X    ptr->perf_index         = perf;
  856. X    if (opt_attrs) {
  857. X    if (opt_attrs->multiinfo) {
  858. X            ptr->multiprocessor = TRUE;
  859. X            ptr->processors     = opt_attrs->multiinfo->proc_num;
  860. X            ptr->memory_type    = opt_attrs->multiinfo->mem_type;
  861. X        }
  862. X        ptr->has_par_compiler   = opt_attrs->has_par_comp;
  863. X        ptr->is_vector_computer = opt_attrs->is_vector;
  864. X    } else {
  865. X        ptr->multiprocessor     = FALSE;
  866. X        ptr->processors         = 1;
  867. X        ptr->memory_type        = SHARED_MEMORY;
  868. X        ptr->has_par_compiler   = FALSE;
  869. X        ptr->is_vector_computer = FALSE;
  870. X    }
  871. X    ptr->ex_storage         = store;
  872. X
  873. X    Free((char *) opt_attrs);
  874. X
  875. X    return(ptr);
  876. X} /* generate_comp_spec_info */
  877. X
  878. END_OF_FILE
  879. if test 16203 -ne `wc -c <'config/symb_system.c'`; then
  880.     echo shar: \"'config/symb_system.c'\" unpacked with wrong size!
  881. fi
  882. # end of 'config/symb_system.c'
  883. fi
  884. if test -f 'dcadmin/Location.c' -a "${1}" != "-c" ; then 
  885.   echo shar: Will not clobber existing file \"'dcadmin/Location.c'\"
  886. else
  887. echo shar: Extracting \"'dcadmin/Location.c'\" \(15073 characters\)
  888. sed "s/^X//" >'dcadmin/Location.c' <<'END_OF_FILE'
  889. X/***************************************************************************
  890. X *                                                                         *
  891. X * @@@@  @@@ @@@@@ @@@@@ @@@@@ @@@ @@@@  @   @ @@@@@ @@@@@ @@@@       @@@  *
  892. X * @   @  @  @       @   @   @  @  @   @ @   @   @   @     @   @     @   @ *
  893. X * @   @  @  @@@@@   @   @@@@@  @  @@@@@ @   @   @   @@@@@ @   @     @     *
  894. X * @   @  @      @   @   @ @    @  @   @ @   @   @   @     @   @     @   @ *
  895. X * @@@@  @@@ @@@@@   @   @  @  @@@ @@@@  @@@@@   @   @@@@@ @@@@       @@@  *
  896. X *                                                                         *
  897. X *              A compiler for distributed programming with C              *
  898. X *                                                                         *
  899. X *                           L o c a t i o n . c                           *
  900. X *                                                                         *
  901. X *                            Package : Administration Process             *
  902. X *                            Version : 1.0                                *
  903. X *                       CreationDate : 16.09.90                           *
  904. X *                         LastUpDate : 14.04.92                           *
  905. X *                                                                         *
  906. X * The routine 'DetermineCreationLocation' which determines the location   *
  907. X * where to create processes which creation location was not specified     *
  908. X * in the Distributed C program.                                           *
  909. X *                                                                         *
  910. X *               Copyright (C) 1990-1994 by Christoph Pleier               *
  911. X *                          All rights reserved!                           *
  912. X ***************************************************************************/
  913. X
  914. X/*
  915. X * This file is part of the Distributed C Development Environment (DCDE).
  916. X * DCDE is free software; you can redistribute it and/or modify
  917. X * it under the terms written in the README-file. 
  918. X * DCDE is distributed in the hope that it will be useful,
  919. X * but WITHOUT ANY WARRANTY; without even the implied warranty of
  920. X * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
  921. X * See the file README for more details.
  922. X */
  923. X
  924. X#include <stdio.h>
  925. X#include <sys/types.h>
  926. X#include <string.h>
  927. X#ifdef HETEROGENEOUS
  928. X# include <rpc/rpc.h>
  929. X#endif
  930. X#include <errno.h>
  931. X#include "ipc.h"
  932. X#include "dcc.h"
  933. X#include "run_Errno.h"
  934. X#include "timeout.h"
  935. X#include "dcadmin.h"
  936. X#ifndef USE_MAPFILE
  937. X# include "cfgparsers.h"
  938. X#endif /* USE_MAPFILE /**/
  939. X#include "location.h"
  940. X
  941. X#ifdef ADMINDEBUG
  942. X# define DEBUGPUTS(str)        fprintf(dfile,"[dbg] %s %s\n", _processprefix, str)
  943. X# define DEBUGFPRINTF(f, a)    fprintf(dfile, f, a)
  944. X#else
  945. X# define DEBUGPUTS(str)        /* nothing */
  946. X# define DEBUGFPRINTF(f, a)    /* nothing */
  947. X#endif /* ADMINDEBUG /**/
  948. X
  949. X#define EXIT(v)            fprintf(stderr, "dcadmin: Terminating!\n"); \
  950. X                exit(v)
  951. X
  952. X/******************************************************************************
  953. X * DetermineCreationLocation()                                                *
  954. X *                                                                            *
  955. X * Determines the location where to create a specific process.                *
  956. X *                                                                            *
  957. X * Return values: OK upon success / ERROR upon error                          *
  958. X ******************************************************************************/
  959. Xint
  960. XDetermineCreationLocation()
  961. X{
  962. X    char *pname,        /* name of process */
  963. X         *pfilename,        /* corresponding file name */
  964. X         *clocation,        /* location of creator process */
  965. X         inputname[100],
  966. X     creat_loc[100];
  967. X    ADMINLOCINFO locinfo;
  968. X#ifdef USE_MAPFILE
  969. X    struct pcreat_list *ptr, *res_ptr, *min_ptr;
  970. X#else 
  971. X    char *result;
  972. X    float h1, h2, h3, h4, h5, h6;
  973. X    PHOSTLIST *phostp, *phostl;
  974. X    COSTINFO *costl, *costl2;
  975. X    COMMPINFO *coml;
  976. X    SYMBTABEL *act_host, *psymbol, *crea_symb, *hsymbol;
  977. X    struct pdat_list *pdatl;
  978. X    float best_index, dcadmin_index, oload_val, crea_val, ipc_val;
  979. X#endif /* USE_MAPFILE /**/
  980. X    struct pdat_list *pdatptr;
  981. X
  982. X    if (check_allocation) {
  983. X    fprintf(stderr, "Enter name of process to allocate: ");
  984. X    scanf("%s", inputname);
  985. X    pname = &(inputname[0]);
  986. X    if (!strcmp(pname, "done"))
  987. X        return(0);
  988. X    pfilename = "(unknown)";
  989. X    } else {
  990. X        /* receive processname */
  991. X#if defined(SINGLE) || defined(HOMOGENEOUS)
  992. X        if (_recv_data(&_con_port, (char *) &locinfo, sizeof(ADMINLOCINFO), ADMINPRCTIME) < 0) {
  993. X#else /* HETEROGENEOUS */
  994. X        if (_recv_data_encoded(&_con_port, (char *) &locinfo, xdr_ADMINLOCINFO, ADMINPRCTIME)) {
  995. X#endif /* SINGLE || HOMOGENEOUS /**/
  996. X        if (Errno == ETIMEOUT)
  997. X            Errno = ETCADRCVNAME;
  998. X        error("determining creation location");
  999. X        EXIT(ERROR);
  1000. X        }
  1001. X        pname     = locinfo.processname;
  1002. X        pfilename = locinfo.processfilename;
  1003. X    clocation = locinfo.creator_location;
  1004. X    }
  1005. X#ifdef ADMINDEBUG
  1006. X    fprintf(dfile, "[dbg] %s DETERMINING location to create process \"%s\" (\"%s\")\n",
  1007. X    _processprefix, pname, (pfilename) ? pfilename : "???");
  1008. X    if (_debugflush)
  1009. X    fflush(dfile);
  1010. X#endif /* ADMINDEBUG /**/
  1011. X
  1012. X#ifdef USE_MAPFILE
  1013. X    /* Determine the location where to create the process with name 'pname'.
  1014. X     * We use the informations stored in the 'process creation list' to 
  1015. X     * determine, where to create the new process. These informations were
  1016. X     * read from a mapping file. The rules for choosing hosts are the 
  1017. X     * following:
  1018. X     *   1) If the list is empty the result is 'local'. Otherwise
  1019. X     *   2) Search the list for entries matching the processname: 
  1020. X     *      a) If there is an entry with a 'num' specification and the number 
  1021. X     *         of the created processes is less than num take this entry as 
  1022. X     *         result (CASE 1a). Otherwise
  1023. X     *      b) If there are one ore more entries without a 'num' specification,
  1024. X     *         take the entry with the minimal number of already created 
  1025. X     *         processes (CASE 1b). Otherwise
  1026. X     *   3) Search the list for entries without processname specification:
  1027. X     *      a) If there is an entry with a 'num' specification and the number 
  1028. X     *         of the created processes is less than num take this entry as 
  1029. X     *         result (CASE 2a). Otherwise
  1030. X     *      b) If there are one ore more entries without a 'num' specification,
  1031. X     *         take the entry with the minimal number of already created 
  1032. X     *         processes (CASE 2b). Otherwise
  1033. X     *   4) The result is 'local'.
  1034. X     */
  1035. X    res_ptr = min_ptr = NULL;
  1036. X    if (pcreat_first) {
  1037. X    /* CASE 1: entries matching the processname: 
  1038. X     *       syntax: [num] processname at [username@]hostname
  1039. X     */
  1040. X        for(ptr = pcreat_first; ptr; ptr = ptr->next) {
  1041. X        if (ptr->processname == NULL || strcmp(pname, ptr->processname)) 
  1042. X        continue;
  1043. X        if (ptr->max_num != -1) {
  1044. X        /* CASE 1a: num specified: 
  1045. X         *          syntax: num processname at [username@]hostname
  1046. X         */
  1047. X        if (ptr->max_num > ptr->created_num) {
  1048. X            res_ptr = ptr;
  1049. X            break;
  1050. X        }
  1051. X        } else {
  1052. X        /* CASE 1b: no num specified: 
  1053. X         *          syntax: processname at [username@]hostname
  1054. X         */
  1055. X        if (min_ptr == NULL || min_ptr->created_num > ptr->created_num)
  1056. X                min_ptr = ptr;
  1057. X        }
  1058. X    } /* for */
  1059. X    if (res_ptr == NULL)
  1060. X        res_ptr = min_ptr;
  1061. X    if (res_ptr == NULL) {
  1062. X        /* CASE 2: entries without processname: 
  1063. X         *         syntax: [num at] [username@]hostname
  1064. X         */
  1065. X            for(ptr = pcreat_first; ptr; ptr = ptr->next) {
  1066. X            if (ptr->processname != NULL) 
  1067. X            continue;
  1068. X            if (ptr->max_num != -1) {
  1069. X            /* CASE 2a: num specified: 
  1070. X             *          syntax: num at [username@]hostname
  1071. X             */
  1072. X            if (ptr->max_num > ptr->created_num) {
  1073. X                res_ptr = ptr;
  1074. X                break;
  1075. X            }
  1076. X            } else {
  1077. X            /* CASE 2b: no num specified: 
  1078. X             *          syntax: [username@]hostname
  1079. X             */
  1080. X            if (min_ptr == NULL || min_ptr->created_num > ptr->created_num)
  1081. X                min_ptr = ptr;
  1082. X            }
  1083. X        } /* for */
  1084. X        if (res_ptr == NULL)
  1085. X            res_ptr = min_ptr;
  1086. X    }
  1087. X    }
  1088. X
  1089. X    /* send result */
  1090. X    if (res_ptr == NULL)
  1091. X        (void) strcpy(locinfo.hostname, "local");
  1092. X    else {
  1093. X        ++(res_ptr->created_num);
  1094. X        (void) strcpy(locinfo.hostname, res_ptr->hostname);
  1095. X    }
  1096. X
  1097. X#else /* Not USE_MAPFILE */
  1098. X
  1099. X    /* Determine the location where to create the process with name 'pname'.
  1100. X     */
  1101. X
  1102. X    result = NULL;
  1103. X
  1104. X    if (!(psymbol = lookup_symbtabel(pname))) {
  1105. X    fprintf(stderr, "dcadmin: warning: can't find process \"%s\" in symbol table\n", pname);
  1106. X    fprintf(stderr, "dcadmin: resulting node for process creation is local node!\n");
  1107. X    result = NULL;
  1108. X    } else {
  1109. X
  1110. X    if (check_allocation) {
  1111. X        fprintf(stderr, "Enter location of creator process: ");
  1112. X        scanf("%s", creat_loc);
  1113. X        clocation = &(creat_loc[0]);
  1114. X    }
  1115. X
  1116. X#ifdef ADMINDEBUG
  1117. X    fprintf(dfile, "node of creator process is \"%s\"\n", clocation);
  1118. X#endif /* ADMINDEBUG /**/
  1119. X
  1120. X    if (!(crea_symb = lookup_symbtabel(clocation))) {
  1121. X        fprintf(stderr, "dcadmin: warning: can't find creator host \"%s\" in symbol table\n", clocation);
  1122. X        fprintf(stderr, "dcadmin: resulting node for process creation is local node!\n");
  1123. X        result = NULL;
  1124. X    } else {
  1125. X        best_index = 0;
  1126. X        for(phostl = psymbol->info.Process.phostlist; phostl; phostl = phostl->next) {
  1127. X        hsymbol = phostl->Host;
  1128. X
  1129. X        for(costl = crea_symb->info.Host.costinfo; costl; costl = costl->next) {
  1130. X            if (costl->dest_host == hsymbol)
  1131. X            break;
  1132. X        }
  1133. X
  1134. X# ifdef ADMINDEBUG
  1135. X        fprintf(dfile, "\nCalculating criterions for host %s:\n", phostl->Host->name);
  1136. X# endif /* ADMINDEBUG /**/
  1137. X
  1138. X        /* consider load of already created processes */
  1139. X        oload_val = phostl->Host->info.Host.prob_load;
  1140. X
  1141. X        /* consider process creation costs */
  1142. X            crea_val = costl->crea_val; 
  1143. X
  1144. X        /* consider interprocess communication costs */
  1145. X# ifdef DO_IPC_TOO
  1146. X        ipc_val = 0.0;
  1147. X        for(coml = psymbol->info.Process.commps; coml; coml = coml->next) {
  1148. X                for(pdatl = pdat_first; pdatl; pdatl = pdatl->next) {
  1149. X                if (!strcmp(coml->Process->name, pdatl->p_descr.processname)) {
  1150. X                    for(costl2 = psymbol->info.Host.costinfo; costl2; costl2 = costl2->next) {
  1151. X#  if defined(SCO_UNIX)
  1152. X                if (!strcmp(costl2->dest_host->name, pdatl->hostname)) {
  1153. X#  else
  1154. X                    if (!strcmp(costl2->dest_host->name, pdatl->p_descr.port.hostname)) {
  1155. X#  endif
  1156. X                        ipc_val += costl2->comm_val * coml->frequency * coml->quantity;
  1157. X                    }
  1158. X                }
  1159. X                    } /* for(costl2) */
  1160. X            }
  1161. X                } /* for(pdatl) */
  1162. X        } /* for(coml) */
  1163. X# endif /* DO_IPC_TOO /**/
  1164. X
  1165. X# ifdef ADMINDEBUG
  1166. X        fprintf(dfile, "CRITERION VALUES (without egalization, without priorities)\n");
  1167. X        fprintf(dfile, "                  preferred host : %d\n", phostl->preferred); 
  1168. X        fprintf(dfile, "  accomplished wished ressources : %d\n", phostl->wished_val); 
  1169. X        fprintf(dfile, "           probably load without : %3.2f\n", phostl->load); 
  1170. X        fprintf(dfile, "              probably load with : %3.2f\n", oload_val);
  1171. X        fprintf(dfile, "                  creation costs : %3.2f\n", crea_val);
  1172. X        fprintf(dfile, "interprocess communication costs : %3.2f\n\n", ipc_val);
  1173. X# endif /* ADMINDEBUG /**/
  1174. X
  1175. X        h1 = phostl->preferred  EGALIZE_PREF;
  1176. X        h2 = phostl->wished_val EGALIZE_WISH;
  1177. X        h3 = (1 / phostl->load) EGALIZE_LOAD;
  1178. X        h4 = (oload_val < 0.01) ? 0 : oload_val EGALIZE_CLOAD;
  1179. X        h5 = (crea_val < 0.01) ? 500 : (1 / crea_val) EGALIZE_CREA;
  1180. X        h6 = ipc_val EGALIZE_IPC;
  1181. X
  1182. X# ifdef ADMINDEBUG
  1183. X        fprintf(dfile, "CRITERION VALUES (with egalization, without priorities)\n");
  1184. X        fprintf(dfile, "                  preferred host : %3.2f\n", h1); 
  1185. X        fprintf(dfile, "  accomplished wished ressources : %3.2f\n", h2); 
  1186. X        fprintf(dfile, "           probably load without : %3.2f\n", h3); 
  1187. X        fprintf(dfile, "              probably load with : %3.2f\n", h4);
  1188. X        fprintf(dfile, "                  creation costs : %3.2f\n", h5);
  1189. X        fprintf(dfile, "interprocess communication costs : %3.2f\n\n", h6);
  1190. X# endif /* ADMINDEBUG /**/
  1191. X
  1192. X        h1 += critprio_preferred;
  1193. X        h2 += critprio_wished;
  1194. X        h3 += critprio_load;
  1195. X        h4 += critprio_cload;
  1196. X        h5 += critprio_crea;
  1197. X        h6 += critprio_ipc;
  1198. X
  1199. X# ifdef ADMINDEBUG
  1200. X        fprintf(dfile, "CRITERION VALUES (with egalization, with priorities)\n");
  1201. X        fprintf(dfile, "                  preferred host : %3.2f\n", h1); 
  1202. X        fprintf(dfile, "  accomplished wished ressources : %3.2f\n", h2); 
  1203. X        fprintf(dfile, "           probably load without : %3.2f\n", h3); 
  1204. X        fprintf(dfile, "              probably load with : %3.2f\n", h4);
  1205. X        fprintf(dfile, "                  creation costs : %3.2f\n", h5);
  1206. X        fprintf(dfile, "interprocess communication costs : %3.2f\n\n", h6);
  1207. X# endif /* ADMINDEBUG /**/
  1208. X
  1209. X        dcadmin_index = h1 + h2 + h3 - h4 + h5 - h6;
  1210. X
  1211. X# ifdef ADMINDEBUG
  1212. X          fprintf(dfile, "process: %s, node: %s, dcadmin_index = %5.4f\n", 
  1213. X            pname, phostl->Host->name, dcadmin_index);
  1214. X# endif /* ADMINDEBUG /**/
  1215. X
  1216. X        if (dcadmin_index > best_index) {
  1217. X                result = strcpy(locinfo.hostname, phostl->Host->name);
  1218. X                best_index = dcadmin_index;
  1219. X        }
  1220. X
  1221. X        } /* for(phostl) */
  1222. X     } /* if (!(crea_symb)) */
  1223. X    } /* if (!(psymbol)) */
  1224. X
  1225. X    if (!result)
  1226. X    strcpy(locinfo.hostname, "local");
  1227. X#endif /* USE_MAPFILE /**/
  1228. X
  1229. X#ifdef ADMINDEBUG
  1230. X    fprintf(dfile, "[dbg] %s LOCATION is \"%s\"\n", _processprefix, locinfo.hostname);
  1231. X    if (_debugflush)
  1232. X    fflush(dfile);
  1233. X#endif /* ADMINDEBUG /**/
  1234. X
  1235. X    fprintf(stderr, "dcadmin: target node for process \"%s\" is \"%s\"\n",
  1236. X    pname, locinfo.hostname);
  1237. X
  1238. X#ifndef USE_MAPFILE
  1239. X    /* actualize probably host load */
  1240. X    hsymbol = lookup_symbtabel(locinfo.hostname);
  1241. X    if (!psymbol || !hsymbol)
  1242. X        return(ERROR);
  1243. X    hsymbol->info.Host.prob_load += psymbol->info.Process.intensity_index / hsymbol->info.Host.perf_index;
  1244. X#endif
  1245. X
  1246. X    if (check_allocation) {
  1247. X#ifndef USE_MAPFILE
  1248. X        printf("Probably load at host %s is now %3.2f\n", 
  1249. X            hsymbol->name, hsymbol->info.Host.prob_load);
  1250. X#endif
  1251. X    /* insert process in list */
  1252. X    /* create a new process data list element */
  1253. X#ifndef USE_MAPFILE
  1254. X        if (pdatptr = (struct pdat_list *) malloc(sizeof(struct pdat_list))) {
  1255. X            /* store the new process in the process data list */
  1256. X            strcpy(pdatptr->p_descr.processname, pname);
  1257. X            pdatptr->p_descr.pid  = -1;
  1258. X# ifdef SCO_UNIX
  1259. X            strcpy(pdatptr->hostname, hsymbol->name);
  1260. X# else
  1261. X            strcpy(pdatptr->p_descr.port.hostname, hsymbol->name);
  1262. X# endif
  1263. X            pdatptr->status = RUNNING;
  1264. X            pdatptr->next = pdat_first;
  1265. X            pdat_first = pdatptr;
  1266. X    }
  1267. X#endif /* Not USE_MAPFILE */
  1268. X    return(1);
  1269. X    } else {
  1270. X        /* send result back */
  1271. X#if defined(SINGLE) || defined(HOMOGENEOUS)
  1272. X        if (_send_data(&_con_port, (char *) &locinfo, sizeof(ADMINLOCINFO), ADMINLOCTIME) < 0) {
  1273. X#else /* HETEROGENEOUS */
  1274. X        if (_send_data_encoded(&_con_port, (char *) &locinfo, xdr_ADMINLOCINFO, ADMINLOCTIME)) {
  1275. X#endif /* SINGLE || HOMOGENEOUS /**/
  1276. X        if (Errno == ETIMEOUT)
  1277. X            Errno = ETCADSNDLOC;
  1278. X        error("determining creation location");
  1279. X        EXIT(ERROR);
  1280. X        }
  1281. X    }
  1282. X
  1283. X    return(OK);
  1284. X} /* DetermineCreationLocation */
  1285. END_OF_FILE
  1286. if test 15073 -ne `wc -c <'dcadmin/Location.c'`; then
  1287.     echo shar: \"'dcadmin/Location.c'\" unpacked with wrong size!
  1288. fi
  1289. # end of 'dcadmin/Location.c'
  1290. fi
  1291. if test -f 'dcadmin/main.c' -a "${1}" != "-c" ; then 
  1292.   echo shar: Will not clobber existing file \"'dcadmin/main.c'\"
  1293. else
  1294. echo shar: Extracting \"'dcadmin/main.c'\" \(16102 characters\)
  1295. sed "s/^X//" >'dcadmin/main.c' <<'END_OF_FILE'
  1296. X/***************************************************************************
  1297. X *                                                                         *
  1298. X * @@@@  @@@ @@@@@ @@@@@ @@@@@ @@@ @@@@  @   @ @@@@@ @@@@@ @@@@       @@@  *
  1299. X * @   @  @  @       @   @   @  @  @   @ @   @   @   @     @   @     @   @ *
  1300. X * @   @  @  @@@@@   @   @@@@@  @  @@@@@ @   @   @   @@@@@ @   @     @     *
  1301. X * @   @  @      @   @   @ @    @  @   @ @   @   @   @     @   @     @   @ *
  1302. X * @@@@  @@@ @@@@@   @   @  @  @@@ @@@@  @@@@@   @   @@@@@ @@@@       @@@  *
  1303. X *                                                                         *
  1304. X *              A compiler for distributed programming with C              *
  1305. X *                                                                         *
  1306. X *                               m a i n . c                               *
  1307. X *                                                                         *
  1308. X *                            Package : Administration Process             *
  1309. X *                            Version : 1.0                                *
  1310. X *                       CreationDate : 16.09.90                           *
  1311. X *                         LastUpDate : 06.12.93                           *
  1312. X *                                                                         *
  1313. X *            The routine 'main' of the administration process.            *
  1314. X *                                                                         *
  1315. X *                  Portions Copyright 1990 Franz Distler                  *
  1316. X *               Copyright (C) 1990-1994 by Christoph Pleier               *
  1317. X *                          All rights reserved!                           *
  1318. X ***************************************************************************/
  1319. X
  1320. X/*
  1321. X * This file is part of the Distributed C Development Environment (DCDE).
  1322. X * DCDE is free software; you can redistribute it and/or modify
  1323. X * it under the terms written in the README-file. 
  1324. X * DCDE is distributed in the hope that it will be useful,
  1325. X * but WITHOUT ANY WARRANTY; without even the implied warranty of
  1326. X * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
  1327. X * See the file README for more details.
  1328. X */
  1329. X
  1330. X#ifdef UNICOS
  1331. Xint errno;
  1332. X#endif
  1333. X
  1334. X#include <stdio.h>
  1335. X#include <sys/types.h>
  1336. X#ifdef HETEROGENEOUS
  1337. X# include <rpc/rpc.h>
  1338. X#endif
  1339. X#include <errno.h>
  1340. X#define symbtabel dcc_symbtabel
  1341. X#define SYMBTABEL DCCSYMBTABEL
  1342. X#include "ipc.h"
  1343. X#include "dcc.h"
  1344. X#include "run_Errno.h"
  1345. X#include "timeout.h"
  1346. X#include "version.h"
  1347. X#undef symbtabel 
  1348. X#undef SYMBTABEL
  1349. X#include "cfgparsers.h"
  1350. X#include "dcadmin.h"
  1351. X#include "location.h"
  1352. X
  1353. X/*
  1354. X * global variables
  1355. X */
  1356. X
  1357. Xint                 Errno,        /* storing error codes                    */
  1358. X                    Intr = 0,        /* indicating interrupt or not            */
  1359. X                    shutdown,        /* flag if to terminate all processes     */
  1360. X                    terminate,      /* flag if to finish own execution        */
  1361. X                    check_allocation; /* check allocation of processes or not */
  1362. Xlong                _pidcount;      /* unused, but needed!                    */
  1363. Xchar               *_programname,   /* the program name                       */
  1364. X                   *_processname,   /* the process name                       */
  1365. X            _processprefix[80], /* the prefix specifying the process  */
  1366. X                    configfilename[MAXPATHNAMELEN]; /* name of config file    */
  1367. XFILE               *dfile;        /* debug file storing debug infos         */
  1368. XADMINREQUEST        req_type;       /* to store request types                 */
  1369. XPORTDESCR           _creator_port,  /* port of creator process                */
  1370. X                    _own_port,      /* own port                               */
  1371. X                    _admin_port,    /* unused, but needed!                    */
  1372. X                    dummy_port;     /* a dummy port                           */
  1373. XCONNECTIONDESCR     _con_port;      /* to store connection descriptors        */
  1374. Xstruct pdat_list   *pdat_first;     /* anchor of process status list          */
  1375. X#ifdef USE_MAPFILE
  1376. Xstruct pcreat_list *pcreat_first,   /* anchor to begin of process creation    */
  1377. X                   *pcreat_last;    /* anchor to end of process creation list */
  1378. X#else
  1379. Xint                 local_flag;     /* create processes at local host or not  */
  1380. X#endif /* USE_MAPFILE /**/
  1381. Xfloat               critprio_preferred;
  1382. Xfloat               critprio_wished;
  1383. Xfloat               critprio_load;
  1384. Xfloat               critprio_cload;
  1385. Xfloat               critprio_crea;
  1386. Xfloat               critprio_ipc;
  1387. XSYMBTABEL          *symbtab,        /* pointer to beginning of symbol table   */
  1388. X                   *last_symb;      /* pointer to end of symbol table         */
  1389. X#ifdef HETEROGENEOUS
  1390. Xchar               *_dcc_buf,       /* encode/decode buffer for data          */
  1391. X                   *_xdr_size_buf;  /* encode/decode buffer for size info     */
  1392. XXDR                 encode_xdrs,    /* for encoding data                      */
  1393. X                    decode_xdrs,    /* for decoding data                      */
  1394. X                    _xdr_encode_size_xdrs,
  1395. X                    _xdr_decode_size_xdrs;
  1396. X#endif /* HETEROGENEOUS /**/
  1397. X#ifdef LINUX
  1398. Xint yylineno;
  1399. X#endif /* LINUX /**/
  1400. X
  1401. X#ifdef ADMINDEBUG
  1402. X# define DEBUGPUTS(str)        {fprintf(dfile,"[dbg] %s %s\n", _processprefix, str); fflush(dfile);}
  1403. X# define DEBUGFPRINTF(f, a)    {fprintf(dfile, f, a); fflush(dfile);}
  1404. X#else
  1405. X# define DEBUGPUTS(str)        /* nothing */
  1406. X# define DEBUGFPRINTF(f, a)    /* nothing */
  1407. X#endif /* ADMINDEBUG /**/
  1408. X
  1409. X#define EXIT(v)            fprintf(stderr, "dcadmin: Terminating!\n"); \
  1410. X                exit(v)
  1411. X
  1412. X/******************************************************************************
  1413. X * main()                                                                     *
  1414. X *                                                                            *
  1415. X * The main function of the administration process.                           *
  1416. X *                                                                            *
  1417. X * Return values: 0 upon successs / ERROR upon error                          *
  1418. X ******************************************************************************/
  1419. Xmain(argc, argv)
  1420. Xint    argc;
  1421. Xchar **argv;
  1422. X{
  1423. X    int  i, timeout;
  1424. X#ifndef USE_MAPFILE
  1425. X    FILE *filep;
  1426. X#endif
  1427. X
  1428. X    check_allocation = FALSE;
  1429. X#ifndef iPSC
  1430. X    if (argc == 1) {
  1431. X    fprintf(stderr, "%s\n%s\n%s\n\n", progname, version, copyright);
  1432. X    fprintf(stderr, "Error: process manually started!\n\n");
  1433. X    DisplayUsage();
  1434. X    exit(ERROR);
  1435. X    }
  1436. X    for(i = 1; i < argc; i++) {
  1437. X    if (!strcmp(argv[i], "-check_allocation")) {
  1438. X        check_allocation = TRUE;
  1439. X        continue;
  1440. X    }
  1441. X
  1442. X    if (!strcmp(argv[i], "-f")) {
  1443. X            /* Option: "-f filename" */
  1444. X            strcpy(configfilename, argv[++i]);
  1445. X        continue;
  1446. X        }
  1447. X    } /* for(i) */
  1448. X#endif /* Not iPSC /**/
  1449. X
  1450. X    /* 
  1451. X     * some initializations 
  1452. X     */
  1453. X    _programname = *argv;
  1454. X    _processname = "administration process";
  1455. X    _set_processprefix();
  1456. X    shutdown  = terminate = 0;
  1457. X    pdat_first   = NULL; 
  1458. X#ifdef USE_MAPFILE
  1459. X    pcreat_first = NULL;
  1460. X    pcreat_last  = NULL;
  1461. X#else
  1462. X    symbtab = last_symb = NULL;
  1463. X    local_flag = FALSE;
  1464. X#endif /* USE_MAPFILE /**/
  1465. X
  1466. X#ifdef ADMINDEBUG
  1467. X    /*
  1468. X     * open debug file and print header
  1469. X     */
  1470. X    if (!(dfile = fopen(DEBUGFILENAME, "w"))) {
  1471. X    Errno = -1;
  1472. X        error("opening protocol file");
  1473. X        EXIT(ERROR);
  1474. X    }
  1475. X    (void) strcpy(_processprefix, "dcadmin: "); 
  1476. X    _debugout = dfile;
  1477. X    fputs("*****************************************************\n", dfile);
  1478. X    fputs("* Distributed C administration process - debug file *\n", dfile);
  1479. X    fputs("*****************************************************\n", dfile);
  1480. X    if (_debugflush)
  1481. X    fflush(dfile);
  1482. X#endif /* ADMINDEBUG /**/
  1483. X
  1484. X    SetSignals();
  1485. X
  1486. X    if (!check_allocation) {
  1487. X
  1488. X#ifdef HETEROGENEOUS
  1489. X        /* 
  1490. X         * allocate heap space for encode/decode buffer 
  1491. X         */
  1492. X        if (_allocate_encode_decode_buffer(ADMINDCCBUFSIZE)) {
  1493. X            error("allocating heap space for encode/decode buffer");
  1494. X        EXIT(ERROR);
  1495. X        }
  1496. X#endif /* HETEROGENEOUS /**/
  1497. X
  1498. X        /* 
  1499. X         * create own port to receive orders.
  1500. X         */ 
  1501. X        if (_create_port(&_own_port)) {
  1502. X        error("creating own port");
  1503. X        EXIT(ERROR);
  1504. X        }
  1505. X
  1506. X#ifdef iPSC
  1507. X        init_port(&_creator_port, MAIN_NODE, MAIN_PID);
  1508. X#else
  1509. X# ifdef ADMINDEBUG
  1510. X        fprintf(dfile, "[dbg] %s reporting back to creator process\n",
  1511. X        _processprefix);
  1512. X        if (_debugflush)
  1513. X        fflush(dfile);
  1514. X# endif /* ADMINDEBUG /**/
  1515. X        /*
  1516. X         * determine port of creator process and report back 
  1517. X         */
  1518. X        (void) _convert_argv_to_port(&_creator_port, &dummy_port, argv);
  1519. X        if (_make_connection(&_con_port, &_own_port, &_creator_port, ADMINCONTIME)){
  1520. X        if (Errno == ETIMEOUT)
  1521. X            Errno = ETCAPTOCPCON;
  1522. X        error("connecting to creator process");
  1523. X        EXIT(ERROR);
  1524. X        }
  1525. X        if (_send_process_data()) {
  1526. X        error("Sending process data");
  1527. X        EXIT(ERROR);
  1528. X        }
  1529. X        if (_close_connection(&_con_port)) {
  1530. X        error("closing connection with creator process");
  1531. X        EXIT(ERROR);
  1532. X        }
  1533. X#endif /* iPSC /**/
  1534. X
  1535. X        /*
  1536. X         * get filename of configuration file
  1537. X         */
  1538. X        if (GetConfigFilename(configfilename)) {
  1539. X        Errno = -1;
  1540. X        error("error receiving filename of configuration file");
  1541. X        fputs("setting defaultname as filename\n", stderr);
  1542. X        (void) strcpy(configfilename, CONFIGFILE);
  1543. X        }
  1544. X
  1545. X    } /* if (!check_allocation) */
  1546. X
  1547. X    /* if not specified by user, search it in home directory */
  1548. X    if (configfilename[0] == 0)
  1549. X    sprintf(configfilename, "%s/%s", getenv("HOME"), CONFIGFILE);
  1550. X
  1551. X#ifdef USE_MAPFILE
  1552. X
  1553. X    /*
  1554. X     * interpret configuration file 
  1555. X     */
  1556. X    if (!(yyin = fopen(configfilename, "r"))) {
  1557. X        fprintf(stderr, "dcadmin: warning: can't open configuration file '%s'\n",
  1558. X        configfilename);
  1559. X    fputs("dcadmin: setting creation list to empty list\n", stderr);
  1560. X    pcreat_first = NULL;
  1561. X    } else {
  1562. X        (void) yyparse();
  1563. X        (void) close(yyin);
  1564. X    }
  1565. X
  1566. X# ifdef ADMINDEBUG
  1567. X    DisplayCreationList();
  1568. X# endif /* ADMINDEBUG /**/
  1569. X
  1570. X#else /* Not USE_MAPFILE */
  1571. X
  1572. X    /*
  1573. X     * read symbol table with program and system informations from 
  1574. X     * configuration file.
  1575. X     */
  1576. X    if (!(filep = fopen(configfilename, "r")) || ReadSymbtab(filep)) {
  1577. X    fprintf(stderr, "dcadmin:   error : can't read program and system info file.\n");
  1578. X    fprintf(stderr, "dcadmin:  reason : %s\n", sys_errlist[errno]);
  1579. X    fprintf(stderr, "dcadmin: warning : generating all unspecified processes at local host!\n");
  1580. X    local_flag = TRUE;
  1581. X    }
  1582. X
  1583. X    fscanf(filep, "%f %f %f %f %f %f\n",
  1584. X        &critprio_preferred, &critprio_wished, &critprio_load,
  1585. X        &critprio_cload, &critprio_crea, &critprio_ipc);
  1586. X
  1587. X    fclose(filep);
  1588. X#endif /* USE_MAPFILE /**/
  1589. X
  1590. X    if (check_allocation) {
  1591. X    fprintf(stderr, "%s\n%s\n%s\n\n", progname, version, copyright);
  1592. X#ifdef ADMINDEBUG
  1593. X    fprintf(dfile, "\nPriorities of the criterions:\n");
  1594. X        fprintf(dfile, "    %2.1f - preferred host\n", critprio_preferred);
  1595. X        fprintf(dfile, "    %2.1f - wished ressources\n", critprio_wished);
  1596. X        fprintf(dfile, "    %2.1f - minimum load (without)\n", critprio_load);
  1597. X        fprintf(dfile, "    %2.1f - minimum load (with)\n", critprio_cload);
  1598. X        fprintf(dfile, "    %2.1f - creation costs\n", critprio_crea);
  1599. X        fprintf(dfile, "    %2.1f - ipc costs\n\n", critprio_ipc);
  1600. X#endif /* ADMINDEBUG /**/
  1601. X    fputs("Enter process names. Type \"done\" to stop.\n\n", stderr);
  1602. X    while(DetermineCreationLocation())
  1603. X        ;
  1604. X    exit(OK);
  1605. X    }
  1606. X
  1607. X    /* The following unlimited loop performs the main job of the administration
  1608. X     * process.
  1609. X     *
  1610. X     * A job is devided in the following steps:
  1611. X     *   1. Accept a connection
  1612. X     *   2. Receive the request type
  1613. X     *   3. Call the appropriate service routine.
  1614. X     *   4. Close the connection
  1615. X     *   5. Check if there is at least one process running. Otherwise exit.
  1616. X     *
  1617. X     * Availible services are:
  1618. X     *   - NOTIFY_START: 
  1619. X     *     Store a new created process in the process data list 
  1620. X     *   - NOTIFY_END:
  1621. X     *     Delete a terminating process from the process data list
  1622. X     *   - NOTIFY_ERROR:
  1623. X     *     Force all processes of the process data list to terminate
  1624. X     *   - NOTIFY_ACCORTER_ON:
  1625. X     *     Change the status of a process to 'accept or terminate'
  1626. X     *   - NOTIFY_ACCORTER_OFF:
  1627. X     *     Change the status of a process to 'running'
  1628. X     *   - NOTIFY_GETLOCATION:
  1629. X     *     Determine the location where to create a specific process.
  1630. X     *
  1631. X     */
  1632. X    while(1) {
  1633. X    if (shutdown)
  1634. X        DEBUGPUTS("SHUTDOWN activated!");
  1635. X    if (terminate)
  1636. X        DEBUGPUTS("TERMINATE activated!");
  1637. X    DEBUGPUTS("WAITING for new request");
  1638. X    /* Accept a connection: 
  1639. X         * If >shutdown< is activated, there have been only processes in the 
  1640. X     * process data list which process' state is 'accept or terminate'.
  1641. X     * If >terminate< is activated, the process list is empty and it looks
  1642. X     * like we can terminate.
  1643. X     * It may happen that a process was started and had not yet got a 
  1644. X     * chance to notify us his existance. Therefore we wait a delay
  1645. X     * until we order the other processes to terminate (shutdown) or 
  1646. X     * until we finish execution (terminate), so that such processes 
  1647. X     * have a chance to connect to us!
  1648. X     */
  1649. X    DEBUGPUTS("ACCEPTING a connection");
  1650. X    if (shutdown && terminate) {
  1651. X        /* This case should be impossible! Sanity code follows! */
  1652. X        terminate = 0;
  1653. X    }
  1654. X    timeout = (shutdown) ? SHUTDOWN_DELAY : ((terminate) ? 
  1655. X        TERMINATE_DELAY : ADMINACCTIME);
  1656. X        if (_accept_connection(&_con_port, &_own_port, timeout)) {
  1657. X        if (errno == EINTR) {
  1658. X        if (shutdown) {
  1659. X            /* No process has connected to us during the shutdown.
  1660. X             * Therefore order all processes to terminate and 
  1661. X             * continue to be able to collect the termination messages!
  1662. X             */
  1663. X            (void) alarm(0);
  1664. X            ShutdownProcesses();
  1665. X            shutdown = 0;
  1666. X            continue;
  1667. X            } else if (terminate) {
  1668. X            /* No process has connected to us during the terminate.
  1669. X             * Therefore finish execution!
  1670. X             */
  1671. X                DEBUGPUTS("TERMINATING");
  1672. X                exit(OK);
  1673. X        }
  1674. X        } else {
  1675. X            error("accepting request");
  1676. X            EXIT(ERROR);
  1677. X        }
  1678. X    }
  1679. X    DEBUGPUTS("GOT a connection");
  1680. X    shutdown = terminate = 0;
  1681. X    /* Receive the request type:
  1682. X     * The request type tells us which service is requested by the
  1683. X     * process that has connected to us.
  1684. X     */
  1685. X    DEBUGPUTS("RECEIVING request type message");
  1686. X#if defined(SINGLE) || defined(HOMOGENEOUS)
  1687. X    if (_recv_data(&_con_port, (char *) &req_type, sizeof(ADMINREQUEST), ADMINRCVTIME)<0){
  1688. X#else /* HETEROGENEOUS */
  1689. X    if (_recv_data_encoded(&_con_port, (char *) &req_type, xdr_ADMINREQUEST, ADMINRCVTIME)){
  1690. X#endif /* SINGLE || HOMOGENEOUS /**/
  1691. X        error("receiving request");
  1692. X        EXIT(ERROR);
  1693. X    }
  1694. X    /* Call the appropriate service routine:
  1695. X     */
  1696. X    switch(req_type.request_type) {
  1697. X    case NOTIFY_START:
  1698. X        DEBUGPUTS("SERVICE: NOTIFY_START");
  1699. X        StoreNewProcessInList();
  1700. X        break;
  1701. X    case NOTIFY_END:
  1702. X        DEBUGPUTS("SERVICE: NOTIFY_END");
  1703. X        DeleteProcessFromList();
  1704. X        break;
  1705. X    case NOTIFY_ERROR:
  1706. X        DEBUGPUTS("SERVICE: NOTIFY_ERROR");
  1707. X        KillProcesses();
  1708. X        break;
  1709. X    case NOTIFY_ACCORTER_ON:
  1710. X        DEBUGPUTS("SERVICE: NOTIFY_ACCORTER_ON");
  1711. X        ChangeProcessStatus(req_type.request_type);
  1712. X        break;
  1713. X    case NOTIFY_ACCORTER_OFF:
  1714. X        DEBUGPUTS("SERVICE: NOTIFY_ACCORTER_OFF");
  1715. X        ChangeProcessStatus(req_type.request_type);
  1716. X        break;
  1717. X    case NOTIFY_GETLOCATION:
  1718. X        DEBUGPUTS("SERVICE: NOTIFY_GETLOCATION");
  1719. X        DetermineCreationLocation();
  1720. X        break;
  1721. X    default:
  1722. X        error("unknown request");
  1723. X        KillProcesses();
  1724. X        EXIT(ERROR);
  1725. X    } /* switch */ 
  1726. X    /* Close the connection:
  1727. X     * Close connection and wait for next job.
  1728. X     */
  1729. X        if (_close_connection(&_con_port))
  1730. X        error("closing connection");
  1731. X#ifdef ADMINDEBUG
  1732. X    DisplayProcessList();
  1733. X#endif /* ADMINDEBUG /**/
  1734. X    DEBUGPUTS("DONE\n");
  1735. X    /* Check if there is at least one process running:
  1736. X     * When all other processes have terminated, we activate >terminate<! 
  1737. X     */
  1738. X    if (pdat_first == NULL)
  1739. X        terminate = 1;
  1740. X    } /* while */
  1741. X} /* main */
  1742. END_OF_FILE
  1743. if test 16102 -ne `wc -c <'dcadmin/main.c'`; then
  1744.     echo shar: \"'dcadmin/main.c'\" unpacked with wrong size!
  1745. fi
  1746. # end of 'dcadmin/main.c'
  1747. fi
  1748. if test -f 'dclocate/BuildLists.c' -a "${1}" != "-c" ; then 
  1749.   echo shar: Will not clobber existing file \"'dclocate/BuildLists.c'\"
  1750. else
  1751. echo shar: Extracting \"'dclocate/BuildLists.c'\" \(14646 characters\)
  1752. sed "s/^X//" >'dclocate/BuildLists.c' <<'END_OF_FILE'
  1753. X/***************************************************************************
  1754. X *                                                                         *
  1755. X * @@@@  @@@ @@@@@ @@@@@ @@@@@ @@@ @@@@  @   @ @@@@@ @@@@@ @@@@       @@@  *
  1756. X * @   @  @  @       @   @   @  @  @   @ @   @   @   @     @   @     @   @ *
  1757. X * @   @  @  @@@@@   @   @@@@@  @  @@@@@ @   @   @   @@@@@ @   @     @     *
  1758. X * @   @  @      @   @   @ @    @  @   @ @   @   @   @     @   @     @   @ *
  1759. X * @@@@  @@@ @@@@@   @   @  @  @@@ @@@@  @@@@@   @   @@@@@ @@@@       @@@  *
  1760. X *                                                                         *
  1761. X *              A compiler for distributed programming with C              *
  1762. X *                                                                         *
  1763. X *                         B u i l d L i s t s . c                         *
  1764. X *                                                                         *
  1765. X *                            Package : Locator Program                    *
  1766. X *                            Version : 1.1                                *
  1767. X *                       CreationDate : 27.02.92                           *
  1768. X *                         LastUpDate : 08.03.92                           *
  1769. X *                                                                         *
  1770. X * The routine 'BuildPriorityLists' which generates the priority lists for *
  1771. X * all processes stored in the symbol table.                               *
  1772. X *                                                                         *
  1773. X *               Copyright (C) 1992-1994 by Christoph Pleier               *
  1774. X *                          All rights reserved!                           *
  1775. X ***************************************************************************/
  1776. X
  1777. X/*
  1778. X * This file is part of the Distributed C Development Environment (DCDE).
  1779. X * DCDE is free software; you can redistribute it and/or modify
  1780. X * it under the terms written in the README-file. 
  1781. X * DCDE is distributed in the hope that it will be useful,
  1782. X * but WITHOUT ANY WARRANTY; without even the implied warranty of
  1783. X * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
  1784. X * See the file README for more details.
  1785. X */
  1786. X
  1787. X#include <stdio.h>
  1788. X#include "cfgparsers.h"
  1789. X#include "dclocate.h"
  1790. X#include "location.h"
  1791. X
  1792. X/******************************************************************************
  1793. X * enter_host_in_list()                                                       *
  1794. X *                                                                            *
  1795. X * Enters the host specified by 'host' in the list pointed to by 'phostlist'. *
  1796. X *                                                                            *
  1797. X * Return values: OK upon success / ERROR upon error.                         *
  1798. X ******************************************************************************/
  1799. Xint
  1800. Xenter_host_in_list(phostlist, host)
  1801. XPHOSTLIST **phostlist;
  1802. XSYMBTABEL *host;
  1803. X{
  1804. X    register PHOSTLIST *ptr, *ptr2;
  1805. X
  1806. X    ptr = (PHOSTLIST *) Malloc(sizeof(PHOSTLIST));
  1807. X    ptr->Host       = host;
  1808. X    ptr->preferred  = FALSE;
  1809. X    ptr->wished_val = 0;
  1810. X    ptr->load       = 0;
  1811. X    ptr->next       = NULL;
  1812. X
  1813. X    if(!*phostlist)
  1814. X    *phostlist = ptr;
  1815. X    else {
  1816. X        for(ptr2 = *phostlist; ptr2->next; ptr2 = ptr2->next)
  1817. X        ;
  1818. X        ptr2->next = ptr;
  1819. X    }
  1820. X
  1821. X    return(OK);
  1822. X} /* enter_host_in_list */
  1823. X
  1824. X/******************************************************************************
  1825. X * display_host_list()                                                        *
  1826. X *                                                                            *
  1827. X * Displays the hostlist pointed to by 'phostlist'.                           *
  1828. X *                                                                            *
  1829. X * Return values: always OK for success.                                      *
  1830. X ******************************************************************************/
  1831. Xint
  1832. Xdisplay_host_list(phostlist)
  1833. XPHOSTLIST *phostlist;
  1834. X{
  1835. X    for(; phostlist; phostlist = phostlist->next) {
  1836. X    printf("    host: %10s, pref: %d, wished_val: %3d, load: %2.2f, overall: %2.2f\n", 
  1837. X        phostlist->Host->name, phostlist->preferred, phostlist->wished_val,
  1838. X        phostlist->load, phostlist->overall_index);
  1839. X    }
  1840. X    return(OK);
  1841. X} /* display_host_list */
  1842. X
  1843. X/******************************************************************************
  1844. X * BuildPriorityLists()                                                       *
  1845. X *                                                                            *
  1846. X * The function to determine the priority lists for all processes stored in   *
  1847. X * the symbol table.                                                          *
  1848. X *                                                                            *
  1849. X * The lists are generated by performing the following actions:               *
  1850. X *                                                                            *
  1851. X * For each process stored in the symbol table do:                            *
  1852. X * 1. Create new list for actual process with regard to specified restricted  *
  1853. X *    hosts and required ressources. The resulting list contains only hosts   *
  1854. X *    which accomplish the required ressources and are not restricted.        *
  1855. X * 2. Determine for each host the components                                  *
  1856. X *    - if host is preferred or not                                           *
  1857. X *    - the sum of accomplished wished ressources                             *
  1858. X *    - the probably host load.                                               *
  1859. X * 3. Put list in priority order with regard to the specified importance of   *
  1860. X *    each criterion.                                                         *
  1861. X *                                                                            *
  1862. X * Return values: OK upon success / ERROR upon error                          *
  1863. X ******************************************************************************/
  1864. Xint
  1865. XBuildPriorityLists()
  1866. X{
  1867. X    int restricted, peripherals, filesystems, required, preferred;
  1868. X    register SYMBTABEL *process, *host;
  1869. X    register IDENTLIST *idl, *idl2;
  1870. X    register FSSPECINFO *p_fs;
  1871. X    register ACCFSINFO *h_fs;
  1872. X    register PATTRINFO *pattr;
  1873. X    PHOSTLIST *hostlist,*act_new_host, *new_phostlist, *last, *phost, *next;
  1874. X
  1875. X    /* FIRST: Create new list for actual process with regard to
  1876. X     *        - restricted hosts
  1877. X     *        - required ressources 
  1878. X     */
  1879. X
  1880. X    for(process = symbtab; process; process = process->next) {
  1881. X
  1882. X    if (process->type != S_PROCESS)
  1883. X        continue;
  1884. X
  1885. X    if (verbose)
  1886. X        printf("generating list for process \"%s\"\n", process->name);
  1887. X
  1888. X    hostlist = NULL;
  1889. X
  1890. X    for(host = symbtab; host; host = host->next) {
  1891. X
  1892. X        if (host->type != S_HOST)
  1893. X        continue;
  1894. X
  1895. X    if (verbose)
  1896. X        printf("    checking host \"%s\"\n", host->name);
  1897. X
  1898. X        /* check if actual host is in RESTRICTED HOSTS list */
  1899. X        restricted = FALSE;
  1900. X        for(idl = process->info.Process.rest_hosts; idl; idl = idl->next) {
  1901. X        if (idl->symbol == host) {
  1902. X            restricted = TRUE;
  1903. X            break;
  1904. X        }
  1905. X        } /* for(idl) */
  1906. X
  1907. X        if (verbose) {
  1908. X            if (restricted)
  1909. X                puts("        host is in restriction list, discarding it");
  1910. X            else
  1911. X            puts("        host is not in restriction list, continuing");
  1912. X        }
  1913. X
  1914. X        /* if actual host is in restricted list, discard actual host */
  1915. X        if (restricted)
  1916. X        continue;
  1917. X
  1918. X        /* check accomplishment of PERIPHERAL DEVICES */
  1919. X        peripherals = TRUE;
  1920. X        for(idl = process->info.Process.peri_dev; idl; idl = idl->next) {
  1921. X            peripherals = FALSE;
  1922. X        for(idl2 = host->info.Host.p_devices; idl2; idl2 = idl2->next) {
  1923. X            if (idl2->symbol == idl->symbol) {
  1924. X            peripherals = TRUE;
  1925. X            break;
  1926. X            }
  1927. X        } /* for(idl2) */
  1928. X        if (!peripherals)
  1929. X            break;
  1930. X        } /* for(idl) */
  1931. X
  1932. X        if (verbose) {
  1933. X            if (!peripherals)
  1934. X            puts("        host has not all required devices, discarding it");
  1935. X            else
  1936. X            puts("        host has all required devices, continuing");
  1937. X        }
  1938. X
  1939. X        /* if actual host hasn't all required peripheral devs, discard it */
  1940. X        if (!peripherals)
  1941. X        continue;
  1942. X        
  1943. X        /* check accomplishment of accessed FILESYSTEMS */
  1944. X        filesystems = TRUE;
  1945. X        for(p_fs = process->info.Process.filesystems; p_fs; p_fs = p_fs->next) {
  1946. X            filesystems = FALSE;
  1947. X        for(h_fs = host->info.Host.f_systems; h_fs; h_fs = h_fs->next) {
  1948. X            if (h_fs->filesystem == p_fs->filesys) {
  1949. X            filesystems = TRUE;
  1950. X            break;
  1951. X            }
  1952. X        } /* for(h_fs) */
  1953. X        } /* for(p_fs) */
  1954. X
  1955. X        if (verbose) {
  1956. X            if (!filesystems)
  1957. X            puts("        host can't access all required filesystems, discarding it");
  1958. X            else
  1959. X            puts("        host can access all required filesystems, continuing");
  1960. X        }
  1961. X
  1962. X        /* if actual host can't access all required filesystems, discard it
  1963. X         */
  1964. X        if (!filesystems)
  1965. X        continue;
  1966. X        
  1967. X        /* check accomplishment of other REQUIRED RESSOURCES */
  1968. X        required = TRUE;
  1969. X        for(pattr = process->info.Process.others; pattr; pattr = pattr->next) {
  1970. X        if (pattr->mode != MODE_REQUIRES) 
  1971. X            continue;
  1972. X        required = TRUE;
  1973. X        switch(pattr->type) {
  1974. X        case PA_PHYS_MEM:
  1975. X            if (pattr->info.phys_mem_size > host->info.Host.phys_mem) {
  1976. X            required = FALSE;
  1977. X            }
  1978. X            break;
  1979. X        case PA_VIRT_MEM:
  1980. X            if (pattr->info.virt_mem_size > host->info.Host.virt_mem) {
  1981. X            required = FALSE;
  1982. X            }
  1983. X            break;
  1984. X        case PA_VECTORIZATION:
  1985. X            if (!host->info.Host.is_vector_computer)
  1986. X            required = FALSE;
  1987. X            break;
  1988. X        case PA_PARALLELIZATION:
  1989. X            if (!host->info.Host.has_par_compiler)
  1990. X            required = FALSE;
  1991. X            break;
  1992. X        } /* switch */
  1993. X        if (!required)
  1994. X            break;
  1995. X        } /* for(pattr) */
  1996. X
  1997. X        if (verbose) {
  1998. X            if (!required)
  1999. X            puts("        host can't offer all required ressources, discarding it");
  2000. X            else
  2001. X            puts("        host can offer all required ressources, continuing");
  2002. X        }
  2003. X
  2004. X        /* if actual host can't offer all required ressources, discard it */
  2005. X        if (!required)
  2006. X        continue;
  2007. X
  2008. X        if (verbose)
  2009. X            puts("        entering host in list");
  2010. X
  2011. X        enter_host_in_list(&hostlist, host);
  2012. X
  2013. X    } /* for(hosts) */
  2014. X
  2015. X     process->info.Process.phostlist = hostlist;
  2016. X
  2017. X    } /* for(process) */
  2018. X
  2019. X    if (verbose) {
  2020. X        puts("Generated hosts lists (NOT in priority order, WITHOUT additional components):");
  2021. X        for(process = symbtab; process; process = process->next) {
  2022. X        if (process->type != S_PROCESS)
  2023. X            continue;
  2024. X        printf("process \"%s\":\n", process->name);
  2025. X        display_host_list(process->info.Process.phostlist);    
  2026. X        }
  2027. X    }
  2028. X
  2029. X    /* SECOND: Determine for each host in each host list the components 
  2030. X     *         - if host is preferred or not
  2031. X     *         - the sum of accomplished wished ressources
  2032. X     *         - the probably host load
  2033. X     */
  2034. X
  2035. X    for(process = symbtab; process; process = process->next) {
  2036. X
  2037. X    if (process->type != S_PROCESS)
  2038. X        continue;
  2039. X
  2040. X    for(hostlist = process->info.Process.phostlist; hostlist; hostlist = hostlist->next) {
  2041. X
  2042. X        /* check if actual host is a preferred host */
  2043. X        preferred = FALSE;
  2044. X        for(idl = process->info.Process.pref_hosts; idl; idl = idl->next) {
  2045. X        if (idl->symbol == hostlist->Host) {
  2046. X            hostlist->preferred = TRUE;
  2047. X            break;
  2048. X        }
  2049. X        } /* for(idl) */
  2050. X
  2051. X        /* determine sum of accomplished wished ressources */
  2052. X        for(pattr = process->info.Process.others; pattr; pattr = pattr->next) {
  2053. X        if (pattr->mode != MODE_WISHES)
  2054. X            continue;
  2055. X        switch(pattr->type) {
  2056. X        case PA_PHYS_MEM:
  2057. X            if (pattr->info.phys_mem_size <= hostlist->Host->info.Host.phys_mem) {
  2058. X            hostlist->wished_val++;
  2059. X            }
  2060. X            break;
  2061. X        case PA_VIRT_MEM:
  2062. X            if (pattr->info.virt_mem_size <= hostlist->Host->info.Host.virt_mem) {
  2063. X            hostlist->wished_val++;
  2064. X            }
  2065. X            break;
  2066. X        case PA_VECTORIZATION:
  2067. X            if (hostlist->Host->info.Host.is_vector_computer)
  2068. X                hostlist->wished_val++;
  2069. X            break;
  2070. X        case PA_PARALLELIZATION:
  2071. X            if (hostlist->Host->info.Host.has_par_compiler)
  2072. X                hostlist->wished_val++;
  2073. X            break;
  2074. X        } /* switch */
  2075. X        } /* for(pattr) */
  2076. X
  2077. X        /* determine probable host load */
  2078. X        hostlist->load = process->info.Process.intensity_index / hostlist->Host->info.Host.perf_index;
  2079. X
  2080. X    } /* for(hostlist) */
  2081. X
  2082. X    } /* for(process) */
  2083. X
  2084. X    if (verbose) {
  2085. X        puts("Generated hosts lists (NOT in priority order, WITH additional components):");
  2086. X        for(process = symbtab; process; process = process->next) {
  2087. X        if (process->type != S_PROCESS)
  2088. X            continue;
  2089. X        printf("process \"%s\":\n", process->name);
  2090. X        display_host_list(process->info.Process.phostlist);    
  2091. X        }
  2092. X    }
  2093. X
  2094. X    /* THIRD: Put list in priority order with regard to one or more of 
  2095. X     *        the criterions:
  2096. X     *        - preferred hosts
  2097. X     *        - wished ressources 
  2098. X     *        - computer load 
  2099. X     */
  2100. X
  2101. X    for(process = symbtab; process; process = process->next) {
  2102. X
  2103. X    if (process->type != S_PROCESS)
  2104. X        continue;
  2105. X
  2106. X    if (verbose)
  2107. X        printf("putting list for process \"%s\" in order\n", process->name);
  2108. X
  2109. X    /* determine overall index for all hosts in list */
  2110. X    for(phost = process->info.Process.phostlist; phost; phost = phost->next) {
  2111. X        phost->overall_index = 
  2112. X          phost->preferred  EGALIZE_PREF + critprio_preferred
  2113. X        + phost->wished_val EGALIZE_WISH + critprio_wished 
  2114. X        + (1 / phost->load) EGALIZE_LOAD + critprio_load;
  2115. X    }
  2116. X
  2117. X    new_phostlist = NULL;
  2118. X
  2119. X    /* sort list */
  2120. X    for(phost = process->info.Process.phostlist; phost; phost = next) {
  2121. X
  2122. X        next = phost->next;
  2123. X
  2124. X        if (!new_phostlist) {
  2125. X        new_phostlist = phost;
  2126. X        new_phostlist->next = NULL;
  2127. X        } else {
  2128. X         last = NULL;
  2129. X        for(act_new_host = new_phostlist; act_new_host; act_new_host = act_new_host->next) {
  2130. X            if (phost->overall_index > act_new_host->overall_index) {
  2131. X            if (!last) {
  2132. X                phost->next = new_phostlist;
  2133. X                new_phostlist = phost;
  2134. X            } else {
  2135. X                last->next = phost;
  2136. X                phost->next = act_new_host;
  2137. X            }
  2138. X            break;
  2139. X            }
  2140. X            last = act_new_host;
  2141. X        } /* for(act_new_host) */
  2142. X        if (!act_new_host) {
  2143. X            last->next = phost;
  2144. X            phost->next = NULL;
  2145. X        }
  2146. X        }
  2147. X
  2148. X    } /* for (phost) */
  2149. X
  2150. X    if (!new_phostlist) {
  2151. X        fprintf(stderr, "WARNING: process \"%s\" can not be located!\n",
  2152. X        process->name);
  2153. X    }
  2154. X
  2155. X        process->info.Process.phostlist = new_phostlist;
  2156. X
  2157. X    } /* for(process) */
  2158. X
  2159. X
  2160. X    if (verbose || show_result) {
  2161. X        puts("Generated hosts lists (IN priority order, WITH additional components):");
  2162. X        for(process = symbtab; process; process = process->next) {
  2163. X        if (process->type != S_PROCESS)
  2164. X            continue;
  2165. X        printf("process \"%s\":\n", process->name);
  2166. X        display_host_list(process->info.Process.phostlist);    
  2167. X        }
  2168. X    }
  2169. X
  2170. X    return(OK);
  2171. X} /* BuildPriorityLists */
  2172. END_OF_FILE
  2173. if test 14646 -ne `wc -c <'dclocate/BuildLists.c'`; then
  2174.     echo shar: \"'dclocate/BuildLists.c'\" unpacked with wrong size!
  2175. fi
  2176. # end of 'dclocate/BuildLists.c'
  2177. fi
  2178. echo shar: End of archive 11 \(of 18\).
  2179. cp /dev/null ark11isdone
  2180. MISSING=""
  2181. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 ; do
  2182.     if test ! -f ark${I}isdone ; then
  2183.     MISSING="${MISSING} ${I}"
  2184.     fi
  2185. done
  2186. if test "${MISSING}" = "" ; then
  2187.     echo You have unpacked all 18 archives.
  2188.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  2189. else
  2190.     echo You still need to unpack the following archives:
  2191.     echo "        " ${MISSING}
  2192. fi
  2193. ##  End of shell archive.
  2194. exit 0
  2195.