File: sge_schedd_conf.c

package info (click to toggle)
gridengine 8.1.9%2Bdfsg-10
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 56,880 kB
  • sloc: ansic: 432,689; java: 87,068; cpp: 31,958; sh: 29,429; jsp: 7,757; perl: 6,336; xml: 5,828; makefile: 4,701; csh: 3,928; ruby: 2,221; tcl: 1,676; lisp: 669; yacc: 519; python: 503; lex: 361; javascript: 200
file content (3813 lines) | stat: -rw-r--r-- 114,613 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
/*___INFO__MARK_BEGIN__*/
/*************************************************************************
 * 
 *  The Contents of this file are made available subject to the terms of
 *  the Sun Industry Standards Source License Version 1.2
 * 
 *  Sun Microsystems Inc., March, 2001
 * 
 * 
 *  Sun Industry Standards Source License Version 1.2
 *  =================================================
 *  The contents of this file are subject to the Sun Industry Standards
 *  Source License Version 1.2 (the "License"); You may not use this file
 *  except in compliance with the License. You may obtain a copy of the
 *  License at http://gridengine.sunsource.net/Gridengine_SISSL_license.html
 * 
 *  Software provided under this License is provided on an "AS IS" basis,
 *  WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
 *  WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
 *  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
 *  See the License for the specific provisions governing your rights and
 *  obligations concerning the Software.
 * 
 *   The Initial Developer of the Original Code is: Sun Microsystems, Inc.
 * 
 *   Copyright: 2001 by Sun Microsystems, Inc.
 * 
 *   All Rights Reserved.
 * 
 ************************************************************************/
/*___INFO__MARK_END__*/

#include <string.h>
#include <pthread.h>

#include "cull/cull.h"

#include "uti/sge_rmon.h"
#include "uti/sge_log.h"
#include "uti/sge_stdio.h"
#include "uti/sge_stdlib.h"
#include "uti/sge_string.h"
#include "uti/sge_parse_num_par.h"
#include "uti/sge_lock.h"
#include "uti/sge_mtutil.h"

#include "sched/msg_schedd.h"

#include "sgeobj/sge_object.h"
#include "sgeobj/sge_answer.h"
#include "sgeobj/sge_centry.h"
#include "sgeobj/sge_feature.h"
#include "sgeobj/sge_usage.h"
#include "sgeobj/sge_range.h"
#include "sgeobj/sge_schedd_conf.h"
#include "sgeobj/cull_parse_util.h"
#include "sgeobj/msg_sgeobjlib.h"

#include "sge.h"
#include "msg_common.h"

/******************************************************
 *
 * All configuration values are stored in one cull
 * master list: Master_Sched_Config_List. This list
 * has only one element: the config element (SC_Type).
 *
 * The configuratin is stored in a CULL list due to the
 * current configuration handling in the system. There
 * are methods outside this module, which need complete
 * access to the list. Therefore exist two methods to 
 * access the whole configuration:
 *
 * - sconf_get_config_list 
 *     (returns a pointer to the cull list 
 *
 * - sconf_get_config 
 *      returns a const pointer the config object.
 *
 * Both methods should only be used, when there is no
 * other way. Usualy the values in the configuration
 * should be accessed via access-function. The module
 * stores the position for each config element for
 * fast access, validates the configuration, when it
 * is changed, and pre-computes some values to return
 * them in the right way.
 *
 * If the configuration is changed directly in the CULL
 * list without using 
 *                "sconf_set_config"
 * , the 
 *               "sconf_validate_config" 
 * needs to be called to ensure that the internal data 
 * is updated.
 *
 * The access is not thread save. The current implementation
 * of the configuration does not allow an easy way to
 * make it thread save. But if only access functions
 * are used it should be easy to make this module thread
 * save, when the configuration is made thread save.
 *
 ******************************************************/



/* default values for scheduler configuration 
 * not all defaults are defined here :-)
 */
#define DEFAULT_LOAD_ADJUSTMENTS_DECAY_TIME "0:7:30"
#define _DEFAULT_LOAD_ADJUSTMENTS_DECAY_TIME 7*60+30
#define DEFAULT_LOAD_FORMULA                "np_load_avg"
#define SCHEDULE_TIME                       "0:0:15"
#define _SCHEDULE_TIME                      15
#define REPRIORITIZE_INTERVAL               "0:0:0"
#define REPRIORITIZE_INTERVAL_I             0
#define MAXUJOBS                            0
#define MAXGJOBS                            0
#define SCHEDD_JOB_INFO                     "true"
/* fixme:  see the comments below...  "infinity" == 0xFFFFFFFF */
#define DEFAULT_DURATION                    "INFINITY" /* the default_duration and default_duration_I have to be */
#define DEFAULT_DURATION_I                  600       /* in sync. One is the string version of the other (based on seconds)*/
#define DEFAULT_DURATION_OFFSET             60

/**
 * multithreading support, thread local
 **/

static pthread_key_t sc_state_key;  

static pthread_once_t sc_once = PTHREAD_ONCE_INIT;

/* a scheduling configuration structure which is stored thread local */
typedef struct {
   qs_state_t queue_state;
   bool       global_load_correction;
   int        schedd_job_info;
   bool       host_order_changed;
   int        last_dispatch_type;
   int        search_alg[SCHEDD_PE_ALG_MAX]; /* stores the weighting for the different algorithms*/
   int        scheduled_pe_jobs;        /* counts the dispatched pe jobs */
   int        scheduled_fast_jobs;           /* counts the dispatched sequential jobs */
   double     decay_constant;            /* used in the share tree */
   /* temporary data used for scheduling messages */
   lListElem *sme; /* Job scheduling informations store if not disabled */
   lListElem *tmp_sme; /* Job scheduling informations store if not disabled */
   bool mes_schedd_info; /* write scheduling information into logfile */
   int log_schedd_info; /* write scheduling information into logfile */
}  sc_state_t; 

/****** sge_schedd_conf/sc_state_init() ****************************************
*  NAME
*     sc_state_init() -- resets the thread local structure
*
*  SYNOPSIS
*     static void sc_state_init(sc_state_t* state) 
*
*  FUNCTION
*     resets the thread local structure, which collects information during
*     a scheduling run.
*
*  INPUTS
*     sc_state_t* state - the thread local structure
*
*  NOTES
*     MT-NOTE: sc_state_init() is MT safe 
*
*  SEE ALSO
*     sc_state_destroy
*******************************************************************************/
static void sc_state_init(sc_state_t* state) 
{
   state->queue_state = QS_STATE_FULL;
   state->global_load_correction = true;
   state->schedd_job_info = SCHEDD_JOB_INFO_FALSE;
   state->host_order_changed = true;
   state->last_dispatch_type = 0;
   state->search_alg[SCHEDD_PE_LOW_FIRST] = 0;
   state->search_alg[SCHEDD_PE_HIGH_FIRST] = 0;
   state->search_alg[SCHEDD_PE_BINARY] = 0;
   state->scheduled_fast_jobs = 0;
   state->scheduled_pe_jobs = 0;
   state->decay_constant = 0.0;
   /* temp data for scheduler messages */
   state->sme = NULL;
   state->tmp_sme = NULL;
   state->mes_schedd_info = false;
   state->log_schedd_info = 0;
}

static void sc_state_destroy(void* state) 
{
   sge_free(&state);
}

static void 
sc_thread_local_once_init(void)
{
   pthread_key_create(&sc_state_key, &sc_state_destroy);
}


void sc_mt_init(void) 
{
   pthread_once(&sc_once, sc_thread_local_once_init);
} 

/*-----*/
/* end */
/*-----*/

/* 
 * addes a parameter to the config_pos.params list and evaluates the settings
 *
 * Parameters:
 * - lList *param_list : target list
 * - lList ** answer_list : error messages
 * - const char* param :  the character version of the paramter
 *
 * Return:
 * - bool : true, when everything was fine, otherwise false
 *
 * See:
 * - sconf_eval_set_profiling
 */
typedef bool (*setParam)(lList *param_list, lList **answer_list, const char* param);

/**
 * specifies an array of valid parameters and its validation functions
 */
typedef struct {
      const char* name;
      setParam setParam; 
}parameters_t;

/**
 * stores the positions of all structure elemens and some
 * precalculated settings.
 */
typedef struct{
   pthread_mutex_t  mutex;
   bool empty;          /* marks this structure as empty or set */
   
   int algorithm;       /* pos settings */
   int schedule_interval;
   int maxujobs;
   int queue_sort_method;
   int job_load_adjustments;
   int load_adjustment_decay_time;
   int load_formula;
   int schedd_job_info;
   int flush_submit_sec;
   int flush_finish_sec;
   int params;
   
   int reprioritize_interval;  
   int halftime;
   int usage_weight_list;
   int compensation_factor;
   int weight_user;
   int weight_project;
   int weight_department;
   int weight_job;
   int weight_tickets_functional;
   int weight_tickets_share;

   int weight_tickets_override;
   int share_override_tickets;
   int share_functional_shares;
   int max_functional_jobs_to_schedule;
   int report_pjob_tickets;
   int max_pending_tasks_per_job;
   int halflife_decay_list; 
   int policy_hierarchy;

   int weight_ticket;
   int weight_waiting_time;
   int weight_deadline;
   int weight_urgency;
   int max_reservation;
   int weight_priority;
   int default_duration;

   int c_is_schedd_job_info;       /* cached configuration */
   u_long32 s_duration_offset;
   lList *c_schedd_job_info_range;
   lList *c_halflife_decay_list;   
   lList *c_params;
   u_long32 c_default_duration;

   bool new_config;     /* identifies an update in the configuration */
}config_pos_type;

static bool schedd_profiling = false;
static bool is_category_job_filtering = false;
static bool current_serf_do_monitoring = false;
static schedd_pe_algorithm  pe_algorithm = SCHEDD_PE_AUTO;

static bool calc_pos(void);

static void sconf_clear_pos(void);

static bool is_config_set(void);
static const char * get_algorithm(void);
static const char *get_schedule_interval_str(void);
static const char *get_load_adjustment_decay_time_str(void);
static const char *reprioritize_interval_str(void);
static const char *get_halflife_decay_list_str(void);
static const char *get_default_duration_str(void);
static const lList *get_usage_weight_list(void);
static const lList *get_job_load_adjustments(void); 
static const char* get_load_formula(void); 

static bool 
sconf_eval_set_profiling(lList *param_list, lList **answer_list, const char* param); 

static bool 
sconf_eval_set_monitoring(lList *param_list, lList **answer_list, const char* param);

static bool 
sconf_eval_set_job_category_filtering(lList *param_list, lList **answer_list, 
                                      const char* param);
static bool 
sconf_eval_set_duration_offset(lList *param_list, lList **answer_list, const char* param);                                      

static bool 
sconf_eval_set_pe_range_alg(lList *param_list, lList **answer_list, const char* param); 

static char policy_hierarchy_enum2char(policy_type_t value);

static policy_type_t policy_hierarchy_char2enum(char character);

static int policy_hierarchy_verify_value(const char* value);

/* array structure. pre-init. Make sure that a default value is added
 * when the config_pos_type is edited
 */
static config_pos_type pos = {PTHREAD_MUTEX_INITIALIZER, true, 
                       -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
                       -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
                       -1, -1, -1, -1, -1, -1, -1, -1, -1,
                       -1, -1, -1, -1, -1, -1, 
                       SCHEDD_JOB_INFO_UNDEF, 0, NULL, NULL, NULL, U_LONG32_MAX, 

                       false};

/*
 * a list of all valid "params" parameters
 *
 * The implementation has a problem. If an entry is removed, its setting is not
 * changed, but it should be turned off. This means we have to turn everything off,
 * before we work on the params 
 */
const parameters_t params[] = {
   {"PROFILE",         sconf_eval_set_profiling},
   {"MONITOR",         sconf_eval_set_monitoring},
   {"JC_FILTER",       sconf_eval_set_job_category_filtering},
   {"DURATION_OFFSET", sconf_eval_set_duration_offset},
   {"PE_RANGE_ALG",    sconf_eval_set_pe_range_alg},
   {"NONE",            NULL},
   {NULL,              NULL}
};

const char *const policy_hierarchy_chars = "OFS";

/* SG: TODO: should be const */
int load_adjustment_fields[] = { CE_name, CE_stringval, 0 };
/* SG: TODO: should be const */
int usage_fields[] = { UA_name, UA_value, 0 };
const char *delis[] = {"=", ",", ""};

/****** sge_schedd_conf/clear_pos() ********************************************
*  NAME
*     clear_pos() -- resets the position information 
*
*  SYNOPSIS
*     static void clear_pos(void) 
*
*  FUNCTION
*     is needed, when a new configuration is set 
*
* MT-NOTE: is not MT safe, the calling function needs to lock LOCK_SCHED_CONF(write)
*
*******************************************************************************/
static void sconf_clear_pos(void){

/* set config empty */
         pos.empty = true;

/* reset positions */
         pos.algorithm = -1; 
         pos.schedule_interval = -1; 
         pos.maxujobs =  -1;
         pos.queue_sort_method = -1; 
         pos.job_load_adjustments = -1; 
         pos.load_formula =  -1;
         pos.schedd_job_info = -1; 
         pos.flush_submit_sec = -1; 
         pos.flush_finish_sec =  -1;
         pos.params = -1;
         
         pos.reprioritize_interval= -1; 
         pos.halftime = -1; 
         pos.usage_weight_list = -1; 
         pos.compensation_factor = -1; 
         pos.weight_user = -1; 
         pos.weight_project = -1; 
         pos.weight_department = -1; 
         pos.weight_job = -1; 
         pos.weight_tickets_functional = -1; 
         pos.weight_tickets_share = -1; 
         pos.weight_tickets_override = -1; 
         pos.share_override_tickets = -1; 
         pos.share_functional_shares = -1; 
         pos.max_functional_jobs_to_schedule = -1; 
         pos.report_pjob_tickets = -1; 
         pos.max_pending_tasks_per_job =  -1;
         pos.halflife_decay_list = -1; 
         pos.policy_hierarchy = -1;

         pos.weight_ticket = -1;
         pos.weight_waiting_time = -1;
         pos.weight_deadline = -1;
         pos.weight_urgency = -1;
         pos.max_reservation = -1;
         pos.weight_priority = -1;
         pos.default_duration = -1;

/* reseting cached values */
         pos.c_is_schedd_job_info = SCHEDD_JOB_INFO_UNDEF;
         lFreeList(&(pos.c_schedd_job_info_range));
         lFreeList(&(pos.c_halflife_decay_list));
         lFreeList(&(pos.c_params));
         pos.c_default_duration = DEFAULT_DURATION_I;

}

