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
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
|
2002-12-02 Egor Duda <deo@logos-m.ru>
* lib/pseudo-reloc.c: New file.
* lib/_cygwin_crt0_common.cc: Perform pseudo-relocs during
initialization of cygwin binary (.exe or .dll).
2002-12-06 Christopher Faylor <cgf@redhat.com>
* cygwin.din: Reflect name change from strtodf to strtof. Export
strtof.
* include/cygwin/version.h: Bump API minor number.
2002-12-04 Steve Osborn <bub@io.com>
* fhandler.h (fhandler_termios::line_edit): Change return from an int
to an enum to allow the function to return an error.
* fhandler_console.cc (fhandler_console::read): Update the line_edit
call to use the new enum.
* fhandler_termios.cc (fhandler_termios::line_edit): Change return from
an int to an enum to allow the function to return an error. Put
put_readahead call before doecho for future patch.
* fhandler_tty.cc (fhandler_pty_master::write): Change to call
line_edit one character at a time, and stop if an error occurs.
2002-12-04 Craig McGeachie <slapdau@yahoo.com.au>
* netdb.cc: New file.
* Makeile.in (DLL_OFILES): Add reference to the new netdb.cc file.
* cygwin.din : Add new aliased exports for service and protocol
enumerations in netdb.cc.
2002-12-04 Thomas Pfaff <tpfaff@gmx.net>
* cxx.cc: New file. Implement new, new[], delete and delete[]
operators and __cxa_pure_virtual if compiled by gcc >=3.
* Makefile.in (DLL_OFILES): Add cxx.o.
Remove libstdc++.a from cygwin1.dll link step.
2002-11-29 Steve Osborn <bub@io.com>
* fhandler_tty.cc (fhandler_pty_master::accept_input): Move
read_retval assignment to prevent race condition. Remove read_retval
from return statement.
2002-11-29 Christopher Faylor <cgf@redhat.com>
* pinfo.h (winpids::set): Renamed from init.
(winpids::init): New declaration.
(winpids::cs): Ditto.
(winpids::winpids): Use set rather than init.
* external.cc (fillout_pinfo): Ditto.
* dcrt0.cc (dll_crt0_1): Call winpids::init.
* pinfo.cc (winpids::set): Renamed from init. Wrap calls in critical
section.
(winpids::init): New function.
(winpids::cs): Define.
2002-11-28 Christopher Faylor <cgf@redhat.com>
* sigproc.cc (sig_dispatch_pending): Remove assertion.
2002-11-27 Christopher Faylor <cgf@redhat.com>
* include/cygwin/version.h: Bump DLL minor number.
2002-11-27 Mikael Ylikoski <my@post.utfors.se>
* fhandler_socket.cc (fhandler_socket::sendto): Fix potential
unitialized value return.
2002-11-27 Christopher Faylor <cgf@redhat.com>
* cygwin.din: Export pthread_getsequence_np.
* include/cygwin/version.h: Bump API minor version.
2002-11-26 Jason Tishler <jason@tishler.net>
* cygwin.din: Export nl_langinfo().
* include/cygwin/version.h: Bump API minor version.
2002-11-26 Christopher Faylor <cgf@redhat.com>
* fhandler_tty.cc (fhandler_pty_master::accept_input): Just use a
normal Sleep or suffer amazing pauses when other tty apps are running.
(fhandler_pty_master::process_slave_output): Ditto.
2002-11-25 Pierre Humblet <pierre.humblet@ieee.org>
* passwd.cc (read_etc_passwd): Never add an entry when starting
on Win95/98/ME if a default entry is present.
* uinfo.cc (internal_getlogin): Look for the default uid if needed.
Always call user.set_name ().
2002-11-25 Corinna Vinschen <corinna@vinschen.de>
* sec_acl.cc (getacl): Set errno to ENOSPC if command is GETACL and
nentries is less than the number of entries in the file's ACL.
2002-11-24 Corinna Vinschen <corinna@vinschen.de>
* sec_acl.cc: Fix some formatting. Only set and check `other' bits in
a_perm throughout. Use ILLEGAL_GID id for all entries having no id.
(setacl): Fix inheritance condition.
(getacl): Set all permission bits in CLASS_OBJ and DEF_CLASS_OBJ
entries. Remove DENY bits before returning to calling function.
(acltomode): Fix usage of searchace(). If available, use CLASS_OBJ
to mask GROUP_OBJ permissions.
(aclfrommode): Fix usage of searchace(). If available, set CLASS_OBJ
permissions to same value as GROUP_OBJ permissions.
2002-11-24 Pierre Humblet <pierre.humblet@ieee.org>
* sec_acl.cc (getace): Fix the behavior when allow and
deny entries are present in arbitrary order.
(getacl): Report the actual number of entries when
aclbufp is NULL, even if nentries is zero. Fix the mask
reporting, handle the case where the owner and group sids
are equal and streamline the code.
(acl_worker): Take allow_ntsec into account.
2002-11-05 Thomas Pfaff <tpfaff@gmx.net>
* dcrt0.cc (dll_crt0_1): Add call to pthread::initMainThread to
initialize mainthread when it is safe to call new.
* init.cc (dll_entry): Change call to store reents in tls key.
* thread.cc (_reent_clib) : Change call to get reents from tls
key.
(_reent_winsup): Ditto.
(MTinterface::Init): Key handling changed. Remove initialization
of member variables.
(MTinterface::fixup_after_fork): Reinitialize mainthread object
after fork. Reset threadount to 1.
(pthread::initMainThread): Create mainthread object dynamically.
and initialize with valid handles.
(pthread::self): Remove calls to create thread objects.
(pthread::setTlsSelfPointer): Change call to store thread self
handle in tls key.
(pthread::getTlsSelfPointer): New static method.
(pthread::exit): Remove setTlsSelfPointer call.
(pthread::initCurrentThread): New method.
(pthread::thread_init_wrapper): Change call to store thread self
handle in tls key.
(pthread::join): Check for a valid joiner.
(pthreadNull::pthreadNull): Mark Null object as detached.
(pthreadNull::exit): Terminate thread via ExitThread.
* thread.h (pthread::initMainThread): Change parameter in function
call.
(pthread::getTlsSelfPointer): New static method.
(pthread::initCurrentThread): New method.
(MTinterface::reent_key): Remove.
(MTinterface::thread_self_dwTlsIndex): Ditto..
(MTinterface::indexallocated): Ditto.
(MTinterface::mainthread): Ditto.
(MTinterface::reent_key): New member.
(MTinterface::thread_self_key): Ditto.
(MTinterface::MTinterface): Initialize all members.
2002-11-23 Christopher Faylor <cgf@redhat.com>
* wait.cc (wait4): Force pending signal delivery before waiting for
process completion.
2002-11-23 Christopher Faylor <cgf@redhat.com>
* include/cygwin/version.h: Bump DLL minor number.
2002-11-22 Christopher Faylor <cgf@redhat.com>
* exceptions.cc (handle_sigsuspend): Force pending signal delivery
before waiting for signals to happen.
* signal.cc (sleep): Force pending signal delivery before sleeping.
(usleep): Ditto.
(signal): Force pending signal delivery before manipulating signal
stuff.
(sigprocmask): Ditto.
(kill_worker): Ditto.
(abort): Ditto.
(sigaction): Ditto.
* syscalls.cc (readv): Force pending signal delivery before I/O.
(writev): Ditto.
(open): Ditto.
* net.cc: Ditto, throughout.
* sigproc.cc (sig_dispatch_pending): Deliver any pending signals prior
to returning.
* tty.cc (tty::make_pipes): Increase pipe buffer size.
2002-11-22 Christopher Faylor <cgf@redhat.com>
* include/cygwin/version.h: Fix comment.
2002-11-21 Igor Pechtchanski <pechtcha@cs.nyu.edu>
* external.cc (cygwin_internal): Fix va_arg references.
2002-11-21 Christopher Faylor <cgf@redhat.com>
* exceptions.cc (sigthread::get_winapi_lock): Just do standard 'give up
timeslice' wait.
(setup_handler): Revamp YA to attempt to deliver signal multiple times
on failure rather than punting to wait_sig.
* miscfuncs.cc (low_priority_sleep): Accept INFINITE sleep to mean
"don't reset the priority after setting it to idle". Return previous
priority.
* winsup.h (SLEEP_0_STAY_LOW): Define.
(low_priority_sleep): Return an int.
* sigproc.h: Define WAIT_SIG_PRIORITY here.
* sigproc.cc: Remove WAIT_SIG_PRIORITY definition.
2002-11-20 Pierre Humblet <pierre.humblet@ieee.org>
* security.h: Declare internal_getpwsid and internal_getgrsid.
Undeclare internal_getpwent. Define DEFAULT_UID_NT. Change
DEFAULT_GID.
* passwd.cc (internal_getpwsid): New function.
(internal_getpwent): Suppress.
(read_etc_passwd): Make static. Rewrite the code for the completion
line. Set curr_lines to 0.
(parse_pwd): Change type to static int. Return 0 for short lines.
(add_pwd_line): Pay attention to the value of parse_pwd.
(search_for): Do not look for nor return the DEFAULT_UID.
* grp.cc (read_etc_group): Make static. Free gr_mem and set
curr_lines to 0. Always call add_pwd_line. Rewrite the code for the
completion line.
(internal_getgrsid): New function.
(parse_grp): If grp.gr_mem is empty, set it to &null_ptr.
Never NULL gr_passwd.
(getgrgid32): Only return the default if ntsec is off and the gid is
ILLEGAL_GID.
* sec_helper.cc (cygsid::get_id): Use getpwsid and getgrsid.
(cygsid_getfrompw): Clean up last line.
(cygsid_getfromgr): Ditto.
(is_grp_member): Use getpwuid32 and getgrgid32.
* uinfo.cc (internal_getlogin): Set DEFAULT_GID at start.
Use getpwsid. Move the read of /etc/group after the second access
to /etc/passwd. Change some debug_printf.
2002-11-20 Steven O'Brien <steven.obrien2@ntlworld.com>
* poll.cc (poll): ...but set POLLIN instead.
2002-11-20 Pierre Humblet <pierre.humblet@ieee.org>
* security.cc (get_attribute_from_acl): Always test "anti",
just in case an access_denied ACE follows an access_allowed.
Handle the case owner_sid == group_sid, with a FIXME.
Remove unnecessary tests for non-NULL PSIDs.
(alloc_sd): Use existing owner and group sids if {ug}id == -1.
Handle case where owner_sid == group_sid.
Do not call is_grp_member. Try to preserve canonical ACE order.
Remove unnecessary tests for non-NULL PSIDs. Reorganize
debug_printf's.
(get_initgroups_sidlist): Put well_known_system_sid on left
side of ==.
(add_access_denied_ace): Only call GetAce if inherit != 0.
(add_access_allowed_ace): Ditto. Use appropriate sizeof.
* syscalls.cc (chown_worker): Pass {ug}id equal to -1 to
alloc_sd, which removes the need to obtain old_{ug}id.
(chmod): Remove call to get_file_attribute (), simply pass
{ug}id equal to -1 to alloc_sd.
2002-11-20 Corinna Vinschen <corinna@vinschen.de>
* poll.cc (poll): Don't set POLLERR if a listening socket has a
pending connect. Don't use errno value from call to
fhandler_socket::recvfrom().
2002-11-19 Christopher Faylor <cgf@redhat.com>
* net.cc: Sprinkle sigframes throughout.
2002-11-16 Christopher Faylor <cgf@redhat.com>
* tty.cc (tty::make_pipes): Make pipe buffer larger.
2002-11-15 Pierre Humblet <pierre.humblet@ieee.org>
* grp.cc (getgroups32): Protect against closing cygheap->user.token.
2002-11-15 Christopher Faylor <cgf@redhat.com>
* include/cygwin/version.h: Bump API_MINOR to accommodate below
changes.
002-11-14 Sergey Okhapkin <sos@prospect.com.ru>
* cygwin.din (siginterrupt): New export.
* signal.cc (siginterrupt): New.
2002-11-15 Sergey Okhapkin <sos@prospect.com.ru>
* select.cc (peek_serial): Don't call PurgeComm() to avoid characters
loss.
2002-11-14 Christopher Faylor <cgf@redhat.com>
* exceptions.cc (setup_handler): Add debugging output. Set thread
priority to idle if pending signals to allow other threads to get into
interruptible state.
* miscfuncs.cc (sys_mbstowcs): Save current thread in variable to avoid
an OS call.
* wait.cc (wait_sig): Reset thread priority each time through loop
since the priority may have been set down to deal with pending signals.
2002-11-14 Christopher Faylor <cgf@redhat.com>
* fhandler_serial.cc (fhandler_serial::tcgetattr): Don't take any
special action when vmin_ == 0.
2002-11-14 Corinna Vinschen <corinna@vinschen.de>
* grp.cc (getgroups32): Revert previous patch. Use impersonation
token if process is in impersonated state.
* sec_helper.cc (is_grp_member): Rewrite. Call getgroups32 only
for current user. Scan passwd and group info otherwise.
2002-11-14 Christopher Faylor <cgf@redhat.com>
* fhandler_console.cc (fhandler_console::write): Allow characters >=
0177 to be displayed in the title bar.
2002-11-14 Corinna Vinschen <corinna@vinschen.de>
* grp.cc (getgroups32): Don't use access token of current user when
retrieving group info for another user.
2002-11-13 Christopher Faylor <cgf@redhat.com>
* dll_init.cc (dll_list::detach): Eliminate reliance on passed in dll
address. Infer from module of caller instead.
(cygwin_detach_dll): Ignore dll_index argument.
* dll_init.h (dll_list::detach): Reflect argument change above.
2002-11-13 Christopher Faylor <cgf@redhat.com>
* ioctl.cc (ioctl): Always print ioctl results, even when it's a tty.
2002-11-13 Christopher Faylor <cgf@redhat.com>
* winsup.h (low_priority_sleep): Declare.
2002-11-13 Christopher Faylor <cgf@redhat.com>
* miscfuncs.cc (low_priority_sleep): New function. Use throughout
where code is supposed to be giving up time slice.
* fhandler_console.cc (fhandler_console::read): Switch button 2/3
output escape sequences to be consistent with xterm.
2002-11-12 Pierre Humblet <pierre.humblet@ieee.org>
* syscalls.cc (chmod): Simplify conditional.
* sec_helper (cygsid::getfromstr): Reorganize to remove
calls to strcpy and strtok_r.
(cygsid::getfromgr): Change type to __uid32_t instead of int.
Keep only the allow_ntsec branch. Never call LookupAccountSid
which calls PDCs, simply return -1 in case of failure.
Use cygsid == instead of calling EqualSid and remove test
for NULL psid.
* security.h: Declare cygsid::getfromgr as __uid32_t.
2002-11-10 Corinna Vinschen <corinna@vinschen.de>
* net.cc: Run indent.
2002-11-10 Alexander Gottwald <Alexander.Gottwald@s1999.tu-chemnitz.de>
* autoload.cc (GetIfEntry): Add symbol.
* net.cc (get_2k_ifconf): Get the interface entries with the GetIfEntry
call intead of the GetIfTable call. Clean-up multiple IP address naming.
2002-11-09 Sergey Okhapkin <sos@prospect.com.ru>
* fhandler.h (class fhandler_pipe): New ioctl() method.
* pipe.cc (fhandler_pipe::ioctl): New.
2002-11-07 Christopher Faylor <cgf@redhat.com>
* fhandler_serial.cc (fhandler_serial::ioctl): Fix typo.
2002-11-07 Christopher January <chris@atomice.net>
* include/cygwin/fs.h: New file.
* include/cygwin/hdreg.h: New file.
* fhandler_floppy.cc (fhandler_floppy::ioctl): Add implementation for
HDIO_GETGEO, BLKGETSIZE, BLKGETSIZE64, BLKRRPART and BLKSSZGET ioctls.
2002-11-07 Gilles Courcoux <Gilles.Courcoux@col.bsf.alcatel.fr>
* fhandler_socket.cc (fhandler_socket::ioctl): Return correct flags
for loopback interface when name is given on input instead of address.
2002-11-07 Jason Tishler <jason@tishler.net>
* cygwin.din: Export fseeko() and ftello().
* include/cygwin/version.h: Bump API minor version.
2002-11-06 Christopher Faylor <cgf@redhat.com>
* fhandler_console.cc (keytable[]): Revert previous change. It would
break too many things.
2002-11-06 Christopher Faylor <cgf@redhat.com>
* fhandler_console.cc (keytable[]): Redefine F1 - F5 to something a
little more sensical.
2002-11-06 Sergey Okhapkin <sos@prospect.com.ru>
* syscalls.cc (getutid): Use UT_IDLEN where appropriate.
2002-11-06 Christopher Faylor <cgf@redhat.com>
* include/cygwin/version.h: Bump API minor number for below export.
2002-11-06 Sergey Okhapkin <sos@prospect.com.ru>
* cygwin.din (pututline): New exported function.
* syscalls.cc (login): Use pututiline().
(setutent): Open utmp as read/write.
(endutent): Check if utmp file is open.
(utmpname): call endutent() to close current utmp file.
(getutid): Enable all cases, use strncmp() to compare ut_id fields.
(pututline): New.
* tty.cc (create_tty_master): Set ut_pid to current pid.
2002-11-05 Christopher Faylor <cgf@redhat.com>
* fhandler_serial.cc (fhandler_serial::ioctl): Don't try to figure out
if OS has the capability to retrieve RTS/CTS. Just set default values
if DeviceIoControl fails. (suggested by Sergey Okhapkin)
2002-11-05 Sergey Okhapkin <sos@prospect.com.ru>
* fhandler_serial.cc (fhandler_serial::raw_read): Use correct type for
minchars.
(fhandler_serial::ioctl): Set errno if the ClearCommError fails.
(fhandler_serial::tcsetattr): Use correct value for vmin_.
(fhandler_serial::tcgetattr): Ditto.
2002-11-05 Thomas Pfaff <tpfaff@gmx.net>
* fhandler_socket.cc (fhandler_socket::recvmsg): Call if from == NULL
WSARecvFrom with fromlen = NULL.
2002-11-04 Christopher Faylor <cgf@redhat.com>
* pinfo.cc (_pinfo::commune_send): Fix thinko in previous checkin.
2002-11-04 Christopher Faylor <cgf@redhat.com>
* pinfo.cc (_pinfo::commune_send): Set priority low when sleeping,
waiting for commune completion so that we don't spin waiting for lower
priority processes.
2002-11-04 Christopher Faylor <cgf@redhat.com>
* sigproc.cc (WAIT_SIG_PRIORITY): Bump to THREAD_PRIORITY_TIME_CRITICAL.
2002-11-04 Christopher Faylor <cgf@redhat.com>
* pinfo.cc (_pinfo::commune_send): Initialize buffer or suffer random
crashes.
2002-11-04 Christopher Faylor <cgf@redhat.com>
* fhandler_process.cc (fhandler_process::fill_filebuf): Deal with error
condition from cmdline retrieval.
2002-11-04 Christopher Faylor <cgf@redhat.com>
* sigproc.cc (WAIT_SIG_PRIORITY): Bump to highest priority.
2002-11-04 Christopher Faylor <cgf@redhat.com>
* include/cygwin/version.h: Bump DLL minor number.
2002-11-03 Christopher Faylor <cgf@redhat.com>
* fhandler_serial.cc (fhandler_serial::ioctl): Reformat. Set errno
appropriately. Exit from the bottom. Correctly deal with third
argument for TCFLSH. (Suggested by Sergey Okhapkin)
2003-11-03 Sergey Okhapkin <sos@prospect.com.ru>
* fhandler_tty.cc (fhandler_tty_slave::ioctl): Do nothing if the new
window size is equal to the old one. Send SIGWINCH if slave connected
to a pseudo tty.
(fhandler_pty_master::ioctl): Do nothing if the new window size is
equal to the old one.
2002-10-31 Pierre Humblet <pierre.humblet@ieee.org>
* fhandler.cc (fhandler_base::open): Verify pc isn't NULL.
2002-10-30 Christopher Faylor <cgf@redhat.com>
* include/cygwin/version.h: Bump DLL minor number.
2002-10-30 Christopher Faylor <cgf@redhat.com>
* external.cc (cygwin_internal): Implement CW_CMDLINE.
* pinfo.h (SIGCOMMUNE): New signal type.
(commune_result): New structure for commune functions.
(picom): New enum for commune functions.
(_pinfo::hello_pid): New. Pid who's communicating with me.
(_pinfo::tothem): New. Handle of communicating pipe.
(_pinfo::fromthem): Ditto.
(_pinfo::commune_recv): Declare.
(_pinfo::commune_send): Declare.
(_pinfo::alive): Declare.
(_pinfo::cmdline): Declare.
(_pinfo::lock): Declare.
* pinfo.cc (set_myself): Initialize new _pinfo lock.
(_pinfo::alive): Define. Determines if process still exists.
(_pinfo::commune_recv): Define. Receive info from another cooperating process.
(_pinfo::commune_send): Define. Send info to another cooperating process.
(_pinfo::cmdline): Define. Determine command line of a given process.
* include/sys/cygwin.h (CW_CMDLINE): Define.
*sigproc.cc (talktome): Communicate with any processes who want to talk
to me.
(wait_sig): Honor __SIGCOMMUNE.
* fhandler.cc (fhandler_virtual::fixup_after_exec): Declare.
* fhandler_proc.cc: Use malloc/free/realloc throughout rather than
cmalloc since buffers don't need to be propagated to subprocesses.
* fhandler_registry.cc: Ditto.
* fhandler_virtual.cc: Ditto.
(fhandler_virtual::fixup_after_exec): Define.
* fhandler_process.cc: Ditto for malloc/free/realloc.
(process_listin): Add "cmdline".
(fhandler_process::fill_filebuf): Implement PROCESS_CMDLINE.
* miscfuncs.cc (isalpha_array): New array populated with xor values for
alpha characters to switch from one case to another.
* string.h (cygwin_strcasematch): New asm implementation of case match.
* string.h (cygwin_nstrcasematch): New asm implementation of counted
case match.
2002-10-24 Pierre Humblet <pierre.humblet@ieee.org>
* pwdgrp.h (pwdgrp_read::open): Compare fh to INVALID_HANDLE_VALUE.
2002-10-22 Christopher Faylor <cgf@redhat.com>
* fhandler_disk_file.cc (fhandler_disk_file::fstat_helper): Nevermind.
Revert everything to previous state wrt ntsec and exec bits.
2002-10-22 Christopher Faylor <cgf@redhat.com>
* shared.cc (shared_info::initialize): Use correct value for version
comparison.
* include/cygwin/version.h (CYGWIN_VERSION_MAGIC): Use all of a DWORD
for magic calculation.
2002-10-22 Christopher Faylor <cgf@redhat.com>
* fhandler_disk_file.cc (fhandler_disk_file::fstat_helper): Oops. Only
do the executable thing for #! scripts since .exe files wouldn't be
executable in ntsec case regardless.
2002-10-22 Christopher Faylor <cgf@redhat.com>
* fhandler_disk_file.cc (fhandler_disk_file::fstat_helper): Always
consider .exe files and '#!' shell scripts to be executable.
2002-10-22 Christopher Faylor <cgf@redhat.com>
* cygthread.cc (cygthread::exiting): New variable.
(cygthread::initialized): Delete.
(cygthread::stub): Use exiting variable to determine when to exit.
(cygthread::runner): Delete.
(cygthread_protect): New variable.
(cygthread::init): Don't start runner thread. Initialize muto for list
protection.
(cygthread::freerange): Return pointer to cygthread.
(cygthread::operator new): Change logic to start threads on an
as-needed basis.
(cygthread::detach): Don't zero id.
(cygthread::terminate): Don't kill any executing threads. Just set
exiting flag.
* cygthread.h (cygthread): Reflect above changes.
* dcrt0.cc (dll_crt0_1): Move cygthread initialization later.
* fork.cc (fork_child): Do fdtab fixup after dll fixup or (apparently)
winsock may allocate memory in dll load address.
2002-10-22 Pierre Humblet <pierre.humblet@ieee.org>
* sec_helper.cc (cygsid::get_id): If the sid matches a sid stored in
cygheap->user, return the uid or gid from myself.
* security.cc (alloc_sd): If gid == myself->gid, return the group sid
from cygheap->user. Remove the test for uid == original_uid, which is
counter-productive.
2002-10-22 Christopher Faylor <cgf@redhat.com>
* cygheap.cc (cygheap_fixup_in_child): Use user_heap element in
cygheap.
(init_cheap): Ditto for declaration.
* fork.cc (fork_parent): Use user_heap element in cygheap.
* heap.h (inheap): Ditto.
* heap.cc (sbrk): Ditto.
(heap_init): Ditto. Reorganize to shrink heap chunk as required and
record new value in cygheap.
* dcrt0.cc (dll_crt0_1): More "move the cygthread init" games.
* shared.cc (open_shared): Rework memory protection to properly deal
with relocated shared segment.
(shared_info::heap_chunk_size): Rename element to 'heap_chunk'.
* shared_info.h (shared_info): Ditto for declaration.
* strace.cc (strace::hello): Report on heap chunk size from cygheap
since it may shrink.
2002-10-20 Christopher Faylor <cgf@redhat.com>
Change _function() to function() throughout.
* cygwin.din: Remove last vestiges (?) of newlib wrappers.
2002-10-20 Christopher Faylor <cgf@redhat.com>
* cygthread.cc (cygthread::detach): Always wait for event or suffer an
apparently inavoidable race.
* dcrt0.cc (dll_crt0_1): Allocate threads after stack has been
relocated.
* debub.cc (lock_debug): Don't acquire lock on exit.
* fork.cc (fork_child): Recreate mmaps before doing anything else since
Windows has a habit of using blocks of memory in the child that could
previously have been occupied by shared memory in the parent.
* mmap.cc (fhandler_disk_file::fixup_mmap_after_fork): Issue error here
and provide some details about what went wrong.
(fixup_mmaps_after_fork): Remove error message.
* shared.cc (open_shared): Move warning message so that more detail is
possible.
* sigproc.cc (sigproc_init): Initialize sync_proc_subproc to avoid a
race.
(sigproc_terminate): Specifically wait for process thread to terminate.
2002-10-20 Christopher Faylor <cgf@redhat.com>
* cygthread.cc (cygthread::stub): Fix typo.
(cygthread::terminate): Don't zero thread handle prior to using it.
2002-10-20 Christopher Faylor <cgf@redhat.com>
* sigproc.cc (wait_sig): Remove obsolete sigchld logic.
2002-10-20 Christopher Faylor <cgf@redhat.com>
Rename _kill() to kill() throughout. Rename _raise() to raise()
throughout. Rename _pid() to pid() throughout.
* Makefile.in: Compile some objects with -fomit-frame-pointer.
* cygwin.din: Reverse aliasing for _kill.
* syscalls.cc (_getpid_r): New function, implemented for newlib
compatibility.
* shared.cc (open_shared): Remove reserving of memory since previous
change eliminate the need for this hack.
2002-10-19 Christopher Faylor <cgf@redhat.com>
* fork.cc (fork_child): Move pinfo fixup later to attempt some minor
gains from concurrency with cythread::init.
2002-10-18 Christopher Faylor <cgf@redhat.com>
* dcrt0.cc (dll_crt0_1): Initialize cygwin threads here only when not
forking.
* fork.cc (fork_child): Initialize cygwin thread later in process to
avoid allocating memory for thread stacks.
* shared.cc (open_shared): Issue warning if NT and shared segment is
relocated.
2002-10-18 Christopher Faylor <cgf@redhat.com>
* cygthread.cc: Bump number of cygthreads up to accommodate
applications which use ttys.
2002-10-18 Christopher Faylor <cgf@redhat.com>
* fork.cc (fork_child): Move mmap initialization.
* shared.cc (shared_info::heap_chunk_size): Store info as megabytes.
Search HKEY_LOCAL_MACHINE as well as HKEY_CURRENT_USER.
* shared_info.h (shared_info::initial_heap_size): Change element name
to reflect new functionality.
* strace.cc (strace::hello): Report on initial heap size.
2002-10-18 Thomas Pfaff <tpfaff@gmx.net>
* thread.cc (verifyable_object_isvalid): Test for a valid object
pointer before testing for static ptr.
2002-10-17 Christopher Faylor <cgf@redhat.com>
* dtable.cc (dtable::init_std_file_from_handle): Force "devices" to
always be in binary mode. Temporary fix until ssh is rebuilt?
2002-10-17 Christopher Faylor <cgf@redhat.com>
* dtable.cc (dtable::set_file_pointers_for_exec): New function.
* dtable.h (dtable::set_file_pointers_for_exec): Declare new function.
* spawn.cc (spawn_guts): Call dtable::set_file_pointers_for_exec to set
pointers to EOF when execing non-cygwin applications.
2002-10-17 Robert Collins <rbtcollins@hotmail.com>
* thread.h (pthread_mutex::isGoodInitializerOrBadObject): Declare.
* thread.cc (pthread_mutex::isGoodInitializerOrBadObject): Implement.
(pthread_mutex::init): Use isGoodInitializerOrBadObject to avoid
unneeded SEGV's during debugging.
2002-10-17 Thomas Pfaff <tpfaff@gmx.net>
* thread.cc (verifyable_object_isvalid): Test for static object first.
2002-10-16 Christopher Faylor <cgf@redhat.com>
* fhandler_tty.cc (fhandler_tty_slave::read): Attempt #527 to properly
implement VMIN/VTIME.
2002-10-15 Christopher Faylor <cgf@redhat.com>
* shared.cc (open_shared): Revert to "old" method for shared memory
location if !wincap.needs_memory_protection.
* wincap.cc: Implement needs_memory_protection throughout.
* wincap.h: Ditto.
2002-10-15 Christopher Faylor <cgf@redhat.com>
* child_info.h (CURR_CHILD_INFO_MAGIC): Reset.
(child_info_fork::mount_table): Remove.
(child_info_fork::myself_addr): Remove.
* fork.cc (fork_child): Don't set either of the above.
* dcrt0.cc (dll_crt0_1): Call memory_init as early as possible.
* fhandler_console.cc (console_state): Move to shared_info.h.
(fhandler_console::get_tty_stuff): Reflect open_shared arg change.
* pinfo.cc (myself_addr): Remove definition.
(pinfo::init): Get myself address from open_shared.
* pinfo.h (myself_addr): Remove declaration.
* shared.cc (open_shared): Rework so that known shared memory locations
are protected. Take shared memory type as fifth argument.
(memory_init): Reflect open_shared arg change.
* shared_info.h (shared_locations): New enum.
(console_state): Move here.
(open_shared): Reflect open_shared arg change in declaration.
2002-10-14 Christopher Faylor <cgf@redhat.com>
* child_info.h (CURR_CHILD_INFO_MAGIC): Reset.
(child_info_fork::heaptop): Remove obsolete element.
(child_info_fork::heabbase): Ditto.
(child_info_fork::heapptr): Ditto.
(child_info_fork::mount_table): New element.
(child_info_fork::myself_addr): Ditto.
* dcrt0.cc (dll_crt0_1): Set mount_table and myself_addr when forking.
(initial_env): Add newline to "sleeping" message.
* dll_init.cc (reserve_upto): Accommodate cygwin heap when freeing
memory. Make debugging output a little more descriptive.
* fork.cc (fork_parent): Save mount_table and myself_addr.
* pinfo.cc (myself_addr): New variable.
(set_myself): Pass PID_MYSELF flag to init.
(pinfo::init): Honor PID_MYSELF. Save address where myself shared
memory resides in myself_addr, for fork.
* pinfo.h (myself_addr): Declare.
* shared.cc (memory_init): On fork, use previously saved address for
location of mount table.
* include/sys/cygwin.h (PID_MYSELF): New value.
* dtable.cc (dtable::stdio_init): Don't pass access type to
init_std_file_from_handle. It's always the same.
(dtable::init_std_file_from_handle): Remove access type argument.
Assume read/write.
* dtable.h (dtable::init_std_file_from_handle): Ditto for declaration.
* exceptions.cc (try_to_debug): Don't try to debug if already being
debugged.
* fhandler_console.cc (shared_console_info_save): New variable.
(fhandler_console::get_tty_stuff): Save address of shared console stuff
for fork.
2002-10-13 Christopher Faylor <cgf@redhat.com>
* cygthread.cc (cygthread::stub): Reintroduce clearing of __name but do
it before SetEvent to eliminate a race.
(cygthread::terminate): Accumulate list of threads to check for
termination and call WaitForMultipleObjects on list rather than waiting
for each thread individually.
* sigproc.cc (subproc_init): Zap hwait_subproc thread handle since it
is no longer used.
2002-10-13 Christopher Faylor <cgf@redhat.com>
* spawn.cc (spawn_guts): Fix so that cygthread::terminate is *really*
called only for exec.
2002-10-13 Christopher Faylor <cgf@redhat.com>
* cygthread.cc (cygthread::stub): Don't zero __name here. That
introduces a race.
2002-10-13 Christopher Faylor <cgf@redhat.com>
* include/cygwin/version.h: Bump DLL minor number.
2002-10-13 Christopher Faylor <cgf@redhat.com>
* cygthread.cc (cygthread::stub): Don't create event for long-running
threads. Initialize thread_sync event here which is used to Suspend
using an event rather than relying on SuspendThread/ResumeThread.
(cygthread::init): Save handle to runner thread for future termination.
(cygthread::cygthread): Only resume thread when it is actually
suspended. Otherwise signal thread completion event.
(cygthread::terminate): Forcibly terminate runner thread and any helper
threads. Call DisableThreadLibrary calls if execing.
* cygthread.h (cygthread::thread_sync): Declare.
* dcrt0.cc (do_exit): Eliminate calls to obsolete window_terminate and
shared_terminate.
* exceptions.cc (events_terminate): Don't bother closing title_mutex
since it is going away anyway.
* pinfo.cc (_pinfo::exit): Call cygthread::terminate to ensure that
threads are shut down before process exit or otherwise strange races
seem to occur.
* shared.cc (shared_terminate): Eliminate.
* shared.h (shared_terminate): Eliminate declaration.
* winsup.h (window_terminate): Eliminate declaration.
* spawn.cc (spawn_guts): Call cygthread::terminate early in process if
execing. Call DisableThreadLibrary calls if execing.
* window.cc (Winmain): Call ExitThread to force exit.
(window_terminate): Eliminate.
* dcrt0.cc (do_exit): Track exit state more closely.
2002-10-10 Christopher Faylor <cgf@redhat.com>
* window.cc (gethwnd): Use SetThreadPriority method.
2002-10-10 Christopher Faylor <cgf@redhat.com>
* Makefile.in (new-cygwin1.dll): Reorganize library order.
* dcrt0.cc (do_exit): Move thread stuff after vfork stuff or threads
are terminated during vfork.
* sigproc.cc (proc_terminate): Grab proc lock prior to signalling
subproc thread exit to avoid an extra "wait-for-thread-to-exit".
2002-10-09 Christopher Faylor <cgf@redhat.com>
* cygthread.cc (cygthread::stub): Don't create an event for "cygself"
threads. Assume that they exit via an ExitThread call.
* cygthread.h (cygthread::SetThreadPriority): New function.
(cygthread::zap_h): New function.
* dcrt0.cc (do_exit): Move cygthread::terminate earlier and establish
exit_state guard.
* fhandler.h (fhandler_tty_master::output_thread): Delete.
* fhandler_tty.cc (fhandler_tty_master::init): Set priority for threads
via method. Zap handles when done. Don't treat process_output
specially.
(process_output): Call ExitThread directly.
(fhandler_tty_master::fixup_after_fork): Don't worry about
output_thread.
(fhandler_tty_master::fixup_after_exec): Ditto.
* sigproc.cc (proc_terminate): Don't detach from hwait_subproc. Just
let it exit.
(sigproc_init): Close thread handle after initialization.
(wait_sig): Use GetCurrentThread() as SetThreadPriority call rather
than *event* handle. Call ExitThread directly on termination.
(wait_subproc): Call ExitThread directly on termination.
* tty.cc (tty_list::terminate): Don't attempt to detach from
output_thread.
2002-10-08 Christopher Faylor <cgf@redhat.com>
* cygheap.cc (dup_now): Make fatal error a little more informative.
(cygheap_setup_for_child): Detect when default size of shared region is
less than the current size and allocate that much.
(_cbrk): Just return NULL on inability to allocate.
(_cmalloc): Ditto.
* cygheap.h (CYGHEAPSIZE): Change size to reflect newer, tinier
fhandler sizes.
* spawn.cc (av::error): New element, reflects potential errno from cmalloc.
(av::~av): Don't free NULL pointers.
(av::replace0_maybe): Detect out-of-memory conditions.
(av::dup_maybe): Ditto.
(av::dup_all): Ditto.
(av::unshift): Ditto.
(spawn_guts): Set errno and return if argv creation ran into problems.
* fhandler.h (fhandler_union): Change member names to something safer.
* fhandler_console.cc (fhandler_console::get_tty_stuff): Always set
fhandler_console::dev_state regardless of whether shared region is
initialized.
* cygthread.cc (cygthread::runner): Use ExitThread rather than return
(planning for future).
2002-10-08 Christopher Faylor <cgf@redhat.com>
* fhandler.h (dev_console): New class.
(fhandler_console::dev_state): New class element.
(fhandler_console::mouse_aware): Use dev_state element.
(fhandler_console::get_tty_stuff): Declare new function.
* fhandler_console.cc: Use dev_state fhandler_console element,
throughout.
(fhandler_console::get_tty_stuff): Move to fhandler_console class.
Incorporate dev_console information. Move constructor stuff here.
2002-10-07 Christopher Faylor <cgf@redhat.com>
* dtable.cc (dtable::init_std_file_from_handle): Try to mimic standard
open behavior with files redirected from stdin/stdout/stderr, i.e.,
fmode settings take precedence over mount settings.
2002-10-07 Christopher Faylor <cgf@redhat.com>
* dtable.cc (unknown_file): New variable.
(dtable::init_std_file_from_handle): Don't set binmode if we couldn't
determine the actual file name on stdin/stdout/stderr.
(handle_to_fn): Return unknown_file when can't determine filename.
2002-10-07 Christopher Faylor <cgf@redhat.com>
* dcrt0.cc (do_exit): Call DisableThreadLibraryCalls since we don't
need to track thread detaches.
* init.cc (dll_entry): Reorganize slightly. Fix api_fatal message.
2002-10-05 Christopher Faylor <cgf@redhat.com>
* cygthread.cc (cygthread::stub): Very minor cleanup.
(cygthread::stub): Report overflows in cygwin thread pool when
DEBUGGING is on and special environment variable is not set.
(cygthread::terminate): Set event only when event actually exists.
* exceptions.cc (signal_exit): Set priority of main thread to low
before setting current thread to high.
2002-10-01 Robert Collins <rbtcollins@hotmail.com>
* thread.cc (pthread_key::keys): Copy on fork. Add a comment explaining
why.
(pthreadNull::_instance): Copy on fork. Absolutely no state exists
in pthreadNull.
2002-09-30 Conrad Scott <conrad.scott@dsl.pipex.com>
* cygserver_transport_pipes.cc (transport_layer_pipes::accept):
Remove trailing \n from debug_printf.
2002-09-30 Christopher Faylor <cgf@redhat.com>
* thread.cc (pthread_mutex::initMutex): Remove \n from api_fatal.
2002-09-30 Christopher Faylor <cgf@redhat.com>
* thread.cc (pthread::precreate): Use explicit "no inherit" option when
creating mutex.
(pthread_mutex::nativeMutex::init): Ditto.
2002-09-30 Christopher Faylor <cgf@redhat.com>
* thread.cc (pthread_key::keys): Do not copy on fork.
(pthread_mutex::mutexInitializationLock): Ditto.
(pthreadNull::_instance): Ditto.
2002-09-30 Christopher Faylor <cgf@redhat.com>
* exceptions.cc (unused_sig_wrapper): Still need additional level of
indirection when setting errno.
2002-09-30 Robert Collins <rbtcollins@hotmail.com>
* thread.cc (pthread_mutex::initMutex): Use the wrapper init call.
(pthread_mutex::nativeMutex::init): Implement.
(pthread_mutex::nativeMutex::lock): Ditto.
(pthread_mutex::nativeMutex::unlock): Ditto.
(pthread_mutex::init): Use the wrapper lock and unlockcalls.
* thread.h (pthread_mutex): Move mutexInitializationLock into a
nativeMutex wrapper class.
2002-09-30 Christopher Faylor <cgf@redhat.com>
Remove \n from calls to strace class printfs throughout.
2002-09-30 Christopher Faylor <cgf@redhat.com>
* exceptions.cc (unused_sig_wrapper): Accommodate newer compilers.
2002-09-29 Christopher Faylor <cgf@redhat.com>
* security.cc (allow_ntsec): Default to zero.
* environ.cc (environ_init): Set allow_ntsec to TRUE by default,
assuming OS allows it.
2002-09-29 Christopher Faylor <cgf@redhat.com>
* environ.cc (environ_init): Avoid a compiler warning.
* path.cc (path_conv::check): Ditto.
* path.h (path_conv::operator int): Ditto.
* regex/engine.c: Ditto throughout.
* regex/regcomp.c: Ditto throughout.
* regex/regexec.c: Ditto throughout.
2002-09-29 Christopher Faylor <cgf@redhat.com>
* thread.cc: Use "%E" in *_printf throughout rather than calling
GetLastError. GNUify comments.
(__pthread_mutex_lock): Don't return error on EBUSY since that just
means that the mutex has already been initialized.
2002-09-30 Robert Collins <rbtcollins@hotmail.com>
* pthread.cc (pthread_mutex_init): Use new pthread_mutex::init.
* thread.cc: Change __pthread_mutex_init to pthread_mutex::init
throughout.
(MTinterface::Init): Initialise pthread_mutex support.
(pthread_mutex::mutexInitializationLock): Instantiate.
(pthread_mutex::initMutex): New method.
(__pthread_cond_dowait): Don't dereference untrusted pointers.
Use the new pthread_mutex::init method.
(__pthread_condattr_init): Don't dereference untrusted pointers.
(__pthread_mutex_init): Rename to pthread_mutex::init.
Lock and release mutexInitializationLock to prevent races on
mutex initialisation.
* thread.h (pthread_mutex::initMutex): New method, initialise
pthread_mutex supporting state on process initialisation.
(pthread_mutex::init): Initialise a single mutex.
(pthread_mutex::mutexInitializationLock): A win32 mutex for
syncronising pthread mutex initialisation.
(__pthread_mutex_init): Remove this.
2002-09-28 Christopher Faylor <cgf@redhat.com>
* thread.h (verifyable_object:~verifyable_object): Make virtual.
2002-09-28 Christopher Faylor <cgf@redhat.com>
* cygthread.h (cygthread::terminate): Declare new function.
(cygthread::initialized): Change to 'int'.
* cygthread.cc (cygthread::stub): Exit thread if initialized < 0.
(cygthread::new): Ditto.
(cygthread::runner): Ditto. Set initialized using xor to preserve
sign.
(cygthread::terminate): New function.
* dcrt0.cc (do_exit): Call cygthread::terminate.
2002-09-27 Robert Collins <rbtcollins@hotmail.com>
* thread.cc (pthread_key::run_destructor): Run_destructor is not
const as it needs to set the key value.
* thread.h (pthread_key::run_destructor): Ditto.
2002-09-27 Robert Collins <rbtcollins@hotmail.com>
* thread.cc (pthread_key::run_destructor): Follow opengroup algorithm.
I.e. only run the destructor NON-NULL key values, and reset the key
to NULL before running the destructor. Reported by Thomas Pfaff.
2002-09-25 Christopher Faylor <cgf@redhat.com>
* cygrun.c (main): Fix setting of CYGWIN environment variable.
* Makefile.in: Remove linking of unnecessary libraries.
2002-09-24 Christopher January <chris@atomice.net>
* fhandler_proc.cc (format_process_stat): make ctty a real device
number.
(format_process_status): use effective uid/gid as real and saved
uid/gid.
2002-09-24 Corinna Vinschen <corinna@vinschen.de>
* errno.cc (errmap): Map ERROR_INVALID_ADDRESS to new errno code
EOVERFLOW.
(_sys_errlist): Add entries for EILSEQ and EOVERFLOW.
(strerror): Ditto.
* mmap.cc (map_map): Set errno in case of error.
(mmap64): Remove setting errno explicitely to ENOMEM.
2002-09-24 Corinna Vinschen <corinna@vinschen.de>
* mmap.cc (map_map): Add debug output.
(mmap64): Evaluate gran_len correctly even if offset isn't 0.
2002-09-22 Christopher Faylor <cgf@redhat.com>
More GNUify non-GNU formatted functions calls throughout.
2002-09-22 Christopher Faylor <cgf@redhat.com>
* Makefile.in (DLL_O_FILES): Restore formatting.
2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
GNUify non-GNU formatted functions calls throughout.
2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
* cygserver_shm.cc (with_strerr): Remove macro.
(server_shmmgr::segment_t::~segment_t): Remove calls to with_strerr.
(server_shmmgr::segment_t::attach): Ditto.
(server_shmmgr::new_segment): Ditto.
* shm.cc (with_strerr): Remove macro.
(client_shmmgr::shmdt): Remove calls to with_strerr.
(client_shmmgr::attach): Ditto.
2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
* include/sys/ipc.h: Move to "include/cygwin/ipc.h".
* include/sys/msg.h: Move to "include/cygwin/msg.h".
* include/sys/sem.h: Move to "include/cygwin/sem.h".
* include/sys/shm.h: Move to "include/cygwin/shm.h".
* include/cygwin/ipc.h: New file.
* include/cygwin/msg.h: Ditto.
* include/cygwin/sem.h: Ditto.
* include/cygwin/shm.h: Ditto.
* cygserver_shm.h: Update includes.
* msg.cc: Ditto.
* sem.cc: Ditto.
2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
* safe_memory.h (safe_delete): Make a templated function.
* cygserver.cc (~server_request): Update use of safe_delete.
(main): Ditto.
* cygserver_client.cc (client_request::handle_request): Ditto.
(client_request::make_request): Ditto.
* cygserver_process.cc (~process_cleanup): Ditto.
(process::remove): Ditto.
(process::cleanup): Ditto.
(process_cache::process): Ditto.
* cygserver_shm.cc (server_shmmgr::segment_t::detach): Ditto.
(server_shmmgr::delete_segment): Ditto.
* shm.cc (client_shmmgr::shmdt): Ditto.
* threaded_queue.cc (~threaded_queue): Ditto.
(threaded_queue::worker_loop): Ditto.
2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
* safe_memory.h: Replace #include <new> with an explicit
definition of the placement new operator.
(safe_delete): Remove unnecessary ## operator.
2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
* cygserver_shm.cc (class server_shmmgr): Remove `cleanup_t'
friend declaration.
(cleanup_t::cleanup_t): Use the segment's shmid as the key rather
than the segment pointer itself.
(cleanup_t::segptr): Remove method.
(cleanup_t::shmid): New method.
(cleanup_t::cleanup): Update for new key value.
(server_shmmgr::find (segment_t *)): Remove method.
* include/cygwin/cygserver_process.h (cleanup_routine::key): Make
method const.
2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
* include/cygwin/cygserver_process.h
(cleanup_routine::_key): New field.
(cleanup_routine::cleanup_routine): Initialise new field with new
argument.
(cleanup_routine::operator==): New method.
(cleanup_routine::key): New method.
(cleanup_routine::cleanup): Make argument non-const.
(process::is_active): New method.
(process::remove): Ditto.
(process::check_exit_code): Rename method.
* cygserver_process.cc (process::add): Reorganize code.
(process::remove): New method.
(process::check_exit_code): Rename method.
(process::cleanup): Use new `process::is_active' method.
(process_cache::process): Ditto.
(process_cache::sync_wait_array): Ditto.
(process_cache::check_and_remove_process): Ditto.
* cygserver_shm.cc (server_shmmgr): Make `cleanup_t' a friend.
(segment_t::detach): Make argument non-const. Remove cleanup
object from client if appropriate.
(cleanup_t::_segptr): Remove field.
(cleanup_t::cleanup_t): Initialise parent explicitly. Remove
field.
(cleanup_t::segptr): New method.
(cleanup_t::cleanup): Add error checking and reporting.
(server_shmmgr::shmdt): Make argument non-const.
(server_shmmgr::find (segment_t *)): New method.
2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
* cygserver.cc (client_request_shutdown::client_request_shutdown):
Comment out verbose tracing statement.
* cygserver_client.cc
(client_request_get_version::client_request_get_version): Ditto.
(client_request_attach_tty::client_request_attach_tty): Ditto.
* cygserver_shm.cc (client_request_shm::client_request_shm):
Ditto.
2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
* cygserver_transport_pipes.cc (transport_layer_pipes::listen):
Set `_is_listening_endpoint' appropriately.
2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
* include/cygwin/cygserver_transport.h
(transport_layer_base::listen): Change return type.
(transport_layer_base::connect): Ditto.
* include/cygwin/cygserver_transport_pipes.h
(transport_layer_pipes::listen): Change return type.
(transport_layer_pipes::connect): Ditto.
(transport_layer_pipes::_sec_none_nih): Remove unused field.
(transport_layer_pipes::_is_listening_endpoint): New field.
* cygserver_transport_pipes.cc: Synchronize with sockets code.
(transport_layer_pipes::transport_layer_pipes): Initialise new
field. Separate out asserts.
(transport_layer_pipes::listen): Change return type. Add asserts.
(transport_layer_pipes::accept): Add asserts.
(transport_layer_pipes::read): Change conditional to an assert.
Add assert.
(transport_layer_pipes::write): Ditto.
(transport_layer_pipes::connect): Change return type. Change
conditional to an assert. Add asserts. Rationalize error code
slightly.
(transport_layer_pipes::impersonate_client): Add asserts.
* include/cygwin/cygserver_transport_sockets.h
(transport_layer_sockets::listen): Change return type.
(transport_layer_sockets::connect): Ditto.
(transport_layer_sockets::_addr): Change type of field.
(transport_layer_sockets::_addr_len): Ditto.
(transport_layer_sockets::_is_accepted_endpoint): New field.
(transport_layer_sockets::_is_listening_endpoint): Ditto.
* cygserver_transport_sockets.cc
(MAX_CONNECT_RETRY): New constant.
(transport_layer_sockets::transport_layer_sockets): Initialise new
fields. Only initialise the socket address where necessary.
(transport_layer_sockets::listen): Change return type. Rewrite.
(transport_layer_sockets::accept): Add asserts. Add tracing
statements. Use a local variable to hold the accepted address.
(transport_layer_sockets::close): Add tracing statements. Unlink
the UNIX domain socket file as appropriate. Close the socket
cleanly.
(transport_layer_sockets::read): Rewrite method.
(transport_layer_sockets::write): Ditto.
(transport_layer_sockets::connect): Change return type. Rewrite.
* cygserver.cc (server_submission_loop::request_loop): Run the
listening thread at high priority with special handling for
shutdown.
(main): Print the request error code rather than errno in shutdown
request code. Install signal handlers with sigaction(2) to avoid
setting SA_RESTART. Check value of the listen method call, now it
has one.
* cygserver_client.cc (client_request::make_request): Check new
return value on connect method call.
2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
* include/cygwin/cygserver_transport_pipes.h
(cygserver_transport_pipes::_sd): Rename field.
(cygserver_transport_pipes::_sec_none_nih): Ditto.
(cygserver_transport_pipes::_sec_all_nih): Ditto.
(cygserver_transport_pipes::_pipe_name): Ditto.
(cygserver_transport_pipes::_hPipe): Ditto.
(cygserver_transport_pipes::_is_accepted_endpoint): Ditto.
* cygserver_transport_pipes.cc
(transport_layer_pipes::transport_layer_pipes): Rename fields.
(transport_layer_pipes::init_security): Ditto.
(transport_layer_pipes::listen): Ditto.
(transport_layer_pipes::accept): Ditto.
(transport_layer_pipes::close): Ditto.
(transport_layer_pipes::read): Ditto.
(transport_layer_pipes::write): Ditto.
(transport_layer_pipes::connect): Ditto.
(transport_layer_pipes::impersonate_client): Ditto.
(transport_layer_pipes::revert_to_self): Ditto.
* include/cygwin/cygserver_transport_sockets.h
(cygserver_transport_sockets::_fd): Rename field.
(cygserver_transport_sockets::_addr): Ditto.
(cygserver_transport_sockets::_addr_len): Ditto.
* cygserver_transport_sockets.cc
(transport_layer_sockets::transport_layer_sockets): Rename fields.
(transport_layer_sockets::listen): Ditto.
(transport_layer_sockets::accept): Ditto.
(transport_layer_sockets::close): Ditto.
(transport_layer_sockets::read): Ditto.
(transport_layer_sockets::write): Ditto.
(transport_layer_sockets::connect): Ditto.
2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
* cygserver_shm.cc (with_strerr): Fix use of %p format.
* shm.cc (client_shmmgr::shmat): Ditto.
(client_shmmgr::shmctl): Ditto.
(client_shmmgr::shmdt): Ditto.
(client_shmmgr::attach): Ditto.
2002-09-22 Christopher Faylor <cgf@redhat.com>
* woutsup.h (system_printf): Remove extraneous semicolon from macro
definition.
2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
* cygserver_transport_pipes.cc
(transport_layer_pipes::connect): Use ProtectHandle in DLL code.
(transport_layer_pipes::close): Use ForceCloseHandle in DLL code.
2002-09-22 Nicholas Wourms <nwourms@netscape.com>
* threaded_queue.h (class queue_submission_loop): Correct friend
declaration for GCC 3.1.1.
* include/cygwin/cygserver_process.h (class process): Ditto.
(class process_cache): Ditto.
2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
* cygserver_shm.cc (server_shmmgr::shmdt): Only call
delete_segment if the segment exists [sic].
2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
* safe_memory.h: Include <new> rather than <new.h> for gcc 3.
2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
* safe_memory.h: New file extracted from "woutsup.h".
* woutsup.h: Move the "safe" new/delete macros into the new
"safe_memory.h" header file and include that here.
* cygserver_client.cc: Explicitly include "safe_memory.h" for
client-side code.
(client_request::make_request): Use the "safe" new/delete macros
unconditionally, i.e. use them on the client side as well as on
the server side.
* cygserver_transport.cc: Explicitly include "safe_memory.h" for
client-side code.
(create_server_transport): Use the "safe" new/delete macros
unconditionally, i.e. use them on the client side as well as on
the server side.
* shm.cc: Include "safe_memory.h".
(client_shmmgr::instance): Use the "safe" new/delete macros.
(client_shmmgr::shmdt): Ditto.
(client_shmmgr::new_segment): Ditto.
2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
* cygserver_process (process::process): Add the client's cygpid
and winpid to all tracing statements as appropriate.
(process::exit_code): Ditto.
(process_cache::check_and_remove_process): Ditto.
* cygserver_shm.cc (server_shmmgr::shmat): Ditto.
(server_shmmgr::shmdt): Ditto.
(server_shmmgr::shmctl): Add a process object argument and remove
the explicit cygpid argument. Add the client's cygpid and winpid
to all tracing statements as appropriate.
(server_shmmgr::shmget): Ditto.
(client_request_shm::serve): Update for the new signature of the
shmctl and shmget methods.
2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
* cygserver.cc (client_request_shutdown::serve): Don't set the
shutdown flag directly, but send a SIGINT, as the signal handler
sets the flag and the signal breaks the pause(2) in the main loop.
(print_usage): Add new options.
(main): Add new --cleanup-threads and --request-threads options to
set the number of threads used by the daemon. Use pause(2) rather
the win32 Sleep in the main loop.
* shm.cc (shmat): Add sigframe.
(shmctl): Ditto.
(shmdt): Ditto.
(shmget): Ditto.
2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
* cygserver_shm.cc: Automatically detach processes from any
segments they are attached to at exit.
(class server_shmmgr::attach_t): New class.
(server_shmmgr::segment_t::IS_DELETED): Rename and make private.
(server_shmmgr::segment_t::_sequence): Make private.
(server_shmmgr::segment_t::_flg): Ditto.
(server_shmmgr::segment_t::_hFileMap): Ditto.
(server_shmmgr::segment_t::_attach_head): New private field.
(server_shmmgr::segment_t::segment_t): Initialise new fields.
Make non-inline.
(server_shmmgr::segment_t::~segment_t): New method.
(server_shmmgr::segment_t::is_deleted): Ditto.
(server_shmmgr::segment_t::is_pending_delete): Ditto.
(server_shmmgr::segment_t::mark_deleted): Ditto.
(server_shmmgr::segment_t::attach): Ditto.
(server_shmmgr::segment_t::detach): Ditto.
(server_shmmgr::segment_t::find): Ditto.
(class server_shmmgr::cleanup_t): New class.
(server_shmmgr::_shm_atts): New private field.
(server_shmmgr::shmat): Add a process object argument to replace
the removed process_cache, cygpid and winpid arguments. Remove
the process_cache manipulations. Move body of code to the
segment_t::attach method. Increment _shm_atts when required.
Update tracing statements.
(server_shmmgr::shmdt): Add a process object argument to replace
the removed cygpid argument. Move body of code to the
segment_t::detach method. Decrement _shm_atts when required.
Update tracing statements.
(server_shmmgr::shmget): Use the new segment_t::is_deleted method.
(server_shmmgr::server_shmmgr): Initialise the new _shm_atts
field.
(server_shmmgr::delete_segment): Remove the CloseHandle code, as
this is now done in the segment_t destructor.
(client_request_shm::serve): Look up the client's process object
and pass to the server_shmmgr::shmat and server_shmmgr::shmdt
methods rather than passing the cache, winpid and cygpid.
* cygserver_process.h: Add a cygpid to the process object to make
it more useful and then pass process objects rather than winpids
where possible.
(cleanup_routine::cleanup): Change argument to be a pointer to a
process object.
(class process): Re-order fields for no discernible reason.
(process::_cygpid): New field.
(process::process): Add a cygpid argument.
(process::winpid): New method.
(process::cygpid): Ditto.
(process::add): Make public, as it always should have been.
(process_cache::process): Add a cygpid argument.
* cygserver_process.cc (process::process): Add a cygpid argument
and use it to initialise the `_cygpid' field. Re-order
initialisers to match new field order.
(process::cleanup): Pass `this' rather than just the winpid to
cleanup_routine::cleanup.
(process_cache::process): Add a cygpid argument and pass it to the
process object constructor.
* include/sys/shm.h (shmatt_t): Make unsigned as per SUSv3.
(shm_info::shm_atts): New field.
2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
* cygserver_shm.cc (class server_shmmgr::segment_t): Add `_'
prefix to the names of all fields.
2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
* msg.cc: New file of stub functions, no functionality.
* sem.cc: Ditto.
* shm.cc (client_shmmgr::shmctl): Add support for an out shm_info
buffer for the SHM_INFO command.
(client_shmmgr::shmget): Use %X to print keys.
* include/sys/ipc.h: Comment all fields and values.
(IPC_PRIVATE): Change to be non-negative.
* include/sys/msg.h: New file with SUSv3 and ipcs(8) interfaces.
* include/sys/sem.h: Ditto.
* include/sys/shm.h: Comment all fields and values.
(struct shm_info): New struct.
* cygserver_shm.h (client_request_shm::shminfo): Rename.
(client_request_shm::shm_info): New method.
(client_request_shm::_parameters.out.hFileMap): Move into union.
(client_request_shm::_parameters.out.shminfo): Rename.
(client_request_shm::_parameters.out.shm_info): New field.
* cygserver_shm.cc (server_shmmgr::_shm_ids): Rename.
(server_shmmgr::_shm_tot): New field.
(server_shmmgr::shmctl): Rename `out_shminfo' argument. Add
`out_shm_info' argument. Fill in the `out_shm_info' argument in
the SHM_INFO command.
(server_shmmgr::shmget): Check `shmflg' against the mode of
existing segments as per Stevens 1990, p. 123.
(server_shmmgr::server_shmmgr): Initialise the new `_shm_tot'
field.
(server_shmmgr::new_segment): Set ENOMEM if CreateFileMapping
fails. Pass `size' to new_segment.
(server_shmmgr::new_segment): Add size argument and use it to
check against and update the new `_shm_tot' field.
(server_shmmgr::delete_segment): Update the new `_shm_tot' field.
* Makefile.in (DLL_OFILES): Add new DLL object files.
2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
* cygserver_transport_pipes.cc: The main change is to make the
client try harder to connect to the server if it's previously
connected, and so has good grounds for believing that the server
is running.
(MAX_WAIT_NAMED_PIPE_RETRY): Change to be an enumerator.
(WAIT_NAMED_PIPE_TIMEOUT): Ditto.
(transport_layer_pipes::accept): Use interlocked operators on
`pipe_instance'.
(transport_layer_pipes::close): Rearrange so that FlushFileBuffers
and DisconnectNamedPipe are only called for accepted endpoints.
Use interlocked operators on `pipe_instance'.
(transport_layer_pipes::read): Use set_errno where required.
(transport_layer_pipes::write): Ditto.
(transport_layer_pipes::connect): Add local static variable
`assume_cygserver'. Set it if a connection is made to cygserver,
clear it if a connection is not made even after retrying. If set,
ignore all errors from CreateFile and retry the connection. Catch
the situation where WaitNamedPipe fails to wait [sic] and add a
`Sleep (0)' so that the server gets a chance to run.
2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
* dcrt0.cc: Only check for cygserver if and when required.
(dll_crt0_1): Remove call to `cygserver_init ()'.
* fhandler_tty.cc (fhandler_tty_slave::open): Change the cygserver
logic to allow for the fact that `cygserver_init ()' may not yet
have been called.
(fhandler_tty_slave::cygserver_attach_tty): Tweak the cygserver
request logic to conform to the practice elsewhere in the code.
* tty.cc (tty::common_init): Add an explicit call to
`cygserver_init ()' if it hasn't already been called.
* include/cygwin/cygserver.h (CYGSERVER_UNAVAIL): Rename from
`CYGSERVER_DEAD'.
(client_request_get_version::check_version): Make available in
cygserver as well the DLL.
(check_cygserver_available): Ditto. Remove `check_version_too'
argument.
(cygserver_init): Ditto. And likewise.
* cygserver_client.cc (client_request_get_version::check_version):
Make available in cygserver as well the DLL.
(client_request::make_request): This may now be called without
`cygserver_init ()' having been called first. Detect this and
call it as required. Add tracing.
(check_cygserver_available): Make available in cygserver as well
the DLL. Remove `check_version_too' argument and always check the
version information. And since this is called from within
`cygserver_init ()', force `cygserver_running' before calling
`client_request::make_request ()'.
(cygserver_init): Make available in cygserver as well the DLL.
Remove `check_version_too' argument.
2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
* cygserver_shm.cc: Implement the ipcs(8) interfaces, IPC_INFO,
SHM_STAT and SHM_INFO.
(server_shmmgr::segment_t::sequence): New static field.
(server_shmmgr::segment_t::key): Remove field, use the new
ds.shm_perm.key field instead.
(server_shmmgr::segment_t::shmid): Remove field.
(server_shmmgr::segment_t::intid): New field.
(server_shmmgr::segment_t::segment_t): Use the `key' argument to
initialise `ds.shm_perm.key'. Change from using `shmid' to
`intid'.
(server_shmmgr::_shmseg_cnt): Renamed from `_shmid_cnt'.
(server_shmmgr::_intid_max): Renamed from `_shmid_max.
(server_shmmgr::shmat): Move the out arguments to the start of the
argument list. Rename the `pid' argument as `cygpid'. Add
tracing. Pass an intid to `find ()', not a shmid.
(server_shmmgr::shmctl): Add separate out arguments. Rename the
`pid' argument as `cygpid'. Add support for the ipcs(8)
interfaces. Add tracing. Pass an intid to `find ()', not a
shmid.
(server_shmmgr::shmdt): Rename the `pid' argument as `cygpid'.
Add tracing. Pass an intid to `find ()', not a shmid.
(server_shmmgr::shmget): Add a separate out arguments. Rename the
`pid' argument as `cygpid'. Add tracing.
(server_shmmgr::server_shmmgr): Update for new field names.
(server_shmmgr::find_by_key): Update for the new `ds.shm_perm.key'
field.
(server_shmmgr::find): Update to use the new `segment_t::intid'
field.
(server_shmmgr::new_segment): Rename the `pid' argument as
`cygpid'. Check that the requested size is within bounds. Handle
new error result from `new_segment (key, HANDLE)'.
(server_shmmgr::new_segment): Work with intids, not shmids. Check
that the new intid is within bounds. Update for new field names.
(server_shmmgr::delete_segment): Pass an intid to `find ()', not a
shmid. Update for new field names.
(client_request_shm::serve): Check that the incoming message
length is the size of the `_parameters.in' struct, not of the
whole in/out parameter union. Likewise, set the outgoing message
length to the size of the `_parameters.out' struct. Update for
the new server_shmmgr interfaces.
* include/sys/ipc.h (ipc_perm::key): New field.
* include/sys/shm.h (SHM_INFO): New constant.
* cygserver_ipc.h (IPCMNI): New constant.
(ipc_int2ext): Add `sequence' argument and munge this into the
external ipc id.
(ipc_ext2int_subsys): Unmunge the sequence number from the
external ipc id.
(ipc_ext2int): Ditto.
(ipc_inc_id): Remove.
(ipc_dec_id): Remove.
* cygserver_shm.h (SHMMAX): New constant.
(SHMMIN): Ditto.
(SHMMNI): Ditto.
(SHMSEG): Ditto.
(SHMALL): Ditto.
(client_request_shm::_parameters): Re-arrange as a union of two
separate structs, one for in arguments, the other for out.
(client_request_shm::shmid): Update for the new parameter layout.
(client_request_shm::ds): Ditto.
(client_request_shm::info): New method.
* shm.cc (client_shmmgr::_shmat_cnt): New static field.
(client_shmmgr::shmat): Add locking. Add tracing.
(client_shmmgr::shmctl): Update for ipcs(8) commands. Add
tracing. Add more argument checking.
(client_shmmgr::shmdt): Add locking. Add tracing. Update the new
`_shmat_cnt' field.
(client_shmmgr::shmget): Add tracing.
(client_shmmgr::fixup_shms_after_fork): Add tracing. Add
consistency checking.
(client_shmmgr::attach): Add more tracing.
(client_shmmgr::new_segment): Update the new `_shmat_cnt' field.
(client_request_shm::client_request_shm): Update for the new
parameter layout. Set the outgoing message length to the size of
the `_parameters.in' struct, not of the whole in/out parameter
union.
2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
* shm.cc: Remove the use of a static client_shmmgr object.
(client_shmmgr::_instance): New static variable.
(client_shmmgr::instance): Allocate a new shmmgr on the heap,
rather than using a local static object.
2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
* cygserver_transport.cc (create_server_transport): Fix
cut-and-paste error.
2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
* cygserver_client.cc (client_request::handle_request): Don't
bother with the client request activity marker when compiled with
debugging output.
2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
* cygserver_transport_pipes.cc
(MAX_WAIT_NAMED_PIPE_RETRY): New constant.
(WAIT_NAMED_PIPE_TIMEOUT): Ditto.
(transport_layer_pipes::close): The `pipe' field is now either
NULL or a valid handle, and it should never have the value
`INVALID_HANDLE_VALUE'.
(transport_layer_pipes::read): Ditto.
(transport_layer_pipes::write): Ditto.
(transport_layer_pipes::connect): Ditto.
(transport_layer_pipes::impersonate_client): Ditto.
(transport_layer_pipes::connect): Ditto. New, but still bogus,
retry logic.
2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
* cygserver_shm.cc (server_shmmgr::server_shmmgr): All fields have
to be initialized now that the singleton is no longer static.
2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
* cygserver_shm.cc (server_shmmgr::_instance): New static field.
(server_shmmgr::_instance_once): Ditto.
(server_shmmgr::initialise_instance): New static method.
(server_shmmgr::instance): Use a pthread_once_t rather than
relying on a local static variable.
2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
* woutsup.h: Remove all uses of the C++ new and delete operators
throughout cygserver until they are fully thread-safe.
(safe_new0): New macro to replace the C++ new operator.
(safe_new): Ditto.
(safe_delete): New macro to replace the C++ delete operator.
* cygserver_client.cc (client_request::handle_request): Replace
all uses of the C++ new and delete operators with the new macros
from "woutsup.h".
(client_request::make_request): Ditto.
* cygserver_process.cc (~process_cleanup): Ditto.
(process::cleanup): Ditto.
(process_cache::process): Ditto.
(process_cache::check_and_remove_process): Ditto.
* cygserver_shm.cc (server_shmmgr::new_segment): Ditto.
(server_shmmgr::delete_segment): Ditto.
* cygserver_transport.cc (create_server_transport): Ditto.
* cygserver_transport_pipes.cc
(transport_layer_pipes::accept): Ditto.
* cygserver_transport_sockets.cc
(transport_layer_sockets::accept): Ditto.
* threaded_queue.cc (~threaded_queue): Ditto.
(threaded_queue::worker_loop): Ditto.
(threaded_queue::stop): Replace sleep(3) with win32 Sleep.
* cygserver.cc (~server_request): Replace all uses of the C++ new
and delete operators with the new macros from "woutsup.h".
(server_submission_loop::request_loop): Ditto.
(main): Ditto. Replace sleep(3) with win32 Sleep. Replace
iostreams with FILEs.
(print_usage): Replace iostreams with FILEs.
(print_version): Ditto.
2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
* cygserver_transport_sockets.cc
(transport_layer_sockets::accept): Rename local variable
`accept_fd' to avoid shadowing the `fd' field.
2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
* cygwin_ipc.h: Moved (back) to "include/sys/ipc.h".
* cygwin_shm.h: Moved (back) to "include/sys/shm.h".
* include/sys/ipc.h: New file.
* include/sys/shm.h: New file.
* cygserver_shm.h: Update for new header file locations.
* ipc.cc: Ditto.
2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
* cygserver_client.cc (client_request::make_request): Comment out
a verbose tracing statement.
* cygserver_process.cc (process_cache::sync_wait_array): Fix
broken assert.
* include/cygwin/cygserver.h (class client_request): Remove excess
use of `class' qualifier in declarations.
(class client_request_get_version): Ditto.
(class client_request_shutdown): Ditto.
(class client_request_attach_tty): Ditto.
2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
* cygserver_ipc.h: New file.
* cygserver_shm.h: Re-written from scratch.
* cygserver_shm.cc: Ditto.
* shm.cc: Ditto.
2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
* threaded_queue.h (class queue_request): Re-write.
(threaded_queue_thread_function): Remove.
(class queue_process_param): Remove.
(class threaded_queue): Re-write.
(class queue_submission_loop): New version of the old
`queue_process_param' class.
(TInterlockedExchangePointer): New templated function.
(TInterlockedCompareExchangePointer): Ditto.
* threaded_queue.cc (worker_function): Remove.
(class threaded_queue): Re-write.
(class queue_process_param): Remove.
(class queue_submission_loop): New version of the old
`queue_process_param' class.
* include/cygwin/cygserver_process.h (process_cleanup): Re-write.
(class process_process_param): Remove.
(class cleanup_routine): Re-write.
(class process): Re-write.
(class process_cache): Re-write.
* cygserver_process.cc (process_cleanup): Re-write.
(class process_process_param): Remove.
(class cleanup_routine): Re-write.
(class process): Re-write.
(class process_cache): Re-write.
* cygserver.cc (request_count): Remove unused variable.
(class server_request): Move methods inline.
(class server_process_param): Remove.
(class server_request_queue): Remove.
(request_queue): Move into `main ()' and change type to
`threaded_queue'.
(request_loop): Remove.
(class server_submission_loop): New version of the old
`server_process_param' class.
(shutdown_server): New variable.
(client_request_shutdown::serve): Set `shutdown_server' to trigger
shutdown.
(handle_signal): Ditto.
(main): Install signal handler for SIGINT rather than SIGQUIT.
Use new interfaces for the `request_queue' and the `cache'.
Create a `server_submission_loop' and add to the `request_queue'.
Add check for the `shutdown_server' variable to the main loop.
* cygserver_shm.cc (client_request_shm::serve): Release the
process object after use.
2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
* cygserver_client.cc (client_request::handle_request): Correct
tracing statement.
* cygserver_transport_pipes.cc: Remove local definition of
FILE_FLAG_FIRST_PIPE_INSTANCE constant.
* cygwin_ipc.h: Update copyright notice.
* cygwin_shm.h: Ditto.
* woutsup.h: Add definition of _WIN32_WINNT.
2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
* cygserver_client (client_request::make_request): Replace my
inappropriate use of set_errno () with error_code () throughout.
2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
* include/cygwin/cygserver.h: Add forward declarations of class
transport_layer_base and class process_cache to reduce
dependencies between header files.
* include/cygwin/cygserver_process.h: Add include of
"threaded_queue.h".
* cygserver.cc: Remove unnecessary cygserver header files.
* cygserver_client.cc: Ditto.
* cygserver_process.cc: Ditto.
* cygserver_shm.cc: Ditto.
* cygserver_shm.h: Ditto.
* cygserver_transport_pipes.cc: Ditto.
* dcrt0.cc: Ditto.
* fhandler_tty.cc: Ditto.
* tty.cc: Ditto.
2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
* cygserver_shm.h: Replace <sys/shm.h> with "cygwin_shm.h" after
merge from HEAD.
* cygwin_ipc.h: Update with changes to include/sys/ipc.h lost in
merge from HEAD.
* cygwin_shm.h: Ditto.
2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
* cygserver.cc: The tests for a duplicate server instance are now
the responsibility of the transport layer.
(request_loop): Use new `recoverable' flag in call to
`cygserver_transport::accept ()' and shutdown on an unrecoverable
error.
(main): Never call `cygserver_init ()'. Fake `cygserver_running'
just for sending a shutdown request.
* cygserver_client.cc (client_request::send): Comment out
message-size tracing statements as verbose.
(client_request::handle): Ditto.
(client_request_get_version::check_version): #ifdef as DLL-only.
(check_cygserver_available): Ditto.
(cygserver_init): Ditto.
* include/cygwin/cygserver.h
(client_request_get_version::check_version): #ifdef as DLL-only.
(check_cygserver_available): Ditto.
(cygserver_init): Ditto.
* include/cygwin/cygserver_transport.h
(transport_layer_base::impersonate_client): #ifdef as
cygserver-only.
(transport_layer_base::revert_to_self): Ditto.
(transport_layer_base::listen): Ditto.
(transport_layer_base::accept): Ditto. Add a `recoverable' out
flag for error handling.
* include/cygwin/cygserver_transport_sockets.h: Ditto.
* include/cygwin/cygserver_transport_pipes.h: Ditto.
(transport_layer_pipes): Change type of the `pipe_name' field.
Remove the `inited' field, as unnecessary. Add new
`is_accepted_endpoint' field.
* include/cygwin/cygserver_transport.cc
(transport_layer_base::impersonate_client): #ifdef as
cygserver-only.
(transport_layer_base::revert_to_self): Ditto.
* include/cygwin/cygserver_transport_sockets.cc
(transport_layer_sockets::listen): #ifdef as cygserver-only.
(transport_layer_sockets::accept): #ifdef as cygserver-only.
Analyse any errno from `accept ()' and set `recoverable' as
appropriate.
* cygserver_transport_pipes.cc: Add local #define of
`FILE_FLAG_FIRST_PIPE_INSTANCE'.
(pipe_instance_lock_once): New variable.
(pipe_instance_lock): Ditto.
(pipe_instance): Ditto.
(initialise_pipe_instance_lock): New function.
(transport_layer_pipes::transport_layer_pipes): Change
initialization of `pipe_name'. Initialize `is_accepted_endpoint'
as appropriate. Remove use of `inited'.
(transport_layer_pipes::impersonate_client): #ifdef as
cygserver-only.
(transport_layer_pipes::revert_to_self): Ditto.
(transport_layer_pipes::listen): Ditto.
(transport_layer_pipes::accept): Ditto. Keep track of how often
many named pipes have been created, in the `pipe_instance'
variable, and pass the `FILE_FLAG_FIRST_PIPE_INSTANCE' flag on the
open of the first instance. Analyse the error code from
`CreateNamedPipe ()' and set the `recoverable' flag as
appropriate.
(transport_layer_pipes::close): Update the `pipe_instance' count.
2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
* woutsup.h (cygserver_running): Add declaration.
(api_fatal): Eliminate.
* include/cygwin/cygserver.h
(client_request_get_version::check_version): Change return type to
bool.
(check_cygserver_available): New function.
(cygserver_init): Add check_version_too argument.
* cygserver_client.cc (allow_daemon): Make a bool.
(client_request_get_version::make_request): See errno on error.
Remove special case for CYGSERVER_REQUEST_GET_VERSION; this is now
handled in cygserver_init().
(client_request_get_version::check_version): Use syscall_printf()
instead of api_fatal(). Return true if cygserver version is
compatible.
(check_cygserver_available): New function; code moved here from
cygserver_init().
(cygserver_init): Move some code into check_cygserver_available().
* cygserver.cc (__set_errno): Copy from debug.cc so that
set_errno() can be used when __OUTSIDE_CYGWIN__.
(main): Call cygserver_init() to set up cygserver_running and add
checks against this to (try and) prevent multiple copies of
cygserver running simultaneously. Remember to delete all
transport connections so that (one day) the transport classes can
tidy up on cygserver shutdown.
2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
* cygserver.cc (main): Adjust tracing output for a cleaner display
when compiled without --enable-debugging.
* threaded_queue.cc (threaded_queue::cleanup): Ditto.
(queue_process_param::stop): Ditto.
* include/cygwin/cygserver.h
(client_request::make_request): Make non-virtual.
(client_request::send): Make virtual and protected, not private.
(client_request_attach_tty::send): New virtual method.
* cygserver_client.cc: Use the `msglen()' accessor rather than
`_header.msglen' throughout.
(client_request_attach_tty::send): New method.
(client_request::make_request): Remove the explicit close of
`transport' as it is closed on deletion.
2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
* include/cygwin/cygserver.h: Change the client_request classes to
give greater encapsulation and to allow variable length requests
and replies.
(enum cygserver_request_code): Now client_request::request_code_t.
(class request_header): Now client_request::header_t. Make a
union of the request_code and the error_code. The `cb' field,
which was the buffer length, is now the `size_t msglen' field.
(struct request_get_version): Now
client_request_get_version::request_get_version.
(struct request_shutdown): Remove unused type.
(struct request_attach_tty): Now
client_request_attach_tty::request_attach_tty.
(client_request::_buf): Make field const.
(client_request::_buflen): New const private field.
(client_request::request_code): New accessor.
(client_request::error_code): Ditto.
(client_request::msglen): Ditto.
(client_request::handle_request): New static method.
(client_request::make_request): New virtual method.
(client_request::handle): New method.
(client_request::send): Make private.
(client_request_get_version::check_version): New method.
(client_request_get_version::serve): Make private.
(client_request_get_version::version): Ditto.
(client_request_shutdown::serve): Ditto.
(client_request_attach_tty::req): Ditto.
(client_request_attach_tty::serve): Ditto.
(client_request_attach_tty::from_master): Make method const.
(client_request_attach_tty::from_master): Ditto.
* cygserver_client.cc
(client_request_get_version::client_request_get_version): Track
changes to the client_request classes.
(client_request_attach_tty::client_request_attach_tty): Ditto.
(client_request_get_version::check_version): New method to
encapsulate code from cygserver_init().
(client_request_shutdown::client_request_shutdown): Move into
"cygserver.cc".
(client_request::send): Track changes to the client_request
classes. Add more error checking.
(client_request::handle_request): New static method containing the
first half of the old server_request::process() code.
(client_request::make_request): New method to replace the old
cygserver_request() function.
(client_request::handle): New method containing the second half of
the old server_request::process() code.
(cygserver_init): Track changes to the client_request classes. In
particular, some code moved into the
client_request_get_version::check_version() method.
* cygserver.cc (client_request_attach_tty::serve): Track changes
to the client_request classes. In particular, only return a reply
body if some handles are successfully duplicated for the client.
And remove goto's.
(client_request_get_version::serve): Track changes to the
client_request classes.
(client_request_shutdown::serve): Ditto.
(class client_request_invalid): Dead, and so young too.
(server_request::request_buffer): Remove unnecessary field.
(client_request_shutdown::client_request_shutdown): Moved here
from "cygserver_client.cc".
(server_request::process): Implementation moved into the new
client_request::handle_request() and client_request::handle()
methods.
* cygserver_shm.h (class client_request_shm): Put client- and
server-specific interfaces inside #ifdef/#ifndef __INSIDE_CYGWIN__
guards.
(client_request_shm::serve): Make private.
* cygserver_shm.cc
(client_request_shm::client_request_shm): Track changes to the
client_request classes.
(client_request_shm::serve): Ditto
* shm.cc (client_request_shm::client_request_shm): Ditto. Use
alloc_sd() rather than set_security_attribute() to get access to
the SECURITY_DESCRIPTOR length, so that we can use it to set the
request body length.
(shmat): Track changes to the client_request classes. In
particular, allocate client_request objects on the stack rather
than on the heap, and use the client_request::make_request()
method rather than the old cygserver_request() function.
(shmdt): Ditto.
(shmctl): Ditto.
(shmget): Ditto.
* fhandler_tty.cc (fhandler_tty_slave::cygserver_attach_tty): Ditto.
2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
* include/cygwin/cygserver_transport.h
(cygserver_transport::read): Change buffer type to void *.
(cygserver_transport::write): Ditto.
* include/cygwin/cygserver_transport_sockets.h
(cygserver_transport_sockets::read): Ditto.
(cygserver_transport_sockets::write): Ditto.
* include/cygwin/cygserver_transport_pipes.h
(cygserver_transport_pipes::read): Ditto.
(cygserver_transport_pipes::write): Ditto.
* cygserver_transport_sockets.cc
(cygserver_transport_sockets::read): Ditto.
(cygserver_transport_sockets::write): Ditto.
* cygserver_transport_pipes.cc
(cygserver_transport_pipes::read): Ditto. Set errno on error, to
match behaviour of cygserver_transport_sockets class.
(cygserver_transport_pipes::write): Ditto.
2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
* cygserver.cc (version): New static variable.
(server_request_queue::add_connection): Remove my gratuitous use
of studly caps.
(setup_privileges): Declare static.
(handle_signal): Ditto.
(longopts): Make a local variable of main().
(opts): Ditto.
(print_usage): New function.
(print_version): Ditto (tip of the hat to Joshua Daniel Franklin
for inspiration here).
(main): More argument checking. Add --help and --version options.
2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
* include/cygwin/cygserver.h (client_request::serve): Make pure
virtual.
* cygserver.cc (client_request::serve): Remove definition of pure
virtual method.
(class client_request_invalid): New class.
(server_request::process): Use new client_request_invalid
class. And remove goto's.
2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
* cygserver.cc (class server_request): Add virtual destructor.
(server_request_queue::addConnection): New method to replace bad
virtual add() method.
(request_loop): Replace call to queue->add() with call to
queue->addConnection().
(server_request::server_request): Use field initialization.
(server_request::~server_request): New virtual destructor.
(server_request::process): Remove close and delete of
transport_layer_base object. It is deleted by the server_request's
own destructor and closed by its own destructor.
* include/cygwin/cygserver.h
(client_request::operator request_header): Remove unused method.
* cygserver_client.cc: Ditto.
* include/cygwin/cygserver_process.h
(class cleanup_routine): Add virtual destructor.
(cleanup_routine::cleanup): Make pure virtual.
(class process_cache): Make destructor non-virtual.
(process_cache::add): Ditto.
* cygserver_process.cc
(cleanup_routine::~cleanup_routine): New virtual destructor.
* include/cygwin/cygserver_transport.h
(class transport_layer_base): Add virtual destructor.
* cygserver_transport.cc
(transport_layer_base::~transport_layer_base): New virtual
destructor.
* include/cygwin/cygserver_transport_pipes.h
(class transport_layer_pipes): Add virtual destructor.
* cygserver_transport_pipes.cc
(transport_layer_pipes::~transport_layer_pipes): New virtual
destructor.
(transport_layer_pipes::close): Null out handle after closing.
* include/cygwin/cygserver_transport_sockets.h
(class transport_layer_sockets): Add virtual destructor.
* cygserver_transport_sockets.cc
(transport_layer_sockets::~transport_layer_sockets): New virtual
destructor.
(transport_layer_sockets::close): Null out fd after closing.
* threaded_queue.h (class queue_request): Add virtual destructor.
(queue_request::process): Make pure virtual.
* threaded_queue.cc (~queue_request): New virtual destructor.
(queue_request::process): Remove definition of pure virtual
method.
2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
* include/cygwin/cygserver.h (client_request::send): Make
non-virtual.
(class client_request_attach_tty): Put client- and server-specific
interfaces inside #ifdef/#ifndef __INSIDE_CYGWIN__ guards.
* cygserver_client.cc: Ditto.
(cygserver_init): Fix error handling.
2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
* cygserver.cc: Throughout the code, check and correct level of
the XXX_printf() functions used. Comment out several of the
debug_printf() calls with "// verbose:". Reformat and correct
typos of some of the XXX_printf() formats.
* cygserver_process.cc: Ditto.
* cygserver_shm.cc: Ditto.
* cygserver_transport_pipes.cc: Ditto.
* cygserver_transport_sockets.cc: Ditto.
* shm.cc (hi_ulong): New function to allow printing of a 64-bit
key with current small_printf implementation.
(lo_ulong): Ditto.
(client_request_shm::client_request_shm): Use hi_ulong() and
lo_ulong() in call to debug_printf().
2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
* cygserver_shm.cc: Remove #define __INSIDE_CYGWIN__ from around
<sys/shm.h> as it no longer contains any internal code.
2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
* include/sys/ipc.h (IPC_PRIVATE): Add cast to key_t.
(IPC_INFO): New flag for ipcs(8).
(IPC_RMID IPC_SET IPC_STAT): Renumber.
* include/sys/shm.h (SHM_RDONLY SHM_RND): Renumber with distinct
values [sic].
(class _shmattach): Internal type moved to "cygserver_shm.h".
(class shmnode): Ditto.
(class shmid_ds): Ditto.
(struct shmid_ds): Add spare fields.
(struct shminfo): New type for IPC_INFO interface.
* cygserver_shm.h: Remove obsolete #if 0 ... #endif block.
(class shm_cleanup): Remove unused class.
(struct _shmattach): Internal type moved from <sys/shm.h>.
(struct shmnode): Ditto.
(struct int_shmid_ds): Ditto. Renamed to avoid name clash with
public interface struct shmid_ds. Use the shmid_bs structure as a
field.
* cygserver_shm.cc: Remove obsolete #if 0 ... #endif block.
(client_request_shm::serve): Update for redefinition of
int_shmid_ds structure.
* shm.cc (build_inprocess_shmds): Ditto.
(fixup_shms_after_fork): Ditto.
(shmctl): Ditto.
(shmget): Ditto. Remove obsolete #if 0 ... #endif code.
2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
* include/cygwin/cygserver_transport.h
(transport_layer_base::transport_layer_base): Remove since it is
now redundant.
(transport_layer_base::listen): Make a pure virtual method.
(transport_layer_base::accept): Ditto.
(transport_layer_base::close): Ditto.
(transport_layer_base::read): Ditto.
(transport_layer_base::write): Ditto.
(transport_layer_base::connect): Ditto.
* cygserver_transport.cc
(transport_layer_base::transport_layer_base): Remove since it is
now redundant.
(transport_layer_base::listen): Remove since it is now a pure
virtual method.
(transport_layer_base::accept): Ditto.
(transport_layer_base::close): Ditto.
(transport_layer_base::read): Ditto.
(transport_layer_base::write): Ditto.
(transport_layer_base::connect): Ditto.
2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
* cygserver.cc (check_and_dup_handle): Only use security code if
running on NT, i.e. if wincap.has_security().
(client_request_attach_tty::serve): Add check for has_security().
* cygserver_process.cc (process_cache::process): Use DWORD winpid
throughout to avoid win32 vs. cygwin pid confusion.
(process::process): Ditto.
* cygserver_shm.cc (client_request_shm::serve): Only use security
code if running on NT, i.e. if wincap.has_security().
* cygserver_shm.h (client_request_shm::parameters.in): Replace the
ambiguous pid field with cygpid and winpid fields.
(client_request_shm::client_request_shm): Reduce to only two
client-side constructors: one for SHM_CREATE, another for all the
other requests.
* shm.cc (client_request_shm::client_request_shm):
Ditto. Initialize cygpid and winpid fields here. On NT initialize
sd_buf here using set_security_attribute() to make use of the euid
and egid.
(shmat): Use new client_request_shm constructor.
(shmdt): Ditto.
(shmctl): Ditto.
(shmget): Ditto. Remove security code, now performed in the
relevant client_request_shm constructor.
* include/cygwin/cygserver_process.h: (class cleanup_routine):
Change winpid type to DWORD.
(class process): Ditto.
2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
* woutsup.h: New file.
* cygserver.cc: Use "woutsup.h" and new XXX_printf macros.
(getfunc): New function, copied verbatim from "strace.cc".
(__cygserver__printf): New function.
* cygserver_client.cc: Use "woutsup.h" and new XXX_printf macros.
* cygserver_process.cc: Ditto.
* cygserver_shm.cc: Ditto.
* cygserver_transport.cc: Ditto.
* cygserver_transport_pipes.cc: Ditto.
* cygserver_transport_sockets.cc: Ditto.
* threaded_queue.cc: Ditto.
* shm.cc: Remove trailing \n from XXX_printf format strings.
* Makefile.in: Remove special __OUTSIDE_CYGWIN__ case for
cygserver_shm.cc.
2002-09-21 Christopher Faylor <cgf@redhat.com>
* init.cc (dll_entry): Temporarily disable thread detach code.
2002-09-21 Christopher Faylor <cgf@redhat.com>
* fhandler.cc (fhandler_base::dup): Don't set handle on failure.
Caller has already taken care of that.
* fhandler_console.cc (fhandler_console::open): Initialize handles to
NULL.
(fhandler_console::close): Ditto.
2002-09-21 Christopher Faylor <cgf@redhat.com>
GNUify non-GNU formatted functions calls throughout.
2002-09-21 Conrad Scott <conrad.scott@dsl.pipex.com>
* cygwin_ipc.h: Move to "include/cygwin/ipc.h".
* cygwin_shm.h: Move to "include/cygwin/shm.h".
* include/cygwin/ipc.h: New file.
* include/cygwin/shm.h: New file.
* ipc.c:c Update <cygwin/ipc.h> include.
* cygserver_shm.cc: Update <cygwin/shm.h> include.
* shm.cc: Ditto.
2002-09-21 Robert Collins <rbtcollins@hotmail.com>
* pthread.cc: Use class::call for converted pthread and semaphore
calls.
* thread.cc: Convert various __pthread_call and __sem_call to
pthread::call and sem::call throughout.
* pthread.h (__pthread_cancel): Convert to pthread::cancel.
(__pthread_join): Convert to pthread::join.
(__pthread_detach): Convert to pthread::detach.
(__pthread_create): Convert to pthread::create.
(__pthread_once): Convert to pthread::once.
(__pthread_atfork): Convert to pthread::atfork.
(__pthread_suspend): Convert to pthread::suspend.
(__pthread_continue): Convert to pthread::resume.
(__sem_init): Convert to semaphore::init.
(__sem_destroy): Convert to semaphore::destroy.
(__sem_wait): Convert to semaphore::wait.
(__sem_trywait): Convert to semaphore::trywait.
(__sem_post): Convert to semaphore::post.
2002-09-21 Robert Collins <rbtcollins@hotmail.com>
* thread.cc: Finish the removal of the separate pthread_key
destructor list.
Remove all pthread_key_destructor and pthread_key_destructor_list
references throughout.
(pthread::exit): Call the new pthread_key interface to activate
destructors.
(pthread_key::keys): Change into a list.
(pthread_key::saveAKey): New method, used via forEach.
(pthread_key::restoreAKey): Ditto.
(pthread_key::destroyAKey): Ditto.
(pthread_key::fixup_before_fork): Use the List::forEach functionality.
(pthread_key::fixup_after_fork): Ditto.
(pthread_key::runAllDestructors): New method implementation.
(pthread_key::pthread_key): Use List::Insert rather than custom list
code.
(pthread_key::~pthread_key): Use List::Remove for the same reason.
* thread.h: Remove all pthread_key_destructor and
pthread_key_destructor_list references throughout.
(List): Move the interface above pthread_key in the header.
Use atomic operations during insert and delete.
(List::forEach): A generic interface for doing something on each node.
(pthread_key::runAllDestructors): New method, run all destructors.
(pthread_key::fork_buf): Make private.
(pthread_key::run_destructor): Ditto.
(pthread_key::saveAKey): New method for clearer source.
(pthread_key::restoreAKey): Ditto.
(pthread_key::destroyAKey): Ditto.
(MTinterface::destructors): Remove.
2002-09-21 Robert Collins <rbtcollins@hotmail.com>
* thread.cc: Partial refactoring of pthread_key destructor
handling. Loosely based on Thomas Pfaff's work.
(pthread_key_destructor_list::Insert): Remove.
(pthread_key_destructor_list::Pop): Remove.
(pthread_key_destructor_list::IterateNull): Call the key's
run_destructor method.
(pthread_key::pthread_key): Initialize new member.
(pthread_key::get): Mark as const for correctness.
(pthread_key::run_destructor): Implement.
* thread.h (pthread_key::get): Mark as const for correctness.
(pthread_key::run_destructor): Declare.
(List): New template class that implements a generic list.
(pthread_key_destructor_list): Inherit from List, and remove
now duplicate functions.
2002-09-21 Robert Collins <rbtcollins@hotmail.com>
* thread.cc: Change verifyable_object_isvalid calls with
PTHREAD_CONDATTR_MAGIC, PTHREAD_MUTEXATTR_MAGIC, PTHREAD_COND_MAGIC,
SEM_MAGIC to objecttype::isGoodObject() calls throughout.
(pthread_condattr::isGoodObject): Implement.
(pthread_mutex::isGoodInitializer): Implement.
(pthread_mutex::isGoodInitializerOrObject): Minor bugfix in the
check for verifyable_object_isvalid result.
(pthread_mutexattr::isGoodObject): Implement.
(pthread_cond::isGoodObject): Ditto.
(pthread_cond::isGoodInitializer): Ditto.
(pthread_cond::isGoodInitializerOrObject): Ditto.
(semaphore::isGoodObject): Ditto.
* thread.h (pthread_mutex::isGoodInitializer): Declare.
(pthread_condattr::isGoodObject): Ditto.
(pthread_cond::isGoodObject): Const correctness.
(pthread_cond::isGoodInitializer): Declare.
(pthread_cond::isGoodInitializerOrObject): Ditto.
(semaphore::isGoodObject): Const correctness.
2002-09-21 Robert Collins <rbtcollins@hotmail.com>
* thread.cc: Change verifyable_object_isvalid calls with
PTHREAD_MUTEX_MAGIC and PTHREAD_KEY_MAGIC and PTHREAD_ATTR_MAGIC to
::isGoodObject() calls throughout.
(MTinterface::Init): Remove dead code.
(pthread_attr::isGoodObject): Implement.
(pthread_key::isGoodObject): Implement.
(pthread_mutex::isGoodObject): Implement.
(pthread_mutex::isGoodInitializerOrObject): Implement.
(pthread::isGoodObject): Update signature.
* thread.h (pthread_key::isGoodObject): Declare.
(pthread_attr::isGoodObject): Ditto.
(pthread_mutex::isGoodObject): Ditto.
(pthread_mutex::isGoodInitializerOrObject): Ditto.
(pthread::isGoodObject): Change to a const parameter for const
correctness.
(pthread_mutexattr::isGoodObject): Declare.
(pthread_condattr::isGoodObject): Ditto.
(pthread_cond::isGoodObject): Ditto.
(semaphore::isGoodObject): Ditto.
2002-09-19 Christopher Faylor <cgf@redhat.com>
Cleanup calls to CreateFile throughout.
* dcrt0.cc (__api_fatal): Correctly check for failing return from CreateFile.
* assert.cc (__assert): Don't check return value from CreateFile for NULL.
* fhandler_console.cc (set_console_state_for_spawn): Ditto.
* fork.cc (fork_parent): Ditto.
2002-09-18 Christopher Faylor <cgf@redhat.com>
* cygthread.cc (cygthread::initialized): Avoid copying on fork or some
threads may not end up in the pool.
(cygthread::new): Avoid race when checking for initialized. Add
debugging code.
2002-09-18 Pierre Humblet <pierre.humblet@ieee.org>
* fhandler.cc (fhandler_base::raw_read): Add case for
ERROR_INVALID_HANDLE due to Win95 directories.
(fhandler_base::open): Handle errors due to Win95 directories.
(fhandler_base::close): Add get_nohandle () test.
(fhandler_base::set_close_on_exec): Ditto.
(fhandler_base::fork_fixup): Ditto.
(fhandler_base::lock): Change error code to Posix EINVAL.
(fhandler_base::dup): If get_nohandle (), set new value to
INVALID_HANDLE_VALUE instead of NULL.
* fhandler_disk_file.cc (fhandler_disk_file::fstat): Call fstat_by_name
if get_nohandle (). Remove extraneous element from strpbrk.
(fhandler_disk_file::open): Remove test for Win95 directory.
* fhandler_random.cc (fhandler_dev_random::open): Add set_nohandle ().
* fhandler_clipboard.cc (fhandler_dev_clipboard::open): Ditto.
* fhandler_zero.cc (fhandler_dev_zero::open): Ditto.
(fhandler_dev_zero::close): Delete.
* fhandler.h (class fhandler_dev_zero): Ditto.
2002-09-17 Robert Collins <rbtcollins@hotmail.com>
* thread.cc (pthread_key::set): Preserve GetLastError(). Reported
by Thomas Pffaf.
2002-09-17 Robert Collins <rbtcollins@hotmail.com>
This work inspires by Thomas Pfaff's pthread_fork patch (1).
* fork.cc (fork_child): Remove MTinterface fixup call, it's
adsorbed by pthread::atforkchild.
Rename __pthread_atforkchild to pthread::atforkchild to give
access to private members.
(fork_parent): Rename __pthread_atforkparent to
pthread::atforkparent to give it access to private members.
Ditto for __pthread_atforkprepare.
* thread.cc: Fix some formatting problems throughout.
(MTinterface::fixup_before_fork): Implement.
(MTinterface::fixup_after_fork): Fix pthread_keys.
(pthread_key::keys): Implement.
(pthread_key::fixup_before_fork): Ditto.
(pthread_key::fixup_after_fork): Ditto.
(pthread_key::pthread_key): Add to pthread_key::keys.
(pthread_key::~pthread_key): Remove from pthread_key::keys.
(pthread_key::saveKeyToBuffer): Implement.
(pthread_key::recreateKeyFromBuffer): Ditto.
(pthread::atforkprepare): Prepare all MT classes for fork.
(pthread::atforkchild): And fix them up afterwards.
* thread.h (pthread_key): Buffer the key value during
fork in fork_buf.
List the keys needing to be fixed up in a linked list with
head pthread_key::keys.
(pthread): Move atfork cygwin internal calls into the class.
(MTInterface): Provide a fixup_before_fork for objecst that
need to save state.
(__pthread_atforkprepare): Remove.
(__pthread_atforkparent): Remove.
(__pthread_atforkchild): Remove.
2002-09-16 Christopher Faylor <cgf@redhat.com>
* init.cc: Cleanup slightly and remove obsolete code.
2002-09-11 Robert Collins <rbtcollins@hotmail.com>
* init.cc (dll_entry): On thread detach, if the thread hasn't
exit()ed, do so.
* pthread.cc (pthread_getsequence_np): Remove the
__pthread_getsequence_np wrapper. This requires errno.h.
* thread.cc (pthread::self): Instantiate a new pthread object
when called and none exists. return a NULL object if instantiation
fails.
(pthread::precreate): Factor out common code.
(pthread::postcreate): Ditto.
(pthread::create): Ditto.
(pthread::exit): Remove the TLS value when we exit to prevent
double exits.
(MTinterface::Init): Bugfix - don't mark the TLS index as created
if one was not allocated.
Apply Extract Method to move pthread specific initialisation into
pthread.
(pthread::initMainThread): Extracted method from MTinterface::Init.
(pthread::setTlsSelfPointer): Extracted method from various pthread
calls, to make reading those functions easier.
(pthread::setThreadIdtoCurrent): Ditto.
(pthread::cancel_self): Bring into the .cc file, it's only used
within the class.
(pthread::getThreadId): Ditto.
(pthread::thread_init_wrapper): Apply Extract Method to the TLS
setting logic.
(pthread::isGoodObject): Extracted method from various pthread
wrapper calls, for clarity of reading.
(pthread::getsequence_np): Converted from __pthread_getsquence_np.
(__pthread_create): Apply Extract Method to the object validation.
(__pthread_cancel): Ditto.
(__pthread_join): Ditto.
(__pthread_detach): Ditto.
(__pthread_suspend): Ditto.
(__pthread_continue): Ditto.
(__pthread_getschedparam): Ditto.
(__pthread_getsequence_np): Remove.
(__pthread_setschedparam): Apply Extract Method to the object
validation.
(pthreadNull::getNullpthread): New method, return the pthreadNull
object.
(pthreadNull::pthreadNull): Private constructor to prevent accidental
use.
(pthreadNull::~pthreadNull): Prevent compile warnings.
(pthreadNull::create): Override pthread behaviour.
(pthreadNull::exit): Ditto.
(pthreadNull::cancel): Ditto.
(pthreadNull::testcancel): Ditto.
(pthreadNull::setcancelstate): Ditto.
(pthreadNull::setcanceltype): Ditto.
(pthreadNull::push_cleanup_handler): Ditto.
(pthreadNull::pop_cleanup_handler): Ditto.
(pthreadNull::getsequence_np): Ditto.
(pthreadNull::_instance): Ditto.
* thread.h (pthread): Declare pre- and post-create.
Move GetThreadId to private scope and rename to getThreadId.
Move setThreadIdtoCurrent to private scope.
Make create virtual.
Make ~pthread virtual.
Declare initMainThread.
Declare isGoodObject.
Make exit virtual.
Make cancel virtual.
Make testcancel virtual.
Make setcancelstate virtual.
Make setcanceltype virtual.
Make push_cleanup_handler virtual.
Make pop_cleanup_handler virtual.
Declare getsequence_np.
Declare setTlsSelfPointer.
(pthreadNull): New null object class for pthread.
(__pthread_getsequence_np): Remove.
2002-09-13 Corinna Vinschen <corinna@vinschen.de>
* syscalls.cc (seteuid32): Treat ILLEGAL_UID invalid.
(setegid32): Treat ILLEGAL_GID invalid.
2002-09-10 Pierre Humblet <pierre.humblet@ieee.org>
* grp.cc (initgroups): Call groups::clear_supp to free the
supplementary group sids that may have been set by setgroups.
* security.cc (cygsidlist::free_sids): Also zero the class members.
* security.h (groups::clear_supp): New.
Rename cygsidlist_unknown to cygsidlist_empty.
2002-09-08 Christopher Faylor <cgf@redhat.com>
* fhandler_tty.cc (fhandler_tty_slave::open): Don't protect
input/output handles since they are not properly manipulated later.
* tty.cc (tty::make_pipes): Ditto.
2002-09-06 Christopher Faylor <cgf@redhat.com>
* winsup.h (_WIN32_WINNT): Protect.
2002-09-06 Christopher Faylor <cgf@redhat.com>
* winsup.h (_WIN32_WINNT): Define.
2002-09-03 Corinna Vinschen <corinna@vinschen.de>
* Makefile.in (DLL_OFILES): Drop shortcut.o.
* path.cc: Move all shortcut functions from shortcut.c to here.
(check_shortcut): Implement without using COM interface.
* path.h: Move definition of SHORTCUT_HDR_SIZE to here.
* shortcut.c: Remove.
* shortcut.h: Ditto.
2002-09-03 Conrad Scott <conrad.scott@dsl.pipex.com>
* fhandler.h (fhandler_socket::read): Remove method.
(fhandler_socket::write): Ditto.
(fhandler_socket::readv): New method.
(fhandler_socket::writev): Ditto.
(fhandler_socket::recvmsg): Add new optional argument.
(fhandler_socket::sendmsg): Ditto.
* fhandler.cc (fhandler_socket::read): Remove method.
(fhandler_socket::write): Ditto.
(fhandler_socket::readv): New method.
(fhandler_socket::writev): Ditto.
(fhandler_socket::recvmsg): Use win32's scatter/gather IO where
possible.
(fhandler_socket::sendmsg): Ditto.
* net.cc (cygwin_recvmsg): Check the msghdr's iovec fields.
(cygwin_sendmsg): Ditto. Add omitted sigframe.
2002-09-02 Kazuhiro Fujieda <fujieda@jaist.ac.jp>
* cygwin.din: Revert exporting new wchar functions.
* include/cygwin/version.h: Change comment for API minor 62.
2002-09-02 Christopher Faylor <cgf@redhat.com>
* dcrt0.cc (dll_crt0_1): Remove getpagesize() call.
* shared.cc (memory_init): Move it here.
2002-08-31 Christopher January <chris@atomice.net>
* fhandler_proc.cc: Add <sys/param.h> include.
(format_proc_uptime): Use KernelTime and UserTime only as they include
the other counters.
(format_proc_stat): KernelTime includes IdleTime, so subtract IdleTime
from KernelTime. Make number of 'jiffies' per second same as HZ define.
* fhandler_process.cc: Add <sys/param.h> include.
(format_process_stat): Make number of 'jiffies' per second same as
HZ define. Use KernelTime and UserTime only to calculate start_time.
2002-08-30 Christopher Faylor <cgf@redhat.com>
(inspired by a patch from Egor Duda)
* select.cc (fhandler_tty_slave::ready_for_read): Remove.
* fhandler.h (fhandler_tty_slave::ready_for_read): Remove declaration.
* fhandler_tty.cc (fhandler_tty_slave::fhandler_tty_slave): Set "don't
need ready for read" flag.
(fhandler_tty_slave::read): Don't do anything special with vtime when
vmin == 0.
2002-08-30 Egor Duda <deo@logos-m.ru>
* autoload.cc (GetConsoleWindow): Correct parameter count.
2002-08-30 Christopher January <chris@atomice.net>
Christopher Faylor <cgf@redhat.com>
* tty.cc (tty_list::allocate_tty): Use GetConsoleWindow, if available.
Call FindWindow in a loop.
* autoload.cc (GetConsoleWindow): Export
2002-08-30 Christopher Faylor <cgf@redhat.com>
* miscfuncs.cc (check_iovec_for_read): Don't check buffer when zero
length iov_len.
(check_iovec_for_write): Ditto.
2002-08-27 Conrad Scott <conrad.scott@dsl.pipex.com>
* fhandler.h (fhandler_base::readv): New method.
(fhandler_base::writev): Ditto.
* fhandler.cc (fhandler_base::readv): New method.
(fhandler_base::writev): Ditto.
* syscalls.cc (_read): Delegate to readv(2).
(_write): Ditto, mutatis mutandi.
(readv): Rewrite, based on the old _read code, to use the new
fhandler_base::readv method. Improve access mode handling and ensure
all calls reach the final strace statement.
(writev): Ditto, mutatis mutandi.
* include/sys/uio.h (struct iovec): Change field types to match SUSv3.
* winsup.h (check_iovec_for_read): New function.
(check_iovec_for_write): Ditto.
* miscfuncs.cc (check_iovec_for_read): Ditto.
(check_iovec_for_write): Ditto.
2002-08-30 Corinna Vinschen <corinna@vinschen.de>
* cygwin.din: Add more prototypes for new wchar functions in newlib.
2002-08-30 Corinna Vinschen <corinna@vinschen.de>
* cygwin.din: Add prototypes for new wchar functions in newlib.
* include/cygwin/version.h: Bump API minor number.
2002-08-29 Boris Schaeling <boriss@web.de>
Corinna Vinschen <corinna@vinschen.de>
* poll.cc (poll): Peek sockets ready for read to see if there's
actually data.
2002-08-28 Christopher Faylor <cgf@redhat.com>
* cygthread.cc (hthreads): Remove unneeded global.
(cygthread::simplestub): New static member function.
(cygthread::runner): Don't set hthreads.
(cygthread::freerange): New member function.
(cygthread::operator new): Call freerange if all cygwin slots are used
up.
(cygthread::exit_thread): Don't mess with event if freerange thread.
(cygthread::detach): Ditto.
* cygthread.h (class cygthread): Declare new member functions and
variables.
2002-08-28 Christopher Faylor <cgf@redhat.com>
* malloc.cc: Protect some definitions to avoid a compile time warning.
2002-08-27 Nicholas Wourms <nwourms@netscape.net>
* cygwin.din: Export getc_unlocked, getchar_unlocked,
putc_unlocked, putchar_unlocked functions.
* include/cygwin/version.h: Bump api minor.
2002-08-28 Corinna Vinschen <corinna@vinschen.de>
* fhandler_socket.cc (fhandler_socket::recvfrom): Eliminate flags
not understood by WinSock.
(fhandler_socket::sendto): Ditto. If WinSock sendto() returns
WSAESHUTDOWN, change errno to EPIPE and raise SIGPIPE if MSG_NOSIGNAL
isn't set in flags.
* include/cygwin/socket.h: Define MSG_WINMASK and MSG_NOSIGNAL.
* include/cygwin/version.h: Bump API minor number.
2002-08-28 Corinna Vinschen <corinna@vinschen.de>
* poll.cc (poll): Eliminate erroneous POLLERR conditional.
2002-08-26 Conrad Scott <conrad.scott@dsl.pipex.com>
* fhandler_socket.cc (fhandler_socket::check_peer_secret_event):
Fix strace message.
(fhandler_socket::connect): Remove sigframe.
(fhandler_socket::accept): Ditto.
(fhandler_socket::getsockname): Ditto.
(fhandler_socket::getpeername): Ditto.
(fhandler_socket::recvfrom): Ditto.
(fhandler_socket::recvmsg): Ditto.
(fhandler_socket::sendto): Ditto.
(fhandler_socket::sendmsg): Ditto.
(fhandler_socket::close): Ditto.
(fhandler_socket::ioctl): Ditto.
* ioctl.cc (ioctl): Add sigframe.
* net.cc (cygwin_sendto): Ditto.
(cygwin_recvfrom): Ditto.
(cygwin_recvfrom): Ditto.
(cygwin_connect): Ditto.
(cygwin_shutdown): Ditto.
(cygwin_getpeername): Ditto.
(cygwin_accept): Ditto. Improve strace message.
(cygwin_getsockname): Ditto. Ditto.
(cygwin_recvmsg): Ditto. Ditto.
(cygwin_sendmsg): Fix strace message.
2002-08-27 Christopher Faylor <cgf@redhat.com>
* child_info.h: Add _PROC_WHOOPS enum value.
(CURR_CHILD_INFO_MAGIC): Update.
(child_info::magic): Make 'long'.
* cygheap.h: Export _cygheap_start.
* cygheap.cc: Don't declare _cygheap_start.
* cygmagic: Use cksum to produce checksums. Append 'U' to end of
checksum.
* dcrt0.cc (initial_env): Calculate sleep ms before reusing buffer.
(_dll_crt0): Detect cygheap mismatch as indicative of different cygwin
version. Set child_proc_info to NULL when _PROC_WHOOPS.
(multiple_cygwin_problem): If child_info specific problem, then set
child_proc_info type to _PROC_WHOOPS.
* shared_info.h (CURR_MOUNT_MAGIC): Update.
(CURR_SHARED_MAGIC): Ditto.
2002-08-25 Conrad Scott <conrad.scott@dsl.pipex.com>
* fhandler.h (fhandler_socket::recvfrom): Fix prototype.
(fhandler_socket::sendto): Ditto.
* fhandler_socket.cc (fhandler_socket::recvfrom): Ditto.
(fhandler_socket::sendto): Ditto.
* include/sys/socket.h (recv): Fix prototype.
(recvfrom): Ditto.
(send): Ditto.
(sendto): Ditto.
* net.cc (cygwin_sendto): Ditto. Improve strace message
(cygwin_recvfrom): Ditto. Ditto.
(cygwin_setsockopt): Improve strace message.
(cygwin_getsockopt): Ditto.
(cygwin_connect): Ditto.
(cygwin_accept): Ditto.
(cygwin_bind): Ditto.
(cygwin_getsockname): Ditto.
(cygwin_getpeername): Ditto.
(cygwin_recv): Fix prototype.
(cygwin_send): Ditto.
(cygwin_recvmsg): Improve strace message.
(cygwin_sendmsg): Ditto.
2002-08-25 Pierre Humblet <Pierre.Humblet@ieee.org>
* sec_acl.cc (getacl): Check ace_sid == well_known_world_sid
before owner_sid and group_sid so that well_known_world_sid
means "other" even when owner_sid and/or group_sid are Everyone.
* security.cc (get_attribute_from_acl): Created from code common
to get_nt_attribute() and get_nt_object_attribute(), with same
reordering as in getacl() above.
(get_nt_attribute): Call get_attribute_from_acl().
(get_nt_object_attribute): Ditto.
2002-08-26 Christopher Faylor <cgf@redhat.com>
* Makefile.in (cygrunk.exe): Make a -mno-cygwin program.
* cygrun.c (main): Export CYGWIN=ntsec unless otherwise set.
* shared.cc (shared_name): Only add build date to shared name when
*testing*.
2002-08-24 Christopher Faylor <cgf@redhat.com>
* Makefile.in (DLL_IMPORTS): Move libuuid.a and libshell32.a to list
rather than referring to them via -l. Add DLL imports last in link
line for new-cygwin.dll and cygrun.exe.
2002-08-19 Christopher Faylor <cgf@redhat.com>
* pinfo.h (pinfo::remember): Arrange for destructor call if
proc_subproc returns error.
* sigproc.cc (zombies): Store 1 + total zombies since proc_subproc uses
NZOMBIES element.
2002-08-19 Corinna Vinschen <corinna@vinschen.de>
* pwdgrp.h (pwdgrp_read::pwdgrp_read): Remove.
(pwdgrp_read::~pwdgrp_read): Ditto.
(pwdgrp_read::open): Reset fh to NULL instead of INVALID_HANDLE_VALUE.
(pwdgrp_read::close): Ditto.
2002-08-19 Christopher Faylor <cgf@redhat.com>
* fhandler.h (fhandler_console::send_winch_maybe): New method.
* fhandler_console.cc (set_console_state_for_spawn): Remove if 0'ed
code.
(fhandler_console::send_winch_maybe): Define new method.
(fhandler_console::read): Use send_winch_maybe where appropriate.
(fhandler_console::init): Just call all tcsetattr rather than
output_tcsetattr.
* select.cc (peek_console): Reorganize so that send_winch_maybe is
called for everything but keyboard input.
2002-08-18 Christopher Faylor <cgf@redhat.com>
* perthread.h (vfork_save): Add ctty, sid, pgid, exitval fields.
(vfork_save::restore_pid): New method.
(vfork_save::restore_exit): New method.
* fork.cc (vfork): Save ctty, sid, pgid and restore them when returning
to "parent". Use exitval field if exiting but never created a new
process.
* syscalls.cc (setsid): Detect when in "vfork" and force an actual fork
so that pid will be allocated (UGLY!).
(getsid): New function.
* dcrt0.cc (do_exit): Use vfork_save::restore_exit method for returning
from a vfork.
* spawn.cc (spawnve): Use vfork_save::{restore_pid,restore_exit}
methods for returning from vfork.
* cygwin.din: Export getsid.
* include/cygwin/version.h: Bump api minor number.
* malloc.cc: #ifdef sYSTRIm for when MORECORE_CANNOT_TRIM is true.
2002-08-18 Christopher Faylor <cgf@redhat.com>
* cygmalloc.h (MORECORE_CANNOT_TRIM): Define.
2002-08-18 Christopher Faylor <cgf@redhat.com>
* sigproc.cc (sigCONT): Define.
* sigproc.h (sigCONT): Declare.
(wait_sig): Create sigCONT event here.
* exceptions.cc (sig_handle_tty_stop): Wait for sigCONT event rather
than stopping thread.
(sig_handle): Set sigCONT event as appropriate on SIGCONT rather than
calling ResumeThread.
2002-08-17 Christopher Faylor <cgf@redhat.com>
* malloc.cc: Update to 2.7.2.
* malloc_wrapper.cc (malloc_init): Call user level mallocs to determine
if the malloc routines have been overridden.
2002-08-16 Christopher Faylor <cgf@redhat.com>
* winsup.h: Remove malloc_*lock functions.
2002-08-16 Christopher Faylor <cgf@redhat.com>
* Makefile.in: Add support for new malloc.o and renamed
malloc_wrapper.o. Use -fomit-frame-pointer for malloc.o compilation.
* malloc_wrapper.cc: New file. Rename from malloc.cc. Add support for
more malloc functions. Eliminate export_* calls. Just use straight
malloc names. Remove unused argument from malloc lock functions.
* cygwin.din: Just export straight malloc names. Add malloc_stats,
malloc_trim, malloc_usable_size, mallopt, memalign, valloc.
* dcrt0.cc (__cygwin_user): Eliminate export_* malloc entries.
* fork.cc (fork_parent): Remove unused argument from malloc_lock
argument.
* malloc.cc: New file. Doug Lea's malloc v2.7.1.
* cygmalloc.h: New file.
* include/cygwin/version.h: Bump API_MINOR.
* sync.h (muto::acquire): Use appropriate number for regparm attribute.
(muto::reset): Ditto.
(muto::release): Ditto.
2002-08-16 Pavel Tsekov <ptsekov@gmx.net>
* exceptions.cc (interrupt_setup): Ensure that the previous signal mask
is properly saved.
2002-08-15 Thomas Pfaff <tpfaff@gmx.net>
* dcrt0.cc: Modify define for CYGWIN_GUARD.
(alloc_stack_hard_way): Just use CYGWIN_GUARD in VirtualAlloc call.
2002-08-11 Conrad Scott <conrad.scott@dsl.pipex.com>
* fhandler.h (fhandler_socket::recv): Remove method.
(fhandler_socket::send): Ditto.
* fhandler_socket.cc (fhandler_socket::recv): Ditto.
(fhandler_socket::send): Ditto.
(fhandler_socket::read): Delegate to fhandler_socket::recvfrom.
(fhandler_socket::write): Delegate to fhandler_socket::sendto.
(fhandler_socket::sendto): Check for null `to' address.
* net.cc (cygwin_sendto): Check for zero request length.
(cygwin_recvfrom): Ditto. Fix signature, use void *buf.
(cygwin_recv): Delegate to cygwin_recvfrom.
(cygwin_send): Delegate to cygwin_sendto.
2002-08-11 Christopher Faylor <cgf@redhat.com>
* cygthread.cc (cygthread::cygthread): Close another race.
2002-08-11 Christopher Faylor <cgf@redhat.com>
* assert.cc (__assert): Call debugger on assertion failure if
debugging.
* dcrt0.cc (dll_crt0_1): Just wait for signal thread to go live rather
than going through the overhead of invoking it.
* fork.cc (fork_child): Ditto.
* exceptions.cc (signal_fixup_after_fork): Call sigproc_init here.
* sigproc.cc (proc_can_be_signalled): Assume that the signal thread is
live.
(sig_dispatch): Ditto.
(sig_send): Ditto.
(wait_for_sigthread): Rename from "wait_for_me". Assume that
wait_sig_inited has been set and that this function is only called from
the main thread.
* sigproc.h (wait_for_sigthread): Declare new function.
2002-08-08 Christopher Faylor <cgf@redhat.com>
* environ.cc (parse_options): Remember the "no" part of any options for
later export.
2002-08-07 Conrad Scott <conrad.scott@dsl.pipex.com>
* winsup.h (__check_null_invalid_struct): Make ptr argument non-const.
(__check_null_invalid_struct_errno): Ditto.
* miscfuncs.cc (__check_null_invalid_struct): Ditto.
(__check_null_invalid_struct_errno): Ditto.
(__check_invalid_read_ptr_errno): Remove superfluous cast.
* net.cc (get): Set appropriate errno if fd is not a socket.
(cygwin_sendto): Fix parameter checking.
(cygwin_recvfrom): Ditto.
(cygwin_setsockopt): Ditto.
(cygwin_getsockopt): Ditto.
(cygwin_connect): Ditto.
(cygwin_gethostbyaddr): Ditto.
(cygwin_accept): Ditto.
(cygwin_bind): Ditto.
(cygwin_getsockname): Ditto.
(cygwin_listen): Ditto.
(cygwin_getpeername): Ditto.
(cygwin_send): Ditto.
(cygwin_shutdown): Ditto. Move sigframe to fhandler_socket.
(cygwin_recvmsg): Fix parameter checking. Add tracing.
(cygwin_sendmsg): Ditto.
* fhandler_socket.cc (fhandler_socket::shutdown): Add sigframe.
* resource.cc (setrlimit): Fix parameter checking.
2002-08-08 Joe Buehler <jbuehler@hekimian.com
* sec_helper.cc (sec_acl): remove extraneous arg to debug_printf.
2002-08-07 Conrad Scott <conrad.scott@dsl.pipex.com>
* fhandler_socket.cc (fhandler_socket::accept): Fix FIONBIO call.
2002-08-06 Christopher Faylor <cgf@redhat.com>
* cygheap.cc (_csbrk): Avoid !cygheap considerations.
(cygheap_init): Deal with unintialized cygheap issues here.
(cheap_init): Move cygheap_max setting here.
2002-08-06 Christopher Faylor <cgf@redhat.com>
Conrad Scott <conrad.scott@dsl.pipex.com
* cygheap.cc (_csbrk): Allocate some slop initially. Don't erroneously
add sbrk amount to returned value in initial case.
2002-08-06 Christopher Faylor <cgf@redhat.com>
* spawn.cc (spawn_guts): Don't set mount_h here.
* sigproc.cc (init_child_info): Set it here instead.
* shared.cc (cygwin_mount_h): Make NO_COPY.
2002-08-06 Christopher Faylor <cgf@redhat.com>
* cygthread.cc (cygthread::stub): Accept flag to pass info structure to
thread function.
(cygthread::operator new): Add defensive debugging output.
(cygthread::cygthread): Add debugging output. Set name after thread
has been awakened to avoid a race.
(cygthread::exit_thread): Use handle operator rather than using ev
directly.
(cygthread::exit_thread): Reorganize to provide debugging. Set __name
to NULL.
* cygthread.h (cygself): Define.
* fhandler_tty.cc (fhandler_tty_master::init): Use cygself as argument
so that invoked thread can access its own info.
(process_output): Derive cygthread info of thread from thread argument.
* sigproc.cc (sigproc_init): Use cygself as argument so that invoked
thread can access its own info.
(wait_sig): Derive cygthread info of thread from thread argument.
2002-08-06 Conrad Scott <conrad.scott@dsl.pipex.com>
* debug.h (handle_list::allocated): Remove field.
* debug.cc (newh): Don't malloc extra entries.
(add_handle): Downgrade strace message level.
(delete_handle): Remove case for `allocated' entries.
2002-08-05 Christopher Faylor <cgf@redhat.com>
* cygthread.cc (cygthread::stub): Change event creation to manual
reset. Set __name after calling SetEvent to prevent races.
(cygthread::detach): Always reset event here to prevent races.
2002-08-03 Conrad Scott <conrad.scott@dsl.pipex.com>
* debug.h (WaitForMultipleObjects): Correct typo.
2002-08-01 Pierre Humblet <Pierre.Humblet@ieee.org>
* security.cc (verify_token): Do not reject a token just because
the supplementary group list is missing Everyone or a groupsid
equal to usersid, or because the primary group is not in the token,
as long as it is equal to the usersid.
* syscalls.cc (seteuid32): Use common code for all successful returns.
* grp.cc (getgroups32): Never includes Everyone in the output.
2002-08-01 Christopher Faylor <cgf@redhat.com>
* cygthread.cc (cygthread::exit_thread): Define new method.
* cygthread.h (cygthread::exit_thread): Declare new method.
* fhandler.h (fhandler_tty_master::hThread): Delete.
(fhandler_tty_master::output_thread): Define.
* fhandler_tty.cc (fhandler_tty_master::fhandler_tty_master): Adjust
constructor.
(fhandler_tty_master::init): Use cygthread rather than handle.
(process_output): Use cygthread method to exit.
(fhandler_tty_master::fixup_after_fork): Set output_thread to NULL
after fork.
(fhandler_tty_master::fixup_after_exec): Set output_thread to NULL
after spawn/exec.
* tty.cc (tty_list::terminate): Detach from output_thread using
cygthread method.
2002-08-01 Christopher Faylor <cgf@redhat.com>
* syscalls.cc (_link): Revert previous change and just always
dereference the oldpath.
2002-08-01 Christopher Faylor <cgf@redhat.com>
* syscalls.cc (link): Properly deal with a link to a symlink.
2002-08-01 Christopher Faylor <cgf@redhat.com>
* cygthread.cc: Remove cruft.
2002-08-01 Christopher Faylor <cgf@redhat.com>
* Makefile.in (DLL_OFILES): Add cygthread.o.
* dcrt0.cc (dll_crt0_1): Eliminate various thread initialization
functions in favor of new cygthread class.
* debug.cc: Remove thread manipulation functions.
* debug.h: Ditto.
* external.cc (cygwin_internal): Use cygthread method for determining
thread name. Remove capability for setting thread name.
* fhandler_console.cc (fhandler_console::read): Use cygthread method
rather than iscygthread function.
* fhandler_tty.cc (fhandler_tty_master::fhandler_tty_master): Use
cygthread methods to create threads.
(fhandler_tty_common::__acquire_output_mutex): Use cygthread method to
retrieve thread name.
* select.cc (pipeinf): Use cygthread pointer rather than handle.
(start_thread_pipe): Ditto.
(pipe_cleanup): Ditto.
(serialinf): Ditto.
(start_thread_serial): Ditto.
(serial_cleanup): Ditto.
(socketinf): Ditto.
(start_thread_socket): Ditto.
(socket_cleanup): Ditto.
* sigproc.cc (hwait_sig): Ditto.
(hwait_subproc): Ditto.
(proc_terminate): Ditto.
(sigproc_terminate): Ditto.
(sigproc_init): Initialize cygthread hwait_sig pointer.
(subproc_init): Initialize cygthread hwait_subproc pointer.
(wait_sig): Rely on cygthread HANDLE operator.
* strace.cc (strace::vsprntf): Use cygthread::name rather than threadname.
* window.cc (gethwnd): Use cygthread method to initialize thread.
2002-07-31 Conrad Scott <conrad.scott@dsl.pipex.com>
* fhandler.h (fhandler_base::get_r_no_interrupt): Make non-virtual.
* net.cc (fdsock): Call set_r_no_interrupt.
2002-07-30 Christopher Faylor <cgf@redhat.com>
* syscalls.cc (_read): Clarify debugging output.
2002-07-30 Christopher Faylor <cgf@redhat.com>
* fhandler.h (fhandler_base::get_r_no_interrupt): Make virtual.
2002-07-30 Christopher Faylor <cgf@redhat.com>
* fhandler_disk_file.cc (fhandler_cygdrive::set_drives): Incorporate .
and .. processing here.
(fhandler_cygdrive::readdir): Assume . and .. are already in pdrive.
(fhandler_cygdrive::seekdir): Ditto.
2002-07-29 Christopher Faylor <cgf@redhat.com>
* dcrt0.cc (dll_crt0_1): Move debug_fixup_after_fork_exec.
* cygheap.cc (cygheap_fixup_in_child): Call debug_fixup_after_fork_exec
immediately after cygheap has been set up.
2002-07-29 Corinna Vinschen <corinna@vinschen.de>
* security.cc: Change some formatting.
* include/cygwin/version.h: Bump API minor version.
2002-07-28 Pierre Humblet <Pierre.Humblet@ieee.org>
* cygheap.h (class cygheap_user): Add member groups.
* security.h (class cygsidlist): Add members type and maxcount, methods
position, addfromgr, alloc_sids and free_sids and operator+= (const
PSID psid). Modify contains () to call position () and optimize add ()
to use maxcount.
(class user_groups): Create. Update declarations of verify_token and
create_token.
* security.cc (cygsidlist::alloc_sids): New.
(cygsidlist::free_sids): New.
(get_token_group_sidlist): Create from get_group_sidlist.
(get_initgroups_sidlist): Create from get_group_sidlist.
(get_group_sidlist): Suppress.
(get_setgroups_sidlist): Create.
(verify_token): Modify arguments. Add setgroups case.
(create_token): Modify arguments. Call get_initgroups_sidlist and
get_setgroups_sidlist as needed. Set SE_GROUP_LOGON_ID from auth_pos
outside of the loop. Rename the various group sid lists consistently.
* syscalls.cc (seteuid32): Modify to use cygheap->user.groups.
(setegid32): Call cygheap->user.groups.update_pgrp.
* grp.cc (setgroups): Create.
(setgroups32): Create.
* uinfo.cc (internal_getlogin): Initialize and update
user.groups.pgsid.
* cygwin.din: Add setgroups and setgroups32.
2002-07-28 Christopher Faylor <cgf@redhat.com>
* fhandler_console.cc (fhandler_console::read): Use appropriate
kill_pgrp method.
* select.cc (peek_console): Ditto.
* fhandler_termios.cc (fhandler_termios::bg_check): Send "stopped"
signal to entire process group as dictated by SUSv3.
* termios.cc (tcsetattr): Detect when stopped signal sent and force a
stop before setting anything.
2002-07-26 Christopher Faylor <cgf@redhat.com>
* include/cygwin/version.h: Bump API version to indicate that ntsec is
on by default now.
2002-07-26 Conrad Scott <conrad.scott@dsl.pipex.com>
* fhandler_registry.cc (fhandler_registry::close): Return any error
result to the caller.
* syscalls.cc (_close): Return result of fhandler::close to the caller.
2002-07-25 Christopher Faylor <cgf@redhat.com>
* security.cc (allow_ntsec): Default to on.
(allow_smbntsec): Default to off.
2002-07-24 David MacMahon <davidm@smartsc.com>
* times.cc (to_time_t): Always round time_t down to nearest second.
2002-07-25 Egor Duda <deo@logos-m.ru>
* Makefile.in: Check if API version is updated when exports are
changed and stop if not so.
2002-07-24 Egor Duda <deo@logos-m.ru>
* include/cygwin/version.h: Bump minor API version.
2002-07-24 Corinna Vinschen <corinna@vinschen.de>
* fhandler_serial.cc: Change 'must_init_serial_line capability'
to 'supports_reading_modem_output_lines' throughout (negated meaning).
* wincap.cc: Ditto.
* wincap.h: Ditto.
2002-07-23 Nicholas Wourms <nwourms@netscape.net>
* cygwin.din (fcloseall): Add symbol for export.
(fcloseall_r): Ditto.
2002-07-24 Christopher Faylor <cgf@redhat.com>
* path.cc (path_conv::check): Always set fileattr when component == 0.
(readlink): Use path_conv method rather than field.
* fhandler_disk_file.cc (fhandler_disk_file::fstat_helper): Ditto,
throughout.
* path.h (path_conv): Make fileattr private.
* exceptions.cc (try_to_debug): Default to idle priority when looping.
2002-07-23 Corinna Vinschen <corinna@vinschen.de>
* fhandler_serial.cc: Use must_init_serial_line capability throughout.
* wincap.cc: Set flag must_init_serial_line appropriately.
* wincap.h: Add flag must_init_serial_line.
2002-07-23 Corinna Vinschen <corinna@vinschen.de>
* security.cc (get_group_sidlist): Create group list from /etc files
even if DC is available but access fails.
2002-07-22 Christopher Faylor <cgf@redhat.com>
* fhandler_serial.cc: Fix formatting problems introduced by below
changes.
2002-07-22 Jacek Trzcinski <jacek@certum.pl>
* fhandler.h (class fhandler_serial): Add new members of the class -
rts,dtr and method ioctl(). Variables rts and dtr important for Win 9x
only.
* fhandler_serial.cc (fhandler_serial::open): Add initial setting of
dtr and rts. Important for Win 9x only.
(fhandler_serial::ioctl): New function. Implements commands TIOCMGET,
TIOCMSET and TIOCINQ.
(fhandler_serial::tcflush): Fix found error.
(fhandler_serial::tcsetattr): Add settings of rts and dtr. Important
for Win 9x only.
* termios.h: Add new defines as a support for ioctl() function on
serial device.
2002-07-20 Christopher Faylor <cgf@redhat.com>
* autoload.cc (LoadDLLprime): Add jmp call to allow streamlining of
later jmp rewrite.
(doit): Avoid use of cx register. Just change one word to avoid races.
2002-07-18 Pierre Humblet <pierre.humblet@ieee.org>
* security.cc (get_unix_group_sidlist): Create.
(get_supplementary_group_sidlist): Evolve into get_unix_group_sidlist.
(get_user_local_groups): Add check for duplicates.
(get_user_primary_group): Suppress.
(get_group_sidlist): Silently ignore PDC unavailability.
Call get_unix_group_sidlist() before get_user_local_groups().
Remove call to get_supplementary_group_sidlist(). Never call
get_user_primary_group() as the passwd group is always included.
Add well_known_authenticated_users_sid in only one statement.
2002-07-19 Christopher Faylor <cgf@redhat.com>
* fhandler_serial.cc (fhandler_serial::tcflush): Fix typo.
2002-07-15 Corinna Vinschen <corinna@vinschen.de>
* security.cc (get_group_sidlist): Fix formatting.
2002-07-14 Christopher Faylor <cgf@redhat.com>
* dcrt0.cc (initial_env): Force path and CYGWIN_DEBUG contents to lower
case.
* exceptions.cc (error_start_init): Use the name derived from
GetModuleName rather than myself->progname.
2002-07-14 Christopher Faylor <cgf@redhat.com>
* dcrt0.cc (dll_crt0_1): Move debug_init call back to here. Avoid a
compiler warning.
* shared.cc (memory_init): Remove debug_init call.
* debug.h (handle_list): Change "clexec" to "inherited".
* debug.cc: Remove a spurious declaration.
(setclexec): Conditionalize away since it is currently unused.
(add_handle): Use inherited field rather than clexec.
(debug_fixup_after_fork_exec): Ditto. Move debugging output to
delete_handle.
(delete_handle): Add debugging output.
* fhandler.cc (fhandler_base::set_inheritance): Don't bother setting
inheritance in debugging table since the handle was never protected
anyway.
(fhandler_base::fork_fixup): Ditto.
* exceptions.cc (debugger_command): Revert.
2002-07-14 Conrad Scott <conrad.scott@dsl.pipex.com>
* debug.cc (clexec): Add missing `hl = hl->next'.
2002-07-14 Christopher Faylor <cgf@redhat.com>
* Makefile.in (cygrun.exe): Add a -lcygwin on the end.
2002-07-14 Christopher Faylor <cgf@redhat.com>
* Makefile.in (cygserver.exe): Add -lstdc++.
(cygrun.exe): Move -lgcc last.
2002-07-13 Christopher Faylor <cgf@redhat.com>
* dcrt0.cc (dll_crt0_1): Delay closing of some handles until cygheap
has been set up.
(break_here): New function, for debugging.
(initial_env): Add program name to "Sleeping" message. Implement new
"CYGWIN_DEBUG" environment variable option.
* exceptions.cc (debugger_command): Add argument to dumper call.
* strace.cc (strace::hello): Use winpid if cygwin pid is unavailable.
(strace::vsprntf): Ditto.
2002-07-13 Christopher Faylor <cgf@redhat.com>
* debug.h (handle_list): Move here from debug.cc. Add "inherit" flag
functionality.
* cygheap.cc (init_cheap): Move cygheap_max calculation to _csbrk.
(_csbrk): Reorganize to not assume first allocation is <= 1 page.
(cygheap_setup_for_child): Mark protected handle as inheritable.
* cygheap.h (cygheap_debug): New struct.
(init_cygheap): Add new structure when debugging.
* dcrt0.cc (dll_crt0_1): Remove call to debug_init. Close ppid_handle
here, if appropriate. Don't protect subproc_ready, since it is already
protected in the parent. Call memory_init prior to ProtectHandle to
ensure that cygheap is set up. Call debug_fixup_after_fork_exec when
appropriate.
(_dll_crt0): Don't close ppid_handle here.
* debug.cc: Use cygheap debug structure rather than static elements
throughout.
(add_handle): Don't issue a warning if attempt to protect handle in
exactly the same way from exactly the same place. Add pid info to
warning output. Accept additional argument controlling whether handle
is to be inherited. Add pid to stored information.
(debug_fixup_after_fork_exec): Renamed from debug_fixup_after_fork.
Reorganize to avoid erroneously skipping handles.
(mark_closed): Add pid info to warning output.
(setclexec): Rename from setclexec_pid.
* fhandler.cc (fhandler_base::get_default_fmode): Minor reorg.
(fhandler_base::fstat): Add debugging output.
(fhandler_base::set_inheritance): Call setclexec rather than
setclexec_pid.
(fhandler_base::fork_fixup): Ditto.
* fhandler_console.cc (get_tty_stuff): Mark protected handle as
inheritable.
* fhandler_tty.cc (fhandler_tty_slave::open): Ditto.
* tty.cc (tty::make_pipes): Ditto.
(tty::common_init): Ditto.
* fork.cc (fork_parent): Ditto.
(fork_child): Close protected handles with correct name. Remove
debug_fixup_after_fork call.
* fhandler_socket.cc (fhandler_socket::create_secret_event): Mark
protected handle as inheritable/non-inheritable, as appropriate.
* shared.cc (memory_init): Mark protected handle as inheritable.
Call debug_init here.
* sigproc.cc (wait_sig): Close protected handle with correct name.
* spawn.cc (spawn_guts): Rename spr to subproc_ready and mark it as
inheritable.
* exceptions.cc (debugger_command): Try to run dumper.exe, if found.
* syscalls.cc (fstat64): Don't follow symlinks for path_conv lookup
since path is already resolved.
2002-07-12 Christopher Faylor <cgf@redhat.com>
* cygwin.din: Change erroneous entries.
2002-07-11 Pavel Tsekov <ptsekov@gmx.net>
* fhandler_disk_file.cc (fhandler_disk_file::open): Don't
move the file pointer to the end of file if O_APPEND is
specified in the open flags.
2002-07-09 Christopher Faylor <cgf@redhat.com>
* debug.cc: Avoid explicit zeroing of globals.
(lock_debug): Make locker a static member. Avoid unlocking when
already unlocked (from Conrad Scott).
(debug_init): Initialize lock_debug::locker here.
* fork.cc (fork_child): Fix up fdtab earlier to avoid some (but not
all) confusion with close-on-exec craziness.
2002-07-05 Corinna Vinschen <corinna@vinschen.de>
* fhandler.h (fhandler_socket::is_unconnected): Constify.
(fhandler_socket::is_connect_pending): Ditto.
(fhandler_socket::is_connected): Ditto.
(fhandler_socket::set_connect_state): New method.
(struct select_record): Add member `except_on_write'.
(select_record::select_record): Initialize all bool values to `false'.
* fhandler_socket.cc: Use set_connect_state() method throughout.
(fhandler_socket::connect): Set state always to connected if connection
isn't pending.
* net.cc (cygwin_getsockopt): Revert erroneous previous patch.
* select.cc (set_bits): Check for `except_on_write'. Set fd in
write_fds if set. Set connect state to connected if fd has been
returned by WINSOCK_SELECT.
(peek_socket): Check for `except_on_write'.
(start_thread_socket): Ditto.
(fhandler_socket::select_write): Don't set `write_ready' if connect
is pending. Set `except_on_write' if connect is pending.
2002-07-05 Christopher Faylor <cgf@redhat.com>
* ntdll.h (_SYSTEM_PROCESSOR_TIMES): Force eight byte alignment.
(_SYSTEM_TIME_OF_DAY_INFORMATION): Ditto.
* path.cc (suffix_scan::has): Reorganize to eliminate double scanning
for for .exe (in the typical case).
2002-07-05 Corinna Vinschen <corinna@vinschen.de>
* fhandler.h (UNCONNECTED): New define.
(CONNECT_PENDING): Ditto.
(CONNECTED): Ditto.
(class fhandler_socket): Add member `had_connect_or_listen'.
Add member functions `is_unconnected', `is_connect_pending' and
`is_connected'.
* fhandler_socket.cc (fhandler_socket::connect): Set member
`had_connect_or_listen' according to return code of WinSock
call.
(fhandler_socket::listen): Ditto.
* net.cc (cygwin_getsockopt): Modify SO_ERROR return value in
case of socket with pending connect().
* select.cc (peek_socket): Only add socket to matching fd_set
if it's not "ready". Call WINSOCK_SELECT only if at least one
socket is in one of the fd_sets.
(start_thread_socket): Only add socket to matching fd_set
if it's not "ready".
(fhandler_socket::select_write): Set write_ready to true also
if socket isn't connected or listening.
2002-07-04 Corinna Vinschen <corinna@vinschen.de>
* fhandler_socket.cc (fhandler_socket::set_sun_path): Don't free
memory here. Allow NULL parameter.
2002-07-04 Corinna Vinschen <corinna@vinschen.de>
* fhandler_socket.cc (fhandler_socket::dup): Add missing copy operation
on sun_path.
2002-07-03 Christopher Faylor <cgf@redhat.com>
* include/cygwin/version.h: Bump DLL minor number.
2002-07-03 Christopher Faylor <cgf@redhat.com>
* include/sys/statfs.h: New header file.
2002-07-03 Christopher Faylor <cgf@redhat.com>
* dtable.cc (cygwin_attach_handle_to_fd): Default to implicit bin mode
if none specified.
* fhandler.cc (fhandler_base::init): Make bin argument a guarantee
rather than a suggestion.
* path.cc (path_conv::check): Load flag returned from
cygwin_conv_to_win32_path into path_flags.
2002-07-03 Conrad Scott <conrad.scott@dsl.pipex.com>
* tty.cc (tty::common_init): Reverse logic of cygserver check in
call to SetKernelObjectSecurity.
2002-07-03 Thomas Pfaff <tpfaff@gmx.net>
* autoload.cc (WSAEventSelect): Define new autoload function.
(WSAEnumNetworkEvents): Ditto.
* fhandler_socket.cc (fhandler_socket::accept): If socket is
in blocking mode wait for incoming connection and signal.
2002-07-02 Christopher Faylor <cgf@redhat.com>
* cygheap.cc (init_cheap): Rearrange error message.
(cygheap_fixup_in_child): Ditto.
* dtable.cc: Remove if 0'ed code.
* fhandler_dsp.cc (fhandler_dev_dsp::open): Force binmode.
* sec_helper.cc (cygsid::get_id): Use system_printf for error message.
* tty.cc (tty::common_init): Ditto.
2002-07-02 Christopher Faylor <cgf@redhat.com>
* net.cc (cygwin_getpeername): Defend against NULL pointer dereference.
2002-07-02 Egor Duda <deo@logos-m.ru>
* include/cygwin/version.h: Bump API minor version.
2002-07-01 Pierre Humblet <pierre.humblet@ieee.org>
* security.cc (get_logon_server): Interpret a zero length
domain as the local domain.
(get_group_sidlist): Add authenticated users SID to SYSTEM's group
list instead of SYSTEM itself.
(verify_token): Accept the primary group sid if it equals
the token user sid.
2002-07-02 Corinna Vinschen <corinna@vinschen.de>
* cygwin.din (__fpclassifyd): Add symbol.
(__fpclassifyf): Ditto.
(__signbitd): Ditto.
(__signbitf): Ditto.
2002-07-02 Corinna Vinschen <corinna@vinschen.de>
* security.h (DONT_INHERIT): Eliminate definition.
(INHERIT_ALL): Ditto.
(INHERIT_ONLY): Ditto.
* sec_acl.cc: Use appropriate defines from accctrl.h instead of the
above throughout.
* security.cc: Ditto.
2002-07-01 Pierre Humblet <pierre.humblet@ieee.org>
* syscalls.c (seteuid32): Return immediately if the program is not
impersonated and both uid and gid are original.
(setegid32): Return immediately if the new gid is the current egid.
2002-07-01 Christopher Faylor <cgf@redhat.com>
* syscalls.cc (seteuid32): Fix incorrect placement of Pierre's patch
below.
2002-07-01 Christopher Faylor <cgf@redhat.com>
* syscalls.cc (seteuid32): Fix incorrect use of system_printf.
2002-07-02 Christopher January <chris@atomice.net>
* autoload.cc (GetSecurityInfo): Define new autoload function.
(RegQueryInfoKeyA): Ditto.
* fhandler.h (fhandler_virtual::fill_filebuf): Change return type to
bool.
(fhandler_proc::fill_filebuf): Ditto.
(fhandler_registry::fill_filebuf): Ditto.
(fhandler_process::fill_filebuf): Ditto.
(fhandler_registry::value_name): Add new member.
(fhandler_registry::close): Add new method.
(fhandler_process::p): Remove member.
* fhandler_proc.cc (fhandler_proc::open): Add set_nohandle after
calling superclass method. Check return value of fill_filebuf.
(fhandler_proc::fill_filebuf): Change return type to bool. Add return
statement.
* fhandler_process.cc (fhandler_process::open): Add set_nohandle after
calling superclass method. Remove references to p. Check return value
of fill_filebuf.
(fhandler_process::fill_filebuf): Change return type to bool. Don't
use dereference operator on p. Add return statement.
(fhandler_process::format_process_stat): Fix typo.
* fhandler_registry.cc: Add static open_key declaration.
(fhandler_registry::exists): Assume path is already normalised. Try
opening the path as a key in its own right first, before reverting to
enumerating subkeys and values of the parent key.
(fhandler_registry::fstat): Add additional code to return more relevant
information about the registry key/value.
(fhandler_registry::readdir): Explicitly set desired access when
opening registry key. Remove output of buf from debug_printf format
string.
(fhandler_registry::open): Use set_io_handle to store registry key
handle. Set value_name member. Move code to read a value from the
registry to fill_filebuf. Add call to fill_filebuf.
(fhandler_registry::close): New method.
(fhandler_registry::fill_filebuf): Change return type to bool. Add
code to read a value from registry.
(fhandler_registry::open_key): Make function static. Use KEY_READ as
desired access unless this is the last path component. Check the
return value of RegOpenKeyEx for an error instead of hKey.
* fhandler_virtual.cc (fhandler_virtual::lseek): Check the return value
of fill_filebuf.
(fhandler_virtual::open): Remove call to set_nohandle.
(fhandler_virtual::fill_filebuf): Change return type to bool. Add
return statement.
* security.cc (get_nt_object_attribute): New function.
(get_object_attribute): New function.
* security.h (get_object_attribute): New function declaration.
2002-07-01 Pierre Humblet <pierre.humblet@ieee.org>
* syscalls.c (seteuid32): Do not return an error when the token cannot
be created only because of a problem with the gid.
2002-07-01 Christopher Faylor <cgf@redhat.com>
* fhandler_clipboard.c (fhandler_dev_clipboard::open): Force text mode.
* fhandler_console.cc (fhandler_console::open): *Really* force binary
mode rather than make it optional.
* fhandler_proc.cc (fhandler_proc::open): Ditto.
* fhandler_process.cc (fhandler_process::open): Ditto.
* fhandler_random.cc (fhandler_dev_random::fhandler_dev_random): Ditto.
* fhandler_raw.cc (fhandler_dev_raw::open): Ditto.
* fhandler_registry.cc (fhandler_registry::open): Ditto.
* fhandler_tty.cc (fhandler_tty_slave::open): Ditto.
* fhandler_virtual.cc (fhandler_virtual::open): Ditto.
* fhandler_windows.cc (fhandler_windows::open): Ditto.
* fhandler_zero.cc (fhandler_dev_zero::open): Ditto.
* net.cc (fdsock): Ditto.
* path.cc (set_flags): Add more debugging.
2002-07-01 Christopher Faylor <cgf@redhat.com>
* debug.cc (threads): Avoid initialization.
* uinfo.cc (cygheap_user::ontherange): (from Corinna Vinschen) Actually
make below changes work.
2002-07-01 Christopher Faylor <cgf@redhat.com>
* uinfo.cc (cygheap_user::ontherange): Make cygwin root the last resort
for HOMEPATH/HOMEDRIVE for consistency with HOME.
2002-07-01 Corinna Vinschen <corinna@vinschen.de>
* shared.cc (sec_none): Move to sec_helper.cc.
(sec_none_nih): Ditto.
(sec_all): Ditto.
(sec_all_nih): Ditto.
(get_null_sd): Ditto.
(sec_acl): Ditto.
(__sec_user): Ditto.
* sec_helper.cc (sec_none): Move from shared.cc to here.
(sec_none_nih): Ditto.
(sec_all): Ditto.
(sec_all_nih): Ditto.
(get_null_sd): Ditto.
(sec_acl): Ditto.
(__sec_user): Ditto.
2002-06-30 Christopher Faylor <cgf@redhat.com>
* uinfo.cc (cygheap_user::ontherange): Potentially set HOME from
existing homepath and homedrive cygheap_user fields (not currently used
yet). Set HOME to / if no other alternative.
(cygheap_user::test_uid): Simplify.
2002-06-30 Christopher Faylor <cgf@redhat.com>
* environ.cc (parse_options): Use setenv to potentially replace CYGWIN
value on export. Fixes broken behavior since November 2000 changes.
(regopt): Return indication of whether or not something has been parsed
from the registry.
(environ_init): Only attempt to export CYGWIN variable when values were
set from the registry. It is exported automatically otherwise.
2002-06-30 Christopher Faylor <cgf@redhat.com>
* fhandler.h (fhandler_process::pid): New field.
(fhandler_process::fstat): Remove unneeded array. Set pid element.
(fhandler_process::open): Ditto.
(fhandler_process::fill_filebuf): Handle case where 'p' field is NULL.
2002-06-30 Christopher Faylor <cgf@redhat.com>
* fhandler.h (fhandler_process::p): New field.
(fhandler_process:fill_filebuf): Revert to same definition as virtual
in parent class.
(fhandler_process::open): Fill out p field rather than passing as an
argument.
(fhandler_process::fill_filebuf): Use p pointer rather than argument.
2002-06-29 Pierre Humblet <pierre.humblet@ieee.org>
* security.cc (extract_nt_dom_user): Check for all buffer overflows.
Call LookupAccountSid after trying to get domain & user from passwd.
(get_group_sidlist): Obtain the domain and user by calling
extract_nt_dom_user instead of LookupAccountSid.
2002-06-29 Christopher Faylor <cgf@redhat.com>
* uinfo.cc (cygheap_user::test_uid): Use standard issetuid test.
2002-06-29 Christopher Faylor <cgf@redhat.com>
* autoload.cc (NetGetDCName): Change to make this an optional load
function.
* cygheap.h (cygheap_user::logsrv): Return NULL when operation fails.
(cygheap_user::winname): Ditto.
(cygheap_user::domain): Ditto.
* uinfo.cc (cygheap_user::env_logsrv): Save results in temp variable.
(cygheap_user::env_userprofile): Ditto.
2002-06-29 Christopher Faylor <cgf@redhat.com>
* environ.cc (spenv::retrieve): Detect return of env_dontadd from
cygheap_user methods.
(build_env): Avoid incrementing environment pointer if not actually
adding to the environment. That could result in garbage in the
environment table. Be more defensive when reallocing envblock.
2002-06-29 Christopher Faylor <cgf@redhat.com>
* uinfo.cc (cygheap_user::test_uid): Return NULL or further tests are
sorta useless.
(cygheap_user::env_domain): Recalculate if name is missing.
2002-06-29 Christopher Faylor <cgf@redhat.com>
* environ.cc (spenv::from_cygheap): Still need to take setuid into
consideration.
2002-06-28 Christopher Faylor <cgf@redhat.com>
* uinfo.cc (cygheap_user::env_logsrv): Return "almost_null" in case
where no domain or username is "SYSTEM".
2002-06-28 Christopher Faylor <cgf@redhat.com>
* cygheap.h (cygheap_user): Reorg to accommodate environment caching.
(cygheap_user::logsrv): New method.
(cygheap_user::winname): Ditto.
(cygheap_user::domain): Ditto.
(cygheap_user::test_uid): Ditto.
* cygheap.cc (cygheap_user::set_name): Reflect name "pwinname" name
change.
* environ.cc (getwinenveq): New function.
(penv::from_cygheap): penv::from_cygheap): Change arguments.
(spenv::retrieve): Ditto for call. Use getwinenveq to retrieve info
from environment. Always return value from cygwin environment, if it
exists.
* environ.h (getwinenveq): Declare.
* uinfo.cc (cygheap_user::ontherange): Use logsrv() rather than
env_logsrv().
(cygheap_user::test_uid): Define new method.
(cygheap_user::env_logsrv): Accept environment arguments. Use test_uid
to find info.
(cygheap_user::env_domain): Ditto.
(cygheap_user::env_userprofile): Ditto.
(cygheap_user::env_homepath): Ditto.
(cygheap_user::env_homedrive): Ditto.
(cygheap_user::env_name): Ditto.
2002-06-27 Christopher Faylor <cgf@redhat.com>
* cygheap.cc (cfree_and_set): New function.
(cygheap_user::set_name): Use cfree_and_set to reset members.
* cygheap.h (cygheap_user): Delete static members.
(cygheap_user::puserprof): New member.
(cfree_and_set): Declare.
* dcrt0.cc (almost_null): Define.
* environ.cc (env_dontadd): Redefine as "almost_null".
* winsup.h (almost_null): Declare.
* syscalls.cc (cfree_and_set): Remove unused variable.
* uinfo.cc (cygheap_user::homepath_env_buf): Eliminate.
(cygheap_user::homedrive_env_buf): Ditto.
(cygheap_user::userprofile_env_buf): Ditto.
(cygheap_user::ontherange): YA change to try to preserve existing
HOMEPATH and HOMEDRIVE. Return almost_null values when variables
should not actually exist.
(cygheap_user::env_logsrv): Ditto.
(cygheap_user::env_domain): Ditto.
(cygheap_user::env_userprofile): Ditto.
2002-06-27 Corinna Vinschen <corinna@vinschen.de>
* dcrt0.cc (dll_crt0_1): Let __progname point to the applications
basename. Move eliminating ".exe" suffix from argv[0] so that it
always also affects __progname.
2002-06-27 Thomas Pfaff <tpfaff@gmx.net>
* thread.cc (pthread::create): Add trace printf to get CreateThread
LastError.
2002-06-27 Corinna Vinschen <corinna@vinschen.de>
* mmap.cc (list::match): Check using pagesize aligned size.
2002-06-26 Christopher Faylor <cgf@redhat.com>
* fhandler_disk_file.cc (fhandler_disk_file::fstat_by_name): Force
FindFirstFile on first file of directory when asking for x:\ .
2002-06-26 Christopher Faylor <cgf@redhat.com>
* cygheap.cc (cygheap_user::set_name): Correct thinko in below change.
2002-06-26 Christopher Faylor <cgf@redhat.com>
* cygheap.cc (cygheap_user::set_name): Avoid clearing things when just
setting name to itself or during first time initialization.
* environ.cc (check_case_init): Make case insensitive.
2002-06-26 Corinna Vinschen <corinna@vinschen.de>
* fhandler.h (fhandler_socket::bind): Add method definition.
(fhandler_socket::connect): Ditto.
(fhandler_socket::listen): Ditto.
(fhandler_socket::accept): Ditto.
(fhandler_socket::getsockname): Ditto.
(fhandler_socket::getpeername): Ditto.
(fhandler_socket::recvfrom): Ditto.
(fhandler_socket::recvmsg): Ditto.
(fhandler_socket::sendto): Ditto.
(fhandler_socket::sendmsg): Ditto.
(fhandler_socket::shutdown): Ditto.
* fhandler_socket.cc (get_inet_addr): Move here from net.cc.
(fhandler_socket::bind): New method.
(fhandler_socket::connect): Ditto.
(fhandler_socket::listen): Ditto.
(fhandler_socket::accept): Ditto.
(fhandler_socket::getsockname): Ditto.
(fhandler_socket::getpeername): Ditto.
(fhandler_socket::recvfrom): Ditto.
(fhandler_socket::recvmsg): Ditto.
(fhandler_socket::sendto): Ditto.
(fhandler_socket::sendmsg): Ditto.
(fhandler_socket::shutdown): Ditto.
* net.cc: Various formatting cleanups throughout.
(get_inet_addr): Move to fhandler_socket.cc.
(cygwin_bind): Move base functionality to appropriate fhandler_socket
method.
(cygwin_connect): Ditto.
(cygwin_listen): Ditto.
(cygwin_accept): Ditto.
(cygwin_getsockname): Ditto.
(cygwin_getpeername): Ditto.
(cygwin_recvfrom): Ditto.
(cygwin_recvmsg): Ditto.
(cygwin_sendto): Ditto.
(cygwin_sendmsg): Ditto.
(cygwin_shutdown): Ditto.
2002-06-26 Corinna Vinschen <corinna@vinschen.de>
* pwdgrp.h (pwdgrp_read::~pwdgrp_read): Avoid compiler warning.
2002-06-26 Christopher Faylor <cgf@redhat.com>
* dcrt0.cc (_dcrt0): Be more defensive when reserved block is used and
it's not cygwin info.
2002-06-26 Christopher Faylor <cgf@redhat.com>
* autoload (noload): Avoid clobbering bx register.
* environ.cc (codepage_init): Use case insensitive match.
* fhandler_console.cc (cp_get_internal): Delete.
(con_to_str): Use get_cp to derive code page.
(str_to_con): Ditto.
* miscfuncs.cc (get_cp): New function.
(sys_wcstombs): New function. Converted from macro.
(sys_mbstowcs): Ditto.
* winsup.h: Reflect above changes.
2002-06-26 Christopher Faylor <cgf@redhat.com>
* winsup.h: Minor cleanup.
* path.h (path_conv::[]): New operator.
* syscalls.cc (_link): Use path_conv operators rather than methods,
where appropriate. Minor white space cleanup.
2002-06-26 Christopher Faylor <cgf@redhat.com>
* include/cygwin/version.h: Bump DLL minor number.
2002-06-25 Thomas Pfaff <tpfaff@gmx.net>
* include/pthread.h (PTHREAD_CANCELED): Define a reasonable value.
* pthread.cc (pthread_exit): Call method instead of function.
(pthread_setcancelstate): Ditto.
(pthread_setcanceltype): Ditto.
(pthread_testcancel): Ditto.
* thread.h (pthread::cancel_event): New member.
(__pthread_cancel_self): New prototype.
(pthread::exit): New Method.
(pthread::cancel): Ditto.
(pthread::testcancel): Ditto.
(pthread::cancel_self): Ditto.
(pthread::static_cancel_self): Ditto.
(pthread::setcancelstate): Ditto.
(pthread::setcanceltype): Ditto.
(__pthread_cancel): Give c++ linkage.
(__pthread_exit): Remove.
(__pthread_setcancelstate): Ditto.
(__pthread_setcanceltype): Ditto.
(__pthread_testcancel): Ditto.
* thread.cc (pthread::pthread): Inititialize cancel_event.
(pthread::~pthread): Close cancel_event if needed.
(pthread::create): Create cancel_event.
(pthread::exit): New method. Replacement for __pthread_exit.
(pthread::cancel): New method.
(pthread::testcancel): Ditto.
(pthread::static_cancel_self); New static method.
(pthread::setcancelstate): New method. Replacement for
__pthread_setcancelstate.
(pthread::setcanceltype): New method. Replacement for
__pthread_setcanceltype.
(pthread::pop_cleanup_handler): Add lock for async cancel safe
cancellation.
(pthread::thread_init_wrapper): Change __pthread_exit to
thread->exit().
(__pthread_cancel): Call method thread->cancel().
(__pthread_exit): Remove.
(__pthread_setcancelstate): Ditto.
(__pthread_setcanceltype): Ditto.
(__pthread_testcancel): Ditto.
2002-06-25 Christopher Faylor <cgf@redhat.com>
* dcrt0.cc (sm): Make NO_COPY.
2002-06-25 Corinna Vinschen <corinna@vinschen.de>
* syscalls.cc (chown): Convert uid to 32 bit.
(lchown): Ditto.
(fchown): Ditto.
2002-06-24 Christopher Faylor <cgf@redhat.com>
* dtable.cc (dtable::find_unused_handle): Avoid coercion.
2002-06-24 Christopher Faylor <cgf@redhat.com>
* dtable.cc (fhandler_base::dup2): Cleanup. Ensure that lock is turned
off in error condition.
2002-06-24 Corinna Vinschen <corinna@vinschen.de>
* uinfo.cc (internal_getlogin): Set myself->uid and myself->gid instead
of user.real_uid and user.real_gid.
(uinfo_init): Evaluate orig_uid and real_uid from myself->uid. Ditto
for gid.
2002-06-23 Pierre Humblet <pierre.humblet@ieee.org>
* security.cc (get_group_sidlist): Add pw argument and use pw->pw_name
in call to get_supplementary_group_sidlist.
(create_token): Add pw argument and use it in call to
get_group_sidlist.
* security.h: Add pw argument in declaration of create_token.
* syscalls.cc (seteuid32): Add pw argument in call to create_token.
2002-06-23 Conrad Scott <conrad.scott@dsl.pipex.com>
* fhandler.cc (fhandler_base::fstat): Set S_IFIFO for pipes.
* fhandler_socket.cc (fhandler_socket.cc::fstat): Set S_IFSOCK.
2002-06-23 Christopher Faylor <cgf@redhat.com>
* lib/_cygwin_S_IEXEC.cc: Remove obsolete file.
2002-06-23 Christopher Faylor <cgf@redhat.com>
Use cygwin_{shm,ipc}.h instead of /sys/{shm,ipc}.h throughout.
* sys/ipc.h: Remove.
* sys/shm.h: Remove.
* cygwin_ipc.h: New file.
* cygwin_shm.h: New file.
2002-06-23 Christopher Faylor <cgf@redhat.com>
* cygwin.sc: Add recent changes from ld sources.
2002-06-23 Conrad Scott <conrad.scott@dsl.pipex.com>
* winsup.h: Move #ifdef EXPCGF code into "winbase.h".
* winbase.h: #ifdef EXPCGF code moved here from "winsup.h".
2002-06-12 Thomas Pfaff <tpfaff@gmx.net>
* thread.h (pthread::cleanup_stack): Rename cleanup_handlers to
cleanup_stack.
* thread.cc (pthread::pthread): Ditto.
(pthread::create): Fix mutex verification.
(pthread::push_cleanup_handler): Renam cleanup_handlers to
cleanup_stack. Remvoe Mutex calls, use InterlockedExchangePointer
instead.
(pthread::pop_cleanup_handler): Rename cleanup_handlers to
cleanup_stack.
(pthread::pop_all_cleanup_handlers): Ditto.
(__pthread_once): Check state first and return if already done.
(__pthread_join): Revert DEADLOCK test to __pthread_equal call.
(__pthread_detach): Unlock mutex before deletion.
2002-06-21 Christopher Faylor <cgf@redhat.com>
* Makefile.in (cygrun.exe): Move -lgcc where it will do some good.
2002-06-21 Corinna Vinschen <corinna@vinschen.de>
* syscalls.cc (stat64_to_stat32): Correctly evaluate st_rdev.
(fstat64): Set st_rdev to same value as st_dev.
(stat_worker): Ditto.
2002-06-21 Corinna Vinschen <corinna@vinschen.de>
* security.cc (alloc_sd): Carefully check owner_sid again after trying
SIDs from cygheap.
2002-06-21 Corinna Vinschen <corinna@vinschen.de>
* security.cc (alloc_sd): Remove unnecessary retrieval of owner name.
Check uid for current user first and use SIDs from cygheap if so.
Set errno to EINVAL if user SID isn't retrievable. Just print user SID
as debug output.
Don't bail out if group SID isn't retrievable. Change debug output
appropriately.
2002-06-21 Christopher Faylor <cgf@redhat.com>
* errno.cc: Change text description for EBADF throughout.
2002-06-20 Pierre Humblet <pierre.humblet@ieee.org>
* uinfo.cc (cygheap_user::ontherange): Use env_name for NetUserGetInfo.
(cygheap_user::env_logsrv): Verify env_domain is valid.
* environ.cc: Include child_info.h and keep spenvs[] sorted.
(environ_init): Check child_proc_info instead of myself->ppid_handle.
2002-06-19 Christopher Faylor <cgf@redhat.com>
* fhandler.cc (fhandler_base::set_flags): Change priority of "linked
in" default binmode setting so that it has priority over optional
setting.
2002-06-19 Christopher Faylor <cgf@redhat.com>
Use hMainProc where appropriate, throughout.
* environ.cc (spenv::retrieve): Add debugging statements.
* pinfo.cc (set_myself): Don't call strace.hello if already stracing.
* strace.cc (strace): Move NO_COPY keyword so that it will actually
take effect.
2002-06-19 Corinna Vinschen <corinna@vinschen.de>
* uinfo.cc (cygheap_user::ontherange): Call NetUserGetInfo() only with
non-NULL logserver parameter.
2002-06-16 Christopher Faylor <cgf@redhat.com>
* cygheap.h (cygheap_user::issetuid): New method.
* dtable.cc (dtable::vfork_child_dup): Use new method to determine if
we are in "setuid mode."
* fork.cc (fork_parent): Ditto.
* spawn.cc (spawn_guts): Ditto.
* syscalls.cc (seteuid32): Ditto.
(setegid32): Ditto.
* environ.cc (spenv::retrieve): (Suggested by Pierre Humblet) Do
potential recalculation of cygheap_user stuff when in setuid mode.
Return special value when environment variable should be calculated but
not added.
(build_env): Don't add retrieved value to dstp if it is 'dont_add'.
2002-06-16 Christopher Faylor <cgf@redhat.com>
Changes suggested by Pierre Humblet.
* environ.cc (NL): New macro.
(conv_envvars): Use NL macro to fill in name and namelen.
(spenv::namelen): New field.
(spenvs): Use NL to fill in name and namelen.
(spenv::retrieve): Eliminate length argument. Instead, use namelen
throughout.
(build_env): Don't calculate length of initial FOO= part of
environment. Accommodate spenv::retrive argument change.
2002-06-16 Christopher Faylor <cgf@redhat.com>
* cygheap.h (cygheap_user::winname): New field.
* cygheap.cc (cygheap_user::set_name): Clear winname when name changes.
* uinfo.cc (cygheap_user::env_logsrv): Avoid calculating server when
Windows user == SYSTEM.
(cygheap_user::env_domain): Set winname here too.
(cygheap_user::env_userprofile): Eliminate superfluous tests.
(cygheap_user::env_name): Seed winname by calling env_domain().
2002-06-12 Pierre Humblet <pierre.humblet@ieee.org>
* spawn.cc (spawn_guts): Revert removal of ciresrv.moreinfo->uid =
ILLEGAL_UID.
2002-06-15 Christopher Faylor <cgf@redhat.com>
* child_info.h (child_proc_info): Declare as base class.
(spawn_info): Declare as alias of child_proc_info to aid debugging.
(fork_info): Ditto.
* cygheap.cc (cygheap_fixup_in_child): Use child_proc_info global
rather than parameter.
* cygheap.h (cygheap_fixup_in_child): Reflect above change in
declaration.
* dcrt0.cc (_dll_crt0): Move 'si' definition here. Assign
child_proc_info.
(dll_crt0_1): Accommodate cygheap_fixup_in_child and *_info changes.
* environ.cc (spenv::retrieve): Make regparm.
* environ.h (environ_init): Ditto.
(win_env::add_cache): Ditto.
(build_env): Ditto.
(getwinenv): Ditto.
* fork.cc (sync_with_parent): Use fork_info global.
(fork_child): Ditto.
2002-06-14 Christopher Faylor <cgf@redhat.com>
* uinfo.cc (cygheap_user::ontherange): Don't set HOMEDRIVE or HOMEPATH
unless one or the other is specified.
2002-06-14 Christopher Faylor <cgf@redhat.com>
* cygheap.h (cygheap_user::userprofile_env_buf): New static member.
* environ.cc (build_env): Add debugging statement.
(spenvs): Switch functions for USERDOMAIN and USERNAME.
* spawn.cc (spawn_guts): Move environment initialization prior to
cygheap_setup_for_child or environment info will never be copied to
child.
2002-06-14 Christopher Faylor <cgf@redhat.com>
* cygheap.h (cygheap_user): Add static members to hold home{drive,path}
info.
* uinfo.cc (cygheap_user::ontherange): Use static class members for
local HOME* storage.
2002-06-14 Christopher Faylor <cgf@redhat.com>
* cygheap.cc (cygheap_user::set_logsrv): Remove.
(cygheap_user::set_domain): Ditto.
* cygheap.h (cygheap_user::set_logsrv): Remove declaration.
(cygheap_user::set_domain): Ditto.
(cygheap_user::env_domain): Declare new method.
(cygheap_user::env_name): Ditto.
* environ.cc (spenvs): Add two environment variables.
* spawn.cc (spawn_guts): Call build_env after RevertToSelf. Always set
ciresrv.mount_h.
(cygheap_user::ontherange): Recalculate homedrive/homepath if they are
empty. Use env_logsrv to get logon server.
(cygheap_user::env_logsrv): Calculate server name here rather than
relying on it having been previously calculated.
(cygheap_user::env_domain): Ditto for domain name.
(cygheap-user::env_name): New method.
2002-06-12 Pierre Humblet <pierre.humblet@ieee.org>
* syscalls.cc (seteuid32): Do not get or set the environment. Do not
call LookupAccountSid nor internal_getlogin. Set cygheap->user name
and sid from the passwd entry.
* uinfo.cc (uinfo_init): Only call internal_getlogin when starting from
a non Cygwin process and use the values returned in user.
(internal_getlogin): Simplify to case where starting from a non Cygwin
process. Store return values in user and return void. Do not set the
Windows default environment.
* dcrt0.cc (dll_crt0_1): Call uinfo_init only when needed. Do not set
myself->uid nor reset user.sid.
* spawn.cc (spawn_guts): Get the sid from cygheap->user. Always
RevertToSelf(). Don't set uid in impersonated case.
* cygheap.cc (cygheap_user::set_sid): Do not set orig_sig.
(cygheap_user::set_orig_sid): New.
* cygheap.h: Declare cygheap_user::set_sid.
* winsup.h: Add argument to uinfo_init().
2002-06-14 Corinna Vinschen <corinna@vinschen.de>
* environ.cc (build_env): If realloc moves envblock, move s with it.
2002-06-13 Nicholas S. Wourms <nwourms@netscape.net>
* winver.rc: Add more words to copyright.
2002-06-13 Corinna Vinschen <corinna@vinschen.de>
* cygheap.cc (cygheap_user::set_name): Revert previous change.
* environ.cc (spenv::retrieve): Check return value of call to
cygheap->user.*from_cygheap().
2002-06-13 Corinna Vinschen <corinna@vinschen.de>
* cygheap.cc (cygheap_user::set_name): Remove setting homedrive and
homepath to NULL.
(cygheap_user::set_logsrv): Fix free'ing of plogsrv.
* cygheap.h (cygheap_user::cygheap_user): Initialize homedrive and
homepath to NULL.
2002-06-13 Christopher Faylor <cgf@redhat.com>
* security.cc (get_logon_server): Use strcasematch rather than
strcasecmp.
2002-06-12 Christopher Faylor <cgf@redhat.com>
* path.cc (chdir): Minor cleanup.
2002-06-12 Christopher Faylor <cgf@redhat.com>
* environ.cc (build_env): Correctly fill out windows environment block
with win32 paths rather than posix paths.
2002-06-12 Christopher Faylor <cgf@redhat.com>
* cygheap.cc (cygheap_user::set_name): Set homedrive and homepath to
NULL on user name change.
(cygheap_user::set_logsrv): Allocate enough space for leading \\ so
that we can put this in the environment, if needed.
* cygheap.h (homebodies): New enum.
(cygheap_user::homedrive): New field.
(cygheap_user::homepath): Ditto.
(cygheap_user::env_logsrv): New method.
(cygheap_user::env_homepath): New method.
(cygheap_user::env_homedrive): New method.
(cygheap_user::env_userprofile): New method.
(cygheap_user::ontherange): New method.
* environ.cc (envsize): Eliminate debugging argument.
(environ_init): Assume that envc counts number of elments not total
size.
(spenv): New class.
(spenvs): New array, rename from forced_winenv_vars, using spenv.
(spenv::retrieve): New method.
(build_env): Rename from 'winenv' -- one stop shopping for building new
environment blocks for both windows and "unix".
* environ.h (build_env: Declare.
(winenv): Delete declaration.
(envsize): Ditto.
* spawn.cc (spawn_guts): Use build_env to build windows and cygwin
environment blocks.
* uinfo.cc (internal_getlogin): Eliminate environment manipulation.
Default to info from GetUserName if it exists. Move HOMEPATH and
HOMEDRIVE stuff elsewhere. Move HOME setting elsewhere. Only set HOME
environment variable in processes that are not parented by a cygwin
process.
(cygheap_user::ontherange): Define new method.
(cygheap_user::env_logsrv): Ditto.
(cygheap_user::env_homepath): Ditto.
(cygheap_user::env_homedrive): Ditto.
(cygheap_user::env_userprofile): Ditto.
2002-06-11 Christopher Faylor <cgf@redhat.com>
* spawn.cc (spawn_guts): More hToken removal cleanup.
2002-06-09 Pierre Humblet <pierre.humblet@ieee.org>
* spawn.cc (spawn_guts): Define sec_attribs and call sec_user_nih()
only once.
2002-06-10 Christopher Faylor <cgf@redhat.com>
* Makefile.in: Ensure that -MD gets added to CFLAGS regardless of
CFLAGS command-line setting.
* cygwin.din: Export sexec* functions as function which returns ENOSYS
(i.e., sexec* is deprecated).
* dtable.cc (dtable::vfork_child_dup): Ensure that impersonation is
restored even on failure.
* exec.cc: Throughout, remove references to sexec* and _spawnve.
* pinfo.h: Remove _spawnve declaration.
* spawn.cc: Rename _spawnve to spawnve and use throughout.
(spawn_guts): Eliminate hToken argument and processing of same. Just
perform special actions if impersonating.
(spawnve): Rename from _spawnve.
2002-06-10 Christopher Faylor <cgf@redhat.com>
* include/sys/strace.h (strace): Avoid use of constructor.
2002-06-10 Christopher Faylor <cgf@redhat.com>
* dcrt0.cc (dll_crt0_1): Initialize wincap and check for sanity before
running global ctors.
* wincap.h (wincap): Eliminate constructor. Default is to zero memory,
anyway.
* wincap.cc (wincap): Copy this on fork to avoid initialization in
forked processes.
2002-06-10 Corinna Vinschen <corinna@vinschen.de>
* fhandler.h (fhandler_socket::fixup_after_fork): Revert patch from
2002-06-04.
* fhandler_socket.cc (fhandler_socket::fixup_after_fork): Ditto.
(fhandler_socket::dup): Ditto.
* net.cc (fdsock): Make sockets explicitely noninheritable on NT.
2002-06-09 Christopher Faylor <cgf@redhat.com>
* fhandler_disk_file.cc (fhandler_disk_file::fstat_helper): Correctly
set number of links for directory, if appropriate.
2002-06-10 Robert Collins <rbtcollins@hotmail.com>
* thread.cc: Variation of a patch from Thomas Pffaf.
(__pthread_detach): Cleanup thread object if the thread has terminated.
(__pthread_join): Change order of error checks, and lock against
join/detach/exit races.
(__pthread_exit): Lock object against join/detach/exit races.
(pthread::thread_init_wrapper): Ditto.
(thread_init_wrapper): Rename to pthread::thread_init_wrapper.
(pthread::create): Check that the mutex initialized correctly.
(pthread::push_cleanup_handler): Lock against potential cancellation
race. NB: this may not be required if pthread_cleanup_push is non-
cancelable.
* thread.h (pthread::mutex): New member.
(thread_init_wrapper): Rename to pthread::thread_init_wrapper.
(pthread::thread_init_wrapper_: New static member.
2002-06-10 Robert Collins <rbtcollins@hotmail.com>
* cygwin.din: Add _pthread_cleanup_push and _pthread_cleanup_pop.
* pthread.cc: Change __pthread_self to pthread::self() thruoghout.
(_pthread_cleanup_push): New function.
(_pthread_cleanup_pop): Ditto.
* thread.cc: Thanks to Thomas Pfaff for the pthread cleanup_push,_pop
patch, this work is derived from that.
Change __pthread_self to pthread::self() thruoghout.
(__pthread_self): Rename to pthread::self.
(pthread::self): New method.
(pthread::pthread): Initialize new member.
(pthread::push_cleanup_handler): New method.
(pthread::pop_cleanup_handler): New method.
(pthread::pop_all_cleanup_handlers): New method.
(__pthread_exit): Pop all cleanup handlers.
* thread.h (pthread::push_cleanup_handler): Declare.
(pthread::pop_cleanup_handler): Ditto.
(pthread::pop_all_cleanup_handlers): Ditto.
(pthread::self): New static method.
(__pthread_exit): Give C++ linkage.
(__pthread_join): Ditto.
(__pthread_detach): Ditto.
(__pthread_self): Remove.
2002-04-24 Thomas Pfaff <tpfaff@gmx.net>
* include/pthread.h (__pthread_cleanup_handler): New structure.
(pthread_cleanup_push): Rewritten.
(pthread_cleanup_pop): Ditto.
(_pthread_cleanup_push): New prototype.
(_pthread_cleanup_pop): Ditto.
2002-04-24 Thomas Pfaff <tpfaff@gmx.net>
* thread.cc (thread_init_wrapper): Check if thread is already joined.
(__pthread_join): Set joiner first.
(__pthread_detach): Ditto.
2002-06-10 Robert Collins <rbtcollins@hotmail.com>
* cygserver_transport.cc (create_server_transport): Finish the split
out of sockets code from transport_layer_base. Thanks to Nicholas
Wourms and Conrad Scott for catching this.
2002-06-08 Christopher Faylor <cgf@redhat.com>
* pinfo.cc (pinfo_dummy): Initialize to correct size.
2002-06-08 Christopher Faylor <cgf@redhat.com>
* path.cc: Change MOUNT_AUTO to MOUNT_CYGDRIVE throughout.
* shared_info.h (CURR_MOUNT_MAGIC): Update.
2002-06-08 Christopher Faylor <cgf@redhat.com>
* external.cc (cygwin_internal): Make v1 mount table access invalid.
* path.cc (mount_info::init): Remove had_to_create_mount_areas initialization.
(mount_info::from_registry): Remove v1 table import.
(mount_info::read_v1_mounts): Eliminate.
(mount_info::import_v1_mounts): Ditto.
* shared_info.h (mount_info): Ditto for both of above.
* sys/mount.h (MOUNT_DEVFS): New enum.
(MOUNT_PROC): Ditto.
2002-06-08 Christopher Faylor <cgf@redhat.com>
* include/wchar.h: Define __need_size_t.
2002-06-07 Christopher Faylor <cgf@redhat.com>
* fhandler_socket.cc (fhandler_socket::fstat): Don't assume that socket
is unix-domain socket.
2002-06-07 Christopher Faylor <cgf@redhat.com>
* times.cc (hires_ms::prime): Set init flag.
2002-06-07 Conrad Scott <conrad.scott@dsl.pipex.com>
* times.cc (hires_ms::prime): Adjust epoch of initime_us from 1601 to
1970.
2002-06-06 Christopher Faylor <cgf@redhat.com>
* autoload.cc (timeGetDevCaps): Define new autoload function.
(timeGetTime): Ditto.
(timeBeginPeriod): Ditto.
(timeEndPeriod): Ditto.
* hires.h (hires_base): New class. Rename from hires.
(hires_us): New class.
(hires_ms): New class.
* strace.cc (strace::microseconds): Use hires_us class.
* times.cc (gettimeofday): Use hires-ms class.
(hires_us::prime): Rename from hires::prime.
(hires_us::usecs): Rename from hires:usecs.
(hires_ms::prime): New method.
(hires_ms::usecs): New method.
(hires_ms::~hires_ms): New destructor.
2002-06-06 Christopher Faylor <cgf@redhat.com>
* autoload.cc (noload): Correctly save argument count register.
2002-06-05 Conrad Scott <conrad.scott@dsl.pipex.com>
* fhandler.cc (fhandler_base::fstat): Initialise tv_nsec member of
st_atim, st_mtim, and st_ctim fields.
* fhandler_disk_file.cc (fhandler_disk_file::fstat_helper): Ditto.
* fhandler_process.cc (fhandler_process::fstat): Ditto.
* glob.c (stat32_to_STAT): Copy across the whole st_atim, st_mtime, and
st_ctim fields.
* syscalls.cc (stat64_to_stat32): Ditto.
* times.cc (to_timestruc_t): New function.
(time_as_timestruc_t): New function.
* winsup.h: Add to_timestruc_t and time_as_timestruc_t functions.
* include/cygwin/stat.h: Replace time_t with timestruc_t throughout for
all file times, removing the st_spare1, st_spare2, and st_spare3 fields
in the process. Add macros to access tv_sec fields by old names.
* include/cygwin/types.h: Typedef timespec_t and timestruc_t as struct
timespec.
2002-06-03 Pierre Humblet <pierre.humblet@ieee.org>
* sec_helper.cc (lookup_name): Suppress.
* security.cc (alloc_sd): Remove logsrv argument.
Remove two calls to lookup_name.
(set_security_attribute): Remove logsrv argument.
Remove logsrv argument in call to alloc_sd.
(set_nt_attribute): Remove logsrv argument.
Remove logsrv argument in call to set_security_attribute.
(set_file_attribute): Remove logsrv argument.
Remove logsrv argument in call to set_nt_attribute.
(set_file_attribute): Remove logsrv argument.
Remove logsrv argument in call to set_file_attribute.
* syscalls.cc (chown_worker): Remove logserver argument in
call to set_file_attribute.
(chmod): Ditto.
* shm.cc (shmget): Remove logsrv argument in call to alloc_sd.
* uinfo.cc (internal_getlogin): Replace calls to
lookup_name by call to LookupAccountName.
* security.h: Remove logsrv in declarations of set_file_attribute
and alloc_sd. Remove declaration of lookup_name.
2002-06-05 Christopher Faylor <cgf@redhat.com>
* child_info.h (CHILD_INFO_MAGIC): Oops. Revert previous change. gcc
3.1 bug?
2002-06-05 Christopher Faylor <cgf@redhat.com>
* child_info.h (CHILD_INFO_MAGIC): Update.
2002-06-05 Christopher Faylor <cgf@redhat.com>
* strace.cc (strace::hello): Set inited, when appropriate.
2002-06-05 Christopher Faylor <cgf@redhat.com>
* cygwin.din: Eliminate some newlib wrappers.
* path.cc (get_devn): Only consider first 99 potential com devices.
(get_device_number): Ditto.
* times.cc (_times): Eliminate.
(_times): Rename from times().
2002-06-05 Christopher Faylor <cgf@redhat.com>
* dir.cc (rmdir): Streamline. Detect attempts to remove directories
from "read-only" virtual devices. (Suggested by Pavel Tsekov)
* syscalls.cc (unlink): Detect attempts to remove directories from
"read-only" virtual devices. (From Pavel Tsekov)
2002-06-05 Christopher Faylor <cgf@redhat.com>
* dtable.cc (handle_to_fn): Check error return value from NtQueryObject
first before seeing if name buffer is NULL.
* grp.cc (read_etc_group): Fix gcc warning regarding snprintf format.
* passwd.cc (read_etc_passwd): Ditto.
2002-04-18 Thomas Pfaff <tpfaff@gmx.net>
* thread.h (pthread::joiner): New member.
* thread.cc (pthread::pthread): Initialize joiner to NULL
(pthread::create): Increment of thread counter moved from
__pthread_create to this location.
(__pthread_create): Increment thread counter removed.
(thread_init_wrapper): Set joiner to self when thread was created
detached.
(__pthread_exit): delete thread when it is detached and not
joined.
(__pthread_join): Check for deadlock and delete thread when it has
terminated.
(__pthread_detach): Set joiner to self when thread state
changed to detached.
2002-06-05 Corinna Vinschen <corinna@vinschen.de>
* grp.cc (read_etc_group): When emulating nonexisting group file on
NT systems, read primary group SID from process token. Use that info
to create correct group entry. On error or on 9x systems fallback
to emulating Administrators group as before.
* passwd.cc (read_etc_passwd): When emulating nonexisting passwd file
on NT systems, read user and primary group SID from process token.
Use that info to create correct passwd entry. On error or on 9x
systems fallback to emulating user with Administrator user id and
Administrators group as before.
2002-06-05 Corinna Vinschen <corinna@vinschen.de>
* grp.cc (etc_group): Removed.
(parse_grp): Make line parameter nonconst. Don't copy data into new
allocated memory. Check for CR instead of LF to accomodate new
read method.
(add_grp_line): Make line parameter nonconst.
(read_etc_group): Rearrange using new pwdgrp_read class.
* passwd.cc (parse_pwd): Don't copy data into new allocated memory.
Check for CR instead of LF to accomodate new read method.
(read_etc_passwd): Rearrange using new pwdgrp_read class.
* pwdgrp.h (pwdgrp_check::set_last_modified): Use different
parameters.
(class pwdgrp_read): New class for opening and reading passwd and
group files.
2002-06-04 Christopher Faylor <cgf@redhat.com>
* dtable.cc (handle_to_fn): Attempt to handle "raw" accesses to remote
shares.
* path.cc (mount_info::conv_to_win32_path): Set flags to binary when
mount entry is not found.
(mount_info::set_flags_from_win32_path): Ditto.
2002-06-04 Christopher Faylor <cgf@redhat.com>
* dtable.cc (handle_to_fn): Correct placement and length of name
buffer. (Suggested by Pavel Tsekov)
2002-06-04 Christopher Faylor <cgf@redhat.com>
Remove fcntl.h includes throughout.
* fhandler.h: Move fcntl.h include here.
(fhandler_base::set_flags): Accept supplied_bin argument. Make
non-inlined.
* dtable.cc (dtable::init_std_file_from_handle): Just use binmode from
pc.
(reset_to_open_binmode): Use set_flags.
* cygwin.din (open): Avoid newlib wrapper.
(read): Ditto.
(unlink): Ditto.
(write): Ditto.
* fhandler.cc (fhandler_base::set_flags): Accept supplied_bin argument.
Make binmode decisions here.
(fhandler_base::open): Avoid using pc if it is NULL. Eliminate binmode
logic. Just call set_flags with binmode argument.
(fhandler_base::init): Call set_flags with binmode argument.
* fhandler_clipboard.cc (fhandler_dev_clipboard::open): Ditto.
* fhandler_console.cc (fhandler_console::open): Ditto.
(fhandler_console::init): Force binary on open.
* fhandler_disk_file.cc (fhandler_disk_file::open): Don't set binmode
here. Let it happen in base class.
* fhandler_dsp.cc (fhandler_dev_dsp::open): Force binmode open. Set
return value appropriately if unable to open.
* fhandler_proc.cc (fhandler_proc::open): Make sure flags are set
before open_status.
* fhandler_process.cc (fhandler_process::open): Ditto.
* fhandler_registry.cc (fhandler_registry::open): Ditto.
* fhandler_random.cc (fhandler_dev_random::fhandler_dev_random): Ditto.
* fhandler_raw.cc (fhandler_dev_raw::open): Force O_BINARY by default.
* fhandler_serial.cc (fhandler_serial::init): Ditto.
* fhandler_tty.cc (fhandler_tty_slave::open): Ditto.
(fhandler_pty_master::open): Ditto.
* fhandler_virtual.cc (fhandler_virtual::open): Ditto.
* fhandler_windows.cc (fhandler_windows::open): Ditto.
* fhandler_zero.cc (fhandler_dev_zero::open): Ditto.
* net.cc (fdsock): Ditto.
* path.cc (path_conv::check): Avoid checking for executable extension
when directory. (Suggested by Pavel Tsekov)
(set_flags): Set PATH_TEXT explicitly, when appropriate.
(mount_info::conv_to_win32_path): Use set_flags() to set path flags.
* path.h (PATH_TEXT): New enum.
(path_conv::binmode): Return appropriate constant based on binmode.
* pipe.cc (make_pipe): Set binmode to O_TEXT xor O_BINARY.
* syscalls.cc (setmode_helper): Make debugging message a little
clearer.
(setmode): Set binmode via set_flags.
2002-06-04 Corinna Vinschen <corinna@vinschen.de>
* fhandler.h (class fhandler_socket): Add private method
fixup_after_fork (bool, HANDLE).
* fhandler_socket.cc (fhandler_socket::fixup_after_fork): Move
functionality to new private method. Add closing parent socket
if not called from dup(). Create method new calling private method
with appropriate parameter.
(fhandler_socket::fixup_after_exec): Call private method
fixup_after_fork with appropriate parameter.
(fhandler_socket::dup): Ditto.
2002-06-04 Corinna Vinschen <corinna@vinschen.de>
* fhandler_dsp.cc (fhandler_dev_dsp::open): Set errno to EACCES if
requested mode isn't supported.
2002-06-03 Christopher Faylor <cgf@redhat.com>
* fhandler.cc (fhandler_base::open): Don't set binmode if already set.
Don't check for file. Files should already be set. Report on binary
mode for debugging.
(fhandler_base::fhandler_base): Don't set default binmode here. That's
for later.
* fhandler_console.cc (fhandler_console::output_tcsetattr): Don't set
binmode, ever, for console.
* fhandler_disk_file.cc (fhandler_disk_file::open): Always set the
binary mode to the value derived from mount table.
* path.cc (mount_info::conv_to_win32_path): Default to binmode if path
does not translate into anything in the mount table.
2002-06-03 Corinna Vinschen <corinna@vinschen.de>
* external.cc (cygwin_internal): Add CW_EXTRACT_DOMAIN_AND_USER
handling to call extract_nt_dom_user() from applications.
* include/sys/cygwin.h (cygwin_getinfo_types): Add
CW_EXTRACT_DOMAIN_AND_USER.
2002-06-03 Corinna Vinschen <corinna@vinschen.de>
* syscalls.cc (stat64_to_stat32): Transform st_dev correctly.
(fstat64): Add evaluating st_ino and st_dev.
(stat_worker): Evaluate st_dev as 32 bit value.
* include/cygwin/stat.h: Use new dev_t definition throughout.
* include/cygwin/types.h: Define __dev16_t and __dev32_t. Define
dev_t according to __CYGWIN_USE_BIG_TYPES__ setting.
* include/sys/sysmacros.h: Define major, minor and makedev
according to __CYGWIN_USE_BIG_TYPES__ setting.
2002-06-03 Pierre Humblet <pierre.humblet@ieee.org>
* syscalls.cc (setegid32): Verify the correctness of the gid
of the group returned by getgrgid32.
2002-06-03 Pierre Humblet <pierre.humblet@ieee.org>
* security.cc (lsa2wchar): Suppressed.
(get_lsa_srv_inf): Suppressed.
(get_logon_server_and_user_domain): Suppressed.
(get_logon_server): Essentially new.
(get_user_groups): Add "domain" argument. Only lookup the
designated server and use "domain" in LookupAccountName.
(is_group_member): Simplify the arguments.
(get_user_local_groups): Simplify the arguments. Do only a
local lookup. Use "BUILTIN" and local domain in LookupAccountName.
(get_user_primary_group). Only lookup the designated server.
(get_group_sidlist): Remove logonserver argument. Do not lookup
any server for the SYSTEM account.
(create_token): Delete logonserver and call to get_logon_server.
Adjust arguments of get_group_sidlist, see above.
* security.h: Delete declaration of get_logon_server_and_user_domain
and add declaration of get_logon_server.
* uinfo.cc (internal_get_login): Call get_logon_server instead of
get_logon_server_and_user_domain.
2002-06-02 Christopher Faylor <cgf@redhat.com>
* dtable.cc (handle_to_fn): Use largest match for device. Correctly
(?) deal with remote drive weirdness.
2002-06-02 Christopher Faylor <cgf@redhat.com>
* fhandler_disk_file.cc (fhandler_disk_file::fstat_by_name): Check
specifically for non-existent file, first.
(fhandler_disk_file::fstat): Perform fd open on files with funny
characters.
2002-06-02 Christopher January <chris@atomice.net>
* fhandler_process.cc (fhandler_process::open): Set fileid.
2002-06-02 Christopher Faylor <cgf@redhat.com>
Remove unneeded sigproc.h includes throughout.
* fhandler.h (fhandler_proc::fill_filebuf): Take a pinfo argument.
* fhandler_proc.cc (fhandler_proc::get_proc_fhandler): Simplify search
for given pid.
(fhandler_proc::readdir): Assume that pid exists if it shows up in the
winpid list.
* fhandler_process.cc (fhandler_process::open): Simplify search for
given pid. Call fill_filebuf with pinfo argument.
(fhandler_process::fill_filebuf): Pass pinfo here and assume that it
exists.
* pinfo.h (pinfo::remember): Define differently if sigproc.h is not
included.
2002-06-02 Christopher Faylor <cgf@redhat.com>
* dll_init.cc (dll_list::detach): Don't run destructor on exit.
2002-06-01 Christopher Faylor <cgf@redhat.com>
* fhandler.cc (fhandler_base::fstat): Move dev and ino calculation into
caller.
* syscalls.cc (stat_worker): Calculate dev and ino calculation here, if
zero.
* fhandler_proc.cc (fhandler_proc::fhandler_proc): Minor reorg for
debugging.
* fhandler_process.cc (fhandler_process::exists): Return 0 on
nonexistence.
(fhandler_process::fstat): Simplify pid logic.
* fhandler_tape.cc (fhandler_dev_tape::fstat): Minor reformatting.
2002-06-01 Christopher Faylor <cgf@redhat.com>
* path.cc (chdir): Don't allow cd'ing to a non-directory virtual path.
2002-05-31 Christopher Faylor <cgf@redhat.com>
* fhandler_disk_file.cc (readdir): Move inode calculation into caller.
(fhandler_cygdrive::readdir): Add "." and "..".
* dir.cc (readdir): Move inode calculation here so that fhandler
readdirs can benefit.
2002-05-31 Christopher Faylor <cgf@redhat.com>
* fhandler_console.cc (fhandler_console::open): Reinstate setting of
flags.
* dtable.cc (dtable::init_std_file_from_handle): Default to using
binmode derived from path_conv, when required.
* fhandler.h (fhandler_base::get_w_binary): Default to binmode if
nothing else is specified.
* fhandler.h (fhandler_base::get_r_binary): Ditto.
* fhandler_disk_file.cc (fhandler_disk_file::fstat_by_handle): Work
around g++ warning.
* path.cc (path_conv::check): Remove a debugging statement.
2002-05-31 Christopher Faylor <cgf@redhat.com>
* fhandler_console.cc (fhandler_console::open): Always default to
binmode.
(fhandler_console::write_normal): Don't honor binmode setting. There
is already a termios setting for this.
(fhandler_console::init): Correct argument order in init call.
2002-05-31 Christopher Faylor <cgf@redhat.com>
* fhandler.cc (fhandler_base::open): Make default open mode == binmode.
(fhandler_base::init): Set open flags based on derived binmode argument.
2002-05-31 Christopher Faylor <cgf@redhat.com>
* dll_init.cc (dll_list::init): Eliminate unneeded debugging statement.
2002-05-31 Christopher Faylor <cgf@redhat.com>
* fhandler_proc.cc (fhandler_proc::readdir): Set errno when no more
files.
* fhandler_process.cc (fhandler_process::readdir): Ditto.
* fhandler_registry.cc (fhandler_registry::readdir): Ditto.
2002-05-30 Christopher Faylor <cgf@redhat.com>
* path.cc (path_conv::check): Set fileattr to INVALID_FILE_ATTRIBUTES
for nonexistent virtual device path.
(chdir): Set correct errno when attempt is made to cd to nonexistent
virtual device path.
2002-05-30 Christopher Faylor <cgf@redhat.com>
* fhandler_disk_file.cc (fhandler_disk_file::fstat): Always call
fstat_by_name if fd is not opened to allow fstat_by_name to properly
set errno.
2002-05-30 Corinna Vinschen <corinna@vinschen.de>
* autoload.cc: Replace autoload statments for ZwXXX by NtXXX.
Drop ZwQuerySystemInformation since NtQuerySystemInformation was
already available.
* fhandler_proc.cc (format_proc_uptime): Replace call to
ZwQuerySystemInformation by call to NtQuerySystemInformation.
(format_proc_stat): Ditto.
* fhandler_process.cc (format_process_stat): Replace call to
ZwQueryInformationProcess by call to NtQueryInformationProcess.
(get_process_state): Ditto.
(get_mem_values): Ditto. Replace call to ZwQueryVirtualMemory by
call to NtQueryVirtualMemory.
* ntdll.h: Cleanup. Drop ZwQuerySystemInformation since
NtQuerySystemInformation was already available. Replace declarations
of ZwXXX functions by declarations of NtXXX.
* pinfo.cc (winpids::enumNT): Replace call to ZwQuerySystemInformation
by call to NtQuerySystemInformation.
2002-05-29 Christopher Faylor <cgf@redhat.com>
* fhandler.cc (binmode): Default to binmode when mode is not known.
2002-05-29 Christopher Faylor <cgf@redhat.com>
* include/sys/cygwin.h (EXTERNAL_PINFO_VERSION): Reinstate.
* external.cc (fillout_pinfo): Use it.
2002-05-29 Corinna Vinschen <corinna@vinschen.de>
* external.cc (fillout_pinfo): Use new version define.
* include/sys/cygwin.h (external_pinfo): Define
EXTERNAL_PINFO_VERSION_16_BIT and EXTERNAL_PINFO_VERSION_32_BIT
instead of just EXTERNAL_PINFO_VERSION.
2002-05-29 Christopher Faylor <cgf@redhat.com>
* external.cc (fillout_pinfo): Set new version field in external_pinfo
structure.
* include/sys/cygwin.h (external_pinfo): Replace strace_file with
version field.
2002-05-29 Corinna Vinschen <corinna@vinschen.de>
Change internal uid datatype from __uid16_t to __uid32_t
throughout.
* cygwin.din: Export new symbols getpwuid32, getpwuid_r32, getuid32,
geteuid32, setuid32, seteuid32.
* passwd.cc (getpwuid32): New function.
(getpwuid_r32): Ditto.
* syscalls.cc (seteuid32): Ditto.
(setuid32): Ditto.
* uinfo.cc (getuid32): Ditto.
(geteuid32): Ditto.
* winsup.h (uid16touid32): New macro, correct casting from __uid16_t
to __uid32_t.
(gid16togid32): Ditto fir gids.
(getuid32): Declare.
(geteuid32): Ditto.
(getpwuid32): Ditto.
* include/sys/cygwin.h (struct external_pinfo): Add members uid32 and
gid32.
2002-05-29 Corinna Vinschen <corinna@vinschen.de>
* include/cygwin/socket.h: Protect some symbols against multiple
definition.
* include/netinet/ip.h: Ditto.
* include/netinet/tcp.h: Ditto.
2002-05-29 Wu Yongwei <adah@netstd.com>
* include/netinet/ip.h: Replace by BSD derived version of the file.
* include/netinet/tcp.h: Ditto.
* include/netinet/udp.h: New file.
* include/cygwin/ip.h: Remove.
2002-05-29 Christopher Faylor <cgf@redhat.com>
* dtable.cc (dtable::init_std_file_from_handle): Attempt stronger
detection of invalid handle.
(handle_to_fn): Detect pathological condition where NT resets the
buffer pointer to NULL on an invalid handle.
2002-05-28 Christopher Faylor <cgf@redhat.com>
* fhandler_disk_file.cc (fhandler_disk_file::fstat_helper): Properly
check for whether we should be opening the file to search for #!
characters. Set path_conv structure execability, too, when
appropriate.
2002-05-28 Corinna Vinschen <corinna@vinschen.de>
* security.cc (set_security_attribute): Call getegid32() instead of
getegid().
* include/cygwin/grp.h: Declare getegid32().
2002-05-28 Corinna Vinschen <corinna@vinschen.de>
Change internal gid datatype from __gid16_t to __gid32_t
throughout.
* cygwin.din: Export new symbols chown32, fchown32, getegid32,
getgid32, getgrgid32, getgrnam32, getgroups32, initgroups32, lchown32,
setgid32, setegid32, getgrent32.
* grp.cc (grp32togrp16): New static function.
(getgrgid32): New function.
(getgrnam32): Ditto.
(getgrent32): Ditto.
(getgroups32): Change name of internal function from getgroups.
(getgroups32): New function.
(initgroups32): Ditto.
* syscalls.cc (chown32): Ditto.
(lchown32): Ditto.
(fchown32): Ditto.
(setegid32): Ditto.
(setgid32): Ditto.
* uinfo.cc (getgid32): Ditto.
(getegid32): Ditto.
* include/cygwin/grp.h: Remove declaration of getgrgid() and getgrnam().
Declare getgrgid32() and getgrnam32() instead. Declare getgid32().
2002-05-27 Christopher Faylor <cgf@redhat.com>
* autoload.cc (noload): Properly mask low order word for determining
number of bytes to pop.
2002-05-27 Christopher Faylor <cgf@redhat.com>
* fhandler_disk_file.cc (fhandler_disk_file::fstat): Minor logic
cleanup.
2002-05-27 Christopher Faylor <cgf@redhat.com>
* autoload.cc (LoadFuncEx): Define via new LoadFuncEx2 macro.
(LoadFuncEx2): Adapt from LoadFuncEx. Provides control of return
value for nonexistent function.
(NtQueryObject): Declare.
(IsDebuggerPresent): Declare via LoadFuncEx2 and always return true if
not available.
* debug.h (being_debugged): Just rely on IsDebuggerPresent return
value.
* dtable.cc (handle_to_fn): New function.
(dtable::init_std_file_from_handle): Attempt to derive std handle's
name via handle_to_fn.
(dtable::build_fhandler_from_name): Fill in what we can in path_conv
structure when given a handle and path doesn't exist.
* fhandler.cc (fhandler_base::open): Don't set the file pointer here.
Use pc->exists () to determine if file exists rather than calling
GetFileAttributes again.
* fhandler.h (fhandler_base::exec_state_isknown): New method.
(fhandler_base::fstat_helper): Add extra arguments to declaration.
(fhandler_base::fstat_by_handle): Declare new method.
(fhandler_base::fstat_by_name): Declare new method.
* fhandler_disk_file (num_entries): Make __stdcall.
(fhandler_base::fstat_by_handle): Define new method.
(fhandler_base::fstat_by_name): Define new method.
(fhandler_base:fstat): Call fstat_by_{handle,name} as appropriate.
(fhandler_disk_file::fstat_helper): Accept extra arguments for filling
out stat structure. Move handle or name specific stuff to new methods
above.
(fhandler_disk_file::open): Use real_path->exists rather than calling
GetFileAttributes again.
* ntdll.h (FILE_NAME_INFORMATION): Define new structure.
(OBJECT_INFORMATION_CLASS): Partially define new enum.
(OBJECT_NAME_INFORMATION): Define new structure.
(NtQueryInformationFile): New declaration.
(NtQueryObject): New declaration.
* path.cc (path_conv::fillin): Define new method.
* path.h (path_conv::fillin): Declare new method.
(path_conv::drive_thpe): Rename from 'get_drive_type'.
(path_conv::volser): Declare new method.
(path_conv::volname): Declare new method.
(path_conv::root_dir): Declare new method.
* syscalls.cc (fstat64): Send real path_conv to fstat as second
argument.
2002-05-24 Pierre Humblet <pierre.humblet@ieee.org>
* security.cc (lsa2str): New function.
(get_priv_list): Call lsa2str instead of sys_wcstombs.
2002-05-22 Pierre Humblet <pierre.humblet@ieee.org>
* syscalls.cc (seteuid): Do not take allow_ntsec into account.
Attempt to use an existing or new token even when the uid
matches orig_uid, but the gid is not in the process token.
Major reorganization after several incremental changes.
(setegid): Do not take allow_ntsec into account. Minor
reorganization after several incremental changes.
2002-05-26 Christopher Faylor <cgf@redhat.com>
* debug.h (being_debugged): New macro.
* dtable.cc (dtable::extend): Use new macro.
* exceptions.cc (try_to_debug): Ditto.
* strace.cc (strace::hello): Only output debugging info when we think
we're being debugged.
2002-05-25 Robert Collins <rbtcollins@hotmail.com>
* winsup.h: Remove duplicate declarations of malloc_lock and
malloc_unlock.
2002-05-24 Christopher Faylor <cgf@redhat.com>
Remove unneeded sync.h, where appropriate, throughout.
Remove unneeded heap.h, where appropriate, throughout.
Remove unneeded exceptions.h, where appropriate, throughout.
Remove unneeded perprocess.h, where appropriate, throughout.
2002-05-22 Pierre Humblet <pierre.humblet@ieee.org>
* security.cc (create_token): Call __sec_user() instead of
sec_user() to remove dependence on allow_ntsec. Verify that
the returned sd is non-null.
2002-05-25 Robert Collins <rbtcollins@hotmail.com>
* gmon.c (fake_sbrk): Correctly return -1 on failed malloc's.
2002-05-24 Christopher Faylor <cgf@redhat.com>
* dtable.cc (dtable::build_fhandler_from_name): Just pass posix path
along to set_name via return_and_clear_normalized_path.
(dtable::build_fhandler): New method with const char * argument.
(dtable::reset_unix_path_name): Eliminate.
(dtable::dup_worker): Use correct build_fhandler method.
* mmap.cc (mmap_record::alloc_fh): Ditto.
* dtable.h (dtable::build_fhandler): New method.
(dtable::reset_unix_path_name): Eliminate.
* fhandler.cc (fhandler_base::set_name): Assume that unix_name has
already been cmalloced.
(fhandler_base::reset_unix_path_name): Eliminate.
(fhandler_base::~fhandler_base): Coercion for cfree.
* fhandler.h (fhandler_base::unix_path_name): Make const char *.
(fhandler_base::win32_path_name): Ditto.
(fhandler_base::reset_unix_path_name): Eliminate.
* fhandler_disk_file.cc (fhandler_cygdrive::set_drives): Accommodate
const char *ness of win32_path_name.
* fhandler_socket.cc (fhandler_socket::fstat): Accommodate new set_name
requirements.
* path.cc (path_conv::return_and_clear_normalized_path): New method.
(path_conv::clear_normalized_path): Eliminate.
(path_conv::~path_conv): Ditto.
(path_conv::check): Accommodate new build_fhandler method.
* path.h (path_conv::~path_conv): Eliminate.
(path_conv::clear_normalized_path): Ditto.
(path_conv::return_and_clear_normalized_path): Declare new method.
2002-05-23 Christopher Faylor <cgf@redhat.com>
* path.cc (path_conv::check): Make sure any trailing path component is
part of potential normalized posix path.
2002-05-23 Christopher Faylor <cgf@redhat.com>
* smallprint.c (__small_vsprintf): Implement '%o' after all these
years.
2002-05-22 Christopher Faylor <cgf@redhat.com>
* fhandler.h (fhandler_virtual::exists): Eliminate path argument.
(fhandler_proc::exists): Ditto.
(fhandler_registry::exists): Ditto.
(fhandler_process::exists): Ditto.
* fhandler_proc.cc (fhandler_proc::exists): Ditto. Use built-in name.
* fhandler_process.cc (fhandler_process::exists): Ditto.
(fstat): Ditto.
* fhandler_registry.cc (fhandler_registry::exists): Ditto.
(fhandler_registry::fstat): Ditto.
* fhandler_virtual.cc (fhandler_virtual::opendir): Ditto.
* path.cc (path_conv::check): Ditto. Add debugging.
2002-05-22 Christopher Faylor <cgf@redhat.com>
* syscalls.cc (dup): Always call dup2 for error handling.
2002-05-22 Corinna Vinschen <corinna@vinschen.de>
* include/cygwin/types.h: Revert previous patch.
2002-05-22 Corinna Vinschen <corinna@vinschen.de>
* include/cygwin/types.h: Define pthread stuff only if _POSIX_THREADS
is defined.
2002-05-19 Pierre Humblet <pierre.humblet@ieee.org>
* security.cc (open_local_policy): Initialize lsa to
INVALID_HANDLE_VALUE instead of NULL.
(get_logon_server_and_user_domain): Test for INVALID_HANDLE_VALUE
instead of NULL.
(create_token): Both of the above.
2002-05-18 Christopher Faylor <cgf@redhat.com>
* fhandler_disk_file.cc (fhandler_disk_file::fstat): Make handling of
nlink consistent for remote files.
2002-05-18 Christopher Faylor <cgf@redhat.com>
* path.cc (path_conv::check): Always set executable bit for executable
extension.
2002-05-17 Christopher Faylor <cgf@redhat.com>
* fhandler.cc (fhandler_base::lseek): Avoid calling SetFilePointer with
high order part of 64 bit address on OS's which do not support that
kind of operation. Otherwise Windows 95 will become confused.
2002-05-16 Pierre Humblet <pierre.humblet@ieee.org>
* fhandler_raw.cc (fhandler_dev_raw::open): Replace set_errno()
by __seterrno_from_win_error().
* security.cc (open_local_policy): Ditto.
(get_lsa_srv_inf): Ditto.
(get_user_groups): Ditto.
(get_user_primary_group): Ditto.
(create_token): Ditto.
(subauth): Ditto.
2002-05-17 Corinna Vinschen <corinna@vinschen.de>
* times.cc (utimes): Use FILE_WRITE_ATTRIBUTES even on 9x/Me when
opening file for writing timestamp.
* wincap.cc: Remove flag has_specific_access_rights.
* wincap.h: Ditto.
2002-05-13 Pierre Humblet <pierre.humblet@ieee.org>
* syscalls.cc (seteuid): Set default dacl in process token.
Replace in-line code by call to verify_token().
(setegid): Reverse change from 2002-01-21. Add call to
RevertToSelf and set primary group in impersonation token.
* security.cc (create_token): Store pgrpsid in token security
descriptor, except if it already appears in my_grps.
Use sec_acl() in place of get_dacl().
(verify_token): Create from code in seteuid(), with tighter checks.
(get_dacl): Deleted.
(get_group_sidlist): Add argument to indicate if pgrpsid is already
in the groups.
* security.h: Define verify_token().
* autoload.cc: Load GetKernelObjectSecurity().
2002-05-13 Mark Bradshaw <bradshaw@staff.crosswalk.com>
* cygwin.din: Add strlcat and strlcpy.
* include/cygwin/version.h: Increment API minor version number.
2002-05-09 Pierre Humblet <pierre.humblet@ieee.org>
* shared.cc (__sec_user): Split into sec_acl() and call orig_sid().
(sec_acl): Create from part of __sec_user(), except creator/owner.
* security.h: Define sec_acl() and MAX_DACL_LEN.
2002-05-12 Christopher Faylor <cgf@redhat.com>
* fhandler_disk_file.cc (fhandler_disk_file::open): Avoid using
O_DIROPEN when OS doesn't support it. Return proper errno in that
case.
2002-05-12 Christopher Faylor <cgf@redhat.com>
* syscalls.cc (_read): Change error to EBADF if attempt to read from a
non-readable fd.
2002-05-11 Christopher Faylor <cgf@redhat.com>
* fhandler.h (executable_states): For now, make dont_care_if_executable
equivalent to not_executable.
* sys/mount.h: Define MOUNT_NOTEXEC.
* path.h (fs_info): New class.
(path_conv): Move fs-specific fields to new 'fs' structure.
(path_conv::update_fs_info): Move to fs_info and rename to just 'update'.
* path.cc (fs_info::update): Ditto. Return 'true' if successful.
(fillout_mntent): Add ',noexec' to list of reported options.
2002-05-11 Christopher Faylor <cgf@redhat.com>
* fhandler_virtual.cc (fhandler_virtual::close): Quiet a compiler
warning.
2002-05-10 Christopher January <chris@atomice.net>
* autoload.cc: Add dynamic load statements for
'ZwQueryInformationProcess' and 'ZwQueryVirtualMemory'.
* fhandler.h: Change type of bufalloc and filesize members of
fhandler_virtual from int to size_t. Change type of position member
from __off32_t to __off64_t. Add new fileid member to fhandler_virtual
class. Make seekdir take an __off64_t argument. Make lseek take an
__off64_t argument. Add fill_filebuf method to fhandler_virtual. Add
fill_filebuf method to fhandler_proc. Add fill_filebuf method to
fhandler_registry. Add fill_filebuf method to fhandler_process. Add
saved_pid and saved_p members to fhandler_process.
* fhandler_proc.cc (proc_listing_array): Add 'loadavg', 'meminfo', and 'stat'.
(proc_fhandlers array): Ditto.
(fhandler_proc::open): Use fill_filebuf to flesh out the file contents.
(fhandler_proc::fill_filebuf): New method.
(fhandler_proc::format_proc_meminfo): Ditto.
(fhandler_proc::format_proc_stat): Ditto.
(fhandler_proc::format_proc_uptime): Ditto.
* fhandler_process.cc (process_listing): Add 'stat' and 'statm'.
(fhandler_process::fstat): Find the _pinfo structure for the process
named in the filename. Return ENOENT if the process is no longer
around. Set the gid and uid fields of the stat structure.
(fhandler_process::open): Store pid and pointer to _pinfo structure in
saved_pid and saved_p respectively. Use fill_filebuf to flesh out file
contents.
(fhandler_proc::fill_filebuf): New method.
(format_process_stat): New function.
(format_process_status): Ditto.
(format_process_statm): Ditto.
(get_process_state): Ditto.
(get_mem_values): Ditto.
* fhandler_registry.cc (fhandler_registry::seekdir): Change argument
type from __off32_t to __off64_t.
(fhandler_registry::fill_filebuf): New method.
* fhandler_virtual.cc (fhandler_virtual::seekdir): Change argument type
from __off32_t to __off64_t.
(fhandler_virtual::lseek): Ditto.
(fhandler_virtual::fill_filebuf): New method.
(fhandler_virtual::fhandler_virtual): Initialise fileid to -1.
* wincap.cc: Set flag has_process_io_counters appropriately.
* wincap.h: Add flag has_process_io_counters.
2002-05-09 Christopher Faylor <cgf@redhat.com>
* syscalls.cc (_write): Change error to EBADF if attempt to write to a
non-writeable fd.
2002-05-08 Corinna Vinschen <corinna@vinschen.de>
* cygheap.h (class cygheap_user): Add member `orig_psid'.
Add method `orig_sid()'.
* cygheap.cc (cygheap_user::set_sid): Maintain orig_psid.
2002-04-28 Norbert Schulze <norbert.schulze@web.de>
* localtime.cc (tzsetwall): Use wildabbr if generated timezone name
length < 3.
2002-05-05 Pierre Humblet <pierre.humblet@ieee.org>
* spawn.cc (spawn_guts): Move call to set_process_privilege()
to load_registry_hive().
* registry.cc (load_registry_hive): ditto.
* fork.cc (fork_parent): Call sec_user_nih() only once.
2002-05-04 Christopher January <chris@atomice.net>
* path.h (path_conv::path_conv): Initialise normalized_path to NULL.
2002-05-03 Christopher Faylor <cgf@redhat.com>
* net.cc (getdomainname): Change second argument of getdomainname to
size_t.
2002-05-03 Christopher January <chris@atomice.net>
* fhandler_proc.cc (proc_listing): Add '.' and '..' to directory
listing.
(fhandler_proc::open): Change use of mode to flags. If the file does
not exist already, fail with EROFS if O_CREAT flag is set. Change
EROFS error to EACCES error when writing to a file. Use cmalloc to
allocate memory for filebuf.
(fhandler_proc::close): Use cfree to free filebuf.
(fhandler_proc::get_proc_fhandler): Properly detect attempts to access
unknown subdir.
* fhandler_process.cc (process_listing): Add '.' and '..' to directory
listing.
(fhandler_process::open): Use cmalloc to allocate memory for filebuf.
(fhandler_process::close): Use cfree to free filebuf.
* fhandler_registry.cc (registry_listing): Add . and '..' to directory
listing.
(fhandler_registry::open): Move check for open for writing before
open_key. Use cmalloc to allocate memory for filebuf.
(fhandler_registry::close): Use cfree to free filebuf.
(fhandler_registry::telldir): Use lower 16 bits of __d_position as
position in directory.
(fhandler_registry::seekdir): Ditto.
* fhandler_virtual.cc (fhandler_virtual::write): Change EROFS error to
EACCES error.
(fhandler_virtual::open): Set the NOHANDLE flag.
(fhandler_virtual::dup): Add call to fhandler_base::dup. Allocate
child's filebuf using cmalloc. Copy filebuf from parent to child.
(fhandler_virtual::close): Use cfree to free filebuf.
(fhandler_virtual::~fhandler_virtual): Ditto.
(from Chris Faylor <cgf@redhat.com>).
(fhandler_registry::readdir): Add support for '.' and '..' files in
subdirectories of /proc/registry.
* path.cc (path_conv::check): Do not return ENOENT if a file is not
found in /proc.
2002-05-02 Christopher Faylor <cgf@redhat.com>
* fhandler_proc.cc (fhandler_proc::fstat): Use fhandler name rather
than path_conv name.
(fhandler_proc::open): Ditto.
* fhandler_process.cc (fhandler_process::fstat): Use fhandler name
rather than path_conv name.
(fhandler_process::open): Ditto.
* fhandler_registry.cc (fhandler_registry::fstat): Use fhandler name
rather than path_conv name.
(fhandler_registry::open): Ditto.
* path.cc (path_conv::check): Don't copy posix path when virtual.
(mount_info::conv_to_win32_path): Don't zero string when isproc. Just
derive normal windows path.
* path.h (path_conv::clear_normalized_path): Declare new method.
* path.cc (path_conv::clear_normalized_path): Define new method.
* dtable.cc (build_fhandler_from_name): Clear normalized path when
finished to conserve space.
2002-05-02 Christopher Faylor <cgf@redhat.com>
* fhandler_proc.cc (fhandler_proc::fstat): Prime with information from
fhandler_base::fstat. Use defines rather than constants for permission
settings.
2002-04-30 Eric Blake <ebb9@email.byu.edu>
* path.cc (hash_path_name): Improve hash function strength.
2002-05-02 Robert Collins <rbtcollins@hotmail.com>
* thread.cc (__pthread_cond_dowait): Fix a race on signalling from a
thread woken by the same condition variable it's signalling on. Thanks
to Michael Beach for the report and test case.
2002-05-02 Christopher Faylor <cgf@redhat.com>
* path.h (pathconv_arg): Add PC_POSIX.
(path_conv): Add normalized_path field.
* path.cc (path_conv::~path_conv): New destructor.
(path_conv::check): Set normalized_path, where appropriate.
* dtable.cc (build_fhandler_from_name): Use normalized path from
path_conv.
* syscalls.cc (chroot): Ditto.
* cygheap.h: Remove path_prefix_p declaration.
2002-02-26 Christopher January <chris@atomice.net>
Christopher Faylor <cgf@redhat.com> (minor fixups)
* Makefile.in: Add fhandler_proc.o, fhandler_registry.o,
fhandler_process.o and fhandler_virtual.o.
* dtable.cc (dtable::build_fhandler): Add entries for FH_PROC,
FH_REGISTRY and FH_PROCESS. Set unix_name to the normalized posix
path.
* fhandler.h: Add constants for FH_PROC, FH_REGISTRY and FH_PROCESS.
Add class declarations for fhandler_virtual, fhandler_proc,
fhandler_registry and fhandler_virtual. Update fhandler_union
accordingly.
* fhandler_proc.cc: New file. Add implementation for fhandler_proc.
* fhandler_virtual.cc: New file. Add implementation for
fhandler_virtual.
* fhandler_process.cc: New file. Add implementation for
fhandler_process.
* fhandler_registry.cc: New file. Add implementation for
fhandler_registry.
* path.cc (isproc): New macro.
(isvirtual_dev): Ditto.
* path.cc (path_conv::check): Add check for virtual devices.
* path.cc (mount_info::conv_to_win32_path): Convert paths in /proc to
empty Win32 paths.
* path.cc (chdir): Replace check for FH_CYGDRIVE with more generic
isvirtual_dev macro. Force setting of posix path for virtual
fhandlers.
* path.h (path_prefix_p): Declare.
Wed May 1 16:06:02 2002 Jason Tishler <jason@tishler.net>
* include/cygwin/types.h: Include <sys/sysmacros.h>.
Wed Apr 17 11:27:04 2002 Jason Tishler <jason@tishler.net>
* security.cc (get_lsa_srv_inf): Prevent extraneous backslashes for
the NT Domain case.
2002-04-12 Corinna Vinschen <corinna@vinschen.de>
* net.cc (cygwin_accept): Set socket type for accepted socket.
(socketpair): Set socket type for both sockets.
2002-04-12 Egor Duda <deo@logos-m.ru>
* fhandler.h (class fhandler_socket): New member to store socket type.
(fhandler_socket::get_socket_type): Access it.
(fhandler_socket::set_socket_type): Ditto.
* net.cc (cygwin_socket): Store socket type.
(cygwin_connect): Disable security checks for connectionless sockets.
(cygwin_accept): Ditto.
2002-04-09 Mark Bradshaw <bradshaw@staff.crosswalk.com>
* cygwin.din: Add strptime.
* include/cygwin/version.h: Increment API version number.
2002-04-09 Corinna Vinschen <corinna@vinschen.de>
* fork.cc (fork_child): Call fixup_mmaps_after_fork() somewhat earlier.
2002-04-09 Corinna Vinschen <corinna@vinschen.de>
* fhandler.cc (fhandler_base::open): Set read-only bit in
file_attributes when adequate.
2002-03-28 Christopher Faylor <cgf@redhat.com>
* times.cc (gettimeofday): Fix typo in previous patch.
2002-03-27 Wu Yongwei <adah@netstd.com>
* times.cc (gettimeofday): Revert to setting timezone info if tz !=
NULL.
2002-03-21 Christopher Faylor <cgf@redhat.com>
* fhandler_disk_file.cc (fhandler_disk_file::fstat_helper): Always set
st_[ug]id to value derived from get_file_attributes.
2002-03-21 Christopher Faylor <cgf@redhat.com>
* spawn.cc (find_exec): Return input if file not found.
2002-03-19 Boris Schaeling <boriss@web.de>
* poll.cc (poll): Add support for invalid descriptors.
2002-03-15 Robert Collins <rbtcollins@hotmail.com>
* fhandler.h (fhandler_termios::lseek): Override lseek.
* fhandler_termios.cc (fhandler_termios::lseek): Implement this.
2002-03-15 Christopher Faylor <cgf@redhat.com>
* cygserver.cc: Include stdlib.h for exit declaration.
* threaded_queue.cc: Ditto.
2002-03-15 Christopher Faylor <cgf@redhat.com>
* pinfo.cc (pinfo::init): Use PID_ALLPIDS flag to control when a
redirected block should be marked as nonexistent.
(winpids::add): Use PID_ALLPIDS when looking for all pids.
* cygwin.h (PID_ALLPIDS): New enum element.
2002-03-15 Corinna Vinschen <corinna@vinschen.de>
* glob.c (stat32_to_STAT): New function.
(g_lstat): Call user space functions always with 32 bit struct stat
as a workaround.
(g_stat): Ditto.
* include/glob.h (struct glob): Don't prototype function pointers
when compiling Cygwin.
2002-03-14 Christopher Faylor <cgf@redhat.com>
* pinfo.cc (pinfo::init): Properly handle execed process stub when
PID_NOREDIR is specified.
2002-03-13 Boris Schaeling <boriss@web.de>
* poll.cc (poll): Remove variable open_fds. Rearrange and add code to
fix settings of revents.
2002-03-13 Corinna Vinschen <corinna@vinschen.de>
* mmap.cc (mmap_record::map_map): Return -1 if VirtualProtect fails.
(list::erase): New method with no argument. Erase latest record
added.
(mmap64): Fail if map_map() fails.
2002-03-12 Corinna Vinschen <corinna@vinschen.de>
* sysconf.cc (sysconf): Fix condition.
2002-03-11 Corinna Vinschen <corinna@vinschen.de>
* mmap.cc (msync): Check area given by addr and len for being a
contigeous mmap'd region.
2002-03-11 Corinna Vinschen <corinna@vinschen.de>
* fork.cc (fork_child): Call fixup_mmaps_after_fork() before
closing parent process handle. Call fixup_mmaps_after_fork()
with parent process handle as parameter.
* mmap.cc (mmap_record::access): New method.
(fixup_mmaps_after_fork): Take process handle as parameter.
In case of FILE_MAP_COPY access, copy valid memory regions to child.
* pinfo.h (fixup_mmaps_after_fork): Change prototype accordingly.
2002-03-07 Corinna Vinschen <corinna@vinschen.de>
* autoload.cc (NetGetDCName): Add symbol.
(NetServerEnum): Remove symbol.
* security.cc (get_lsa_srv_inf): Call NetGetDCName() instead of
NetServerEnum() since it's faster. Don't call it at all if machine
is not a domain member.
2002-03-06 Christopher Faylor <cgf@redhat.com>
* path.cc (normalize_posix_path): Avoid runs of '.'s > 2.
2002-03-05 Christopher Faylor <cgf@redhat.com>
* errno.cc: Change EPERM associated text to "Operation not permitted"
throughout.
2002-03-05 Christopher Faylor <cgf@redhat.com>
* fhandler_socket.cc (fhandler_socket::close): Respond to signals while
looping, waiting for socket to close. Superstitiously clear last error
when WSAEWOULDBLOCK.
2002-03-05 Robert Collins <rbtcollins@hotmail.com>
* cygserver_transport_pipes.cc (transport_layer_pipes::transport_layer_pipes):
Always init - until static members work correctly.
* shm.cc (shmget): Initialize the security descriptor - thanks Corinna!
* include/sys/ipc.h: Make the ipc control constants partitioned off from the sem
control constants.
2002-03-04 Christian Lestrade <christian.lestrade@free.fr>
* include/sys/termios.h: Define _POSIX_VDISABLE. Define CCEQ macro.
* fhandler_termios.cc: Include <sys/termios.h>.
(line_edit): Recognize disabled c_cc[] chars. Ignore VDISCARD when
not in ICANON mode.
2002-03-04 Dmitry Timoshkov <dmitry@baikal.ru>
* syscalls.cc (truncate64): Use ftruncate64 directly to not lose
upper 32 bits.
2002-03-04 Robert Collins <rbtcollins@hotmail.com>
* cygserver_shm.cc (delete_shmnode): New function.
(client_request_shm::serve): Use it.
2002-03-04 Robert Collins <rbtcollins@hotmail.com>
* cygserver_shm.cc (client_request_shm::serve): Implement SHM_DETACH.
* shm.cc (shmdt): Implement.
2002-03-04 Robert Collins <rbtcollins@hotmail.com>
* cygserver_shm.cc: Run indent.
(deleted_head): New global for storing shm id's pending deletion.
(client_request_shm::serve): Return ENOSYS for invalid request types.
Implement SHM_DEL - delete a shm id.
* cygserver_shm.h (SHM_DEL): New type value.
* shm.cc (delete_inprocess_shmds): New function, does what it's name implies.
(shmctl): Implement shm_rmid control type.
2002-03-04 Robert Collins <rbtcollins@hotmail.com>
* Makefile.in (install): Remove install-bin to allow make install to work.
2002-03-03 Robert Collins <rbtcollins@hotmail.com>
* shm.cc (shmat): Prevent a compile error.
(shmdt): Set errno as this function is incomplete.
2002-02-28 Christopher Faylor <cgf@redhat.com>
* times.cc: Remove if 0'd code. Clean up slightly.
2002-02-28 Robert Collins <rbtcollins@hotmail.com>
* Merge cygwin_daemon into head minus the new shm and ipc exports.
2002-02-28 Robert Collins <rbtcollins@hotmail.com>
* fhandler_tty.cc (fhandler_tty_slave::open): More debugging.
(fhandler_tty_slave::read): Fix printf type for the handle.
* tty.cc (tty::common_init): Add a FIXME for security.
2002-01-29 Robert Collins <rbtcollins@hotmail.com>
* Makefile.in (OBJS): Remove duplicate localtime.o.
2002-01-17 Robert Collins <rbtcollins@hotmail.com>
* cygserver.cc (check_and_dup_handle): Consolidate the two variants for
simplicity.
Add Some basic debug output.
(client_request_attach_tty::serve): Use the new debug_printf for clarity.
Mark the duplicated handles as inheritable - fixup_after_fork() doesn't reopen
tty's.
2002-01-16 Robert Collins <rbtcollins@hotmail.com>
* cygserver.cc (transport): Correct scope.
(client_request_attach_tty::serve): Add more debug information.
Fix erroneous use of transport instead of conn.
* cygserver_transport_pipes.cc (transport_layer_pipes::close): More debug.
(transport_layer_pipes::read): Ditto.
(transport_layer_pipes::write): Ditto.
(transport_layer_pipes::impersonate_client): Ditto.
Mon Oct 8 7:41:00 2001 Robert Collins <rbtcollins@hotmail.com>
* cygserver.cc (server_request::process): Rename client_request_shm_get to
client_request_shm.
* cygserver_process.cc (process_cache::add): Rename to add_task.
Use process_cleanup instead of process_request.
(process_cache::remove_process): New method.
(process::process): Initialize new members.
(process::~process): New member.
(process::cleanup): New method.
(process::add_cleanup_routine): New method.
(process_request::process): Rename to process_cleanup.
Call the process object's cleanup method and then delete it.
(process_process_param::request_loop): Remove the signalling process.
* cygserver_shm.cc: Globally rename client_request_shm_get to client_request_shm.
(client_request_shm_get::serve): Handle attach request counting.
* cygserver_shm.h: Globally rename client_request_shm_get to client_request_shm.
(class shm_cleanup): New class.
* shm.cc: Globally rename client_request_shm_get to client_request_shm.
(client_request_shm::client_request_shm): New constructor for attach requests.
(shmat): Use it.
* include/cygwin/cygserver_process.h (class process_request): Rename to
process_cleanup.
(class cleanup_routine): New class.
(class process): New members and methods to allow calling back when the process
terminates.
Thu Oct 4 14:12:00 2001 Robert Collins <rbtcollins@hotmail.com>
* cygserver.cc (request_loop): Make static.
(main): Use new cache constructor syntax.
Start cache worker threads.
Cleanup the cache at shutdown.
* cygserver_process.cc: Run indent.
(process_cache::process_cache): Add a trigger to use when adding a process.
(process_cache::process): Move process_entry to process.
Insert at the end of the list.
Trigger the request loop when new process's inserted.
(process_cache::process_requests): Do it.
(process_cache::add): New method.
(process_cache::handle_snapshot): New method.
(process::process): Merge in the process_entry fields.
(process::handle): Make a stub function.
(process::exit_code): New method.
(process_request::process): New method.
(process_process_param::request_loop): New method.
* cygserver_shm.cc: New header dependency - threaded_queue.h.
* threaded_queue.cc (threaded_queue::cleanup): Clearer messages.
(queue_process_param::stop): Short spinlock on interruptible threads.
* threaded_queue.h (class threaded_queue): New constructor.
* include/cygwin/cygserver_process.h (process_request): New class.
(process_entry): Remove.
(process): Merge in process_entry.
(process_cache): Inherit from threaded_queue.
Tue Oct 2 23:24:00 2001 Robert Collins <rbtcollins@hotmail.com>
* cygserver.cc (class server_process_param): Use new constructor syntax.
* cygserver_process.cc (process_cache::~process_cache): New function.
* threaded_queue.cc: Define condition debug_printf.
Run indent.
(threaded_queue::cleanup): Move queue_process_param guts to a method.
(threaded_queue::process_requests): Ditto.
(queue_process_param::queue_process_param): New method.
(queue_process_param::~queue_process_param): Ditto.
(queue_process_param::start): Ditto.
(queue_process_param::stop): Ditto.
* threaded_queue.h (class queue_process_param): Add support for
interruptible request loops.
* cygwin/include/cygwin/cygserver_process.h (class process_cache): Add
destructor.
Tue Oct 2 23:24:00 2001 Robert Collins <rbtcollins@hotmail.com>
* cygserver_client.cc: New flag allow_daemon to disable the daemon completely.
(cygserver_request): Check it.
(cygserver_init): Ditto.
* environ.cc (parse_thing): Add (no)daemon option.
Tue Oct 2 23:00:00 2001 Robert Collins <rbtcollins@hotmail.com>
* shm.cc: Update to handle include changes from HEAD.
Tue Oct 2 16:06:00 2001 Robert Collins <rbtcollins@hotmail.com>
* Makefile.in: Remove cygserver_shm.o from cygwin1.dll.
Rename cygserver_shm_outside.o to cygserver_shm.o.
* cygserver.cc (server_request::process): Use the new client_request
constructor.
* cygserver_client.cc: Remove the #ifdef's stubs for the server method
within cygwin.
(client_request_attach_tty::client_request_attach_tty): Use the new
client_request constructor.
(client_request_shutdown::client_request_shutdown): Ditto.
(client_request::client_request): Ditto.
* cygserver_shm.cc (client_request_shm_get::serve): Remove the
#ifdef'd stub for in-cygwin builds.
(client_request_shm_get::client_request_shm_get): Use the new
client_request constructor, and remove the in-cygwin variants.
* cygserver_shm.h (class client_request_shm_get): #ifndef test the
serve method - it's only used in cygserver.
* shm.cc (client_request_shm_get::client_request_shm_get): New function.
* include/cygwin/cygserver.h (request_header): New constructor.
(class client_request): Use it.
New constructor accepting the header size.
#ifndef test the server method - it's only used within cygserver.
(client_request_get_version): #ifdef test the server method.
(client_request_shutdown): Ditto.
(client_request_attach_tty): Ditto.
Tue Oct 2 9:57:00 2001 Robert Collins <rbtcollins@hotmail.com>
* Makefile.in: add threaded_queue.o to cygserver.exe.
* cygserver.cc: Include threaded_queue.h
(class server_request): Inherit from queue_request.
(class server_process_param): Inherit from queue_process_param.
(class server_request_queue): Inherit from threaded_queue.
(request_loop): Adjust for new types.
(server_request_queue::process_requests): Remove guts to
threaded_queue::process_requests.
(server_request::server_request): Adjust for new types.
(worker_function): Delete.
(server_request_queue::create_workers): Delete.
(server_request_queue::cleanup): Delete.
(server_request_queue::add): Move guts to threaded_queue::add.
* threaded_queue.cc: New file.
* threaded_queue.h: New file.
Mon Oct 1 12:38:00 2001 Robert Collins <rbtcollins@hotmail.com>
* cygserver.cc (client_request::serve): New function.
* cygserver_process.cc: Inlude <pthread.h> for pthread_once.
(process_cache::process_cache): Initialise a crtiical section for write access.
(process_cache::process): Use the critical section. Also add missing entries to
the cache.
(do_process_init): New function to initalise class process static variables.
(process::process): Ensure that the process access critical section is
initialised.
(process::handle): Close the handle of old process's when they have terminated
and we are returning the handle for a process with the same pid.
* cygserver_shm.cc: Run indent.
Include cygserver_process.h to allow process cache functionality.
(client_request_shm_get::serve): New parameter for process cache support.
Use the process cache, not OpenProcess to get a handle to the originating process.
Fix a handle leak with token_handle.
* cygserver_shm.h (class client_request_shm_get): Update ::serve for process
cache support.
* cygserver_transport_pipes.cc: Redefine debug_printf to be conditional on DEBUG.
* include/cygwin/cygserver.h: Do not implement client_request::serve in the
header.
* include/cygwin/cygserver_process.h (class process_cache): Add a write access
critical section to prevent races when requests from a multithreaded
application arrive.
Sun Sep 30 23:41:00 2001 Robert Collins <rbtcollins@hotmail.com>
* Makefile.in: Add cygserver_process.o to cygserver.exe.
* cygserver.cc: Include signal.h and cygwin_version.h.
Define debug_printf as a macro.
Define DEBUG to a value.
(client_request_attach_tty::serve): Add beginning of process cache support.
Change from #ifdef DEBUG to work with new DEBUG style.
(client_request_get_version::serve): Add beginning of process cache support.
(class server_request): New prototype for support of process cache.
(class queue_process_param): New class to allow request loop threading.
(class server_request_queue): Add beginning of process cache support.
Allow request loop threading.
(request_loop): Thread function for request loops.
(server_request_queue::process_requests): Initiator for threaded request loops.
(client_request_shutdown::serve): Add beginning of process cache support.
(server_request::server_request): Ditto.
(server_request::process): Use debug_printf. Add beginning of process cache
support.
(server_request_queue::cleanup): Kill off any request loop threads.
(server_request_queue::add): Add beginning of process cache support.
(handle_signal): Trigger a shutdown.
(main): Print out some useful info at startup - version, date time.
Add process cache support.
Spawn a separate thread for the transport request loop, thus allowing concurrent
support for multiple transports.
* cygserver_client.cc (client_request_get_version::serve): Add process cache
support.
(client_request_attach_tty::serve): Add process cache support.
(client_request_shutdown::serve): Add process cache support.
* cygsserver_process.cc: New file with the process cache support.
* cygserver_shm.cc: Redefine debug_printf to allow conditional output.
* cygwin.din: Export shmdt().
* shm.cc: Run indent.
Update FIXME's.
(shmdt): New function.
* include/cygwin/cygserver.h (class client_request): Add process cache support.
(class client_request_get_version): Ditto.
(class client_request_shutdown): Ditto.
(class client_request_attach_tty): Ditto.
* include/cygwin/cygserver_process.h: New header for process cache support.
Sun Sep 30 8:52:00 2001 Robert Collins <rbtcollins@hotmail.com>
* include/cygwin/cygserver_transport.h: Add copyright header.
* include/cygwin/cygserver_transport_pipes.h: Ditto.
* include/cygwin/cygserver_transport_sockets.h: Ditto.
Sat Sep 29 20:40:00 2001 Robert Collins <rbtcollins@hotmail.com>
* Makefile.in: Add cygserver_transport_sockets.o to DLL_OFILES.
Add cygserver_transport_sockets_outside.o to cygserver.exe.
* cygserver.cc: Include new include files.
* cygserver_client.cc: Ditto.
* cygserver_shm.h: No need to include <sys/socket.h> now.
* cygerver_transport.cc: Include new include files.
(transport_layer_base::transport_layer_base): Strip back to a stub.
(transport_layer_base::listen): Ditto.
(transport_layer_base::accept): Ditto.
(transport_layer_base::close): Ditto.
(transport_layer_base::read): Ditto.
(transport_layer_base::write): Ditto.
(transport_layer_base::connect): Ditto.
* cygserver_transport_pipes.cc: Include new header
"cygwin/cygserver_transport_pipes.h".
* cygserver_transport_sockets.cc: New file.
* dcrt0.cc: No need to include <sys/socket.h> now.
* fhandler_tty.cc: Ditto.
* tty.cc: Ditto.
* include/cygwin/cygserver_transport.h: Strip the base class to a stub.
Remove the cygserver_transport_pipes class.
* include/cygwin/cygserver_transport_pipes.h: New file.
* include/cygwin/cygserver_transport_sockets.h: New file.
Tue Sep 25 16:22:00 2001 Robert Collins <rbtcollins@hotmail.com>
* autoload.cc: Add dynamic load statement for 'ImpersonateNamedPipeClient'.
* Makefile.in: Add new object files, and build instructions for cygserver.exe.
* cygwin.din: Export ftok, shmat, shmctl and shmget.
* dcrt0.cc: Additional includes for cygserver support.
(dll_crt0_1): Initialise the cygserver client.
* fhandler.h (fhandler_tty): New method cygserver_attach_tty.
* fhandler_tty.cc: Additional includes for cygserver support.
(fhandler_tty_slave::open): Attempt to use the cygserver when obtaining
handles from the parent process. On failure or 9x use the current method.
(fhandler_tty_slave::cygserver_attach_tty): New function.
* fork.cc (fork_child): Fixup shm memory mapped areas.
* pinfo.h: Declare fixup_shms_after_fork().
* security.h: Declare alloc_sd().
* tty.cc: Additonal includes to support cygserver.
(tty::common_init): Don't allow others to open us if the cygserver is running.
* winsup.h: Declare cygserver_running.
* cygserver.cc: New file.
* cygserver_client.cc: New file.
* cygserver_shm.cc: New file.
* cygserver_shm.h: New file.
* cygserver_transport.cc: New file.
* cygserver_transport_pipes.cc: New file.
* ipc.cc: New file.
* shm.cc: New file.
* include/cygwin/cygserver.h: New file.
* include/cygwin/cygserver_transport.h: New file.
* include/sys/ipc.h: New file.
* include/sys/shm.h: New file.
2002-02-28 Robert Collins <rbtcollins@hotmail.com>
* thread.cc (semaphore::TryWait): Set errno as required by posix 1003.1.
(__sem_wait): Ditto.
(__sem_trywait): Ditto.
2002-02-27 Christopher Faylor <cgf@redhat.com>
* include/cygwin/version.h: Bump DLL minor number.
2002-02-23 Corinna Vinschen <corinna@vinschen.de>
* cygwin.din (fstat64): New symbol.
(ftruncate64): Ditto.
(lseek64): Ditto.
(lstat64): Ditto.
(mmap64): Ditto.
(seekdir64): Ditto.
(stat64): Ditto.
(telldir64): Ditto.
(truncate64): Ditto.
* dir.cc (telldir64): New function.
(telldir): Call telldir64().
(seekdir64): New function.
(seekdir): Call seekdir64().
* fhandler.h: Redefine all methods using __off32_t to use __off64_t.
* fhandler.cc: Use __off64_t and struct __stat64 throughout.
* fhandler_clipboard.cc: Ditto.
* fhandler_disk_file.cc: Ditto.
* fhandler_dsp.cc: Ditto.
* fhandler_floppy.cc: Ditto.
* fhandler_mem.cc: Ditto.
* fhandler_random.cc: Ditto.
* fhandler_socket.cc: Ditto.
* fhandler_tape.cc: Ditto.
* fhandler_zero.cc: Ditto.
* pipe.cc: Ditto.
* glob.c: Ditto, call lstat64 and stat64 in Cygwin.
* mmap.cc: Use __off64_t throughout.
(mmap64): New function.
* sec_acl.cc (acl_worker): Use struct __stat64, call stat64 and lstat64.
* syscalls.cc (lseek64): New function.
(stat64_to_stat32): Ditto.
(fstat64): Ditto.
(stat64): Ditto.
(lstat64): Ditto.
(ftruncate64): Ditto.
(truncate64): Ditto.
(_fstat): Call fstat64.
(_stat): Call stat64.
(cygwin_lstat): Rename to avoid declaration problem. Call lstat64.
(stat_worker): Use struct __stat64.
(access): Ditto.
(ftruncate): Call ftruncate64.
(truncate): Call truncate64.
* wincap.cc: Set flag has_64bit_file_access appropriately.
* wincap.h: Add flag has_64bit_file_access.
* winsup.h (ILLEGAL_SEEK): Define as __off64_t.
(stat_dev): Declare using struct __stat64.
(stat_worker): Ditto.
* include/cygwin/stat.h (struct __stat32): Define if compiling Cygwin.
(struct __stat64): Ditto.
(struct stat): Revert definition with explicitly sized datatypes.
Eliminate sized field names.
* include/cygwin/types.h (blksize_t): New type.
(__blkcnt32_t): Ditto.
(__blkcnt64_t): Ditto.
(blkcnt_t): Ditto.
2002-02-22 Christopher Faylor <cgf@redhat.com>
* sync.h (new_muto): Just accept an argument which denotes the name of
the muto. Use this argument to construct static storage.
* cygheap.cc (cygheap_init): Reflect above change.
* exceptions.cc (events_init): Ditto.
* malloc.cc (malloc_init): Ditto.
* path.cc (cwdstuff::init): Ditto.
* cygheap.h (cwdstuff): Change name of lock element to make it less
generic.
* path.cc (cwdstuff::get_hash): Ditto.
(cwdstuff::get_initial): Ditto.
(cwdstuff::set): Ditto.
(cwdstuff::get): Ditto.
* sigproc.cc (proc_subproc): Ditto.
* debug.cc (lock_debug): Change to method. Use method rather than
macro throughout.
* tty.h (tty_min::kill_pgrp): Declare new method.
* fhandler_termios.cc (tty_min::kill_pgrp): New method.
(fhandler_termios::line_edit): Use new method for killing process.
* dcrt0.cc (do_exit): Ditto.
* dtable.cc (dtable::get_debugger_info): New method for inheriting
dtable info from a debugger.
* tty.cc (tty_init): Attempt to grab file handle info from parent
debugger, if appropriate.
# dtable.cc (dtable::stdio_init): Make this a method.
(dtable::init_std_file_from_handle): Don't set fd unless it's not open.
(dtable::build_fhandler_from_name): Move name setting to
dtable::build_fhandler.
(dtable::build_fhandler): Add win32 name parameter.
* dcrt0.cc (dll_crt0_1): Change to use dtable stdio_init.
* dtable.h (dtable): Reflect build_fhandler parameter change.
* mmap.cc (mmap_record::alloc_fh): Don't set name parameter in
build_fhandler.
* net.cc (fdsock): Remove set_name call since it is now handled by
build_fhandler.
* sigproc.cc (proc_subproc): Release muto as early as possible.
2001-02-22 Corinna Vinschen <corinna@vinschen.de>
* smallprint.c (rn): Allow long long values.
(__small_vsprintf): Add 'D', 'U' and 'X' formats for long long
parameters.
2002-02-19 Christopher Faylor <cgf@redhat.com>
* fhandler.cc (fhandler_base::puts_readahead): Remove default parameter
setting. Newer gcc's complain about this.
(fhandler_base::set_readahead_valid): Ditto.
* fhandler_dsp.cc (Audio::open): Ditto.
(fhandler_dev_dsp::open): Ditto.
2002-02-19 Christopher Faylor <cgf@redhat.com>
* fork.cc (fork_parent): Use sec_user_nih to control process/thread
inheritance/permission.
* spawn.cc (spawn_guts): Ditto.
* security.cc (create_token): Initialize token so that it is not tested
for bogus value later. Use sec_user to control process/thread
creation.
* security.h (__sec_user): Rename declaration from sec_user.
(sec_user_nih): Declare here as inline function wrapper for __sec_user.
(sec_user): Ditto.
* sigproc.cc (czombies): Allocate a character array for zombies to
avoid constructor overhead
(extremely hackish, I know).
(cpchildren): Ditto.
(pchildren): New define.
(zombies): Ditto.
(getsem): Use sec_user_nih to control semaphore inheritance/permission.
2002-02-16 Christopher Faylor <cgf@redhat.com>
* times.cc (hires::prime): Restore thread priority on failure
condition.
* uinfo.cc (uinfo_init): Use more robust method for determining if
process was invoked from a non-cygwin process.
* sync.h (muto::init): Eliminate "inheritance" parameter.
(new_muto): Reflect removal of parameter.
* sync.cc (muto::init): Ditto.
* cygheap.cc (cygheap_init): Ditto.
* debug.cc (threadname_init): Ditto.
* exceptions.cc (events_init): Ditto.
* malloc.cc (malloc_init): Ditto.
* path.cc (cwdstuff::init): Ditto.
* sigproc.cc (sigproc_init): Ditto.
* grp.cc (group_lock): Use different method for locking with static
member.
(read_etc_group): REALLY ensure that read lock mutex is released.
* passwd.cc (passwd_lock): Use different method for locking with static
member.
(read_etc_passwd): REALLY ensure that read lock mutex is released.
* shared.cc (sec_user): Correct reversed inheritance test.
2002-02-15 Christopher Faylor <cgf@redhat.com>
* hires.h (hires::usecs): Rename from utime. Accept an argument.
* strace.cc (strace::microseconds): Use hires class for calculating
times.
* sync.h (new_muto): Use NO_COPY explicitly in declaration.
* times.cc (gettimeofday): Reflect change in usecs argument.
(hires::usecs): Ditto. Changed name from utime.
* winsup.h (NO_COPY): Add nocommon attribute to force setting aside
space for variable.
* regcomp.c (REQUIRE): Add a void cast to bypass a warning.
2002-02-15 Christopher Faylor <cgf@redhat.com>
* hires.h: New file.
* times.cc (gettimeofday): Use hires class for calculating current time.
(hires::prime): New method.
(hires::utime): Ditto.
2002-02-14 Christopher Faylor <cgf@redhat.com>
* include/sys/cygwin.h (cygwin_getinfo_types): New CW_STRACE_ACTIVE.
* external.cc (cygwin_internal): Handle CW_STRACE_ACTIVE.
2002-02-14 Christopher Faylor <cgf@redhat.com>
* exceptions.cc (unused_sig_wrapper): Eliminate unused parameter to
asm.
* external.cc (cygwin_internal): Change CW_STRACE_ON to
CW_STRACE_TOGGLE.
* strace.cc (strace::hello): Toggle strace on and off.
* sync.cc (muto::init): Rename from constructor.
* sync.h (muto::new): Delete.
(muto::delete): Ditto.
(new_muto): Simplify. Use muto.init for nearly everything.
* uinfo.cc (uinfo_init): Avoid closing a NULL handle.
* include/sys/cygwin.h (cygwin_getinfo_types): Rename CW_STRACE_OFF to
CW_STRACE_TOGGLE. Delete CW_STRACE_OFF.
* include/sys/strace.h (strace): Add "inited" field.
2001-02-12 Corinna Vinschen <corinna@vinschen.de>
* include/cygwin/acl.h: Fix definition of aclent_t.
2002-02-10 Christopher Faylor <cgf@redhat.com>
* Makefile.in (DLL_OFILES): Consolidate object files.
2002-02-10 Corinna Vinschen <corinna@vinschen.de>
* child_info.h, cygheap.h, fhandler_clipboard.cc, fhandler_dsp.cc,
fhandler_floppy.cc, fhandler_mem.cc, fhandler_random.cc,
fhandler_tape.cc, fhandler_zero.cc, grp.cc, mmap.cc, passwd.cc,
pinfo.cc, pinfo.h, pipe.cc, sec_acl.cc, sec_helper.cc, security.cc,
security.h, thread.h, uinfo.cc, include/cygwin/acl.h: Fix copyright.
2002-02-10 Corinna Vinschen <corinna@vinschen.de>
* child_info.h, cygheap.h, dcrt0.cc, dir.cc, fhandler.cc, fhandler.h,
fhandler_clipboard.cc, fhandler_disk_file.cc, fhandler_dsp.cc,
fhandler_floppy.cc, fhandler_mem.cc, fhandler_random.cc,
fhandler_tape.cc, fhandler_zero.cc, grp.cc, mmap.cc, passwd.cc,
pinfo.cc, pinfo.h, pipe.cc, sec_acl.cc, sec_helper.cc, security.cc,
security.h, spawn.cc, syscalls.cc, thread.h, uinfo.cc, winsup.h:
Change usage of uid_t to __uid16_t, gid_t to __gid16_t and
off_t to __off32_t throughout. Use INVALID_UID, INVALID_GID and
INVALID_SEEK instead casting -1 to the appropriate type.
* winsup.h: Define INVALID_UID, INVALID_GID and INVALID_SEEK.
* include/cygwin/acl.h: Define internal __aclent16_t and __aclent32_t
types. Don't declare acl functions when compiling Cygwin.
* include/cygwin/grp.h: Declare getgrgid() and getgrnam() with
correct types for internal usage.
2002-02-10 Corinna Vinschen <corinna@vinschen.de>
Patch suggested by Pierre A. Humblet <Pierre.Humblet@ieee.org>:
* uinfo.cc (internal_getlogin): Try evaluating user by SID even if
ntsec is off.
(uinfo_init): Set primary group even if ntsec is off.
2002-02-09 Corinna Vinschen <corinna@vinschen.de>
* include/cygwin/grp.h: New file.
* include/cygwin/stat.h: Ditto.
* include/cygwin/types.h: Add definitions for __off32_t,
__off64_t, off_t, __uid16_t, __uid32_t, uid_t, __gid16_t,
__gid32_t and gid_t.
* include/sys/cygwin.h: Use correct uid and gid types.
2002-02-09 Corinna Vinschen <corinna@vinschen.de>
* dtable.cc (dtable::dup2): Revert previous patch.
* fhandler.h: Ditto.
(fhandler_socket::recv): Define new method.
(fhandler_socket::send): Ditto.
* fhandler_socket.cc (fhandler_socket::recv): New method.
(fhandler_socket::send): Ditto.
(fhandler_socket::read): Call fhandler_socket::recv() now.
(fhandler_socket::write): Call fhandler_socket::send() now.
* net.cc (class wsock_event): Move definition to wsock_event.h.
(fdsock): Revert previous patch.
(cygwin_recv): Move implementation to fhandler_socket::recv().
(cygwin_send): Move implementation to fhandler_socket::send().
* wsock_event.h: New file.
2002-02-06 Alexander Gottwald <Alexander.Gottwald@s1999.tuchemnitz.de>
* net.cc (get_2k_ifconf): Create interface entries for tokenring cards.
2002-02-08 Corinna Vinschen <corinna@vinschen.de>
* dtable.cc (dtable::dup2): Store fd for fhandler_socket.
* fhandler.h (fhandler_base::set_fd): New virtual method.
(fhandler_base::get_fd): Ditto.
(fhandler_socket::set_fd): Ditto.
(fhandler_socket::get_fd): Ditto.
* fhandler_socket.cc (fhandler_socket::read): Call cygwin_recv instead
of native Winsock recv.
(fhandler_socket::write): Call cygwin_send instead of native Winsock
send.
* net.cc (fdsock): Store fd in fhandler_socket.
2002-02-07 Corinna Vinschen <corinna@vinschen.de>
* net.cc (cygwin_getsockname): Fix handling of NULL sun_path.
2002-01-29 Corinna Vinschen <corinna@vinschen.de>
* net.cc (getdomainname): Fix registry key for 9x systems, too.
2002-01-29 Corinna Vinschen <corinna@vinschen.de>
* net.cc (getdomainname): Fix registry key for NT systems.
2002-01-28 Christopher Faylor <cgf@redhat.com>
* external.cc (cygwin_internal): Initialize various internal settings
if required to allow use of some things from user loaded DLL.
(CW_STRACE_ON): Add new feature.
(CW_CYGWIN_PID_TO_WINPID): Ditto.
* pinfo.cc (set_myself): Call "strace.hello" to initiate possible
strace session.
(pinfo::init): Guard against dereferencing uninitialized myself.
* sigproc.cc (wait_sig): Call strace.hello() when __SIGTRACE "signal"
received.
* strace.cc (strace::hello): New method.
* wincap.cc (wincapc::init): Avoid initializing if already initialized.
* wincap.h (wincapc::wincapc): New method.
* include/sys/cygwin.h: Add new CW_ enums. Kludge typedefs of
{g,u}id_t if required.
* strace.h (strace::hello): Declare new method.
2002-01-28 Earnie Boyd <earnie@users.sf.net>
* include/sys/strace.h (_STRACE_ON): Define.
(_STRACE_OFF): Ditto.
2002-01-24 Christopher Faylor <cgf@redhat.com>
* speclib: Ensure that temporary def file is removed.
2002-01-23 Christopher Faylor <cgf@redhat.com>
* speclib: Use rm -f to remove temp file just to quiet any potential
warnings.
2002-01-23 Corinna Vinschen <corinna@vinschen.de>
* security.cc (create_token): Use sec_user() to create
SECURITY_ATTRIBUTES structure for primary token. Use
MAXIMUM_ALLOWED access rights instead of TOKEN_ALL_ACCESS.
2002-01-23 Corinna Vinschen <corinna@vinschen.de>
* path.cc (symlink): Fix check for already existing file.
2002-01-21 Christopher Faylor <cgf@redhat.com>
* cygmagic: Suppress error output when figuring out if sum takes an
option.
2002-01-21 Christopher Faylor <cgf@redhat.com>
* cygmagic: Attempt to figure out if sum takes an option.
2002-01-21 DJ Delorie <dj@redhat.com>
* Makefile.in (libpthread.a): Pass the assembler also.
(libm.a): Ditto.
(libc.a): Ditto.
* speclib: Specify the assembler to dlltool.
2002-01-21 Christopher Faylor <cgf@redhat.com>
* include/cygwin/version.h: Bump DLL minor number.
2002-01-21 Corinna Vinschen <corinna@vinschen.de>
* grp.cc (getgrgid): Don't return default gid entry when ntsec is on.
* syscalls.cc (setegid): Don't set primary group in process token.
2002-01-21 Christopher Faylor <cgf@redhat.com>
* speclib: Don't use /dev/null as DLL name. Just default to what's
already in .def file.
2002-01-21 Christopher Faylor <cgf@redhat.com>
* exceptions.cc (sig_handle): Remove last vestiges of SA_NOCLDSTOP code
which caused SIGCHLD to be ignored.
2002-01-20 Christopher Faylor <cgf@redhat.com>
* include/cygwin/version.h: Bump DLL minor number.
2002-01-20 Christopher Faylor <cgf@redhat.com>
* syscalls.cc (regfree): Make dll_export.
2002-01-20 Christopher Faylor <cgf@redhat.com>
* exceptions.cc (ctrl_c_handler): Convert windows pid to cygwin pid
when detecting if we should actually handle CTRL-C.
2002-01-19 Christopher Faylor <cgf@redhat.com>
* Makefile.in (new-cygwin1.dll): Revert previous change. libsupc++.a
is only available in libstdc++-v3.
2002-01-19 Christopher Faylor <cgf@redhat.com>
* exceptions.cc (sig_handle_tty_stop): Don't send SIGCHLD if parent
doesn't want it.
(sig_handle): Don't check for SA_NOCLDSTOP here. We don't have enough
information.
2002-01-19 Christopher Faylor <cgf@redhat.com>
* include/cygwin/version.h: Bump DLL minor number.
2002-01-19 Christopher Faylor <cgf@redhat.com>
* Makefile.in (new-cygwin1.dll): Just use -lsupc++ for link.
* sigproc.cc (proc_exists): Change existence criteria.
* sync.h (new_muto): Add volatile to definition to avoid gcc
optimization problems.
2002-01-19 Corinna Vinschen <corinna@vinschen.de>
* include/cygwin/version.h: Bump API minor version to 51.
2002-01-19 Mark Bradshaw <bradshaw@staff.crosswalk.com>
* cygwin.din: Add recvmsg and sendmsg.
* net.cc: Add cygwin_recvmsg and cygwin_sendmsg.
* /usr/include/sys/socket.h: Add recvmsg and sendmsg.
2002-01-19 Corinna Vinschen <corinna@vinschen.de>
* security.cc (create_token): Close processes token handle as soon
as it's not used anymore.
2002-01-17 Corinna Vinschen <corinna@vinschen.de>
* Makefile.in: Add fnmatch.o to DLL_OFILES.
* cygwin.din: Add fnmatch export symbol.
* fnmatch.c: New file.
* include/fnmatch.h: Ditto.
* include/cygwin/version.h: Bump API minor version to 50.
2002-01-15 Corinna Vinschen <corinna@vinschen.de>
* path.cc (fchdir): Call chdir with full windows path.
2002-01-14 Corinna Vinschen <corinna@vinschen.de>
* dir.cc: Use INVALID_FILE_ATTRIBUTES instead of "(DWORD) -1"
for file attributes throughout.
* fhandler.cc: Ditto.
* fhandler_disk_file.cc: Ditto.
* path.cc: Ditto.
* path.h: Ditto.
* syscalls.cc: Ditto.
* times.cc (utimes): Use path_conv::isdir() instead of explicit
GetFileAttributes() call.
2002-01-13 Christopher Faylor <cgf@redhat.com>
* dcrt0.cc (multiple_cygwin_problem): Clarify logic and make
CYGWIN_MISMATCH_OK more powerful.
2002-01-10 Christopher Faylor <cgf@redhat.com>
* exceptions.cc (sig_handle): Accept a second argument indicating
whether the signal came from this process or not.
* sigproc.h: Reflect sig_handle arg change.
* signal.cc (kill_pgrp): Add sigframe info.
(abort): New function. Eliminates newlib function of same name.
* sigproc.cc (wait_sig): Pass "signal from this process" value as arg
2.
2002-01-10 Corinna Vinschen <corinna@vinschen.de>
* syscalls.cc (pathconf): Guard _PC_PATH_MAX branch against invalid
file parameter.
2002-01-09 Christopher Faylor <cgf@redhat.com>
Robert Collins <rbtcollins@hotmail.com>
* exceptions.cc (early_stuff_init): Rename from misnamed
set_console_handler.
(ctrl_c_handler): Attempt to work around potential signal duplication
during process startup.
(sig_handle): Ignore SIGINT when we're just an "exec stub".
* spawn.cc (spawn_guts): Store pid of spawned process in global for use
by ctrl_c_handler.
* dcrt0.cc (dll_crt0_1): Call renamed initialization function.
* winsup.h: Reflect function name change.
2002-01-08 Corinna Vinschen <corinna@vinschen.de>
* net.cc (cygwin_accept): Set sun_path for newly connected socket.
2002-01-07 Ralf Habacker <Ralf.Habacker@freenet.de>
* Makefile.in: Add uninstall target.
2002-01-07 Christopher Faylor <cgf@redhat.com>
* sigproc.cc (getsem): Clean up debugging output.
2002-01-07 Christopher Faylor <cgf@redhat.com>
* sigproc.cc (getsem): Set errno when unable to create own semaphore.
Reorganize to make clearer that error should only come from initial
creation of process semaphore.
2002-01-06 Christopher Faylor <cgf@redhat.com>
* dtable.cc (dtable::init_std_file_from_handle): Add some defensive
code to invalid handle case.
2002-01-06 Corinna Vinschen <corinna@vinschen.de>
* ioctl.cc (ioctl): Make third argument optional.
* include/sys/ioctl.h: Ditto in declaration.
* dtable.cc (dtable::init_std_file_from_handle): Revert previous
bogus patch.
* window.cc (WndProc): Raise SIGURG instead of SIGIO in case of FD_OOB
message.
2002-01-05 Christopher Faylor <cgf@redhat.com>
* dir.cc (opendir): Guarantee release of alloced fhandler structure on
error.
2002-01-05 Corinna Vinschen <corinna@vinschen.de>
* exceptions.cc (sig_handle): Set default action for SIGURG to SIG_IGN.
2002-01-05 Corinna Vinschen <corinna@vinschen.de>
* dtable.cc (dtable::init_std_file_from_handle): Don't treat NULL
handle as errorneous.
2002-01-04 Christopher Faylor <cgf@redhat.com>
* cygmagic: Change logic for equality test.
2002-01-04 Christopher Faylor <cgf@redhat.com>
* dir.cc (opendir): Don't attempt to call sub-opendir if ENOENT.
2002-01-04 Corinna Vinschen <corinna@vinschen.de>
* net.cc: Replace usage of AF_UNIX by Posix compliant AF_LOCAL
throughout.
(socketpair): Explicitly allow SOCK_STREAM and SOCK_DGRAM socket types
in families AF_UNIX and AF_LOCAL. Explicitly allow PF_UNSPEC, PF_LOCAL
and PF_INET protocols. Return error otherwise. Implement datagram
socketpairs.
2002-01-01 Christopher Faylor <cgf@redhat.com>
* speclib: Remove temp files automatically.
2002-01-01 Corinna Vinschen <corinna@vinschen.de>
* fhandler.h (fhandler_socket::sun_path): New private member.
(fhandler_socket::set_sun_path): New method.
(fhandler_socket::get_sun_path): Ditto.
* fhandler_socket.cc (fhandler_socket::fhandler_socket): Initialize
sun_path to NULL.
(fhandler_socket::~fhandler_socket): Free sun_path if needed.
(fhandler_socket::set_sun_path): New method.
* net.cc (cygwin_bind): Set sun_path to path of local socket file.
(cygwin_getsockname): Add code to return correct sockaddr for unix
domain sockets.
|