/****** sge_schedd_conf/calc_pos() ********************************************
*  NAME
*     calc_pos() -- 
*
*  SYNOPSIS
*     static void calc_pos(void) 
*
*  FUNCTION
*
* MT-NOTE: is not MT safe, the calling function needs to lock LOCK_SCHED_CONF(write)
*
*******************************************************************************/
static bool calc_pos(void)
{
   bool ret = true;

   DENTER(TOP_LAYER, "calc_pos");

   if (pos.empty) {
      const lListElem *config = lFirst(*(object_type_get_master_list(SGE_TYPE_SCHEDD_CONF)));

      if (config) {
         pos.empty = false;

         ret &= (pos.algorithm = lGetPosViaElem(config, SC_algorithm, SGE_NO_ABORT )) != -1; 
         ret &= (pos.schedule_interval = lGetPosViaElem(config, SC_schedule_interval, SGE_NO_ABORT)) != -1; 
         ret &= (pos.maxujobs = lGetPosViaElem(config, SC_maxujobs, SGE_NO_ABORT)) != -1;
         ret &= (pos.queue_sort_method = lGetPosViaElem(config, SC_queue_sort_method, SGE_NO_ABORT)) != -1;

         ret &= (pos.job_load_adjustments = lGetPosViaElem(config,SC_job_load_adjustments, SGE_NO_ABORT )) != -1;
         ret &= (pos.load_adjustment_decay_time = lGetPosViaElem(config, SC_load_adjustment_decay_time, SGE_NO_ABORT)) != -1;
         ret &= (pos.load_formula = lGetPosViaElem(config, SC_load_formula, SGE_NO_ABORT)) != -1;
         ret &= (pos.schedd_job_info = lGetPosViaElem(config, SC_schedd_job_info, SGE_NO_ABORT)) != -1;
         ret &= (pos.flush_submit_sec = lGetPosViaElem(config, SC_flush_submit_sec, SGE_NO_ABORT)) != -1;
         ret &= (pos.flush_finish_sec = lGetPosViaElem(config, SC_flush_finish_sec, SGE_NO_ABORT)) != -1;
         ret &= (pos.params = lGetPosViaElem(config, SC_params, SGE_NO_ABORT)) != -1;

         ret &= (pos.reprioritize_interval = lGetPosViaElem(config, SC_reprioritize_interval, SGE_NO_ABORT)) != -1;
         ret &= (pos.halftime = lGetPosViaElem(config, SC_halftime, SGE_NO_ABORT)) != -1;
         ret &= (pos.usage_weight_list = lGetPosViaElem(config, SC_usage_weight_list, SGE_NO_ABORT)) != -1;

         ret &= (pos.compensation_factor = lGetPosViaElem(config, SC_compensation_factor, SGE_NO_ABORT)) != -1;
         ret &= (pos.weight_user = lGetPosViaElem(config, SC_weight_user, SGE_NO_ABORT)) != -1;
         ret &= (pos.weight_project = lGetPosViaElem(config, SC_weight_project, SGE_NO_ABORT)) != -1;
         ret &= (pos.weight_department = lGetPosViaElem(config, SC_weight_department, SGE_NO_ABORT)) != -1;
         ret &= (pos.weight_job = lGetPosViaElem(config, SC_weight_job, SGE_NO_ABORT)) != -1;

         ret &= (pos.weight_tickets_functional = lGetPosViaElem(config, SC_weight_tickets_functional, SGE_NO_ABORT)) != -1;
         ret &= (pos.weight_tickets_share = lGetPosViaElem(config, SC_weight_tickets_share, SGE_NO_ABORT)) != -1;
         ret &= (pos.weight_tickets_override = lGetPosViaElem(config, SC_weight_tickets_override, SGE_NO_ABORT)) != -1;

         ret &= (pos.share_override_tickets = lGetPosViaElem(config, SC_share_override_tickets, SGE_NO_ABORT)) != -1;
         ret &= (pos.share_functional_shares = lGetPosViaElem(config, SC_share_functional_shares, SGE_NO_ABORT)) != -1;
         ret &= (pos.max_functional_jobs_to_schedule = lGetPosViaElem(config, SC_max_functional_jobs_to_schedule, SGE_NO_ABORT)) != -1;
         ret &= (pos.report_pjob_tickets = lGetPosViaElem(config, SC_report_pjob_tickets, SGE_NO_ABORT)) != -1;
         ret &= (pos.max_pending_tasks_per_job = lGetPosViaElem(config, SC_max_pending_tasks_per_job, SGE_NO_ABORT)) != -1;
         ret &= (pos.halflife_decay_list = lGetPosViaElem(config, SC_halflife_decay_list, SGE_NO_ABORT)) != -1;
         ret &= (pos.policy_hierarchy = lGetPosViaElem(config, SC_policy_hierarchy, SGE_NO_ABORT)) != -1;

         ret &= (pos.weight_ticket = lGetPosViaElem(config, SC_weight_ticket, SGE_NO_ABORT)) != -1;
         ret &= (pos.weight_waiting_time = lGetPosViaElem(config, SC_weight_waiting_time, SGE_NO_ABORT)) != -1;
         ret &= (pos.weight_deadline = lGetPosViaElem(config, SC_weight_deadline, SGE_NO_ABORT)) != -1;
         ret &= (pos.weight_urgency = lGetPosViaElem(config, SC_weight_urgency, SGE_NO_ABORT)) != -1;
         ret &= (pos.weight_priority = lGetPosViaElem(config, SC_weight_priority, SGE_NO_ABORT)) != -1;
         ret &= (pos.max_reservation = lGetPosViaElem(config, SC_max_reservation, SGE_NO_ABORT)) != -1;
         ret &= (pos.default_duration = lGetPosViaElem(config, SC_default_duration, SGE_NO_ABORT)) != -1;
      }
      else {
         ret = false;
      }   
   }

   DRETURN(ret);
}

/****** sge_schedd_conf/schedd_conf_set_config() *******************************
*  NAME
*     schedd_conf_set_config() -- overwrites the existing configuration 
*
*  SYNOPSIS
*     bool schedd_conf_set_config(lList **config, lList **answer_list) 
*
*  FUNCTION
*    - validates the new configuration 
*    - precalculates some values and caches them
*    - stores the position of each attribute in the structure
*    - and sets the new configuration, if the validation worked
*
*    If the new configuration is a NULL pointer, the current configuration
*    if deleted.
*
*  INPUTS
*     lList **config      - new configuration (SC_Type)
*     lList **answer_list - error messages 
*
*  RESULT
*     bool - true, if it worked
*
*  MT-NOTE: is MT-safe, uses LOCK_SCHED_CONF(write)
*
*
*  SG TODO: use a internal eval config function and not the external one.
*
*******************************************************************************/
bool sconf_set_config(lList **config, lList **answer_list)
{
   lList *store = NULL;
   bool ret = true;
   lList **master_sconf_list = NULL;

   DENTER(TOP_LAYER,"sconf_set_config"); 

   sge_mutex_lock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);

   master_sconf_list = object_type_get_master_list(SGE_TYPE_SCHEDD_CONF); 
  
#if 0 
   store = Master_Sched_Config_List;   
#else
   store = *master_sconf_list;
#endif
   
   if (config) {
#if 0
      Master_Sched_Config_List = *config;
#endif
      *master_sconf_list = *config;

      sge_mutex_unlock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);
      ret = sconf_validate_config_(answer_list);
      sge_mutex_lock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);
      
      if (ret) {
         lFreeList(&store);
         *config = NULL;
      } else {
         *master_sconf_list = store;
         if (!*master_sconf_list) {
            SGE_ADD_MSG_ID(sprintf(SGE_EVENT, SFNMAX, MSG_USE_DEFAULT_CONFIG)); 
            answer_list_add(answer_list, SGE_EVENT, STATUS_ESYNTAX, ANSWER_QUALITY_WARNING);
 
            *master_sconf_list = lCreateList("schedd config list", SC_Type);
            lAppendElem(*master_sconf_list, sconf_create_default());

         }
         sge_mutex_unlock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);
         sconf_validate_config_(NULL);
         sge_mutex_lock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);
      }   
   } else {
      sconf_clear_pos();
   }

   sge_mutex_unlock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);
   DRETURN(ret);
}

/****** sge_schedd_conf/sconf_is_valid_load_formula() *******************
*  NAME
*     sconf_is_valid_load_formula() -- ??? 
*
*  SYNOPSIS
*     bool sconf_is_valid_load_formula_(lList **answer_list, lList 
*     *centry_list) 
*
*  INPUTS
*     lList **answer_list - ??? 
*     lList *centry_list  - ??? 
*
*  RESULT
*     bool - 
*
*  MT-NOTE:  is MT safe, uses LOCK_SCHED_CONF(read)
*
*******************************************************************************/
bool sconf_is_valid_load_formula(lList **answer_list,
                                  lList *centry_list)
{
   bool is_valid = false;
   lListElem *schedd_conf = NULL;
   const char *load_formula = NULL;

   DENTER(TOP_LAYER, "sconf_is_valid_load_formula");
   sge_mutex_lock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);

   schedd_conf = lFirst(*(object_type_get_master_list(SGE_TYPE_SCHEDD_CONF)));
   /* Modify input */
   load_formula = lGetString(schedd_conf, SC_load_formula);
   sge_strip_blanks((char *)load_formula);

   is_valid = validate_load_formula(load_formula, answer_list, centry_list, SGE_ATTR_LOAD_FORMULA);

   sge_mutex_unlock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);
   DRETURN(is_valid);
}

/****** sge_schedd_conf/sconf_create_default() ***************************
*  NAME
*     sconf_create_default() -- returns a default configuration 
*
*  SYNOPSIS
*     lListElem* sconf_create_default() 
*
*  FUNCTION
*     Creates a default configuration, but does not change the current
*     active configuration. A set config has to be used to make the
*     current configuration the active one.
*
*  RESULT
*     lListElem* - default configuration (SC_Type)
*
* MT-NOTE: is MT-safe, does not use global variables
*
*******************************************************************************/
lListElem *sconf_create_default()
{
   lListElem *ep, *added;

   DENTER(TOP_LAYER, "sconf_create_default");

   ep = lCreateElem(SC_Type);

   lSetString(ep, SC_algorithm, "default");
   lSetString(ep, SC_schedule_interval, SCHEDULE_TIME);
   lSetUlong(ep, SC_maxujobs, MAXUJOBS);

   lSetUlong(ep, SC_queue_sort_method, QSM_LOAD);

   added = lAddSubStr(ep, CE_name, "np_load_avg", SC_job_load_adjustments, CE_Type);
   lSetString(added, CE_stringval, "0.50");

   lSetString(ep, SC_load_adjustment_decay_time, 
                     DEFAULT_LOAD_ADJUSTMENTS_DECAY_TIME);
   lSetString(ep, SC_load_formula, DEFAULT_LOAD_FORMULA);
   lSetString(ep, SC_schedd_job_info, SCHEDD_JOB_INFO);
   lSetUlong(ep, SC_flush_submit_sec, 0);
   lSetUlong(ep, SC_flush_finish_sec, 0);
   lSetString(ep, SC_params, "none");
   
   lSetString(ep, SC_reprioritize_interval, REPRIORITIZE_INTERVAL);
   lSetUlong(ep, SC_halftime, 168);

   added = lAddSubStr(ep, UA_name, USAGE_ATTR_CPU, SC_usage_weight_list, UA_Type);
   lSetDouble(added, UA_value, 1.00);
   added = lAddSubStr(ep, UA_name, USAGE_ATTR_MEM, SC_usage_weight_list, UA_Type);
   lSetDouble(added, UA_value, 0.0);
   added = lAddSubStr(ep, UA_name, USAGE_ATTR_IO, SC_usage_weight_list, UA_Type);
   lSetDouble(added, UA_value, 0.0);

   lSetDouble(ep, SC_compensation_factor, 5);
   lSetDouble(ep, SC_weight_user, 0.25);
   lSetDouble(ep, SC_weight_project, 0.25);
   lSetDouble(ep, SC_weight_department, 0.25);
   lSetDouble(ep, SC_weight_job, 0.25);
   lSetUlong(ep, SC_weight_tickets_functional, 0);
   lSetUlong(ep, SC_weight_tickets_share, 0);

   lSetBool(ep, SC_share_override_tickets, true);  
   lSetBool(ep, SC_share_functional_shares, true);
   lSetUlong(ep, SC_max_functional_jobs_to_schedule, 200);
   lSetBool(ep, SC_report_pjob_tickets, true);
   lSetUlong(ep, SC_max_pending_tasks_per_job, 50);
   lSetString(ep, SC_halflife_decay_list, "none"); 
   lSetString(ep, SC_policy_hierarchy, policy_hierarchy_chars );

   lSetDouble(ep, SC_weight_ticket, 0.5);
   lSetDouble(ep, SC_weight_waiting_time, 0.278); 
   lSetDouble(ep, SC_weight_deadline, 3600000 );
   lSetDouble(ep, SC_weight_urgency, 0.5 );
   lSetUlong(ep, SC_max_reservation, 0);
   lSetDouble(ep, SC_weight_priority, 0.0 );
   lSetString(ep, SC_default_duration, DEFAULT_DURATION);

   DRETURN(ep);
}

/****** sge_schedd_conf/sconf_is_centry_referenced() ***************************
*  NAME
*     sconf_is_centry_referenced() -- ??? 
*
*  SYNOPSIS
*     bool sconf_is_centry_referenced(const lListElem *this_elem, const 
*     lListElem *centry) 
*
*  FUNCTION
*     ??? 
*
*  INPUTS
*     const lListElem *centry    - ??? 
*
*  RESULT
*     bool - 
*
*  MT-NOTE:   is MT save, uses LOCK_SCHED_CONF(read)
*
*******************************************************************************/
bool sconf_is_centry_referenced(const lListElem *centry) 
{
   bool ret = false;
   const lListElem *sc_ep = NULL;
   
   sge_mutex_lock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);
   
   sc_ep = lFirst(*(object_type_get_master_list(SGE_TYPE_SCHEDD_CONF)));
   
   if (sc_ep != NULL) {
      const char *name = lGetString(centry, CE_name);
      lList *centry_list = lGetList(sc_ep, SC_job_load_adjustments);
      lListElem *centry_ref = lGetElemStr(centry_list, CE_name, name);

      ret = ((centry_ref != NULL)? true : false);

      if (!ret) {
         if (load_formula_is_centry_referenced(lGetString(sc_ep, SC_load_formula), centry)) {
            ret = true;
         }
      }
   }

   sge_mutex_unlock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);
   return ret;
}

/****** sge_schedd_conf/get_load_adjustment_decay_time_str() *************
*  NAME
*     get_load_adjustment_decay_time_str() -- ??? 
*
*  SYNOPSIS
*     const char * get_load_adjustment_decay_time_str() 
*
*  FUNCTION
*     ??? 
*
*  INPUTS
*
*  RESULT
*     const char * - 
*
*  MT-NOTE:  is not MT safe, the calling function needs to lock LOCK_SCHED_CONF(read)
*
*******************************************************************************/
static const char * get_load_adjustment_decay_time_str()
{
   const lListElem *sc_ep = lFirst(*(object_type_get_master_list(SGE_TYPE_SCHEDD_CONF))); 
      
   if (pos.load_adjustment_decay_time != -1) {
      return lGetPosString(sc_ep, pos.load_adjustment_decay_time );
   }   
   else {
      return DEFAULT_LOAD_ADJUSTMENTS_DECAY_TIME;
   }   
}

/****** sge_schedd_conf/sconf_get_load_adjustment_decay_time() *****************
*  NAME
*     sconf_get_load_adjustment_decay_time() -- ??? 
*
*  SYNOPSIS
*     u_long32 sconf_get_load_adjustment_decay_time() 
*
*  FUNCTION
*     ??? 
*
*  INPUTS
*
*  RESULT
*     u_long32 - 
*
*  MT-NOTE: is thread save, uses LOCK_SCHED_CONF(read)
*
*******************************************************************************/
u_long32 sconf_get_load_adjustment_decay_time() 
{
   u_long32 uval;
   const char *time = NULL;

   sge_mutex_lock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);

   time = get_load_adjustment_decay_time_str();

   if (!extended_parse_ulong_val(NULL, &uval, TYPE_TIM, time, NULL, 0, 0, true)) {
      uval = _DEFAULT_LOAD_ADJUSTMENTS_DECAY_TIME;
   }

   sge_mutex_unlock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);
   return uval;
}

/****** sge_schedd_conf/sconf_get_job_load_adjustments() ***********************
*  NAME
*     sconf_get_job_load_adjustments() -- ??? 
*
*  SYNOPSIS
*     const lList* sconf_get_job_load_adjustments(void) 
*
*  FUNCTION
*     ??? 
*
*  INPUTS
*     void - ??? 
*
*  RESULT
*     const lList* - returns a copy, needs to be freed
*
*  MT-NOTE: is thread save, uses LOCK_SCHED_CONF(read)
*
*******************************************************************************/
lList *sconf_get_job_load_adjustments(void) {
   lList *load_adjustments = NULL;      
  
   sge_mutex_lock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);

   load_adjustments = lCopyList("load_adj_copy", get_job_load_adjustments());
   
   sge_mutex_unlock("Sched_Conf_Lock", "", __LINE__, &pos.mutex); 
   return load_adjustments;
}

/****** sge_schedd_conf/get_job_load_adjustments() ***********************
*  NAME
*     get_job_load_adjustments() -- ??? 
*
*  SYNOPSIS
*     const lList* get_job_load_adjustments(void) 
*
*  FUNCTION
*     ??? 
*
*  INPUTS
*     void - ??? 
*
*  RESULT
*     const lList* - 
*
*  MT-NOTE:  is not MT safe, the calling function needs to lock LOCK_SCHED_CONF(read)
*
*******************************************************************************/
static const lList *get_job_load_adjustments(void) 
{
   const lListElem *sc_ep = lFirst(*(object_type_get_master_list(SGE_TYPE_SCHEDD_CONF)));
      
   if (pos.job_load_adjustments!= -1) {
      return lGetPosList(sc_ep, pos.job_load_adjustments); 
   }   
   else {
      return NULL;
   }   
}


/****** sge_schedd_conf/sconf_get_load_formula() *******************************
*  NAME
*     sconf_get_load_formula() -- ??? 
*
*  SYNOPSIS
*     const char* sconf_get_load_formula(void) 
*
*  FUNCTION
*     ??? 
*
*  INPUTS
*     void - ??? 
*
*  RESULT
*     const char* - this is a copy of the load formula, the caller has to free it
*
*  MT-NOTE: is thread save, uses LOCK_SCHED_CONF(read)
*
*******************************************************************************/
char* sconf_get_load_formula(void) {
   char *formula = NULL;      
  
   sge_mutex_lock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);

   formula = sge_strdup(formula, get_load_formula());  
  
   sge_mutex_unlock("Sched_Conf_Lock", "", __LINE__, &pos.mutex); 
   return formula;
}

/****** sge_schedd_conf/get_load_formula() *******************************
*  NAME
*     get_load_formula() -- ??? 
*
*  SYNOPSIS
*     const char* get_load_formula(void) 
*
*  FUNCTION
*     ??? 
*
*  INPUTS
*     void - ??? 
*
*  RESULT
*     const char* - 
*
*     MT-NOTE: is not MT safe, the calling function needs to lock LOCK_SCHED_CONF(read)
*
*******************************************************************************/
static const char* get_load_formula(void) 
{
   const lListElem *sc_ep =  lFirst(*(object_type_get_master_list(SGE_TYPE_SCHEDD_CONF)));
      
   if (pos.load_formula != -1) {
      return lGetPosString(sc_ep, pos.load_formula);
   }   
   else {
      return DEFAULT_LOAD_FORMULA;
   }   
}

/****** sge_schedd_conf/sconf_get_queue_sort_method() **************************
*  NAME
*     sconf_get_queue_sort_method() -- ??? 
*
*  SYNOPSIS
*     u_long32 sconf_get_queue_sort_method(void) 
*
*  FUNCTION
*     ??? 
*
*  INPUTS
*     void - ??? 
*
*  RESULT
*     u_long32 - 
*
*  MT-NOTE: is thread save, uses LOCK_SCHED_CONF(read)
*
*******************************************************************************/
u_long32 sconf_get_queue_sort_method(void) 
{
   const lListElem *sc_ep =  NULL;
   u_long32 sort_method = 0;
  
   sge_mutex_lock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);
   
   if (pos.queue_sort_method != -1) {
      sc_ep = lFirst(*(object_type_get_master_list(SGE_TYPE_SCHEDD_CONF)));
      sort_method = lGetPosUlong(sc_ep, pos.queue_sort_method);
   }

   sge_mutex_unlock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);
   return sort_method;
}

/****** sge_schedd_conf/sconf_get_maxujobs() ***********************************
*  NAME
*     sconf_get_maxujobs() -- ??? 
*
*  SYNOPSIS
*     u_long32 sconf_get_maxujobs(void) 
*
*  FUNCTION
*     ??? 
*
*  INPUTS
*     void - ??? 
*
*  RESULT
*     u_long32 - 
*
*  MT-NOTE: is thread save, uses LOCK_SCHED_CONF(read)
*
*******************************************************************************/
u_long32 sconf_get_maxujobs(void) 
{
   u_long32 jobs = MAXUJOBS;
   
   sge_mutex_lock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);
   
   if (pos.maxujobs != -1) {
      const lListElem *sc_ep = lFirst(*(object_type_get_master_list(SGE_TYPE_SCHEDD_CONF)));
      jobs = lGetPosUlong(sc_ep, pos.maxujobs );
   }   

   sge_mutex_unlock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);
   return jobs;
}

/****** sge_schedd_conf/get_schedule_interval_str() **********************
*  NAME
*     get_schedule_interval_str() -- ??? 
*
*  SYNOPSIS
*     const char* get_schedule_interval_str(void) 
*
*  FUNCTION
*     ??? 
*
*  INPUTS
*     void - ??? 
*
*  RESULT
*     const char* - 
*
*  MT-NOTE: is not MT-safe, the caller needs to hold the LOCK_SCHED_CONF(read)
*
*******************************************************************************/
static const char *get_schedule_interval_str(void)
{
   if (pos.schedule_interval != -1) {
      const lListElem *sc_ep =  lFirst(*(object_type_get_master_list(SGE_TYPE_SCHEDD_CONF)));
      if (sc_ep != NULL) {
         return lGetPosString(sc_ep, pos.schedule_interval);
      } else {
         return NULL;
      }
   }   
   else {
      return SCHEDULE_TIME;
   }   
}

/****** sge_schedd_conf/sconf_get_schedule_interval() **************************
*  NAME
*     sconf_get_schedule_interval() -- ??? 
*
*  SYNOPSIS
*     u_long32 sconf_get_schedule_interval(void) 
*
*  FUNCTION
*     ??? 
*
*  INPUTS
*     void - ??? 
*
*  RESULT
*     u_long32 - 
*
*  MT-NOTE: is thread save, uses LOCK_SCHED_CONF(read)
*
*******************************************************************************/
u_long32 sconf_get_schedule_interval(void) {
   u_long32 uval = _SCHEDULE_TIME;   
   const char *time = NULL;
   
   sge_mutex_lock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);
   
   time = get_schedule_interval_str();
   if (!extended_parse_ulong_val(NULL, &uval, TYPE_TIM, time, NULL, 0, 0, true) ) {
         uval = _SCHEDULE_TIME;
   }

   sge_mutex_unlock("Sched_Conf_Lock", "", __LINE__, &pos.mutex); 
   return uval;  
} 


/****** sge_schedd_conf/reprioritize_interval_str() ********************
*  NAME
*     reprioritize_interval_str() -- ??? 
*
*  SYNOPSIS
*     const char* reprioritize_interval_str(void) 
*
*  FUNCTION
*     ??? 
*
*  INPUTS
*     void - ??? 
*
*  RESULT
*     const char* - 
*
*  MT-NOTE: is not MT safe, the calling function needs to lock LOCK_SCHED_CONF(read)
*
*******************************************************************************/
static const char *reprioritize_interval_str(void)
{
   if (pos.reprioritize_interval!= -1) {
      const lListElem *sc_ep =  lFirst(*(object_type_get_master_list(SGE_TYPE_SCHEDD_CONF)));
      return lGetPosString(sc_ep, pos.reprioritize_interval);
   }   
   else {
      return REPRIORITIZE_INTERVAL;
   }   
}

/****** sge_schedd_conf/sconf_get_reprioritize_interval() ********************
*  NAME
*     sconf_get_reprioritize_interval() -- ??? 
*
*  SYNOPSIS
*     u_long32 sconf_get_reprioritize_interval(void) 
*
*  FUNCTION
*     ??? 
*
*  INPUTS
*     void - ??? 
*
*  RESULT
*     u_long32 - 
*
*  MT-NOTE: is thread save, uses LOCK_SCHED_CONF(read)
*
*******************************************************************************/
u_long32 sconf_get_reprioritize_interval(void) {
   u_long32 uval = REPRIORITIZE_INTERVAL_I;
   const char *time = NULL;

   sge_mutex_lock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);
  
   time = reprioritize_interval_str();

   if (!extended_parse_ulong_val(NULL, &uval, TYPE_TIM,time, NULL, 0 , 0, true)) {
      uval = REPRIORITIZE_INTERVAL_I;
   }
   
   sge_mutex_unlock("Sched_Conf_Lock", "", __LINE__, &pos.mutex); 
   return uval;
}

/****** sge_schedd_conf/sconf_enable_schedd_job_info() *************************
*  NAME
*     sconf_enable_schedd_job_info() -- ??? 
*
*  SYNOPSIS
*     void sconf_enable_schedd_job_info() 
*
*  FUNCTION
*     ??? 
*
*  INPUTS
*
*  RESULT
*     void - 
*
*  MT-NOTE: is thread save, uses local storage
*
*******************************************************************************/
void sconf_enable_schedd_job_info() 
{
   GET_SPECIFIC(sc_state_t, sc_state, sc_state_init, sc_state_key, "sconf_enable_schedd_job_info");
   sc_state->schedd_job_info = SCHEDD_JOB_INFO_TRUE;
}

/****** sge_schedd_conf/sconf_disable_schedd_job_info() ************************
*  NAME
*     sconf_disable_schedd_job_info() -- ??? 
*
*  SYNOPSIS
*     void sconf_disable_schedd_job_info() 
*
*  FUNCTION
*     ??? 
*
*  INPUTS
*
*  RESULT
*     void - 
*
*  MT-NOTE: is thread save, uses local storage
*
*******************************************************************************/
void sconf_disable_schedd_job_info() 
{
   GET_SPECIFIC(sc_state_t, sc_state, sc_state_init, sc_state_key, "sconf_disable_schedd_job_info");
   sc_state->schedd_job_info = SCHEDD_JOB_INFO_FALSE;
}

/****** sge_schedd_conf/sconf_best_pe_alg() ************************************
*  NAME
*     sconf_best_pe_alg() -- returns the alg to use for pe-range jobs
*
*  SYNOPSIS
*     schedd_pe_algorithm sconf_best_pe_alg() 
*
*  FUNCTION
*     It checks for the alg. to use. If the user did not set a custom one, it
*     will evaluate the weights and return the most sucessful one.
*
*  RESULT
*     schedd_pe_algorithm - pe-range alg.
*
*  NOTES
*     MT-NOTE: sconf_best_pe_alg() is MT safe 
*
*  SEE ALSO
*     sconf_best_pe_alg

*******************************************************************************/
schedd_pe_algorithm sconf_best_pe_alg() 
{
   schedd_pe_algorithm alg;

   sge_mutex_lock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);
   alg = pe_algorithm;
   sge_mutex_unlock("Sched_Conf_Lock", "", __LINE__, &pos.mutex); 

   if (alg != SCHEDD_PE_AUTO) {
      return alg;
   }
   else {
      GET_SPECIFIC(sc_state_t, sc_state, sc_state_init, sc_state_key, "sconf_best_pe_alg");
    
      if ((sc_state->search_alg[SCHEDD_PE_BINARY] >= sc_state->search_alg[SCHEDD_PE_LOW_FIRST]) &&
          (sc_state->search_alg[SCHEDD_PE_BINARY] >= sc_state->search_alg[SCHEDD_PE_HIGH_FIRST])) {
         return SCHEDD_PE_BINARY;
      }
      else if (sc_state->search_alg[SCHEDD_PE_HIGH_FIRST] >= sc_state->search_alg[SCHEDD_PE_LOW_FIRST]){
         return SCHEDD_PE_HIGH_FIRST;
      }
      else {
         return SCHEDD_PE_LOW_FIRST;
      }
   }
}

/****** sge_schedd_conf/sconf_update_pe_alg() **********************************
*  NAME
*     sconf_update_pe_alg() -- updates the weights for the different algorithms
*
*  SYNOPSIS
*     void sconf_update_pe_alg(int runs, int current, int max) 
*
*  FUNCTION
*     updates the weights for the different algorithms. Since the alg. with
*     the bigest number is taken, the numbers are negative. It uses the running
*     averages to ensure, that the numbers are not getting to big and that the
*     scheduler can reakt to changes. 
*
*
*  INPUTS
*     int runs    - number of runs it would have taken with the bin search alg.
*     int current - number of runs it took
*     int max     - max runs
*
*  NOTES
*     MT-NOTE: sconf_update_pe_alg() is MT safe 
*
*  SEE ALSO
*     sconf_best_pe_alg
*
*******************************************************************************/
void sconf_update_pe_alg(int runs, int current, int max) 
{
   const int HISTORY = 66;
   const int PRESENT = 34;

   if (max > 1) {
      int low_run = current+1;
      int high_run = max - current+1;
      GET_SPECIFIC(sc_state_t, sc_state, sc_state_init, sc_state_key, "sconf_update_pe_alg");

      /* we calculate 2 digits behind the commma*/
      runs *= 100;
      low_run *= 100;
      high_run *= 100;

      sc_state->search_alg[SCHEDD_PE_BINARY]     = (sc_state->search_alg[SCHEDD_PE_BINARY]     * HISTORY) / 100;
      sc_state->search_alg[SCHEDD_PE_HIGH_FIRST] = (sc_state->search_alg[SCHEDD_PE_HIGH_FIRST] * HISTORY) / 100;
      sc_state->search_alg[SCHEDD_PE_LOW_FIRST]  = (sc_state->search_alg[SCHEDD_PE_LOW_FIRST]  * HISTORY) / 100; 

      sc_state->search_alg[SCHEDD_PE_BINARY]     -= runs     * PRESENT / 100;
      sc_state->search_alg[SCHEDD_PE_LOW_FIRST]  -= low_run  * PRESENT / 100;
      sc_state->search_alg[SCHEDD_PE_HIGH_FIRST] -= high_run * PRESENT / 100;
   }
}

int sconf_get_pe_alg_value(schedd_pe_algorithm alg)
{
   GET_SPECIFIC(sc_state_t, sc_state, sc_state_init, sc_state_key, "sconf_update_pe_alg");
   return sc_state->search_alg[alg];
}

void sconf_inc_fast_jobs(void) 
{
   GET_SPECIFIC(sc_state_t, sc_state, sc_state_init, sc_state_key, "sconf_inc_fast_jobs");
   sc_state->scheduled_fast_jobs++;
}

int sconf_get_fast_jobs(void) 
{
   GET_SPECIFIC(sc_state_t, sc_state, sc_state_init, sc_state_key, "sconf_get_fast_jobs");
   return sc_state->scheduled_fast_jobs;
}

void sconf_inc_pe_jobs(void) 
{
   GET_SPECIFIC(sc_state_t, sc_state, sc_state_init, sc_state_key, "sconf_inc_pe_jobs");
   sc_state->scheduled_pe_jobs++;
}

int sconf_get_pe_jobs(void) 
{
   GET_SPECIFIC(sc_state_t, sc_state, sc_state_init, sc_state_key, "sconf_get_pe_jobs");
   return sc_state->scheduled_pe_jobs;
}

void sconf_reset_jobs(void)
{
   GET_SPECIFIC(sc_state_t, sc_state, sc_state_init, sc_state_key, "sconf_reset_jobs");
   sc_state->scheduled_fast_jobs = 0;
   sc_state->scheduled_pe_jobs = 0;
}

/****** sge_schedd_conf/sconf_get_schedd_job_info() ****************************
*  NAME
*     sconf_get_schedd_job_info() -- ??? 
*
*  SYNOPSIS
*     u_long32 sconf_get_schedd_job_info(void) 
*
*  FUNCTION
*     ??? 
*
*  INPUTS
*     void - ??? 
*
*  RESULT
*     u_long32 - 
*
*  MT-NOTE: is thread save, uses LOCK_SCHED_CONF(read) and local storage
*
*******************************************************************************/
u_long32 sconf_get_schedd_job_info(void) {
   u_long32 info = 0;

   sge_mutex_lock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);
   
   info = pos.c_is_schedd_job_info;

   sge_mutex_unlock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);    

   if (info == SCHEDD_JOB_INFO_FALSE) {
      GET_SPECIFIC(sc_state_t, sc_state, sc_state_init, sc_state_key, "sconf_get_schedd_job_info");
      info = sc_state->schedd_job_info;
   }
   
   return info;
}

/****** sge_schedd_conf/sconf_get_schedd_job_info_range() **********************
*  NAME
*     sconf_get_schedd_job_info_range() -- ??? 
*
*  SYNOPSIS
*     const lList* sconf_get_schedd_job_info_range(void) 
*
*  FUNCTION
*     ??? 
*
*  INPUTS
*     void - ??? 
*
*  RESULT
*     const lList* -  returns a copy, needs to be freed
*
*  MT-NOTE: is thread save, uses LOCK_SCHED_CONF(read)
*
*******************************************************************************/
lList *sconf_get_schedd_job_info_range(void) {
   lList *range_copy = NULL;        
  
   sge_mutex_lock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);
   
   range_copy = lCopyList("copy_range", pos.c_schedd_job_info_range);
   
   sge_mutex_unlock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);    
   return range_copy;
}

/****** sge_schedd_conf/sconf_is_id_in_schedd_job_info_range() **********************
*  NAME
*     sconf_is_id_in_schedd_job_info_range() -- ??? 
*
*  SYNOPSIS
*     const lList* sconf_is_id_in_schedd_job_info_range(void) 
*
*  FUNCTION
*     ??? 
*
*  INPUTS
*     void - ??? 
*
*  RESULT
*     bool -
*
*  MT-NOTE: is thread save, uses LOCK_SCHED_CONF(read)
*
*******************************************************************************/
bool sconf_is_id_in_schedd_job_info_range(u_long32 job_number) 
{
   bool is_in_range = false;        
  
   sge_mutex_lock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);

   is_in_range = range_list_is_id_within(pos.c_schedd_job_info_range, job_number);

   sge_mutex_unlock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);     
   return is_in_range;
}

/****** sge_schedd_conf/get_algorithm() **********************************
*  NAME
*     get_algorithm() -- ??? 
*
*  SYNOPSIS
*     const char* get_algorithm(void) 
*
*  FUNCTION
*     ??? 
*
*  INPUTS
*     void - ??? 
*
*  RESULT
*     const char* -
*
*  MT-NOTE: is not MT-safe, the caller needs the LOCK_SCHED_CONF(read)
*
*******************************************************************************/
static const char * get_algorithm(void) 
{
   if (pos.algorithm!= -1) {
      const lListElem *sc_ep =  lFirst(*(object_type_get_master_list(SGE_TYPE_SCHEDD_CONF)));
      return lGetPosString(sc_ep, pos.algorithm);
   }   
   else {
      return "default";
   }   
}


/****** sge_schedd_conf/sconf_get_usage_weight_list() **************************
*  NAME
*     sconf_get_usage_weight_list() -- ??? 
*
*  SYNOPSIS
*     const lList* sconf_get_usage_weight_list(void) 
*
*  FUNCTION
*     ??? 
*
*  INPUTS
*     void - ??? 
*
*  RESULT
*     lList* - returns a copy, needs to be freed
*
*  MT-NOTE: is thread save, uses LOCK_SCHED_CONF(read)
*
*******************************************************************************/
lList *sconf_get_usage_weight_list(void) 
{
   lList *weight_list = NULL;      
  
   sge_mutex_lock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);
   
   weight_list = lCopyList("copy_weight", get_usage_weight_list());

   sge_mutex_unlock("Sched_Conf_Lock", "", __LINE__, &pos.mutex); 
   return weight_list;
}


/****** sge_schedd_conf/get_usage_weight_list() **************************
*  NAME
*     get_usage_weight_list() -- ??? 
*
*  SYNOPSIS
*     const lList* get_usage_weight_list(void) 
*
*  FUNCTION
*     ??? 
*
*  INPUTS
*     void - ??? 
*
*  RESULT
*     const lList* - 
*
*  MT-NOTE: is not MT safe, the calling function needs to lock LOCK_SCHED_CONF(read)
*
*******************************************************************************/
static const lList *get_usage_weight_list(void) 
{
   const lListElem *sc_ep =  lFirst(*(object_type_get_master_list(SGE_TYPE_SCHEDD_CONF)));

   if (pos.usage_weight_list != -1) {
      return lGetPosList(sc_ep, pos.usage_weight_list );
   }   
   else {
      return NULL;
   }   
}



/****** sge_schedd_conf/sconf_get_weight_user() ********************************
*  NAME
*     sconf_get_weight_user() -- ??? 
*
*  SYNOPSIS
*     double sconf_get_weight_user(void) 
*
*  FUNCTION
*     ??? 
*
*  INPUTS
*     void - ??? 
*
*  RESULT
*     double - 
*
*  MT-NOTE: is thread save, uses LOCK_SCHED_CONF(read)
*
*******************************************************************************/
double sconf_get_weight_user(void) 
{
   double weight = 0;
   
   sge_mutex_lock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);
   
   if (pos.weight_user!= -1) {
      const lListElem *sc_ep = lFirst(*(object_type_get_master_list(SGE_TYPE_SCHEDD_CONF)));
      weight = lGetPosDouble(sc_ep, pos.weight_user);
   }   

   sge_mutex_unlock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);
   return weight;
}

/****** sge_schedd_conf/sconf_get_weight_department() **************************
*  NAME
*     sconf_get_weight_department() -- ??? 
*
*  SYNOPSIS
*     double sconf_get_weight_department(void) 
*
*  FUNCTION
*     ??? 
*
*  INPUTS
*     void - ??? 
*
*  RESULT
*     double - 
*
*  MT-NOTE: is thread save, uses LOCK_SCHED_CONF(read)
*
*******************************************************************************/
double sconf_get_weight_department(void) 
{
   double weight = 0;
   
   sge_mutex_lock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);

   if (pos.weight_department != -1) {
      const lListElem *sc_ep = lFirst(*(object_type_get_master_list(SGE_TYPE_SCHEDD_CONF)));
      weight = lGetPosDouble(sc_ep, pos.weight_department);
   }   

   sge_mutex_unlock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);
   return weight;
}

/****** sge_schedd_conf/sconf_get_weight_project() *****************************
*  NAME
*     sconf_get_weight_project() -- ??? 
*
*  SYNOPSIS
*     double sconf_get_weight_project(void) 
*
*  FUNCTION
*     ??? 
*
*  INPUTS
*     void - ??? 
*
*  RESULT
*     double - 
*
*  MT-NOTE: is thread save, uses LOCK_SCHED_CONF(read)
*
*******************************************************************************/
double sconf_get_weight_project(void) 
{
   double weight = 0;
   
   sge_mutex_lock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);

   if (pos.weight_project != -1) {
      const lListElem *sc_ep = lFirst(*(object_type_get_master_list(SGE_TYPE_SCHEDD_CONF)));
      weight = lGetPosDouble(sc_ep, pos.weight_project);
   }

   sge_mutex_unlock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);
   return weight;
}

/****** sge_schedd_conf/sconf_get_weight_job() *********************************
*  NAME
*     sconf_get_weight_job() -- ??? 
*
*  SYNOPSIS
*     double sconf_get_weight_job(void) 
*
*  FUNCTION
*     ??? 
*
*  INPUTS
*     void - ??? 
*
*  RESULT
*     double - 
*
*  MT-NOTE: is thread save, uses LOCK_SCHED_CONF(read)
*
*******************************************************************************/
double sconf_get_weight_job(void) 
{
   double weight = 0;
   
   sge_mutex_lock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);

   if (pos.weight_job != -1) {
      const lListElem *sc_ep = lFirst(*(object_type_get_master_list(SGE_TYPE_SCHEDD_CONF)));
      weight = lGetPosDouble(sc_ep, pos.weight_job);
   }   

   sge_mutex_unlock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);
   return weight;
}

/****** sge_schedd_conf/sconf_get_weight_tickets_share() ***********************
*  NAME
*     sconf_get_weight_tickets_share() -- ??? 
*
*  SYNOPSIS
*     u_long32 sconf_get_weight_tickets_share(void) 
*
*  FUNCTION
*     ??? 
*
*  INPUTS
*     void - ??? 
*
*  RESULT
*     u_long32 - 
*
*  MT-NOTE: is thread save, uses LOCK_SCHED_CONF(read)
*
*******************************************************************************/
u_long32 sconf_get_weight_tickets_share(void) 
{
   double weight = 0;
   
   sge_mutex_lock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);

   if (pos.weight_tickets_share != -1) {
      const lListElem *sc_ep = lFirst(*(object_type_get_master_list(SGE_TYPE_SCHEDD_CONF)));
      weight = lGetPosUlong(sc_ep, pos.weight_tickets_share );
   }   

   sge_mutex_unlock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);
   return weight;
}

/****** sge_schedd_conf/sconf_get_weight_tickets_functional() ******************
*  NAME
*     sconf_get_weight_tickets_functional() -- ??? 
*
*  SYNOPSIS
*     u_long32 sconf_get_weight_tickets_functional(void) 
*
*  FUNCTION
*     ??? 
*
*  INPUTS
*     void - ??? 
*
*  RESULT
*     u_long32 - 
*
*  MT-NOTE: is thread save, uses LOCK_SCHED_CONF(read)
*
*******************************************************************************/
u_long32 sconf_get_weight_tickets_functional(void) 
{
   double weight = 0;
   
   sge_mutex_lock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);

   if (pos.weight_tickets_functional != -1) {
      const lListElem *sc_ep = lFirst(*(object_type_get_master_list(SGE_TYPE_SCHEDD_CONF)));
      weight = lGetPosUlong(sc_ep, pos.weight_tickets_functional);
   }   

   sge_mutex_unlock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);
   return weight;
}

/****** sge_schedd_conf/sconf_get_halftime() ***********************************
*  NAME
*     sconf_get_halftime() -- ??? 
*
*  SYNOPSIS
*     u_long32 sconf_get_halftime(void) 
*
*  FUNCTION
*     ??? 
*
*  INPUTS
*     void - ??? 
*
*  RESULT
*     u_long32 - 
*
*  MT-NOTE: is thread save, uses LOCK_SCHED_CONF(read)
*
*******************************************************************************/
u_long32 sconf_get_halftime(void) 
{
   const lListElem *sc_ep = NULL;
   u_long32 halftime = 0;
  
   sge_mutex_lock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);
   
   if (pos.halftime != -1) {
      sc_ep = lFirst(*(object_type_get_master_list(SGE_TYPE_SCHEDD_CONF)));
      halftime = lGetPosUlong(sc_ep, pos.halftime);
   }   

   sge_mutex_unlock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);
   return halftime;
}


/****** sge_schedd_conf/sconf_set_weight_tickets_override() ********************
*  NAME
*     sconf_set_weight_tickets_override() -- ??? 
*
*  SYNOPSIS
*     void sconf_set_weight_tickets_override(u_long32 active) 
*
*  FUNCTION
*     ??? 
*
*  INPUTS
*     u_long32 active - ??? 
*
*  RESULT
*     void - 
*
*  MT-NOTE: is thread save, uses LOCK_SCHED_CONF(write)
*
*******************************************************************************/
void sconf_set_weight_tickets_override(u_long32 active) 
{
   lListElem *sc_ep = NULL;

   sge_mutex_lock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);   

   sc_ep = lFirst(*(object_type_get_master_list(SGE_TYPE_SCHEDD_CONF)));
   
   if (pos.weight_tickets_override!= -1) {
      lSetPosUlong(sc_ep, pos.weight_tickets_override, active);
   }

   sge_mutex_unlock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);
   return;
}

/****** sge_schedd_conf/sconf_get_weight_tickets_override() ********************
*  NAME
*     sconf_get_weight_tickets_override() -- ??? 
*
*  SYNOPSIS
*     void sconf_get_weight_tickets_override(u_long32 active) 
*
*  FUNCTION
*     ??? 
*
*  RESULT
*     u_long32 - 
*
*  MT-NOTE: is thread save, uses LOCK_SCHED_CONF(read)
*
*******************************************************************************/
u_long32 sconf_get_weight_tickets_override() 
{
   u_long32 tickets = 0;
   
   sge_mutex_lock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);   

   if (pos.weight_tickets_override!= -1) {
      lListElem *sc_ep = lFirst(*(object_type_get_master_list(SGE_TYPE_SCHEDD_CONF)));
      tickets = lGetPosUlong(sc_ep, pos.weight_tickets_override);
   }

   sge_mutex_unlock("Sched_Conf_Lock", "", __LINE__, &pos.mutex); 
   return tickets;

}

/****** sge_schedd_conf/sconf_get_compensation_factor() ************************
*  NAME
*     sconf_get_compensation_factor() -- ??? 
*
*  SYNOPSIS
*     double sconf_get_compensation_factor(void) 
*
*  FUNCTION
*     ??? 
*
*  INPUTS
*     void - ??? 
*
*  RESULT
*     double - 
*
*  MT-NOTE: is thread save, uses LOCK_SCHED_CONF(read)
*
*******************************************************************************/
double sconf_get_compensation_factor(void) 
{
   double factor = 1;
   
   sge_mutex_lock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);

   if (pos.compensation_factor!= -1) {
      const lListElem *sc_ep = lFirst(*(object_type_get_master_list(SGE_TYPE_SCHEDD_CONF)));
      factor = lGetPosDouble(sc_ep, pos.compensation_factor);
   }

   sge_mutex_unlock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);
   return factor;
}

/****** sge_schedd_conf/sconf_get_weight_ticket() ****************************
*  NAME
*     sconf_get_weight_ticket() -- ??? 
*
*  SYNOPSIS
*     double sconf_get_weight_ticket(void) 
*
*  FUNCTION
*     ??? 
*
*  INPUTS
*     void - ??? 
*
*  RESULT
*     double - 
*
*  MT-NOTE: is thread save, uses LOCK_SCHED_CONF(read)
*
*******************************************************************************/
double sconf_get_weight_ticket(void) 
{
   double  weight = 0;   

   sge_mutex_lock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);
   
   if (pos.weight_ticket != -1) {
      const lListElem *sc_ep = lFirst(*(object_type_get_master_list(SGE_TYPE_SCHEDD_CONF)));
      weight = lGetPosDouble(sc_ep, pos.weight_ticket);
   }   

   sge_mutex_unlock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);
   return weight;
}     

void sconf_get_weight_ticket_urgency_priority(double *ticket, double *urgency, double *priority) 
{
   sge_mutex_lock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);
   
   if (pos.weight_ticket != -1 && pos.weight_urgency != -1 && pos.weight_priority != -1) {
      const lListElem *sc_ep = lFirst(*(object_type_get_master_list(SGE_TYPE_SCHEDD_CONF)));
      *ticket = lGetPosDouble(sc_ep, pos.weight_ticket);
      *urgency = lGetPosDouble(sc_ep, pos.weight_urgency);
      *priority = lGetPosDouble(sc_ep, pos.weight_priority);
   }   
   
   sge_mutex_unlock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);
}

/****** sge_schedd_conf/sconf_get_weight_waiting_time() ************************
*  NAME
*     sconf_get_weight_waiting_time() -- ??? 
*
*  SYNOPSIS
*     double sconf_get_weight_waiting_time(void) 
*
*  FUNCTION
*     ??? 
*
*  INPUTS
*     void - ??? 
*
*  RESULT
*     double - 
*
*  MT-NOTE: is thread save, uses LOCK_SCHED_CONF(read)
*
*******************************************************************************/
double sconf_get_weight_waiting_time(void) 
{
   double weight = 0;

   sge_mutex_lock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);
   
   if (pos.weight_waiting_time != -1) {
      const lListElem *sc_ep = lFirst(*(object_type_get_master_list(SGE_TYPE_SCHEDD_CONF)));
      weight = lGetPosDouble(sc_ep, pos.weight_waiting_time);
   }   

   sge_mutex_unlock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);
   return weight;
}     

/****** sge_schedd_conf/sconf_get_weight_deadline() ****************************
*  NAME
*     sconf_get_weight_deadline() -- ??? 
*
*  SYNOPSIS
*     double sconf_get_weight_deadline(void) 
*
*  FUNCTION
*     ??? 
*
*  INPUTS
*     void - ??? 
*
*  RESULT
*     double - 
*
*  MT-NOTE: is thread save, uses LOCK_SCHED_CONF(read)
*
*******************************************************************************/
double sconf_get_weight_deadline(void) 
{
   double weight = 0;

   sge_mutex_lock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);
   
   if (pos.weight_deadline != -1) {
      const lListElem *sc_ep = lFirst(*(object_type_get_master_list(SGE_TYPE_SCHEDD_CONF)));
      weight = lGetPosDouble(sc_ep, pos.weight_deadline);
   }   

   sge_mutex_unlock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);
   return weight;
}     

/****** sge_schedd_conf/sconf_get_weight_urgency() ****************************
*  NAME
*     sconf_get_weight_urgency() -- ??? 
*
*  SYNOPSIS
*     double sconf_get_weight_urgency(void) 
*
*  FUNCTION
*     ??? 
*
*  INPUTS
*     void - ??? 
*
*  RESULT
*     double - 
*
*  MT-NOTE: is thread save, uses LOCK_SCHED_CONF(read)
*
*******************************************************************************/
double sconf_get_weight_urgency(void) 
{
   double weight = 0;

   sge_mutex_lock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);
   
   if (pos.weight_urgency != -1) {
      const lListElem *sc_ep = lFirst(*(object_type_get_master_list(SGE_TYPE_SCHEDD_CONF)));
      weight = lGetPosDouble(sc_ep, pos.weight_urgency);
   }   

   sge_mutex_unlock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);
   return weight;
}     

/****** sge_schedd_conf/sconf_get_max_reservations() ***************************
*  NAME
*     sconf_get_max_reservations() -- Max reservation tuning parameter
*
*  SYNOPSIS
*     int sconf_get_max_reservations(void) 
*
*  FUNCTION
*     Tuning parameter. 
*     Returns maximum number of reservations that should be done by 
*     scheduler. If 0 is returned this no single job shall get a reservation
*     and assignments are to be made for 'now' only.
*     
*  RESULT
*     int - Max. number of reservations
*
*  MT-NOTE: is thread save, uses LOCK_SCHED_CONF(read)
*
*******************************************************************************/
u_long32 sconf_get_max_reservations(void) {
   u_long32 max_res = 0;
 
   sge_mutex_lock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);
   
   if (!pos.empty && (pos.max_reservation != -1)) {
      lListElem *sc_ep = lFirst(*(object_type_get_master_list(SGE_TYPE_SCHEDD_CONF)));
      max_res = lGetPosUlong(sc_ep, pos.max_reservation);
   }

   sge_mutex_unlock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);
   return max_res;
}

/****** sge_schedd_conf/get_default_duration_str() **********************
*  NAME
*     get_default_duration_str() -- Return default_duration string
*
*  SYNOPSIS
*     const char* get_default_duration_str(void) 
*
*  FUNCTION
*     Returns default duration string from scheduler configuration.
*
*  RESULT
*     const char* - 
*
*  MT-NOTE: is not MT safe, the calling function needs to lock LOCK_SCHED_CONF(read)
*
*******************************************************************************/
static const char *get_default_duration_str(void)
{
   const lListElem *sc_ep =  lFirst(*(object_type_get_master_list(SGE_TYPE_SCHEDD_CONF)));
      
   if (pos.schedule_interval != -1) {
      return lGetPosString(sc_ep, pos.default_duration);
   }   
   else {
      return DEFAULT_DURATION;
   }   
}
/****** sge_schedd_conf/sconf_get_weight_priority() ****************************
*  NAME
*     sconf_get_weight_priority() -- ??? 
*
*  SYNOPSIS
*     double sconf_get_weight_priority(void) 
*
*  FUNCTION
*     ??? 
*
*  INPUTS
*     void - ??? 
*
*  RESULT
*     double - 
*
*  MT-NOTE: is thread save, uses LOCK_SCHED_CONF(read)
*
*******************************************************************************/
double sconf_get_weight_priority(void) 
{
   double weight = 0;

   sge_mutex_lock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);
      
   if (pos.weight_priority != -1) {
      const lListElem *sc_ep = lFirst(*(object_type_get_master_list(SGE_TYPE_SCHEDD_CONF)));
      weight = lGetPosDouble(sc_ep, pos.weight_priority);
   }   

   sge_mutex_unlock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);
   return weight;
}     


/****** sge_schedd_conf/sconf_get_share_override_tickets() *********************
*  NAME
*     sconf_get_share_override_tickets() -- ??? 
*
*  SYNOPSIS
*     bool sconf_get_share_override_tickets(void) 
*
*  FUNCTION
*     ??? 
*
*  INPUTS
*     void - ??? 
*
*  RESULT
*     bool - 
*
*  MT-NOTE: is thread save, uses LOCK_SCHED_CONF(read)
*
*******************************************************************************/
bool sconf_get_share_override_tickets(void) 
{
   bool is_share = false;

   sge_mutex_lock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);

   if (pos.share_override_tickets != -1) {
      const lListElem *sc_ep = lFirst(*(object_type_get_master_list(SGE_TYPE_SCHEDD_CONF)));
      is_share = lGetPosBool(sc_ep, pos.share_override_tickets) ? true : false;
   }   

   sge_mutex_unlock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);
   return is_share;
}
/****** sge_schedd_conf/sconf_get_share_functional_shares() ********************
*  NAME
*     sconf_get_share_functional_shares() -- ??? 
*
*  SYNOPSIS
*     bool sconf_get_share_functional_shares(void) 
*
*  FUNCTION
*     ??? 
*
*  INPUTS
*     void - ??? 
*
*  RESULT
*     bool - 
*******************************************************************************/
bool sconf_get_share_functional_shares(void)
{
   bool is_share = true;

   sge_mutex_lock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);

   if (pos.share_functional_shares != -1) {
      const lListElem *sc_ep = lFirst(*(object_type_get_master_list(SGE_TYPE_SCHEDD_CONF)));
      is_share = lGetPosBool(sc_ep, pos.share_functional_shares) ? true : false;
   }   

   sge_mutex_unlock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);
   return is_share;
}

/****** sge_schedd_conf/sconf_get_report_pjob_tickets() *************************
*  NAME
*     sconf_get_report_pjob_tickets() -- ??? 
*
*  SYNOPSIS
*     bool sconf_get_report_pjob_tickets(void) 
*
*  FUNCTION
*     ??? 
*
*  INPUTS
*     void - ??? 
*
*  RESULT
*     bool - 
*
*  MT-NOTE: is thread save, uses LOCK_SCHED_CONF(read)
*
*******************************************************************************/
bool sconf_get_report_pjob_tickets(void)
{
   bool is_report = true;

   sge_mutex_lock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);

   if (pos.report_pjob_tickets!= -1) {
      const lListElem *sc_ep = lFirst(*(object_type_get_master_list(SGE_TYPE_SCHEDD_CONF)));
      is_report = lGetPosBool(sc_ep, pos.report_pjob_tickets) ? true : false;
   }   

   sge_mutex_unlock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);
   return is_report;
}

/****** sge_schedd_conf/sconf_is_job_category_filtering() **********************
*  NAME
*     sconf_is_job_category_filtering() -- true, if the job_category_filtering is on
*
*  SYNOPSIS
*     bool sconf_is_job_category_filtering(void) 
*
*  FUNCTION
*     returns the status of the job category filtering 
*
*  RESULT
*     bool - true, the job category filtering is on
*
*  NOTES
*     MT-NOTE: is MT save, uses LOCK_SCHED_CONF(read) 
*
*******************************************************************************/
bool sconf_is_job_category_filtering(void){
   bool filtering = false;

   sge_mutex_lock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);
   
   filtering = is_category_job_filtering;   

   sge_mutex_unlock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);
   return filtering;
}

/****** sge_schedd_conf/sconf_get_flush_submit_sec() ***************************
*  NAME
*     sconf_get_flush_submit_sec() -- ??? 
*
*  SYNOPSIS
*     int sconf_get_flush_submit_sec(void) 
*
*  FUNCTION
*     ??? 
*
*  INPUTS
*     void - ??? 
*
*  RESULT
*     int - 
*
*  MT-NOTE: is thread save, uses LOCK_SCHED_CONF(read)
*
*******************************************************************************/
u_long32 sconf_get_flush_submit_sec(void)
{
   const lListElem *sc_ep = NULL;
   u_long32 flush_sec = 0;
  
   sge_mutex_lock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);
      
   if (pos.flush_submit_sec != -1) {
      sc_ep = lFirst(*(object_type_get_master_list(SGE_TYPE_SCHEDD_CONF)));
      if (sc_ep != NULL) {
         flush_sec = lGetPosUlong(sc_ep, pos.flush_submit_sec);
      }
   }

   sge_mutex_unlock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);
   return flush_sec;
}
   
/****** sge_schedd_conf/sconf_get_flush_finish_sec() ***************************
*  NAME
*     sconf_get_flush_finish_sec() -- ??? 
*
*  SYNOPSIS
*     int sconf_get_flush_finish_sec(void) 
*
*  FUNCTION
*     ??? 
*
*  INPUTS
*     void - ??? 
*
*  RESULT
*     int - 
*
*  MT-NOTE: is thread save, uses LOCK_SCHED_CONF(read)
*
*******************************************************************************/
u_long32 sconf_get_flush_finish_sec(void)
{
   const lListElem *sc_ep = NULL;
   u_long32 flush_sec = 0;
  
   sge_mutex_lock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);
      
   if (pos.flush_finish_sec!= -1) {
      sc_ep = lFirst(*(object_type_get_master_list(SGE_TYPE_SCHEDD_CONF)));
      if (sc_ep != NULL) {
         flush_sec = lGetPosUlong(sc_ep, pos.flush_finish_sec);
      }
   }

   sge_mutex_unlock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);
   return flush_sec;
}


/****** sge_schedd_conf/sconf_get_max_functional_jobs_to_schedule() ************
*  NAME
*     sconf_get_max_functional_jobs_to_schedule() -- ??? 
*
*  SYNOPSIS
*     u_long32 sconf_get_max_functional_jobs_to_schedule(void) 
*
*  FUNCTION
*     ??? 
*
*  INPUTS
*     void - ??? 
*
*  RESULT
*     u_long32 - 
*
*  MT-NOTE: is thread save, uses LOCK_SCHED_CONF(read)
*
*******************************************************************************/
u_long32 sconf_get_max_functional_jobs_to_schedule(void)
{
   u_long32 amount = 200;

   sge_mutex_lock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);

   if (pos.max_functional_jobs_to_schedule != -1) {
      const lListElem *sc_ep = lFirst(*(object_type_get_master_list(SGE_TYPE_SCHEDD_CONF)));
      amount = lGetPosUlong(sc_ep, pos.max_functional_jobs_to_schedule);
   }   

   sge_mutex_unlock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);
   return amount;
}

/****** sge_schedd_conf/sconf_get_max_pending_tasks_per_job() ******************
*  NAME
*     sconf_get_max_pending_tasks_per_job() -- ??? 
*
*  SYNOPSIS
*     u_long32 sconf_get_max_pending_tasks_per_job(void) 
*
*  FUNCTION
*     ??? 
*
*  INPUTS
*     void - ??? 
*
*  RESULT
*     u_long32 - 
*
*  MT-NOTE:   is MT save, uses LOCK_SCHED_CONF(read)
*
*******************************************************************************/
u_long32 sconf_get_max_pending_tasks_per_job(void)
{
   u_long32 max_pending = 50;
 
   sge_mutex_lock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);
   
   if (pos.max_pending_tasks_per_job != -1) {
      const lListElem *sc_ep = lFirst(*(object_type_get_master_list(SGE_TYPE_SCHEDD_CONF)));
      max_pending = lGetPosUlong(sc_ep, pos.max_pending_tasks_per_job);
   }
      
   sge_mutex_unlock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);
   return max_pending;
}

/****** sge_schedd_conf/get_halflife_decay_list_str() ********************
*  NAME
*     get_halflife_decay_list_str() -- ??? 
*
*  SYNOPSIS
*     const char* get_halflife_decay_list_str(void) 
*
*  FUNCTION
*     ??? 
*
*  INPUTS
*     void - ??? 
*
*  RESULT
*     const char* - 
*
* MT-NOTE: is not MT safe, the calling function needs to lock LOCK_SCHED_CONF(read)
*
*******************************************************************************/
static const char *get_halflife_decay_list_str(void)
{
   const lListElem *sc_ep = lFirst(*(object_type_get_master_list(SGE_TYPE_SCHEDD_CONF)));

   if (pos.halflife_decay_list != -1) {
      return lGetPosString(sc_ep, pos.halflife_decay_list);
   }   
   else {
      return "none";
   }
}

/****** sge_schedd_conf/sconf_get_halflife_decay_list() ************************
*  NAME
*     sconf_get_halflife_decay_list() -- ??? 
*
*  SYNOPSIS
*     const lList* sconf_get_halflife_decay_list(void) 
*
*  FUNCTION
*     ??? 
*
*  INPUTS
*     void - ??? 
*
*  RESULT
*     const lList* - 
*
*  MT-NOTE:   is MT save, uses LOCK_SCHED_CONF(read)
*
*******************************************************************************/
lList* sconf_get_halflife_decay_list(void){
   lList *decay_list = NULL; 

   sge_mutex_lock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);
  
   decay_list = lCopyList("copy_decay_list",pos.c_halflife_decay_list);
      
   sge_mutex_unlock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);    
   return decay_list;      
}

/****** sge_schedd_conf/is_config_set() *********************************************
*  NAME
*     is_config_set() -- checks, if a configuration exists
*
*  SYNOPSIS
*     bool is_config_set(void) 
*
*  RESULT
*     bool - true, if a configuration exists
*
*  MT-NOTE: is not MT safe, the calling function needs to lock LOCK_SCHED_CONF(read)
*
*******************************************************************************/
static bool is_config_set(void) 
{
   const lListElem *sc_ep = NULL;
   
   if (*(object_type_get_master_list(SGE_TYPE_SCHEDD_CONF))) {
      sc_ep = lFirst(*(object_type_get_master_list(SGE_TYPE_SCHEDD_CONF)));
   }   

   return ((sc_ep != NULL) ? true : false);
}

/****** sge_schedd_conf/sconf_is() *********************************************
*  NAME
*     sconf_is() -- checks, if a configuration exists
*
*  SYNOPSIS
*     bool sconf_is(void) 
*
*  RESULT
*     bool - true, if a configuration exists
*
*
*  MT-NOTE:   is MT save, uses LOCK_SCHED_CONF(read)
*
*******************************************************************************/
bool sconf_is(void) 
{
   bool is = false;
  
   sge_mutex_lock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);

   is = is_config_set();

   sge_mutex_unlock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);
   return is;
}


/****** sge_schedd_conf/sconf_get_config() *************************************
*  NAME
*     sconf_get_config() -- returns a config object.  
*
*  SYNOPSIS
*     const lListElem* sconf_get_config(void) 
*
*  RESULT
*     const lListElem* - a copy of the current config object
*
* NOTE
*  DO NOT USE this method. ONLY when there is NO OTHER way. All config
*  settings can be accessed via access function.
*
*  MT-NOTE: is thread save, uses LOCK_SCHED_CONF(read)
*
*******************************************************************************/
lListElem *sconf_get_config(void)
{
   lListElem *config = NULL;
  
   sge_mutex_lock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);
   
   config = lCopyElem(lFirst(*(object_type_get_master_list(SGE_TYPE_SCHEDD_CONF))));

   sge_mutex_unlock("Sched_Conf_Lock", "", __LINE__, &pos.mutex); 
   return config;
}

/****** sge_schedd_conf/sconf_get_config_list() ********************************
*  NAME
*     sconf_get_config_list() -- returns a pointer to the list, which contains
*                                the configuration
*
*  SYNOPSIS
*     lList* sconf_get_config_list(void) 
*
*  RESULT
*     lList* - a copy of the config list
*
*  MT-NOTE: is thread save, uses LOCK_SCHED_CONF(read)
*
* NOTE
*  DO NOT USE this method. ONLY when there is NO OTHER way. All config
*  settings can be accessed via access function. The config can be set
*  via sconf_set_config(...)
*
* IMPORTANT
*
*  If you modify the configuration by directly accessing, you have to call
*  sconf_validate_config_ afterwards to ensure, that the caches reflect
*  your changes.
*
*******************************************************************************/
lList *sconf_get_config_list(void)
{
   lList *copy_list = NULL;

   DENTER(TOP_LAYER, "sconf_get_config_list");
   sge_mutex_lock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);
 
   copy_list = lCopyList("sched_conf_copy", *(object_type_get_master_list(SGE_TYPE_SCHEDD_CONF)));

   sge_mutex_unlock("Sched_Conf_Lock", "", __LINE__, &pos.mutex); 
   DRETURN(copy_list);
}

/****** sge_schedd_conf/sconf_print_config() ***********************************
*  NAME
*     sconf_print_config() -- prints the current configuration to the INFO stream 
*
*  SYNOPSIS
*     void sconf_print_config() 
*
*  MT-NOTE:  is MT safe, uses LOCK_SCHED_CONF(read/write) 
*
*******************************************************************************/
void sconf_print_config(void){

   char tmp_buffer[1024];
   u_long32 uval;
   const char *s;
   const lList *lval= NULL;
   double dval;

   DENTER(TOP_LAYER, "sconf_print_config");

   if (!sconf_is()){
      ERROR((SGE_EVENT, SFNMAX, MSG_SCONF_NO_CONFIG));
      DRETURN_VOID;
   }

   sconf_validate_config_(NULL);

   sge_mutex_lock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);

   /* --- SC_algorithm */
   s = get_algorithm();
   INFO((SGE_EVENT, MSG_ATTRIB_USINGXASY_SS , s, "algorithm"));
     
   /* --- SC_schedule_interval */
   s = get_schedule_interval_str();
   INFO((SGE_EVENT, MSG_ATTRIB_USINGXFORY_SS , s, "schedule_interval"));

   /* --- SC_load_adjustment_decay_time */
   s = get_load_adjustment_decay_time_str();
   INFO((SGE_EVENT, MSG_ATTRIB_USINGXFORY_SS, s, "load_adjustment_decay_time"));

   /* --- SC_load_formula */
   INFO((SGE_EVENT, MSG_ATTRIB_USINGXFORY_SS, get_load_formula(), "load_formula"));

   /* --- SC_schedd_job_info */
   INFO((SGE_EVENT, MSG_ATTRIB_USINGXFORY_SS, lGetString(lFirst(*(object_type_get_master_list(SGE_TYPE_SCHEDD_CONF))), SC_schedd_job_info), "schedd_job_info"));
   
   /* --- SC_params */
   s=lGetString(lFirst(*(object_type_get_master_list(SGE_TYPE_SCHEDD_CONF))), SC_params);
   INFO((SGE_EVENT, MSG_READ_PARAM_S, s)); 

   /* --- SC_reprioritize_interval */
   s = reprioritize_interval_str();
   INFO((SGE_EVENT, MSG_ATTRIB_USINGXFORY_SS, s, "reprioritize_interval"));

   /* --- SC_usage_weight_list */
   uni_print_list(NULL, tmp_buffer, sizeof(tmp_buffer), get_usage_weight_list(), usage_fields, delis, 0);
   INFO((SGE_EVENT, MSG_ATTRIB_USINGXFORY_SS, tmp_buffer, "usage_weight_list"));

   /* --- SC_halflife_decay_list_str */
   s = get_halflife_decay_list_str();
   INFO((SGE_EVENT, MSG_ATTRIB_USINGXFORY_SS, s, "halflife_decay_list"));
  
   /* --- SC_policy_hierarchy */
   s = lGetString(lFirst(*(object_type_get_master_list(SGE_TYPE_SCHEDD_CONF))), SC_policy_hierarchy);
   INFO((SGE_EVENT, MSG_ATTRIB_USINGXFORY_SS, s, "policy_hierarchy"));

   /* --- SC_job_load_adjustments */
   lval = get_job_load_adjustments();
   uni_print_list(NULL, tmp_buffer, sizeof(tmp_buffer), lval, load_adjustment_fields, delis, 0);
   INFO((SGE_EVENT, MSG_ATTRIB_USINGXFORY_SS, tmp_buffer, "job_load_adjustments"));
   
   sge_mutex_unlock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);

   /* --- SC_maxujobs */
   uval = sconf_get_maxujobs();
   INFO((SGE_EVENT, MSG_ATTRIB_USINGXFORY_US, sge_u32c( uval), "maxujobs"));

   /* --- SC_queue_sort_method (was: SC_sort_seq_no) */
   uval = sconf_get_queue_sort_method();
   INFO((SGE_EVENT, MSG_ATTRIB_USINGXFORY_US,  sge_u32c (uval), "queue_sort_method"));

   /* --- SC_flush_submit_sec */
   uval = sconf_get_flush_submit_sec();
   INFO((SGE_EVENT,MSG_ATTRIB_USINGXFORY_US,  sge_u32c (uval) , "flush_submit_sec"));

   /* --- SC_flush_finish_sec */
   uval = sconf_get_flush_finish_sec();
   INFO((SGE_EVENT,MSG_ATTRIB_USINGXFORY_US,  sge_u32c (uval) , "flush_finish_sec"));
   
   /* --- SC_halftime */
   /* fixme:  should allow time value, as man page originally said */
   uval = sconf_get_halftime();
   INFO((SGE_EVENT, MSG_ATTRIB_USINGXFORY_US ,  sge_u32c (uval), "halftime"));

   /* --- SC_compensation_factor */
   dval = sconf_get_compensation_factor();
   INFO((SGE_EVENT, MSG_ATTRIB_USINGXFORY_6FS, dval, "compensation_factor"));

   /* --- SC_weight_user */
   dval = sconf_get_weight_user();
   INFO((SGE_EVENT, MSG_ATTRIB_USINGXFORY_6FS, dval, "weight_user"));

   /* --- SC_weight_project */
   dval = sconf_get_weight_project();
   INFO((SGE_EVENT, MSG_ATTRIB_USINGXFORY_6FS, dval, "weight_project"));

   /* --- SC_weight_department */
   dval = sconf_get_weight_department();
   INFO((SGE_EVENT, MSG_ATTRIB_USINGXFORY_6FS, dval, "weight_department"));

   /* --- SC_weight_job */
   dval = sconf_get_weight_job();
   INFO((SGE_EVENT, MSG_ATTRIB_USINGXFORY_6FS, dval, "weight_job"));

   /* --- SC_weight_tickets_functional */
   uval = sconf_get_weight_tickets_functional();
   INFO((SGE_EVENT, MSG_ATTRIB_USINGXFORY_US,  sge_u32c (uval), "weight_tickets_functional"));

   /* --- SC_weight_tickets_share */
   uval = sconf_get_weight_tickets_share();
   INFO((SGE_EVENT, MSG_ATTRIB_USINGXFORY_US,  sge_u32c (uval), "weight_tickets_share"));

   /* --- SC_share_override_tickets */
   uval = sconf_get_share_override_tickets();
   INFO((SGE_EVENT, MSG_ATTRIB_USINGXFORY_US,  sge_u32c (uval), "share_override_tickets"));

   /* --- SC_share_functional_shares */
   uval = sconf_get_share_functional_shares();
   INFO((SGE_EVENT, MSG_ATTRIB_USINGXFORY_US,  sge_u32c (uval), "share_functional_shares"));

   /* --- SC_max_functional_jobs_to_schedule */
   uval = sconf_get_max_functional_jobs_to_schedule();
   INFO((SGE_EVENT, MSG_ATTRIB_USINGXFORY_US,  sge_u32c (uval), "max_functional_jobs_to_schedule"));
   
   /* --- SC_report_job_tickets */
   uval = sconf_get_report_pjob_tickets();
   INFO((SGE_EVENT, MSG_ATTRIB_USINGXFORY_US,  sge_u32c (uval), "report_pjob_tickets"));
   
   /* --- SC_max_pending_tasks_per_job */
   uval = sconf_get_max_pending_tasks_per_job();
   INFO((SGE_EVENT, MSG_ATTRIB_USINGXFORY_US,  sge_u32c (uval), "max_pending_tasks_per_job"));

   /* --- SC_weight_ticket */
   dval = sconf_get_weight_ticket();
   INFO((SGE_EVENT, MSG_ATTRIB_USINGXFORY_6FS,  dval, "weight_ticket"));

   /* --- SC_weight_waiting_time */
   dval = sconf_get_weight_waiting_time();
   INFO((SGE_EVENT, MSG_ATTRIB_USINGXFORY_6FS,  dval, "weight_waiting_time"));

   /* --- SC_weight_deadline */
   dval = sconf_get_weight_deadline();
   INFO((SGE_EVENT, MSG_ATTRIB_USINGXFORY_6FS,  dval, "weight_deadline"));

   /* --- SC_weight_urgency */
   dval = sconf_get_weight_urgency();
   INFO((SGE_EVENT, MSG_ATTRIB_USINGXFORY_6FS,  dval, "weight_urgency"));

   /* --- SC_weight_priority */
   dval = sconf_get_weight_priority();
   INFO((SGE_EVENT, MSG_ATTRIB_USINGXFORY_6FS,  dval, "weight_priority"));

   /* --- SC_max_reservation */
   dval = sconf_get_max_reservations();
   INFO((SGE_EVENT, MSG_ATTRIB_USINGXFORY_6FS,  dval, "max_reservation"));

   /* --- SC_default_duration */
   s = get_default_duration_str();
   INFO((SGE_EVENT, MSG_ATTRIB_USINGXFORY_SS, s, "default_duration"));

   DRETURN_VOID;
}

/****** sge_schedd_conf/sconf_is_new_config() *******************************
*  NAME
*     sconf_is_new_config() -- 
*
*  SYNOPSIS
*     bool sconf_is_new_config() 
*
*  FUNCTION
*
*  RESULT
*     bool - 
*
*  MT-NOTE:  is MT safe, uses LOCK_SCHED_CONF(read) 
*
*******************************************************************************/
bool sconf_is_new_config() {
   bool is_new_config = false;
   
   sge_mutex_lock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);
   
   is_new_config = pos.new_config;
   
   sge_mutex_unlock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);
   return is_new_config;
}

/****** sge_schedd_conf/sconf_reset_new_config() *******************************
*  NAME
*     sconf_reset_new_config() -- 
*
*  SYNOPSIS
*     bool sconf_reset_new_config() 
*
*  FUNCTION
*
*  MT-NOTE:  is MT safe, uses LOCK_SCHED_CONF(write) 
*
*******************************************************************************/
void sconf_reset_new_config() 
{
   sge_mutex_lock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);  
   
   pos.new_config = false;
   
   sge_mutex_unlock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);
}

/****** sge_schedd_conf/sconf_validate_config_() *******************************
*  NAME
*     sconf_validate_config_() -- validates the current config 
*
*  SYNOPSIS
*     bool sconf_validate_config_(lList **answer_list) 
*
*  FUNCTION
*     validates the current config and updates the caches. 
*
*  INPUTS
*     lList **answer_list - error messages 
*
*  RESULT
*     bool - false for invalid scheduler configuration
*
*  MT-NOTE:  is MT safe, uses LOCK_SCHED_CONF(read/write) 
*
*******************************************************************************/
bool sconf_validate_config_(lList **answer_list)
{
   char tmp_buffer[1024], tmp_error[1024];
   u_long32 uval;
   const char *s;
   const lList *lval= NULL;
   bool ret = true;
   u_long32 max_reservation = 0;

   DENTER(TOP_LAYER, "sconf_validate_config_");

   if (!sconf_is()){
      DPRINTF(("sconf_validate: no config to validate\n"));
      DRETURN(true);
   }
   
   sge_mutex_lock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);
   sconf_clear_pos();

   pos.new_config = true; 
   
   if (!calc_pos()){
      SGE_ADD_MSG_ID(sprintf(SGE_EVENT, SFNMAX, MSG_INCOMPLETE_SCHEDD_CONFIG)); 
      answer_list_add(answer_list, SGE_EVENT, STATUS_ESYNTAX, ANSWER_QUALITY_ERROR);
      ret = false; 
   }

 /* --- SC_params */
   {
      const char *sparams = lGetString(lFirst(*(object_type_get_master_list(SGE_TYPE_SCHEDD_CONF))), SC_params); 
      char *s = NULL; 
      
      /* the implementation has a problem. If an entry is removed, its setting is not
         changed, but it should be turned off. This means we have to turn everything off,
         before we work on the params */
      schedd_profiling = false;
      is_category_job_filtering = false;
      current_serf_do_monitoring = false;
      pos.s_duration_offset = DEFAULT_DURATION_OFFSET; 
      pe_algorithm = SCHEDD_PE_AUTO;

      if (sparams) {
         struct saved_vars_s *context = NULL;

         if (pos.c_params == NULL) {
            pos.c_params = lCreateList("params", PARA_Type);
         }
         for (s=sge_strtok_r(sparams, ",; ", &context); s; s=sge_strtok_r(NULL, ",; ", &context)) {
            int i = 0;
            bool added = false;
            for(i=0; params[i].name ;i++ ){
               if (!strncasecmp(s, params[i].name, sizeof(params[i].name)-1)){
                  if (params[i].setParam) {
                     ret &= params[i].setParam(pos.c_params, answer_list, s);
                  }
                  added = true;
               }               
            }
            if (!added){
               SGE_ADD_MSG_ID(sprintf(SGE_EVENT, MSG_UNKNOWN_PARAM_S, s));
               answer_list_add(answer_list, SGE_EVENT, STATUS_ESYNTAX, ANSWER_QUALITY_ERROR);
               ret = false;
            }
         }
         sge_free_saved_vars(context);
      } else {
         lSetString(lFirst(*(object_type_get_master_list(SGE_TYPE_SCHEDD_CONF))), SC_params, "none");
      }
   }
   
   sge_mutex_unlock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);

   max_reservation = sconf_get_max_reservations();
   
   sge_mutex_lock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);
   
   /* --- SC_algorithm */
   s = get_algorithm();
   if ( !s || (strcmp(s, "default") && strcmp(s, "simple_sched") && strncmp(s, "ext_", 4))) {
      if (!s)
         s = "not defined";
      SGE_ADD_MSG_ID(sprintf(SGE_EVENT, MSG_ATTRIB_ALGORITHMNOVALIDNAME_S, s)); 
      answer_list_add(answer_list, SGE_EVENT, STATUS_ESYNTAX, ANSWER_QUALITY_ERROR);
      ret = false; 
   }
     
   /* --- SC_schedule_interval */
   s = get_schedule_interval_str();
   if (!s || !extended_parse_ulong_val(NULL, &uval, TYPE_TIM, s, tmp_error, sizeof(tmp_error), 0, true) ) {
      if (!s)
         SGE_ADD_MSG_ID(sprintf(SGE_EVENT, MSG_ATTRIB_XISNOTAY_SS , "schedule_interval", "not defined"));   
      else
         SGE_ADD_MSG_ID(sprintf(SGE_EVENT, MSG_ATTRIB_XISNOTAY_SS , "schedule_interval", tmp_error));    
      answer_list_add(answer_list, SGE_EVENT, STATUS_ESYNTAX, ANSWER_QUALITY_ERROR);
      ret =  false;
   }

   /* --- SC_load_adjustment_decay_time */
   s = get_load_adjustment_decay_time_str();
   if (!s || !extended_parse_ulong_val(NULL, &uval, TYPE_TIM, s, tmp_error, sizeof(tmp_error), 0, true)) {
      if (!s) {
         SGE_ADD_MSG_ID(sprintf(SGE_EVENT, MSG_ATTRIB_XISNOTAY_SS , "schedule_interval", "not defined"));
      }   
      else {
         SGE_ADD_MSG_ID(sprintf(SGE_EVENT, MSG_ATTRIB_XISNOTAY_SS, "load_adjustment_decay_time", tmp_error));    
      }   
      answer_list_add(answer_list, SGE_EVENT, STATUS_ESYNTAX, ANSWER_QUALITY_ERROR);
      ret = false; 
   }
  
  /* --- SC_schedd_job_info */
   {
      char buf[4096];
      char* key = NULL;
      int ikey = 0;
      lList *rlp=NULL, *alp=NULL;
      const char *schedd_info = lGetString(lFirst(*(object_type_get_master_list(SGE_TYPE_SCHEDD_CONF))), SC_schedd_job_info);

      if (schedd_info == NULL){
         SGE_ADD_MSG_ID(sprintf(SGE_EVENT, SFNMAX, MSG_ATTRIB_SCHEDDJOBINFONOVALIDPARAM ));
         answer_list_add(answer_list, SGE_EVENT, STATUS_ESYNTAX, ANSWER_QUALITY_ERROR);  
         ret = false;
      }
      else {
         struct saved_vars_s *context = NULL;
         sge_strlcpy(buf, schedd_info, sizeof(buf));
         /* on/off or watch a set of jobs */
         key = sge_strtok_r(buf, " \t", &context);
         if (!strcmp("true", key)) 
            ikey = SCHEDD_JOB_INFO_TRUE;
         else if (!strcmp("false", key)) 
            ikey = SCHEDD_JOB_INFO_FALSE;
         else if (!strcmp("job_list", key)) 
            ikey = SCHEDD_JOB_INFO_JOB_LIST;
         else {
            SGE_ADD_MSG_ID(sprintf(SGE_EVENT, SFNMAX, MSG_ATTRIB_SCHEDDJOBINFONOVALIDPARAM ));
            answer_list_add(answer_list, SGE_EVENT, STATUS_ESYNTAX, ANSWER_QUALITY_ERROR);
            ret = false; 
         }
         /* check list of groups */
         if (ikey == SCHEDD_JOB_INFO_JOB_LIST) {
            key = sge_strtok_r(NULL, "\n", &context);
            range_list_parse_from_string(&rlp, &alp, key, false, false, 
                                         INF_NOT_ALLOWED);
            if (rlp == NULL) {
               lFreeList(&alp);
               SGE_ADD_MSG_ID(sprintf(SGE_EVENT, SFNMAX, MSG_ATTRIB_SCHEDDJOBINFONOVALIDJOBLIST));
               answer_list_add(answer_list, SGE_EVENT, STATUS_ESYNTAX, ANSWER_QUALITY_ERROR);
               ret = false; 
            }   
            else{
               pos.c_is_schedd_job_info = ikey;
               pos.c_schedd_job_info_range = rlp;
            }
         }
         else{
            pos.c_is_schedd_job_info = ikey;
         }
         sge_free_saved_vars(context);
      }
   }

   /* --- SC_reprioritize_interval */
   s = reprioritize_interval_str();
   if (s == NULL || !extended_parse_ulong_val(NULL, &uval, TYPE_TIM, s, tmp_error, 
                                              sizeof(tmp_error), 0, true)) {
      if (s == NULL) {
         SGE_ADD_MSG_ID(sprintf(SGE_EVENT, MSG_ATTRIB_XISNOTAY_SS , "schedule_interval", 
                        "not defined"));
      }   
      else {   
         SGE_ADD_MSG_ID(sprintf(SGE_EVENT, MSG_ATTRIB_XISNOTAY_SS , "reprioritize_interval", 
                        tmp_error));    
      }   
      answer_list_add(answer_list, SGE_EVENT, STATUS_ESYNTAX, ANSWER_QUALITY_ERROR);
      ret = false; 
   }
  
   /* --- SC_halflife_decay_list_str */
   {
      s = get_halflife_decay_list_str();
      if (s && (strcasecmp(s, "none") != 0)) {
         lList *halflife_decay_list = NULL;
         lListElem *ep = NULL;
         const char *s0 = NULL;
         const char *s1 = NULL;
         const char *s2 = NULL; 
         const char *s3 = NULL;
         double value;
         struct saved_vars_s *sv1=NULL; 
         struct saved_vars_s *sv2=NULL;
         s0 = s; 
         for(s1=sge_strtok_r(s0, ":", &sv1); s1 != NULL;
             s1=sge_strtok_r(NULL, ":", &sv1)) {
            if (((s2=sge_strtok_r(s1, "=", &sv2)) != NULL) &&
                ((s3=sge_strtok_r(NULL, "=", &sv2)) != NULL) &&
                (sscanf(s3, "%lf", &value) == 1)) {
               ep = lAddElemStr(&halflife_decay_list, UA_name, s2, UA_Type);
               lSetDouble(ep, UA_value, value);
            }
            sge_free(&sv2);
         }
         sge_free(&sv1);
        
         if (lGetNumberOfElem(halflife_decay_list) == 0) {
            answer_list_add(answer_list, MSG_GDI_INVALIDHALFLIFE_DECAY, STATUS_ESYNTAX, 
                            ANSWER_QUALITY_ERROR); 
            ret = false;
         }

         pos.c_halflife_decay_list = halflife_decay_list;   
      } 
   }
  
   /* --- SC_policy_hierarchy */
   {
      const char *value_string = lGetString(lFirst(*(object_type_get_master_list(SGE_TYPE_SCHEDD_CONF))), 
                                            SC_policy_hierarchy);
      if (value_string) {
         if (policy_hierarchy_verify_value(value_string) != 0) {
            answer_list_add(answer_list, MSG_GDI_INVALIDPOLICYSTRING, STATUS_ESYNTAX, 
                            ANSWER_QUALITY_ERROR);  
            ret = false;
            lSetString(lFirst(*(object_type_get_master_list(SGE_TYPE_SCHEDD_CONF))), SC_policy_hierarchy, 
                       policy_hierarchy_chars);
         }
      } 
      else {
         if (!s)
         value_string = "not defined";
         SGE_ADD_MSG_ID(sprintf(SGE_EVENT, MSG_ATTRIB_XISNOTAY_SS , "policy hierarchy", 
                                value_string));    
         answer_list_add(answer_list, SGE_EVENT, STATUS_ESYNTAX, ANSWER_QUALITY_ERROR);
         ret = false;          
      }
   }
  
   /* --- SC_max_reservation and SC_default_duration */
   {
      const char *s = get_default_duration_str();

      if (s == NULL || !extended_parse_ulong_val(NULL, &uval, TYPE_TIM, s, tmp_error, 
                                                 sizeof(tmp_error), 1, true) ) {
         if (s == NULL) {
            SGE_ADD_MSG_ID(sprintf(SGE_EVENT, MSG_ATTRIB_XISNOTAY_SS , "default_duration", 
                                   "not defined"));   
         }   
         else {
            SGE_ADD_MSG_ID(sprintf(SGE_EVENT, MSG_ATTRIB_XISNOTAY_SS , "default_duration", 
                                   tmp_error));    
         }   
         answer_list_add(answer_list, SGE_EVENT, STATUS_ESYNTAX, ANSWER_QUALITY_ERROR);
         ret =  false;
      } 
      else {
         /* ensure we get a non-zero/non-infinity duration default in reservation scheduling mode */
         if (max_reservation != 0 && uval == 0) {
            SGE_ADD_MSG_ID(sprintf(SGE_EVENT, SFNMAX, MSG_RR_REQUIRES_DEFAULT_DURATION));    
            answer_list_add(answer_list, SGE_EVENT, STATUS_ESYNTAX, ANSWER_QUALITY_ERROR);      
            ret = false; 
         }
         else {
            pos.c_default_duration = uval;
         }
      }
   }
  
   /* --- SC_usage_weight_list */
   if (uni_print_list(NULL, tmp_buffer, sizeof(tmp_buffer), 
       get_usage_weight_list(), usage_fields, delis, 0) < 0) {
      SGE_ADD_MSG_ID(sprintf(SGE_EVENT, MSG_SCHEDD_USAGE_WEIGHT_LIST_S, tmp_error));    
      answer_list_add(answer_list, SGE_EVENT, STATUS_ESYNTAX, ANSWER_QUALITY_ERROR);      
      ret = false; 
   }

   /* --- SC_job_load_adjustments */
   lval = get_job_load_adjustments();
   if (uni_print_list(NULL, tmp_buffer, sizeof(tmp_buffer), lval, load_adjustment_fields, delis, 0) < 0) {
      SGE_ADD_MSG_ID(sprintf(SGE_EVENT, MSG_SCHEDD_JOB_LOAD_ADJUSTMENTS_S, s)); 
      answer_list_add(answer_list, SGE_EVENT, STATUS_ESYNTAX, ANSWER_QUALITY_ERROR);
      ret = false;
   }

   sge_mutex_unlock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);
   
   /* --- SC_load_formula */
   {
      lList *master_centry_list = *object_type_get_master_list(SGE_TYPE_CENTRY);
      if (master_centry_list != NULL && !sconf_is_valid_load_formula(answer_list, master_centry_list)) {
         ret = false; 
      }
   }

   /* --- SC_max_pending_tasks_per_job */
   if (sconf_get_max_pending_tasks_per_job() == 0) {
      SGE_ADD_MSG_ID(sprintf(SGE_EVENT, MSG_ATTRIB_WRONG_SETTING_SS, "max_pending_tasks_per_job", ">0"));    
      answer_list_add(answer_list, SGE_EVENT, STATUS_ESYNTAX, ANSWER_QUALITY_ERROR);
      ret = false;
   }
   
   DRETURN(ret);
}


/****** sge_schedd_conf/sconf_validate_config() ********************************
*  NAME
*     sconf_validate_config() -- validate a given configuration 
*
*  SYNOPSIS
*     bool sconf_validate_config(lList **answer_list, lList *config) 
*
*  INPUTS
*     lList **answer_list - error messages 
*     lList *config       - config to validate 
*
*  RESULT
*     bool - true, if the config is valid
*
*  MT-NOTE:  is MT safe, uses LOCK_SCHED_CONF(write)
*
* SG TODO: needs cleanup!!
*
*******************************************************************************/
bool sconf_validate_config(lList **answer_list, lList *config){
   lList *store = NULL;
   bool ret = true;

   DENTER(TOP_LAYER, "sconf_validate_config");

   if (config){
      sge_mutex_lock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);
      store = *(object_type_get_master_list(SGE_TYPE_SCHEDD_CONF));
      *(object_type_get_master_list(SGE_TYPE_SCHEDD_CONF)) = config;
      sge_mutex_unlock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);
      
      ret = sconf_validate_config_(answer_list);
      
      sge_mutex_lock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);
      *(object_type_get_master_list(SGE_TYPE_SCHEDD_CONF)) = store;
      sge_mutex_unlock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);

      sconf_validate_config_(NULL);
   }
   
   DRETURN(ret);
}

/****** sgeobj/conf/policy_hierarchy_verify_value() ***************************
*  NAME
*     policy_hierarchy_verify_value() -- verify a policy string 
*
*  SYNOPSIS
*     int policy_hierarchy_verify_value(const char* value) 
*
*  FUNCTION
*     The function tests whether the given policy string (value) is i
*     valid. 
*
*  INPUTS
*     const char* value - policy string 
*
*  RESULT
*     int - 0 -> OK
*           1 -> ERROR: one char is at least twice in "value"
*           2 -> ERROR: invalid char in "value"
*           3 -> ERROR: value == NULL
*
*  MT-NOTE:  is MT safe, uses only the given data.
*
******************************************************************************/
static int policy_hierarchy_verify_value(const char* value) 
{
   int ret = 0;

   DENTER(TOP_LAYER, "policy_hierarchy_verify_value");

   if (value != NULL) {
      if (strcmp(value, "") && strcasecmp(value, "NONE")) {
         int is_contained[POLICY_VALUES]; 
         int i;

         for (i = 0; i < POLICY_VALUES; i++) {
            is_contained[i] = 0;
         }

         for (i = 0; i < strlen(value); i++) {
            char c = value[i];
            int index = policy_hierarchy_char2enum(c);

            if (is_contained[index]) {
               DPRINTF(("character \'%c\' is contained at least twice\n", c));
               ret = 1;
               break;
            } 

            is_contained[index] = 1;

            if (is_contained[INVALID_POLICY]) {
               DPRINTF(("Invalid character \'%c\'\n", c));
               ret = 2;
               break;
            }
         }
      }
   } 
   else {
      ret = 3;
   }

   DRETURN(ret);
}

/****** sgeobj/conf/sconf_ph_fill_array() *****************************
*  NAME
*     sconf_ph_fill_array() -- fill the policy array 
*
*  SYNOPSIS
*     void sconf_ph_fill_array(policy_hierarchy_t array[], 
*                                      const char *value) 
*
*  FUNCTION
*     Fill the policy "array" according to the characters given by 
*     "value".
*
*     value == "FODS":
*        policy_hierarchy_t array[4] = {
*            {FUNCTIONAL_POLICY, 1},
*            {OVERRIDE_POLICY, 1},
*            {DEADLINE_POLICY, 1},
*            {SHARE_TREE_POLICY, 1}
*        };
*
*     value == "FS":
*        policy_hierarchy_t array[4] = {
*            {FUNCTIONAL_POLICY, 1},
*            {SHARE_TREE_POLICY, 1},
*            {OVERRIDE_POLICY, 0},
*            {DEADLINE_POLICY, 0}
*        };
*
*     value == "OFS":
*        policy_hierarchy_t hierarchy[4] = {
*            {OVERRIDE_POLICY, 1},
*            {FUNCTIONAL_POLICY, 1},
*            {SHARE_TREE_POLICY, 1},
*            {DEADLINE_POLICY, 0}
*        }; 
*
*     value == "NONE":
*        policy_hierarchy_t hierarchy[4] = {
*            {OVERRIDE_POLICY, 0},
*            {FUNCTIONAL_POLICY, 0},
*            {SHARE_TREE_POLICY, 0},
*            {DEADLINE_POLICY, 0}
*        }; 
*
*  INPUTS
*     policy_hierarchy_t array[] - array with at least POLICY_VALUES 
*                                  values 
*     const char* value          - "NONE" or any combination
*                                  of the first letters of the policy 
*                                  names (e.g. "OFSD")
*
*  RESULT
*     "array" will be modified 
*
*  MT-NOTE:  is MT safe, uses LOCK_SCHED_CONF(read)
*
******************************************************************************/
void sconf_ph_fill_array(policy_hierarchy_t array[])
{
   int is_contained[POLICY_VALUES];
   int index = 0;
   int i;
   const char *policy_hierarchy_string = NULL;
   
   DENTER(TOP_LAYER, "sconf_ph_fill_array");

   sge_mutex_lock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);
   
   policy_hierarchy_string = lGetPosString(lFirst(*(object_type_get_master_list(SGE_TYPE_SCHEDD_CONF))), 
                                           pos.policy_hierarchy);
   
   for (i = 0; i < POLICY_VALUES; i++) {
      is_contained[i] = 0;
      array[i].policy = INVALID_POLICY;
   }     
   if (policy_hierarchy_string != NULL && strcmp(policy_hierarchy_string, "") && 
       strcasecmp(policy_hierarchy_string, "NONE")) {
      
      for (i = 0; i < strlen(policy_hierarchy_string); i++) {
         char c = policy_hierarchy_string[i];
         policy_type_t enum_value = policy_hierarchy_char2enum(c); 

         is_contained[enum_value] = 1;
         array[index].policy = enum_value;
         array[index].dependent = 1;
         index++;
      }
   }
   
   for (i = INVALID_POLICY + 1; i < LAST_POLICY_VALUE; i++) {
      if (!is_contained[i])  {
         array[index].policy = (policy_type_t)i;
         array[index].dependent = 0;
         index++;
      }
   }

   sge_mutex_unlock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);
   DRETURN_VOID;
}

/****** sgeobj/conf/policy_hierarchy_char2enum() ******************************
*  NAME
*     policy_hierarchy_char2enum() -- Return value for a policy char
*
*  SYNOPSIS
*     policy_type_t policy_hierarchy_char2enum(char character) 
*
*  FUNCTION
*     This function returns a enum value for the first letter of a 
*     policy name. 
*
*  INPUTS
*     char character - "O", "F" or "S"
*
*  RESULT
*     policy_type_t - enum value 
*
*  MT-NOTE:
*     not thread safe, needs LOCK_SCHED_CONF(read)
*
******************************************************************************/
static policy_type_t policy_hierarchy_char2enum(char character)
{
   const char *pointer;
   policy_type_t ret;
   
   pointer = strchr(policy_hierarchy_chars, character);
   if (pointer != NULL) {
      ret = (policy_type_t)((pointer - policy_hierarchy_chars) + 1);
   } else {
      ret = INVALID_POLICY;
   }
   return ret;
}


/****** sgeobj/conf/sconf_ph_print_array() ****************************
*  NAME
*     sconf_ph_print_array() -- print hierarchy array 
*
*  SYNOPSIS
*     void sconf_ph_print_array(policy_hierarchy_t array[]) 
*
*  FUNCTION
*     Print hierarchy array in the debug output 
*
*  INPUTS
*     policy_hierarchy_t array[] - array with at least 
*                                  POLICY_VALUES values 
*
*  MT-NOTE: is MT save, no lock needed, works on the passed in data
*
******************************************************************************/
void sconf_ph_print_array(policy_hierarchy_t array[])
{
   int i;

   DENTER(TOP_LAYER, "sconf_ph_print_array");
   
   for (i = INVALID_POLICY + 1; i < LAST_POLICY_VALUE; i++) {
      char character = policy_hierarchy_enum2char(array[i-1].policy);
      
      DPRINTF(("policy: %c; dependent: %d\n", character, array[i-1].dependent));
   }   

   DRETURN_VOID;
}

/****** sgeobj/conf/policy_hierarchy_enum2char() ******************************
*  NAME
*     policy_hierarchy_enum2char() -- Return policy char for a value 
*
*  SYNOPSIS
*     char policy_hierarchy_enum2char(policy_type_t value) 
*
*  FUNCTION
*     Returns the first letter of a policy name corresponding to the 
*     enum "value".
*
*  INPUTS
*     policy_type_t value - enum value 
*
*  RESULT
*     char - "O", "F", "S", "D"
*
*  MT-NOTE:
*     not thread safe, needs LOCK_SCHED_CONF(read)
*
******************************************************************************/
static char policy_hierarchy_enum2char(policy_type_t value) 
{
   return policy_hierarchy_chars[value - 1];
}

/****** sge_schedd_conf/sconf_eval_set_profiling() *****************************
*  NAME
*     sconf_eval_set_profiling() -- ??? 
*
*  SYNOPSIS
*     static bool sconf_eval_set_profiling(lList *param_list, lList 
*     **answer_list, const char* param) 
*
*  FUNCTION
*     ??? 
*
*  INPUTS
*     lList *param_list   - ??? 
*     lList **answer_list - ??? 
*     const char* param   - ??? 
*
*  RESULT
*     static bool - 
*
*  MT-NOTE:
*     not thread safe, needs LOCK_SCHED_CONF(write)
*
*******************************************************************************/
static bool sconf_eval_set_profiling(lList *param_list, lList **answer_list, const char* param){
   bool ret = true;
   lListElem *elem = NULL;
   DENTER(TOP_LAYER, "sconf_eval_set_profiling");

   schedd_profiling = false;

   if (!strncasecmp(param, "PROFILE=1", sizeof("PROFILE=1")-1) || 
       !strncasecmp(param, "PROFILE=TRUE", sizeof("PROFILE=TRUE")-1) ) {
      schedd_profiling = true;
      elem = lCreateElem(PARA_Type);
      lSetString(elem, PARA_name, "profile");
      lSetString(elem, PARA_value, "true");
   }      
   else if (!strncasecmp(param, "PROFILE=0", sizeof("PROFILE=0")-1) ||
            !strncasecmp(param, "PROFILE=FALSE", sizeof("PROFILE=FALSE")-1) ) {
      elem = lCreateElem(PARA_Type);
      lSetString(elem, PARA_name, "profile");
      lSetString(elem, PARA_value, "false");
   }
   else {
      SGE_ADD_MSG_ID(sprintf(SGE_EVENT, MSG_INVALID_PARAM_SETTING_S, param)); 
      answer_list_add(answer_list, SGE_EVENT, STATUS_ESYNTAX, ANSWER_QUALITY_ERROR);
      ret = false;
   }
   if (elem){
      lAppendElem(param_list, elem);
   }

   DRETURN(ret);
}

/****** sge_schedd_conf/sconf_eval_set_job_category_filtering() ****************
*  NAME
*     sconf_eval_set_job_category_filtering() -- enable jc filtering or not.
*
*  SYNOPSIS
*     static bool sconf_eval_set_job_category_filtering(lList *param_list, 
*     lList **answer_list, const char* param) 
*
*  FUNCTION
*     A parsing function for the prama settings in the scheduler configuration.
*     It is looking for JC_FILTER to be set to true, or false and updates the
*     settings accordingly.
*
*  INPUTS
*     lList *param_list   - the param list
*     lList **answer_list - the answer list, in case of an error
*     const char* param   - the param string
*
*  RESULT
*     static bool - true, if everything went fine
*
*     MT-NOTE: is not MT safe, the calling function needs to lock LOCK_SCHED_CONF(write)
*
*******************************************************************************/
static bool sconf_eval_set_job_category_filtering(lList *param_list, lList **answer_list, const char* param){
   bool ret = true;
   lListElem *elem = NULL;
   
   DENTER(TOP_LAYER, "sconf_eval_set_job_category_filtering");

   is_category_job_filtering= false;

   if (!strncasecmp(param, "JC_FILTER=1", sizeof("JC_FILTER=1")-1) || 
       !strncasecmp(param, "JC_FILTER=TRUE", sizeof("JC_FILTER=TRUE")-1) ) {
      is_category_job_filtering= true;
      elem = lCreateElem(PARA_Type);
      lSetString(elem, PARA_name, "jc_filter");
      lSetString(elem, PARA_value, "true");
   }      
   else if (!strncasecmp(param, "JC_FILTER=0", sizeof("JC_FILTER=1")-1) ||
            !strncasecmp(param, "JC_FILTER=FALSE", sizeof("JC_FILTER=FALSE")-1) ) {
      elem = lCreateElem(PARA_Type);
      lSetString(elem, PARA_name, "jc_filter");
      lSetString(elem, PARA_value, "false");
   }
   else {
      SGE_ADD_MSG_ID(sprintf(SGE_EVENT, MSG_INVALID_PARAM_SETTING_S, param)); 
      answer_list_add(answer_list, SGE_EVENT, STATUS_ESYNTAX, ANSWER_QUALITY_ERROR);
      ret = false;
   }
   if (elem){
      lAppendElem(param_list, elem);
   }

   DRETURN(ret);
}


/****** sge_schedd_conf/sconf_eval_set_monitoring() ****************************
*  NAME
*     sconf_eval_set_monitoring() -- Control SERF on/off via MONITOR param 
*
*  SYNOPSIS
*     static bool sconf_eval_set_monitoring(lList *param_list, lList 
*     **answer_list, const char* param) 
*
*  FUNCTION
*     The MONITOR param allows schedule entry recording facility module 
*     be switched on/off. 
*
*  INPUTS
*     lList *param_list   - ??? 
*     lList **answer_list - ??? 
*     const char* param   - ??? 
*
*  RESULT
*     static bool - parsing error
*
*  NOTES
*     MT-NOTE: is not MT safe, the calling function needs to lock LOCK_SCHED_CONF(write)
*
*******************************************************************************/
static bool sconf_eval_set_monitoring(lList *param_list, lList **answer_list, const char* param){
   bool ret = true;
   lListElem *elem = NULL;
   const char mon_true[] = "MONITOR=TRUE", mon_one[] = "MONITOR=1";
   const char mon_false[] = "MONITOR=FALSE", mon_zero[] = "MONITOR=0";
   bool do_monitoring = false;

   DENTER(TOP_LAYER, "sconf_eval_set_monitoring");

   if (!strncasecmp(param, mon_one, sizeof(mon_one)-1) || 
       !strncasecmp(param, mon_true, sizeof(mon_true)-1) ) {
      do_monitoring = true;
      elem = lCreateElem(PARA_Type);
      lSetString(elem, PARA_name, "monitor");
      lSetString(elem, PARA_value, "true");
   }      
   else if (!strncasecmp(param, mon_zero, sizeof(mon_zero)-1) ||
            !strncasecmp(param, mon_false, sizeof(mon_false)-1) ) {
      elem = lCreateElem(PARA_Type);
      lSetString(elem, PARA_name, "monitor");
      lSetString(elem, PARA_value, "false");
   }
   else {
      SGE_ADD_MSG_ID(sprintf(SGE_EVENT, MSG_INVALID_PARAM_SETTING_S, param)); 
      answer_list_add(answer_list, SGE_EVENT, STATUS_ESYNTAX, ANSWER_QUALITY_ERROR);
      ret = false;
   }
   if (elem){
      lAppendElem(param_list, elem);
   }

   current_serf_do_monitoring = do_monitoring;

   DRETURN(ret);
}

static bool sconf_eval_set_duration_offset(lList *param_list, lList **answer_list, const char* param)
{
   u_long32 uval;
   char *s;

   if (!(s=strchr(param, '=')) ||
       !extended_parse_ulong_val(NULL, &uval, TYPE_TIM, ++s, NULL, 0, 0, true)) {
      pos.s_duration_offset = DEFAULT_DURATION_OFFSET; 
      return false;
   }
   pos.s_duration_offset = uval;

   return true;
}

/****** sge_schedd_conf/sconf_eval_set_pe_range_alg() **************************
*  NAME
*     sconf_eval_set_pe_range_alg() -- parses the sched. param
*
*  SYNOPSIS
*     static bool sconf_eval_set_pe_range_alg(lList *param_list, lList 
*     **answer_list, const char* param) 
*
*  RESULT
*     static bool - true, if successful
*
*  NOTES
*     MT-NOTE: sconf_eval_set_pe_range_alg() is not MT safe, caller needs LOCK_SCHED_CONF(write)
*
*******************************************************************************/
static bool sconf_eval_set_pe_range_alg(lList *param_list, lList **answer_list, const char* param)
{
   char *s;

   DENTER(TOP_LAYER, "sconf_eval_set_monitoring");
   
   if ((s=strchr(param, '=')) != NULL) {
      s++;
      if (strncasecmp(s, "auto", sizeof("auto")-1)  == 0) {
          pe_algorithm = SCHEDD_PE_AUTO;
      }
      else if (strncasecmp(s, "least", sizeof("least")-1)  == 0) {
          pe_algorithm = SCHEDD_PE_LOW_FIRST;
      }
      else if (strncasecmp(s, "bin", sizeof("bin")-1)  == 0) {
          pe_algorithm = SCHEDD_PE_BINARY;
      }
      else if (strncasecmp(s, "highest", sizeof("highest")-1)  == 0) {
          pe_algorithm = SCHEDD_PE_HIGH_FIRST;
      }
      else {
            DRETURN(false);
      }
      DRETURN(true);
   }
   
   DRETURN(false);
}

/* 
   QS_STATE_FULL
      All debitations caused by running jobs are in effect.
   QS_STATE_EMPTY
      We ignore all debitations caused by running jobs.
      Ignore all but static load values.
*/
void sconf_set_qs_state(qs_state_t qs_state) 
{
   GET_SPECIFIC(sc_state_t, sc_state, sc_state_init, sc_state_key, "sconf_set_qs_state");
   sc_state->queue_state = qs_state;
}

qs_state_t sconf_get_qs_state(void) 
{
   GET_SPECIFIC(sc_state_t, sc_state, sc_state_init, sc_state_key, "sconf_get_qs_state");
   return sc_state->queue_state;
}
void sconf_set_global_load_correction(bool flag) 
{
   GET_SPECIFIC(sc_state_t, sc_state, sc_state_init, sc_state_key, "sconf_set_global_load_correction");
   sc_state->global_load_correction = flag;
}
bool sconf_get_global_load_correction(void) 
{
   GET_SPECIFIC(sc_state_t, sc_state, sc_state_init, sc_state_key, "sconf_get_global_load_correction");
   return sc_state->global_load_correction;
}

u_long32 sconf_get_default_duration(void) 
{
   return pos.c_default_duration;
}

bool sconf_get_host_order_changed(void)
{
   GET_SPECIFIC(sc_state_t, sc_state, sc_state_init, sc_state_key, "sconf_get_host_order_changed");
   return sc_state->host_order_changed;
}

void sconf_set_host_order_changed(bool changed)
{
   GET_SPECIFIC(sc_state_t, sc_state, sc_state_init, sc_state_key, "sconf_set_host_order_changed");
   sc_state->host_order_changed = changed;
}

int sconf_get_last_dispatch_type(void)
{
   GET_SPECIFIC(sc_state_t, sc_state, sc_state_init, sc_state_key, "sconf_get_last_dispatch_type");
   return sc_state->last_dispatch_type;
}

void sconf_set_last_dispatch_type(int last)
{
   GET_SPECIFIC(sc_state_t, sc_state, sc_state_init, sc_state_key, "sconf_set_last_dispatch_type");
   sc_state->last_dispatch_type = last;
}

void sconf_set_decay_constant(double decay) 
{
   GET_SPECIFIC(sc_state_t, sc_state, sc_state_init, sc_state_key, "sconf_set_decay_constant");
   sc_state->decay_constant = decay;
}
double sconf_get_decay_constant(void) 
{
   GET_SPECIFIC(sc_state_t, sc_state, sc_state_init, sc_state_key, "sconf_get_decay_constant");
   return sc_state->decay_constant;
}

void sconf_set_mes_schedd_info(bool newval)
{
   GET_SPECIFIC(sc_state_t, sc_state, sc_state_init, sc_state_key, "sconf_set_mes_schedd_info");
   if (newval == true) {
      if (sc_state->sme == NULL || sc_state->tmp_sme == NULL) {
         /* if one of the values is NULL the messaging framework is initialized
            in this case just ignore the activate request */
         return;
      }
   }
   sc_state->mes_schedd_info = newval;
}

bool sconf_get_mes_schedd_info()
{
   GET_SPECIFIC(sc_state_t, sc_state, sc_state_init, sc_state_key, "sconf_get_mes_schedd_info");
   return sc_state->mes_schedd_info;
}

void schedd_mes_set_logging(int bval) {
   GET_SPECIFIC(sc_state_t, sc_state, sc_state_init, sc_state_key, "schedd_mes_set_logging");
   sc_state->log_schedd_info = bval;
}

int schedd_mes_get_logging(void) {
   GET_SPECIFIC(sc_state_t, sc_state, sc_state_init, sc_state_key, "schedd_mes_get_logging");
   return sc_state->log_schedd_info;
}

lListElem *sconf_get_sme(void) {
   GET_SPECIFIC(sc_state_t, sc_state, sc_state_init, sc_state_key, "sconf_get_sme");
   return sc_state->sme;
}

void sconf_set_sme(lListElem *sme) {
   GET_SPECIFIC(sc_state_t, sc_state, sc_state_init, sc_state_key, "sconf_get_sme");
   sc_state->sme = sme;
}

lListElem *sconf_get_tmp_sme(void) {
   GET_SPECIFIC(sc_state_t, sc_state, sc_state_init, sc_state_key, "sconf_get_tmp_sme");
   return sc_state->tmp_sme;
}

void sconf_set_tmp_sme(lListElem *sme) {
   GET_SPECIFIC(sc_state_t, sc_state, sc_state_init, sc_state_key, "sconf_get_tmp_sme");
   sc_state->tmp_sme = sme;
}

u_long32 sconf_get_duration_offset(void)
{
   u_long32 offset = 0;

   sge_mutex_lock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);
   
   offset = pos.s_duration_offset;

   sge_mutex_unlock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);
   return offset;
}

/****** sge_resource_utilization/serf_control() ********************************
*  NAME
*     serf_get_active() -- Retrieve whether SERF is active or not
*
*  SYNOPSIS
*     bool serf_get_active(void);
*
*  FUNCTION
*     Returns whether SERF is active or not
*
*  RETURN
*     bool - true = on 
*            false = off
*
*  MT-NOTE: is MT safe, uses LOCK_SCHED_CONF(read)
*
*  NOTES
*     Actually belongs to sge_serf.c but this would cause a link dependency 
*     libsgeobj -> libschedd !! 
*******************************************************************************/
bool serf_get_active(void)
{
   bool is = false;

   sge_mutex_lock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);
   
   is = current_serf_do_monitoring;

   sge_mutex_unlock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);
   return is;
}

bool sconf_get_profiling(void)
{
   bool profiling = false;

   sge_mutex_lock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);
   
   profiling = schedd_profiling;

   sge_mutex_unlock("Sched_Conf_Lock", "", __LINE__, &pos.mutex);
   return profiling;
}