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
|
2011-12-13 Dave Korn <dave.korn.cygwin@gmail.com>
* times.cc (hires_ns::resolution): Don't return less than 1.
2011-12-12 Christopher Faylor <me.cygwin2011@cgf.cx>
* cygthread.h (cygthread::name): Very minor formatting tweak.
* exceptions.cc (_cygtls::call_signal_handler): Add paranoid debugging
output.
* sigproc.h (cygwait): Call signal handler when signal is detected and
loop as appropriate.
* fhandler.h (fhandler_base_overlapped::wait_return): Remove
overlapped_signal.
* fhandler.cc (fhandler_base_overlapped::wait_overlapped): Remove
restartable signal accommodations in light of cygwait improvements.
(fhandler_base_overlapped::raw_read): Remove now-obsolete signal loop
behavior.
(fhandler_base_overlapped::raw_write): Ditto.
* fhandler_console.cc (fhandler_console::read): Ditto.
* fhandler_serial.cc (fhandler_serial::raw_read): Ditto.
(fhandler_serial::raw_write): Ditto.
* fhandler_tty.cc (fhandler_pty_slave::read): Ditto.
* ioctl.cc (ioctl): Add standard syscall introducer and leaver debug
output.
2011-12-12 Corinna Vinschen <vinschen@redhat.com>
* fhandler_process.cc (dos_drive_mappings): Partially rewrite to
handle volumes mounted into juntion points correctly.
2011-12-12 Corinna Vinschen <vinschen@redhat.com>
* fhandler_process.cc (dos_drive_mappings::dos_drive_mappings): Fully
resolve symbolic links returned by QueryDosDeviceW. Explain why.
2011-12-12 Corinna Vinschen <vinschen@redhat.com>
* mount.cc (fs_info::update): Set has_buggy_reopen for Netapps as well.
2011-12-12 Corinna Vinschen <vinschen@redhat.com>
Christopher Faylor <me.cygwin2011@cgf.cx>
* dcrt0.cc (wow64_respawn): New static variable.
(wow64_started_from_native64): New function to check if a WOW64
process got started from a native 64 bit process.
(respawn_wow64_process): New function to respawn process.
(dll_crt0_0): When started from a native parent, check if parent
is a 64 bit process. If so, return early.
(_dll_crt0): Respawn WOW64 process here if required.
* init.cc (respawn_wow64_process): Remove.
(dll_entry): Rename wow64_test_stack_marker to test_stack_marker.
Drop WOW64 test here.
2011-12-11 Christopher Faylor <me.cygwin2011@cgf.cx>
* pipe.cc (fhandler_pipe::create): Use debug_printf to print debugging
info since this isn't a "syscall".
(pipe_worker): New function created from _pipe().
(_pipe): Use pipe_worker to create a pipe. Use standard syscall strace
reporting on exit.
(pipe): Ditto.
(pipe2): Ditto.
2011-12-10 Christopher Faylor <me.cygwin2011@cgf.cx>
* select.cc (select_stuff::wait): Very minor formatting fix.
(peek_windows): Report on HWND handle used in queries.
* select.h: Update copyright.
* sigproc.h (cygwait): Eliminate multi-argument variety since more
general implementation may cause odd problems in select. Also force to
always be inline.
2011-12-10 Christopher Faylor <me.cygwin2011@cgf.cx>
* sigproc.h (cygwait): Delete duplicate va_start and add matching
va_end.
2011-12-10 Christopher Faylor <me.cygwin2011@cgf.cx>
* sigproc.h (cygwait): Tweak test for cancellable event to make it a
little more clear.
2011-12-09 Christopher Faylor <me.cygwin2011@cgf.cx>
* exceptions.cc (ctrl_c_handler): YA in a series or reversions. Put
back _my_tls.remove along with a comment.
(sigpacket::process): Remove code which now causes a gdb deadlock.
* sigproc.cc (_cygtls::signal_exit): Signal debugger with signal number
earlier.
2011-12-09 Christopher Faylor <me.cygwin2011@cgf.cx>
* dllfixdbg: Work around annoying gdb warning about missing
.gnu_debuglink.
2011-12-09 Christopher Faylor <me.cygwin2011@cgf.cx>
Rename cygWFMO to cygwait throughout and use the magic of polymorphism
to "wait for stuff".
* fhandler.cc (fhandler_base_overlapped::wait_overlapped): Use
simplified arg form of cygwait.
* fhandler_console.cc (fhandler_console::read): Ditto.
* fhandler_audio.cc (fhandler_dev_dsp::Audio_out::waitforspac): Ditto.
(fhandler_dev_dsp::Audio_in::waitfordata): Ditto.
* fhandler_fifo.cc (fhandler_fifo::wait): Ditto.
* fhandler_serial.cc (fhandler_serial::raw_read): Ditto.
(fhandler_serial::raw_write): Ditto.
* select.cc (cygwin_select): Ditto.
* sigproc.h (cygwait): Rename from cygWFMO. Define two argument and
single argument forms of this function.
* fhandler_tty.cc (fhandler_pty_slave::open): Use method to query if
tty is open.
(fhandler_pty_slave::read): Send SIGHUP when master is detected as
closed.
(fhandler_pty_common::close): Close input_available_event in callers
since master may need to signal it first.
(fhandler_pty_master::close): Lie and set input_available_event when
closing, then close input_available_event.
(fhandler_pty_slave::close): Close input_available_event explicitly
here.
* tty.h (tty::is_master_closed): Declare new method.
2011-12-09 Christopher Faylor <me.cygwin2011@cgf.cx>
* sigproc.cc (signal_exit): Revert reversion of 2011-12-04 change
since, otherwise, you see hangs when the signal pipe is closed.
2011-12-08 Christopher Faylor <me.cygwin2011@cgf.cx>
* select.cc (cygwin_select): Fifth time is the charm.
2011-12-08 Christopher Faylor <me.cygwin2011@cgf.cx>
* select.cc (cygwin_select): Make sure that 0 is returned when sel.wait
times out.
2011-12-08 Christopher Faylor <me.cygwin2011@cgf.cx>
* include/sys/wait.h: Add in all c++ functions.
2011-12-08 Christopher Faylor <me.cygwin2011@cgf.cx>
* select.cc (select_stuff::wait): Temporarily disallow APCS.
2011-12-08 Christopher Faylor <me.cygwin2011@cgf.cx>
* include/sys/wait.h: Ensure that C++ functions are only used when
using C++.
2011-12-08 Christopher Faylor <me.cygwin2011@cgf.cx>
* select.cc (cygwin_select): Make sure that poll is called when
appropriate.
2011-12-08 Christopher Faylor <me.cygwin2011@cgf.cx>
* dll_init.cc (dll_dllcrt0): Don't try to initialize dll data if we're
dynamically loaded since fork() doesn't work in that scenario anyway.
(dll_dllcrt0_1): Don't accommodate dynamically loaded dlls.
* exceptions.cc (ctrl_c_handler): Don't lock the process; there's too
much risk of deadlock.
* sigproc.cc (_cygtls::remove_wq): Don't try to remove anything from
the waitq if there is obviously nothing there.
* strace.cc (strace::activate): Allow stracing dynamically loaded
cygwin1.dll.
2011-12-07 Christopher Faylor <me.cygwin2011@cgf.cx>
* fhandler_termios.cc (tty_min::kill_pgrp): Don't send __SIGSETPGRP
to ourselves since presumably we are already initialized.
2011-12-07 Christopher Faylor <me.cygwin2011@cgf.cx>
* select.cc (cygwin_select): Add common introducer and leaver debug
output.
(select_stuff::poll): Remove unneeded debugging.
2011-12-07 Christopher Faylor <me.cygwin2011@cgf.cx>
* exceptions.cc (ctrl_c_handler): Remove _my_tls.remove since it can
cause deadlocks during exec and will eventually be handled anyway.
2011-12-07 Corinna Vinschen <vinschen@redhat.com>
* spawn.cc (child_info_spawn::worker): Add CREATE_BREAKAWAY_FROM_JOB
to all spawned processes. Explain why.
2011-12-06 Christopher Faylor <me.cygwin2011@cgf.cx>
* fhandler_fifo.cc (fhandler_fifo::wait): Fix stupid typo and actually
wait for the handle.
2011-12-05 Christopher Faylor <me.cygwin2011@cgf.cx>
* sigproc.cc (close_my_readsig): New function.
(_cygtls::signal_exit): Close my_readsig via close_my_readsig(),
avoiding communication with the signal pipe.
(wait_sig): Close my_readsig via close_my_readsig().
2011-12-05 Corinna Vinschen <vinschen@redhat.com>
* mmap.cc (mlock): Replace LOCK_VM_IN_WSL with correct MAP_PROCESS.
(munlock): Ditto.
* ntdll.h: Rearrange to have all preprocessor definitions at the start
of the file. Add comments to each definition block.
(MAP_PROCESS): Rename from LOCK_VM_IN_WSL.
(MAP_SYSTEM): Rename from LOCK_VM_IN_RAM.
2011-12-04 Christopher Faylor <me.cygwin2011@cgf.cx>
* sigproc.h (cygWFMO): Don't assume that cancellable event is always
available.
* fhandler_dsp.cc (fhandler_dev_dsp::Audio_out::waitforspace): Use
cygWFMO instead of WaitForMultipleObjects.
(fhandler_dev_dsp::Audio_in::waitfordata): Ditto.
* fhandler_fifo.cc (fhandler_fifo::wait): Ditto.
* fhandler_serial.cc (fhandler_serial::raw_read): Ditto.
(fhandler_serial::raw_write): Ditto.
* fhandler_tty.cc (fhandler_pty_slave::read): Ditto.
* select.cc (cygwin_select): Ditto for degenerate case.
2011-12-04 Christopher Faylor <me.cygwin2011@cgf.cx>
* sigproc.h (cygWFMO): Move inside "INSIDE_CYGWIN" #ifdef.
2011-12-04 Christopher Faylor <me.cygwin2011@cgf.cx>
* exceptions.cc (exception::handle): Drop abbreviation for "exception"
since I never remember what it stands for.
(sig_handle_tty_stop): Remove obsolete call to reset_signal_arrived.
(_cygtls::call_signal_handler): Rework to grab signal information from
_main_tls if none is set for _my_tls. Try harder to keep thread
locked.
(reset_signal_arrived): Delete.
* fhandler.cc (fhandler_base_overlapped::wait_overlapped): Use new
cygWFMO call to wait for an event + standard cygwin stuff. Modify
debug output to acccomodate new function.
* fhandler_console.cc (fhandler_console::read): Replace
WaitForMultipleObjects with cygWFMO.
* fhandler_socket.cc (get_inet_addr): Add comment.
* gendef (_sigdelayed): Remove call to reset_signal_arrived.
* sigproc.cc (_cygtls::signal_exit): Don't close my_readsig here unless
we're in the signal thread.
(create_signal_arrived): Create signal_arrived as auto-reset so that only
one thread is woken when a signal arrives.
* sigproc.h (cygWFMO): New function.
(reset_signal_arrived): Delete declaration.
2011-12-03 Christopher Faylor <me.cygwin2011@cgf.cx>
* mmap.cc (mlock): Add standard syscall return value debugging output.
(munlock): Ditto.
(posix_madvise): Ditto.
* signal.cc: Remove obsolete sigcatchers stuff throughout.
(sigaction_worker): Add function name parameter and use it to show
standard syscall return value debugging output. Also add fault
protection.
(sigaction): Accommodate extra argument to sigaction_worker.
(siginterrupt): Ditto.
* syscalls.cc (read): Remove obsolete sigcatchers stuff.
(readv): Ditto.
2011-12-03 Corinna Vinschen <vinschen@redhat.com>
* mmap.cc (mlock): Drop requesting SE_LOCK_MEMORY_PRIVILEGE. Drop
outdated comment. Call NtLockVirtualMemory with LOCK_VM_IN_WSL flag.
(munlock): Drop requesting SE_LOCK_MEMORY_PRIVILEGE. Call
NtUnlockVirtualMemory with LOCK_VM_IN_WSL flag.
2011-12-03 Christopher Faylor <me.cygwin2011@cgf.cx>
Throughout, remove extra space after function name from debugging
output.
Throughout, change syscalls to report on return values using new %R
format option.
* smallprint.cc (__small_vsprintf): Add parsing for %R to report on
return values and possible errno from syscalls.
* errno.cc (errmap): Add PRIVILEGE_NOT_HELD.
* fhandler_tty.cc (fhandler_pty_master::setup): When creating a thread
use shorter name to reduce debuggging output.
* select.cc (start_thread_pipe): Ditto.
(start_thread_serial): Ditto.
(start_thread_socket): Ditto.
(start_thread_mailslot): Ditto.
* sigproc.cc (talktome): Ditto.
2011-12-03 Corinna Vinschen <vinschen@redhat.com>
* fhandler.cc (fhandler_base::open): Fix comment a bit more.
2011-12-03 Corinna Vinschen <vinschen@redhat.com>
* fhandler.cc (fhandler_base::open): Fix typos in comment.
2011-12-02 Corinna Vinschen <vinschen@redhat.com>
* path.cc (conv_path_list): Take cygwin_conv_path_t as third parameter.
Allow all types of CCP conversions. Accommodate throughout.
(cygwin_conv_path): Use current ANSI or OEM codepage for WIN_A
conversions, depending on current file API codepage setting.
(cygwin_conv_path_list): Allow all CCP conversion types.
* include/sys/cygwin.h (CCP_CONVTYPE_MASK): Add to cygwin_conv_path_t
enum for convenience.
2011-11-29 Christopher Faylor <me.cygwin2011@cgf.cx>
* sigproc.cc (get_proc_lock): Remove extra NULL check. Return false on
failure.
2011-11-29 Christopher Faylor <me.cygwin2011@cgf.cx>
* sync.cc: Fix comment.
2011-11-29 Christopher Faylor <me.cygwin2011@cgf.cx>
* dll_init.cc (dll_list::reserve_space): Use %p rather than %lx to show
reserved space.
2011-11-29 Christopher Faylor <me.cygwin2011@cgf.cx>
* sigproc.cc (remove_proc): Don't terminate the currently executing
thread.
2011-11-28 Christopher Faylor <me.cygwin2011@cgf.cx>
* cygheap.cc (cygheap_fixup_in_child): Accommodate new HEAP_3*
classifications for cleanup-after-fork.
* cygheap_malloc.h (cygheap_types): Add HEAP_2_MAX, HEAP_3_FHANDLER.
* fhandler.h: Throughout, change clone to take a cmalloc id.
(fhandler_base::delete): Inline.
(fhandler_base_overlapped): Mark flush_async_io as a friend.
(fhandler_base_overlapped::asio_done): Declare new static member.
(fhandler_base_overlapped::asio_close_counter): Ditto.
(fhandler_base_overlapped::check_later): Declare new function.
(fhandler_base_overlapped::flush_all_async_io): Ditto.
* fhandler.cc (fhandler_base_overlapped::asio_done): Declare.
(fhandler_base_overlapped::asio_close_counter): Ditto.
(flush_async_io): Declare new thread function.
(fhandler_base_overlapped::flush_all_async_io): Declare new function.
(fhandler_base_overlapped::check_later): Ditto.
(fhandler_base_overlapped::close): Call check_later to close
nonblocking fd asynchronously. Assume that this completed
successfully.
* select.cc (pipe_data_available): Don't consider data to be
"available" if fd still has unflushed I/O.
* syscalls.cc (close_all_files): Call
fhandler_base_overlapped::flush_all_async_io to make sure that all
nonblocking pipe I/O has completed.
2011-11-28 Corinna Vinschen <vinschen@redhat.com>
* external.cc (fillout_pinfo): Store program name as POSIX path in
ep.progname_long.
2011-11-28 Corinna Vinschen <vinschen@redhat.com>
* pinfo.cc (pinfo::exit): Call TerminateProcess to avoid potential
busy loop in ntdll.dll when calling ExitProcess. Only call ExitProcess
as a fallback.
2011-11-27 Christopher Faylor <me.cygwin2011@cgf.cx>
* init.cc (dll_entry): Revert previous change since it caused
inexplicable fork problems.
2011-11-26 Christopher Faylor <me.cygwin2011@cgf.cx>
* init.cc (dll_entry): Don't bother calling through thread removal
cleanup if we are exiting.
2011-11-26 Christopher Faylor <me.cygwin2011@cgf.cx>
* exceptions.cc (stackdump): Make global.
(signal_exit): Move to sigproc.cc.
* sigproc.cc (signal_exit): Move here. Declare stackdump extern. Set
my_sendsig to indicate that signals are no longer available.
(my_readsig): Make Static again.
(sig_send): Interpret ERROR_BROKEN_PIPE as ESRCH. Remove special-case
EACCESS errno setting, just setting errno generally, even for "its_me"
case.
2011-11-25 Christopher Faylor <me.cygwin2011@cgf.cx>
* exceptions.cc (sigpacket::process): Move signal_exit processing
into...
(_cygtls::signal_exit): ...here. Close my_readsig and comment on why.
* pinfo.cc (pinfo::exit): Move sigproc_terminate earlier. Set exiting
flag in lock_process.
* sigproc.cc (my_readsig): Make global.
* sync.cc (muto::exiting_thread): Delete.
(muto::acquire): Delete #if 0'ed code.
* sync.h (muto::exiting_thread): Delete.
(set_exiting_thread): Ditto.
(lock_process::lock_process): Don't worry about setting the exiting
thread since it had no meaning.
2011-11-24 Christopher Faylor <me.cygwin2011@cgf.cx>
* cygthread.cc (cygthread::name): Default name to "main" if we are early
in the process of setting up the DLL and no name is known.
* dcrt0.cc (initial_env): Remove CYGWIN_SLEEP stuff.
(get_cygwin_startup_info): Activate strace here as appropriate.
(dll_crt0_0): Move get_cygwin_startup_info as early as possible to
avoid missing strace output.
* fork.cc (frok::child): Move debugging statement to point where ppid
will be set.
* pinfo.cc (pinfo::thisproc): Remove obsolete call to strace.hello.
Tweak debug output slightly.
* select.cc (select_stuff::wait): Allow APCS to be triggered while
waiting since we use them now. Report when that happens.
* sigproc.cc (child_info::child_info): Use strace.active() rather than
strace.attached().
* spawn.cc (child_info_spawn::worker): Only write strace child pid
when we know it's a cygwin process. Accommodate change to write_child
argument list.
* strace.cc (strace::hello): Delete. Move functionality...
(strace::activate): ...to here.
(mypid): Just use raw GetCurrentProcessId () if myself isn't set.
(strace::write_childpid): Don't wait for subproc_ready. Remove arg
which was required for it.
* include/sys/strace.h (strace::hello): Delete.
(strace::write_childpid): Delete first argument.
2011-11-23 Christopher Faylor <me.cygwin2011@cgf.cx>
* child_info.h (CURR_CHILD_INFO_MAGIC): Reset for previous changes.
* dcrt0.cc (get_cygwin_startup_info): Signal readiness when stracing
since strace::write_child relies on it. Use strace.activate to notify
strace process, passing in arg indicating whether we're forked.
* sigproc.cc (wait_sig): Accommodate new strace::activate argument.
* spawn.cc (child_info_spawn::worker): Oops. Previous suspended test
was actually correct. Revert and document.
* strace.cc (strace::activate): Send additional flag indicating whether
this is an attempt to activate a forked process.
(strace::hello): Report on windows pid.
* include/sys/strace.h (strace::strace): Make a dummy.
(strace::activate): Modify declaration to accept an argument.
(strace::write_childpid): Set regparm.
2011-11-23 Christopher Faylor <me.cygwin2011@cgf.cx>
* pipe.cc (fhandler_pipe::create): Avoid derefencing a NULL pointer.
* child_info.h (child_info): Reorganize some elements so that the ones
which are initialized in a constructor are all together.
* sigproc.cc (child_info::child_info): Initialize values via the
constructor rather than as C statements and make sure that flags is set
to zero initially.
* spawn.cc (child_info_spawn::worker): Use iscygwin() test for
determining when to send strace info since it is more foolproof than
checking the suspend state.
2011-11-23 Christopher Faylor <me.cygwin2011@cgf.cx>
* fhandler.h (fhandler_pipe::create): Rename from the misnamed
"create_selectable". Change return to DWORD.
(fhandler_pty_common::pipesize): New constant.
* fhandler_fifo.cc (fhandler_fifo::fhandler_fifo): Reflect
create_selectable name change.
* miscfuncs.cc (CreatePipeOverlapped): Ditto.
* pipe.cc (fhandler_pipe::create): Ditto.
(fhandler_pipe::create): Rename from the misnamed "create_selectable".
Return DWORD. Only set pipe size to default when it is passed in as
zero.
* fhandler_tty.cc (fhandler_pty_master::setup): Ditto. Use
fhandler_pty_common::pipesize rather than a raw constant.
* tty.cc (tty::not_allocated): Ditto.
* sigproc.cc (sigproc_init): Use fhandler_pipe::create to create the
signal pipe to get a more appropriate message based pipe.
2011-11-21 Christopher Faylor <me.cygwin2011@cgf.cx>
* sigproc.cc (remove_proc): Don't do busy loop when exiting since it
doesn't matter.
2011-11-21 Christopher Faylor <me.cygwin2011@cgf.cx>
* sigproc.cc (remove_proc): Don't do busy loop when execing since
thread could have been terminated prior to setting flag.
* signal.cc (sigwaitinfo): Zero event before closing to signal other
threads that it is no longer available.
2011-11-18 Corinna Vinschen <corinna@vinschen.de>
* shared.cc (get_shared_parent_dir): Use global shared_parent_dir
instead of local dir variable and create handle not inheritable to
avoid accumulating stray handles in child processes.
(get_session_parent_dir): Ditto with session_parent_dir variable.
2011-11-17 Corinna Vinschen <corinna@vinschen.de>
* shared.cc (shared_info::create): Open global shared data section
non-inheritable to avoid accumulating stray handles in child processes.
2011-11-15 Christopher Faylor <me.cygwin2011@cgf.cx>
* child_info.h (CURR_CHILD_INFO_MAGIC): Reset.
(cygheap_exec_info::nchildren): Move from child_info_spawn.
(cygheap_exec_info::cchildren): Ditto.
(cygheap_exec_info::record_children): Declare new function.
(cygheap_exec_info::reattach_children): Ditto.
(cygheap_exec_info::alloc): Ditto.
(child_info_spawn::nchildren): Move to cygheap_exec_info.
(child_info_spawn::cchildren): Ditto.
* sigproc.cc (cygheap_exec_info::alloc): Define new function.
(child_info_spawn::cleanup): Accommodate move of children info to
cygheap_exec_info.
(cygheap_exec_info::record_children): Define new function.
(cygheap_exec_info::reattach_children): Ditto.
(child_info_spawn::record_children): Use
cygheap_exec_info function to accomplish this task.
(child_info_spawn::reattach_children): Ditto.
* spawn.cc (child_info_spawn::worker): Allocate moreinfo using
cygheap_exec_info::alloc.
* dcrt0.cc (child_info_fork::alloc_stack_hard_way): Use abort for the
error to avoid a retry.
2011-11-14 Christopher Faylor <me.cygwin2011@cgf.cx>
* pinfo.cc (_pinfo::dup_proc_pipe): Fatalize a warning when debugging.
2011-11-13 Christopher Faylor <me.cygwin2011@cgf.cx>
Remove erroneously checked-in debugging statements.
* cygheap.cc (cygheap_fixup_in_child): Here.
* debug.cc (delete_handle): Here.
* sigproc.cc (child_info_spawn::cleanup): Here.
* spawn.cc (child_info_spawn::worker): Here.
2011-11-13 Christopher Faylor <me.cygwin2011@cgf.cx>
Throughout, change "sig %d" in strace output to "signal %d" for
consistency.
* assert.cc (__assert_func): Output assertion string to strace too.
* fork.cc (frok::parent): Report ASAP on forked pid in debugging output.
* pinfo.cc (pinfo::_pinfo_release): Define new function.
(pinfo::init): Use _pinfo_release() rather than release() to release
shared memory stuff.
(pinfo::wait): Shorten name of process waiting thread for more concise
debugging.
(pinfo::release): Use pinfo_release to release shared memory part of
struct.
* pinfo.h (pinfo::__pinfo_release): Declare.
2011-11-10 Christopher Faylor <me.cygwin2011@cgf.cx>
Throughout use "have_execed" macro rather than "hExeced" global handle.
Throughout rename _PROC_* to _CH_*.
* child_info.h: Include "pinfo.h".
(child_info_types): Rename _PROC_* -> _CH_* to avoid confusion with
similarly named constants.
(_PROC_*): Delete unneeded aliases.
(PROC_*): Ditto.
(CURR_CHILD_INFO_MAGIC): Ditto.
(cchildren): Define using "pinfo_minimal".
(child_info::set_saw_ctrl_c): Move to
(child_info_spawn::set_saw_ctrl_c): Here.
(child_info_spawn::lock): New field.
(child_info_spawn::hExeced): Ditto.
(child_info_spawn::ev): Ditto.
(child_info_spawn::~child_info_spawn): Move to sigproc.cc.
(child_info_spawn::child_info_spawn): Ditto.
(child_info_spawn::cleanup): Declare new function.
(child_info_spawn::set_saw_ctrl_c): Move to this class. Set flag only
when execed and return true when we have set the flag.
(child_info_spawn::child_info_spawn::signal_myself_exited): New function.
(child_info_spawn::wait_for_myself): Ditto.
(child_info_spawn::has_execed_cygwin): Ditto.
(child_info_spawn::has_execed): Ditto. Replaces "hExeced" test.
(child_info_spawn::operator HANDLE&): New operator.
(child_info_spawn::worker): Define old "spawn_guts" as class member.
(ch_spawn): Declare.
(have_execed): Define.
(have_execed_cygwin): Ditto.
* cygheap.h: Update comment.
* dcrt0.cc (get_cygwin_startup_info): Use _CH_* enums.
(child_info_spawn::handle_spawn): Ditto.
(dll_crt0_0): Ditto.
(multiple_cygwin_problem): Ditto.
* exceptions.cc (chExeced): Delete obsolete declaration.
(ctrl_c_handler): Reference set_saw_ctrl_c via new ch_spawn global.
* globals.cc (hExeced): Delete.
* pinfo.cc (pinfo::thisproc): Refer to cygheap as ::cygheap for
consistency in handle naming when -DDEBUGGING.
(pinfo::init): Accommodate case where myself.h is known but h0 is
passed in.
(pinfo::pinfo): New constructor for setting up a pinfo passed in by
previous exec'or.
(pinfo::proc_waiter): Don't handle subprocess if we're in the process
of exiting due to an exec of a cygwin process. Don't close
rd_proc_pipe here. Close it when we actually are finished with the
process. Use new ch_spawn.signal_myself_exited function to let exec
stub know that subprocess has exited.
(pinfo::wait): Clarify debugging output.
(pinfo::release): Use "close_h" to close all handles to avoid races.
(winpids::add): Assume that elements of the array do not need to be
zeroed and are properly initialized or suffer problems on
pinfo::release. Don't close hProcess since release does that now.
* pinfo.h: Update comment.
(pinfo_minimal): Move some elements from pinfo here so that
child_info_spawn can use them.
(pinfo): Inherit from pinfo_minimal.
(pinfo::pinfo): Modify to accommodate new pinfo_minimal.
(pinfo::allow_remove): New function.
* sigproc.cc (proc_subproc): Use boolean values for true/false.
Implement PROC_EXEC_CLEANUP.
(proc_terminate): Set ppid = 1 since the procs list will only be
iterated when the process has not execed. Don't do any cleanup here
since it is now handled in pinfo::release.
(sigproc_init): Initialize sync_proc_subproc earlier.
(child_info::child_info): Assume that all important fields are properly
initialized and avoid memset().
(child_info_spawn::child_info_spawn): Specifically test for execing and
then set up appropriate fields in the struct.
(child_info_spawn::cleanup): Define new function.
(child_info_spawn::record_children): Specifically test for being execed
here. Fill in pinfo_minimal part of children array.
(child_info_spawn::reattach_children): Use constructor to duplicate
information for previous exec'or. Add more debugging output.
(remove_proc): Force deletion of thread when exiting due to exec. Rely
on pinfo::cleanup in release.
* sigproc.h (PROC_EXEC_CLEANUP): New enum.
(PROC_DETACHED_CHILD): Delete.
* spawn.cc (chExeced): Delete.
(child_info_spawn::worker): Rename from spawn_guts. Use elements of
child_info_spawn throughout rather than ch.whatever. Use ::cygheap to
refer to global rather than element of child_info. Use
wait_for_myself() rather than waitpid(). Call
child_info_spawn::cleanup on function return.
(spawnve): Reflect movement of spawn_guts functionality into
child_info_spawn::worker.
* syscalls.cc (popen): Ditto.
* winsup.h (spawn_guts): Delete declaration.
2011-11-08 Corinna Vinschen <corinna@vinschen.de>
* posix.sgml (std-gnu): Add ptsname_r.
2011-11-08 Christopher Faylor <me.cygwin2011@cgf.cx>
* fhandler.h (__ptsname): New macro.
* dtable.cc (decode_tty): Use __ptsname to generate the slave pty name.
* fhandler_tty.cc (fhandler_pty_master::ptsname_r): Ditto.
* bsdlib.cc: Add needed includes for openpty() changes.
(openpty): Use __ptsname to generate the slave pty name. Close slave
fd when aslave == NULL.
2011-11-08 Christopher Faylor <me.cygwin2011@cgf.cx>
* include/cygwin/stdlib.h: Update copyright.
2011-11-07 Christopher Faylor <me.cygwin2011@cgf.cx>
* cygwin.din (ptsname_r): Export.
* fhandler.cc (fhandler_base::ptsname_r): Define.
* fhandler.h (fhandler_base::ptsname): Delete.
(fhandler_base::ptsname_r): Declare.
(fhandler_pty_master::ptsname_r): Declare.
* fhandler_tty.cc (fhandler_pty_master::ptsname): Delete.
(fhandler_pty_master::ptsname_r): New reentrant function derived from
previous ptsname.
* syscalls.cc (ptsname_r): Implement new function with functionality
similar to Linux.
(ptsname): Use ptsname_r () to fill out buf.
* include/cygwin/stdlib.h (ptsname_r): Declare.
* include/cygwin/version.h: Bump CYGWIN_VERSION_API_MINOR to 255 to
reflect export of ptsname_r.
* pinfo.cc (pinfo::wait): Return bool rather than int.
* pinfo.h (info::wait): Ditto.
(pinfo::reattach): Define !defined(_SIGPROC_H) case for consistency.
* sigproc.cc (child_info_spawn::reattach_children): Use correct
dwProcessId rather than pid when duplicating handle.
2011-11-07 Corinna Vinschen <corinna@vinschen.de>
* fhandler.cc (CHUNK_SIZE): Drop NO_COPY.
2011-11-07 Corinna Vinschen <corinna@vinschen.de>
* syscalls.cc (check_dir_not_empty): Check surplus directory entries
by calling NtQueryAttributesFile. Make STATUS_DIRECTORY_NOT_EMPTY
return value dependent on its status code. Add long comment to explain.
(unlink_nt): Add comment to explain flaw in checking the sharing mode.
Set status to STATUS_SUCCESS instead of 0. Add a retry loop to setting
the delete disposition and trying to move a directory to bin to
workaround rare cases of lingering, already deleted subdirectory
entries. Add long comment to explain.
(rename): Set status to STATUS_SUCCESS instead of 0.
2011-11-05 Christopher Faylor <me.cygwin2011@cgf.cx>
* pinfo.cc (status_exit): Recognize STATUS_ILLEGAL_INSTRUCTION.
(child_info::proc_retry): Ditto.
2011-11-05 Christopher Faylor <me.cygwin2011@cgf.cx>
* pinfo.cc (status_exit): Return complete error code. Handle
STATUS_ACCESS_VIOLATION correctly.
(pinfo::set_exit_code): Set self->exitcode directly from status_exit.
2011-11-04 Christopher Faylor <me.cygwin2011@cgf.cx>
* pinfo.h (pinfo::reattach): Only set destroy to false when
proc_subproc succeeds. Return true for success.
* sigproc.cc (child_info_spawn::reattach_children): Try harder to clean
up on error by detecting reattach failures too.
2011-11-04 Christopher Faylor <me.cygwin2011@cgf.cx>
* sigproc.cc (child_info_spawn::reattach_children): Clean up handle
when can't open parent process or suffer handle leak.
2011-11-03 Christopher Faylor <me.cygwin2011@cgf.cx>
* sigproc.cc (child_info::sync): Report on exit code in strace output.
(child_info::proc_retry): Don't consider STATUS_ACCESS_VIOLATION as a
restartable event.
2011-11-03 Christopher Faylor <me.cygwin2011@cgf.cx>
* sigproc.cc (child_info_spawn::reattach_children): Avoid issuing an
error when we can't duplicate from "parent" since it is probably ok if
children of the previous owner of the pid disappear.
2011-11-03 Corinna Vinschen <corinna@vinschen.de>
* fhandler.cc (off_current): Define local in fhandler_base::raw_write.
Drop erroneous NO_COPY, add _RDATA to make R/O.
(off_append): Ditto.
* globals.cc (_RDATA): Move definition from here...
* winsup.h: ...to here.
2011-10-30 Christopher Faylor <me.cygwin2011@cgf.cx>
* fhandler.h (fhandler_pipe::create_selectable): Remove optional
argument, take an options argument for CreateNamedPipe/CreateFile.
Change handle arguments to expect pointers.
(fhandler_fifo::fifo_state): Delete.
(fhandler_fifo::dummy_client): Ditto.
(fhandler_fifo::open_nonserver): Ditto.
(fhandler_fifo::wait_state): Ditto.
(fhandler_fifo::raw_write): Ditto.
(fhandler_fifo::read_ready): New field.
(fhandler_fifo::write_ready): Ditto.
(fhandler_fifo::wait): Modify argument.
(fhandler_fifo::fifo_name): Add a new argument.
(fhandler_fifo::fixup_after_fork): New function.
* fhandler_fifo.cc (fhandler_fifo::fhandler_fifo): Remove
initialization of expunged elements. Initialize new handles to NULL.
(fhandler_fifo::open_nonserver): Delete.
(fnevent): New macro for creating a named event.
(fnpipe): New macro for creating a unique named pipe name.
(create_pipe): New macro for simplification of named pipe creation.
(fhandler_fifo::fifo_name): Use new argument when creating a shared
name.
(fhandler_fifo::open): Rewrite. Use events to synchronize.
(fhandler_fifo::wait): Rewrite to wait for new fifo events which are
supplied as a parameter.
(fhandler_fifo::raw_read): Rewrite to use handle mechanism to detect
client-side disconnect.
(fhandler_fifo::raw_write): Delete.
(fhandler_fifo::close): Remove accommodations for expunged fields.
Close event handles.
(fhandler_fifo::dup): Remove accommodations for expunged fields.
Duplicate event handles.
(fhandler_fifo::fixup_after_fork): New function. Perform fixups on
event handles.
(fhandler_fifo::set_close_on_exec): Remove accommodations for expunged
fields. Set inheritance for new handle fields.
* miscfuncs.cc (CreatePipeOverlapped): Accommodate changes in
fhandler_pipe::create_selectable.
* tty.cc (tty::not_allocated): Ditto.
* pipe.cc (fhandler_pipe::create): Ditto.
(fhandler_pipe::create_selectable): Accept an extra open_mode argument.
Pass arguments by reference and allow opening one end of the pipe at a
time.
* sys/strace.h (debug_only_printf): Define new macro which calls
debug_printf only when DEBUGGING is defined.
2011-10-28 Christopher Faylor <me.cygwin2011@cgf.cx>
* exceptions.cc (sigpacket::process): Avoid a potential deadlock when
exiting due to a signal.
2011-10-28 Corinna Vinschen <corinna@vinschen.de>
* cygwin.din (getgrouplist): Export.
* grp.cc (get_groups): New static function to run the core functionality
of initgroups and getgrouplist.
(initgroups32): Call get_groups and just create supplementary group
list in cygheap. Rename name of first argument to "user". Add an
assertion to test for a NULL user name.
(initgroups): Rename name of first argument to "user".
(getgrouplist): New function.
* posix.sgml (std-bsd): Add getgrouplist.
* include/cygwin/grp.h (getgrouplist): Declare.
* include/cygwin/version.h: Bump API minor number.
2011-10-25 Christopher Faylor <me.cygwin2011@cgf.cx>
* child_info.h (cchildren): New struct.
(child_info_spawn::nchildren): Rename from nprocs.
(child_info_spawn::children): Change type to cchildren for more
bookkeeping possibilities.
(child_info_spawn::child_info_spawn): Clear nchildren.
(child_info_spawn::record_children): Declare new function.
(child_info_spawn::reattach_children): Ditto.
* dcrt0.cc (child_info_spawn::handle_spawn): Call reattach_children to
gather list of processes we are potentially waiting for.
* pinfo.h (pinfo::pinfo): Make sure that rd_proc_pipe is always cleared.
(pinfo::reattach): New function.
* sigproc.cc: Move pinfo.h earlier so that it can be used in sigproc.h.
(get_proc_lock): Don't bother with a lock during DLL initialization.
(proc_subproc): Handle PROC_REATTACH_CHILD.
(proc_terminate): Orphan children only when we are not an execed
process or when the pid is about to be occupied by a non-cygwin
process.
(child_info_spawn::record_children): Define new function.
(child_info_spawn::reattach_children): Ditto.
* sigproc.h (procstuff): Define PROC_REATTACH_CHILD and renumber other
elements.
* spawn.cc (spawn_guts): Record any to-be-waited-for subprocesses if
about to exec a cygwin process.
* sigproc.cc (sig_send): Fix harmless transposition of fifth and six
arguments to DuplicateHandle().
(child_info::child_info): Ditto.
* globals.cc (hExeced): Make NO_COPY.
2011-10-25 Corinna Vinschen <corinna@vinschen.de>
* hookapi.cc (hook_or_detect_cygwin): Take additional handle
to a file mapping as parameter. If this handle is not NULL,
create another file mapping for the IAT.
* spawn.cc (av::fixup): Only map the first 64K of an image and
keep the mapping handle to use as argument to hook_or_detect_cygwin.
* winsup.h (hook_or_detect_cygwin): Add mapping handle as default
parameter in declaration.
2011-10-24 Corinna Vinschen <corinna@vinschen.de>
* syscalls.cc (unlink_nt): Fix a bug which overwrites the NT status
value in case setting the delete disposition returns with
STATUS_DIRECTORY_NOT_EMPTY.
2011-10-24 Corinna Vinschen <corinna@vinschen.de>
* shared.cc (open_shared): Fix memory reservation of essential shared
memory regions. Drop delta computations since delta is always 0 in
non-relocated case. Add a comment.
2011-10-23 Christopher Faylor <me.cygwin2011@cgf.cx>
* fhandler_tty.cc (fhandler_pty_slave::read): Use consistent way for
testing ReadFile return.
* pipe.cc (fhandler_pipe::create_selectable): Open the write side of
the pipe in message-mode to force writing as "chunks". Explain why.
2011-10-23 Christopher Faylor <me.cygwin2011@cgf.cx>
* path.cc (path_conv::get_nt_native_path): Avoid dereferencing path
when it is NULL.
2011-10-21 Christopher Faylor <me.cygwin2011@cgf.cx>
* dtable.cc (dtable::delete_archetype): Improve debugging output.
(dtable::init_std_file_from_handle): Close console handle early, before
initialization. Build up openflags for passing to open_setup, just to
be safe.
(last_tty_dev): New variable.
(fh_last_tty_dev): New macro.
(fh_alloc): Try again to keep track of previously opened tty, this time
by just saving the device and using that to potentially open an
archetype. Avoid setting the "/dev/tty" name if the creation of the
fhandler failed.
(build_fh_pc): Remove unused second argument. Reorganize how and where
the name is set. Set last_tty_dev as appropriate. Avoid a NULL
dereference in a debug printf.
* dtable.h (build_fh_pc): Reflect removal of second parameter.
* fhandler.cc (fhandler_base::reset): Use new '<<' operator to copy pc
since it preserves any potentially previously set name.
(fhandler_base::set_name): Ditto.
* fhandler.h (fhandler_*::clone): Throughout use ccalloc to allocate
new fhandler, primarily to make sure that pc field is properly zeroed.
(fhandler_termios::last): Eliminate.
(fhandler_termios): Remove setting of last.
(fhandler_base::~fhandler_termios): Ditto.
* fhandler_console.cc (fhandler_console::open): Don't make decisions
about opening close-on-exec handles here since it makes no sense for
archetypes.
(fhandler_console::init): Assume that input handle has already been
opened.
* fhandler_termios.cc (fhandler_termios::last): Delete.
* path.h (path_conv::eq_worker): New function. Move bulk of operator =
here.
(operator <<): New function.
(operator =): Use eq_worker to perform old functionality.
* child_info.h (NPROCS): Move here from sigproc.cc.
(child_info::nprocs): New field. Not used yet.
(child_info::children):: Ditto.
2011-10-21 Corinna Vinschen <corinna@vinschen.de>
* fhandler_disk_file.cc (fhandler_disk_file::rmdir): Check invalid
success only on Samba shares.
* mount.cc (fs_info::update): Drop has_buggy_basic_info flag for
NcFsd.
* syscalls.cc (unlink_nt): Fix typo in comment.
2011-10-21 Corinna Vinschen <corinna@vinschen.de>
* globals.cc (ro_u_ncfsd): New R/O unicode string.
* mount.cc (fs_info::update): Check for "NcFsd" FS. Set flags and
change comments accordingly.
(fs_names): Add entry for NcFsd FS.
* mount.h (enum fs_info_type): Add ncfsd.
(class fs_info): Add ncfsd flag and accessor methods.
* path.h (class path_conv): Add fs_is_ncfsd method.
* syscalls.cc (unlink_nt): Experimentally try delete-on-close on NcFsd
in STATUS_CANNOT_DELETE case.
2011-10-20 Christopher Faylor <me.cygwin2011@cgf.cx>
* fhandler.h (fhandler*::copyto): Free path_conv strings first.
* path.h (cfree_and_null): Rename and expand from cfree_maybe.
(path_conv &operator =): Call free_strings rather than freeing strings
directly.
2011-10-20 Christopher Faylor <me.cygwin2011@cgf.cx>
Throughout change TTY_* to PTY_*, tty_* to pty_*, and ttym_* to ptmx_*.
* devices.cc: Regenerate.
* dtable.cc: (fh_alloc): Preserve /dev/tty name when that's what we
opened.
(build_fh_pc): Preserve any existing name.
* fhandler.cc (fhandler_base::open_with_arch): Ditto.
* fhandler_tty.cc (fhandler_pty_master::fhandler_pty_master): Force the
name to /dev/ptmx while preserving other pty master device information.
* path.h (cfree_maybe): New macro.
(path_conv::operator =): Free any allocated strings in target.
(path_conv::free_strings): Delete unused function.
* sigproc.cc (proc_terminate): Remove previous accommodation for execed
processes since it didn't have the desired effect. Change comment to a
FIXME.
* spawn.cc (chExeced): Mark NO_COPY.
(exe_suffixes): Ditto.
2011-10-20 Corinna Vinschen <corinna@vinschen.de>
* syscalls.cc (try_to_bin): Improve debug output.
(check_dir_not_empty): Take additional path_conv argument. Improve
debug output. Change syscall_printf to debug_printf.
(unlink_nt): Improve debug output. Change syscall_printf to
debug_printf.
(unlink): Change syscall_printf to debug_printf.
* cygthread.h: Fix copyright dates.
2011-10-18 Corinna Vinschen <corinna@vinschen.de>
* path.cc: Extend two comments. Mention the name RtlpCurDirRef
for reference.
2011-10-17 Christopher Faylor <me.cygwin2011@cgf.cx>
* dcrt0.cc (dll_crt0_1): Copy argv before passing to main().
2011-10-17 Christopher Faylor <me.cygwin2011@cgf.cx>
* sigproc.cc (proc_terminate): Avoid setting ppid to 1 if we're execing.
2011-10-15 Christopher Faylor <me.cygwin2011@cgf.cx>
* cygerrno.h (__set_errno): Modify debugging output to make searching
strace logs easier.
Throughout, change /dev/tty* to /dev/pty*.
Throughout, add flags argument to fhandler_*::dup methods.
* devices.in: Rename (temporarily?) /dev/ttyN to /dev/ptyN. Add
/dev/ptymN devices for pty masters.
* devices.cc: Regenerate.
* devices.h (MAX_CONSOLES): Set to max number supported by devices.in.
(fh_devices::FH_PTMX): Rename from FH_PTYM.
(device::operator int): Return by reference.
* dtable.cc (fh_alloc): Take pc as an argument rather than just the
device. This makes debugging easier since more information is
available. Actually implement handling for already-allocated pty
master devices. Make different decisions when generating fhandler for
not-opened devices. Add kludge to deal with opening /dev/tty.
(cnew_no_ctor): New macro.
(build_fh_pc): Make debugging output more verbose. Use new clone()
fhandler interface to duplicate archetypes. Reset last term opened.
(dtable::dup_worker): Use Use new clone() fhandler interface to
duplicate archetypes. Pass flags to child dup handler.
(dtable::dup3): Set O_NOCTTY flag if newfd is not stdin/stdout/stderr.
* fhandler.cc (fhandler_base::reset): Rename from operator =() and
reduce functionality and sense of copy direction.
(fhandler_base::open_with_arch): Use published interface to query
io_handle(). Use new copyto() fhandler method to copy from/to found
archetype.
* fhandler.h: Throughout, delete size(), add copyout, clone, and
fhandler_* (void *) methods.
(fhandler_base::reset): Rename from operator =().
(fhandler_termios::is_dev_tty): Delete.
(fhandler_termios): change "protected" region to "private".
(fhandler_termios::is_dev_tty): Delete.
(fhandler_termios): Rearrange protected/public.
(fhandler_termios::fhandler_termios): Remember last fhandler_termios
"opened".
(fhandler_termios::~fhandler_termios): Forget last fhandler_termios
opened.
(ioctl): Rename from ioctl_termios. Take a void * argument. Reflect
argument change in pinfo::set_ctty.
(fhandler_console::dup): Declare new function. Set ctty here if
appropriate.
(fhandler_pty_master::from_master): Privatize.
(fhandler_pty_master::to_master): Ditto.
(fhandler_pty_master::dwProcessId): Ditto.
(fhandler_pty_master::fhandler_pty_master): Add an `int' argument.
(fhandler_pty_master::open_setup): Declare new function.
(fhandler_pty_master::~fhandler_pty_master): Declare new method.
(fhandler_nodevice): Remove commented out function declaration.
* fhandler_console.cc: Use get_ttyp() instead of tc() throughout.
(fhandler_console::dup): Define new function to set controlling ctty on
dup, as appropriate.
(fhandler_console::ioctl): Reflect ioctl_termios name change.
(fhandler_console::setup): Rename from get_tty_stuff.
(fhandler_console::open_setup): Reflect argument change in
pinfo::set_ctty.
(fhandler_console::fhandler_console): Set _tc here.
* fhandler_termios.cc (handler_termios::ioctl): Rename. Take a void *
arg like other ioctl functions.
* fhandler_tty.cc (fhandler_pty_slave::dup): Call myself->set_ctty to
potentially reset the controlling terminal.
(fhandler_pty_slave::ioctl): Reflect name/arg change for ioctl_termios.
(fhandler_pty_slave::fhandler_pty_slave): Take a "unit" argument. Call
setup() here so that we will know the unit number of this fhandler as
soon as possible. Set the unit as appropriate.
(handler_pty_master::open): Move most stuff to constructor and
open_setup.
(handler_pty_slave::open_setup): Reflect argument change in
pinfo::set_ctty.
(handler_pty_master::open_setup): Define new function.
(fhandler_pty_master::cleanup): Clear handles as a flag that the
destructor does not have to do "close" operations.
(fhandler_pty_master::close): Ditto.
(fhandler_pty_master::~fhandler_pty_master): Define new method.
(fhandler_pty_master::ioctl): Reflect name/arg change for
ioctl_termios.
(fhandler_pty_master::setup): Allocate tty here. Rely on handles being
returned from allocated test rather than opening them here. Avoid
setting _need_nl here since it is already zeroed in the constructor.
Set up device information with DEV_TTYM_MAJOR.
* path.h (path_conv &operator =): Take a const argument.
(path_conv::dup): Ditto.
(pathconv_arg::PC_OPEN): New enum.
(pathconv_arg::PC_CTTY): Ditto.
(path_types::PATH_CTTY): Ditto.
(path_types::PATH_OPEN): Ditto.
(path_conv::isopen): New method.
(path_conv::isctty_capable): Ditto.
* path.cc (path_conv::check): Set PATH_OPEN and PATH_CTTY as
appropriate.
* pipe.cc (fhandler_pipe::open): Use copyto to copy pipe handle.
* syscall.cc (open): Reinstate fd > 2 check to disallow resetting ctty
on non-std* handles.
* tty.cc (tty_list::allocate): Pass out handles for allocated tty. use
`not_allocated' to find unallocated ttys. Avoid keeping the lock since
the allocation of the tty should be sufficient to prevent multiple
access.
(tty::not_allocated): Clarify comment. Rename. Return handles when an
unused tty is found. Simply test for existing tty.
(tty::exists): Rewrite to use `not_allocated'.
* tty.h (NTTYS): Reset down to actual number supported by devices.in.
(tty::not_allocated): Declare new function.
(tty_list::allocate): Pass out read/write tty handles. Zero them when
not found.
* fhandler_proc.cc: Reflect name change from FH_PTYM -> FH_PTMX.
* pinfo.h (pinfo::set_ctty): Reduce/reorder arguments passed in.
* pinfo.cc (pinfo::set_ctty): Ditto. Just use tc() built into the
passed-in fhandler_termios pointer. Return true if ctty is assigned.
* syscalls.cc (open): Call build_fh_pc with PC_OPEN flag. Set PC_CTTY
if appropriate.
(stat_worker): Remove is_dev_tty () stuff.
2011-10-15 Corinna Vinschen <corinna@vinschen.de>
* fhandler_process.cc (dos_drive_mappings::fixup_if_match): Convert
native NT network paths into DOS UNC paths.
2011-10-15 Corinna Vinschen <corinna@vinschen.de>
* sec_auth.cc (get_token_group_sidlist): Add CONSOLE LOGON SID on
systems supporting it. Never add SERVICE SID but keep code in for
future reference. Explain why.
(get_priv_list): Add cygpsid pointer parameter. Point it to the
mandatory integrity SID which matches account and privileges.
(create_token): Fetch mandatory integrity SID from call to
get_priv_list.
(lsaauth): Call get_priv_list with additional NULL pointer. Change
comment accordingly.
* sec_helper.cc (well_known_console_logon_sid): New static SID.
(cygpriv): Change to structure containing extra flag to store info
about required integrity level.
(privilege_luid): Accommodate changes to cygpriv. Return integrity
level in new high_integrity parameter.
(privilege_name): Accommodate changes to cygpriv.
(set_privilege): Drop trailing \n from debug output.
(set_cygwin_privileges): Don't set SE_CREATE_GLOBAL_PRIVILEGE anymore
since it's just not needed, but keep code in for future reference.
Change comment accordingly.
* security.h (well_known_console_logon_sid): Declare.
(privilege_luid): Align declaration to above change.
* wincap.h (wincaps::has_console_logon_sid): New element.
* wincap.cc: Implement above element throughout.
2011-10-13 Corinna Vinschen <corinna@vinschen.de>
* path.cc (find_fast_cwd_pointer): Allow 'push crit-sect-addr' instead
of 'mov edi, crit-sect-addr; push edi' and set rcall accordingly.
2011-10-13 Corinna Vinschen <corinna@vinschen.de>
* path.cc (copy_cwd_str): Move up in file to be accessible from
class fcwd_access_t.
(class fcwd_access_t): New class to consolidate and hide the details
of the various FAST_CWD implementations. Add implementation for
Windows 8 Developer Preview.
(fast_cwd_version): Make static private member of fcwd_access_t.
(fast_cwd_ptr): Change base type to fcwd_access_t.
(find_fast_cwd_pointer): Return fcwd_access_t**.
(find_fast_cwd): Ditto. Rip out all FAST_CWD implementations and use
fcwd_access_t methods instead.
(cwdstuff::override_win32_cwd): Ditto.
2011-10-12 Corinna Vinschen <corinna@vinschen.de>
* fhandler_console.cc (fhandler_console::cursor_set): Disable forcing
y to the current winBottom position. Explain why.
2011-10-11 Christopher Faylor <me.cygwin2011@cgf.cx>
* cygwin.din: Remove some _tc* exports. Add tcgetsid().
* dtable.cc (fh_alloc): Revert ill-advised setting of major/minor. Use
new is_dev_tty to remember that this device was opened as /dev/tty.
* fhandler.cc (fhandler_base::fstat): Remove leftover debugging
statement.
(fhandler_base::tcgetsid): New function.
* fhandler.h ((fhandler_base::tcgetsid): Declare new function.
(fhandler_base::is_dev_tty): Ditto.
(fhandler_termios): Rearrange protected/public.
(fhandler_termios::fhandler_termios): Remember last fhandler_termios
"opened".
(fhandler_termios::~fhandler_termios): Forget last fhandler_termios
opened.
(fhandler_termios::opened_as_dev_tty): Declare new field.
(fhandler_termios::is_dev_tty): Declare new function.
(fhandler_termios::tcgetsid): Ditto.
(fhandler_pty_common::use_archetype): Move here from subclass.
(fhandler_pty_slave::use_archetype): Move up.
(fhandler_pty_master::use_archetype): Ditto.
* fhandler_console.cc (fhandler_console::ioctl): Rename second argument
from `buf' to `arg' for consistency. Call ioctl_termios for common
fhandler_termios ioctl handling.
* fhandler_tty.cc (fhandler_pty_slave::ioctl): Call ioctl_termios for
common fhandler_termios ioctl handling.
(fhandler_pty_master::ioctl): Ditto.
* fhandler_termios.cc (fhandler_termios::tcgetsid): Implement new
function.
(fhandler_termios::ioctl_termios): Ditto. Implements TIOCSCTTY
handling.
* syscalls.cc (stat_worker): Set /dev/tty device info when appropriate.
* termios.cc (tcgetpgrp): Avoid extraneous "isatty" check.
(tcgetsid): Implement new function.
* include/cygwin/version.h: Bump CYGWIN_VERSION_API_MINOR to 253.
* include/sys/termios.h (TIOCSCTTY): Define.
2011-10-11 Christopher Faylor <me.cygwin2011@cgf.cx>
* dtable.cc (fh_alloc): Don't parse /dev/tty if ctty is < 0. Reset
major/minor from the specific tty to those for /dev/tty.
2011-10-10 Christopher Faylor <me.cygwin2011@cgf.cx>
* syscalls.cc (open): Add temporary kludge to avoid assigning the
controlling tty on open unless the open is for stdin/stdout/stderr.
* tty.cc (tty_list::connect): Set ENXIO when can't find a tty.
2011-10-10 Corinna Vinschen <corinna@vinschen.de>
* fhandler.h (fhandler_process::closedir): Declare.
* fhandler_process.cc (fhandler_process::closedir): New function to
avoid a SEGV in fhandler_proc::closedir.
2011-10-10 Christopher Faylor <me.cygwin2011@cgf.cx>
* fhandler_tty.cc (fhandler_pty_slave::open): Clarify debugging output.
(fhandler_pty_slave::open): Change ENOENT to ENXIO when can't open a
tty.
2011-10-07 Corinna Vinschen <corinna@vinschen.de>
Christopher Faylor <me.cygwin2011@cgf.cx>
* fhandler.h (fhandler_console::tc_getpgid): New function.
* spawn.cc (spawn_guts): Add logic to put pure-windows processes "in
the background" when they are started that way.
2011-10-07 Corinna Vinschen <corinna@vinschen.de>
* include/sys/cygwin.h (cygwin_getinfo_types): Define values
additionally as preprocessor symbols.
2011-10-06 Corinna Vinschen <corinna@vinschen.de>
* fhandler_termios.cc (fhandler_termios::tcsetpgrp): Send __SIGSETPGRP
pseudo signal to process group instead of just calling
init_console_handler.
* sigproc.cc (wait_sig): Call init_console_handler here on __SIGSETPGRP
signal.
* sigproc.h (__SIGSETPGRP): Define.
2011-10-06 Christian Franke <franke@computer.org>
* include/cygwin/wait.h: Use new __wait_status_to_int()
macro to access status value in W*() status checks.
Fix status description.
* include/sys/wait.h: Allow `int' and `union wait' as
wait status parameter. Change __wait_status_to_int()
macro and wait () prototypes accordingly. Add inline
functions for C++. Remove extra `;'.
2011-10-05 Corinna Vinschen <corinna@vinschen.de>
* external.cc (create_winenv): Rename from sync_winenv. Take
environment pointer as parameter and return pointer to corresponding
win32 environment block if != NULL. Otherwise just sync as before.
(cygwin_internal): Add CW_CVT_ENV_TO_WINENV case.
* include/cygwin/version.h: Bump API minor number.
* include/sys/cygwin.h (cygwin_getinfo_types): Add CW_CVT_ENV_TO_WINENV.
2011-10-04 Corinna Vinschen <corinna@vinschen.de>
* net.cc (socketpair): Bind first socket to loopback only as well.
2011-09-21 Christopher Faylor <me.cygwin2011@cgf.cx>
* tty.cc (grantpt): Check for valid fd.
(unlockpt): Ditto.
2011-09-02 Corinna Vinschen <corinna@vinschen.de>
* net.cc (cygwin_getsockopt): Drop erroneous double conversion of error
code returned by SOL_SOCKET/SO_ERROR. Fix error handling.
2011-09-01 Corinna Vinschen <corinna@vinschen.de>
* lc_msg.h: Regenerate.
2011-09-01 Corinna Vinschen <corinna@vinschen.de>
* dlfcn.cc (gfpod_helper): Helper function to search DLL using
a given DLL name. Change default search path to allow /usr/bin.
(get_full_path_of_dll): Find DLLs even if the caller used a ".so"
suffix or a "lib" prefix for the DLL.
2011-08-31 Corinna Vinschen <corinna@vinschen.de>
* flock.cc (inode_t::unlock_and_remove_if_unused): Rename from
unlock_and_remove.
2011-08-29 Corinna Vinschen <corinna@vinschen.de>
* flock.cc (LOCK_OBJ_NAME_LEN): Change to accommodate extra lf_ver
field.
(class lockf_t): Add lf_ver field.
(lockf_t::lockf_t): Initialize lf_ver to 0.
(class inode_t): Change i_wait to i_cnt. Change comment to explain
change in usage.
(inode_t:use): Rename from wait. Make private.
(inode_t::unuse): Rename from unwait. Make private.
(inode_t::inuse): Rename from waiting. Make private.
(inode_t::notused): New public method to set use count to 0.
(inode_t::unlock_and_remove): New method to unlock node and to delete
it if it's unused in current process.
(fhandler_base::del_my_locks): Drop global list lock. Drop variable
no_locks_left. Simpify unlocking and removing node by just calling
unlock_and_remove.
(fixup_lockf_after_exec): Call notused method for each node.
(inode_t::get): Call use method. Lock node only if outside of list
lock.
(inode_t::get_all_locks_list): Accommodate additional lf_ver field
when creating lockf_t structure from object name.
(lockf_t::create_lock_obj_attr): Accommodate additional lf_ver field
when creating object name from lockf_t structure. Handle
STATUS_OBJECT_NAME_COLLISION gracefully in F_POSIX case as well.
Change comment accordingly. Increment lf_ver field rather than high
byte of lf_wid field. Simplify comment.
(fhandler_disk_file::lock): Always call unlock_and_remove rather than
just UNLOCK on node.
(lf_setlock): Move ret definition where it's used. Drop unneeded
tests for obj being not NULL. Only check for deadlock condition if the
lock we're trying to establish is a POSIX lock. Revamp object
collecting and wait code to cover all cases. Don't return with EDEADLK
if blocking process can't be opened for synchronization in F_POSIX case,
rather just wait like in F_FLOCK case. Change system_printf to
debug_printf in that case. Only run WaitForMultipleObjects with high
priority. Close obj and process handles prior to locking node.
2011-08-27 Corinna Vinschen <corinna@vinschen.de>
* fhandler.cc (fhandler_base::open): Fix typo in comment.
(fhandler_base::close): Move call to del_my_locks from here...
* fhandler_disk_file.cc (fhandler_disk_file::open): ...to here.
* flock.cc (struct lockfattr_t): New type.
(lockf_t::close_lock_obj): New method, use throughout.
(lockf_t::create_lock_obj_attr): New method.
(lockf_t::create_lock_obj): Use create_lock_obj_attr method. Handle
STATUS_OBJECT_NAME_COLLISION in F_FLOCK case gracefully. Add lengthy
comments to explain why and how.
(lockf_t::open_lock_obj): Use create_lock_obj_attr method.
(lockf_t::del_lock_obj): Call NtSetEvent rather than SetEvent for
symmetry.
(fhandler_disk_file::lock): Define n only where it's used. Call
need_fork_fixup only if call was successful. Handle EINTR and
ECANCELED return values from lf_setlock.
(lf_setlock): Drop WAIT_UNLOCKED and WAIT_PROC_EXITED. Don't wait
for event object handle count to become <= 1 in F_LOCK case.
Simplify WFMO return value handling. Don't handle signal and cancel
events here; just return with appropriate error code instead.
(lf_getblock): Ignore locks for which the handle can't be opened.
Use IsEventSignalled.
* ntdll.h (STATUS_INVALID_INFO_CLASS): Undef if defined elsewhere to
make sure the definition is casted to NTSTATUS.
(STATUS_INVALID_HANDLE): Define and ditto.
(STATUS_OBJECT_NAME_COLLISION): Define.
(NtSetEvent): Declare.
2011-08-25 Rafal Zwierz <rzwierz@googlemail.com>
* cygthread.cc (cygthread::simplestub): Notify that the thread has
detached also in freerange thread case.
2011-08-25 Corinna Vinschen <corinna@vinschen.de>
* fhandler.cc (fhandler_base::open): Never open files with
FILE_OVERWITE/FILE_OVERWRITE_IF. Set file size to 0 explicitely if
regular, existing file has been opened for writing with O_TRUNC flag
set. Explain why.
2011-08-24 Corinna Vinschen <corinna@vinschen.de>
* thread.cc (pthread::pthread): Drop setting parent_tls. Call
sigprocmask to copy parent thread signal mask into new parent_sigmask
member.
(pthread::thread_init_wrapper): Copy _my_tls.sigmask from new
parent_sigmask member.
* thread.h (class pthread): Drop parent_tls. Add parent_sigmask.
2011-08-24 Christopher Faylor <me.cygwin2011@cgf.cx>
* thread.cc (pthread::exit): Create dummy tls structure to hold
_main_tls contents if we've asked _main_tls to exit.
2011-08-23 Corinna Vinschen <corinna@vinschen.de>
* poll.cc (poll): Don't return prematurely if invalid fds have been
encountered. Enforce timeout set to 0 in case of invalid fds. Take
number of invalid fds into account when returning.
2011-08-23 Corinna Vinschen <corinna@vinschen.de>
* fhandler_socket.cc (fhandler_socket::send_internal): Fix setting
nosignal flag. Convert ECONNABORTED on connection-oriented socket
to EPIPE, too.
2011-08-21 Christopher Faylor <me.cygwin2011@cgf.cx>
* dtable.cc (conv_start_chars): Remove unneeded section attribute.
2011-08-20 Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
* include/paths.h (_PATH_MAILDIR): Define.
(_PATH_SHELLS): Define.
2011-08-20 Corinna Vinschen <corinna@vinschen.de>
* fhandler_process.cc (format_process_maps): Define page protection
shortcuts RO, X, and WC. Use in creating access flag string. Don't
set type flag to 's' for copy-on-write pages, as on Linux.
2011-08-19 Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
* devices.h (fh_devices): Define DEV_MISC_MAJOR, DEV_MEM_MAJOR,
DEV_SOUND_MAJOR. Use throughout.
* fhandler_proc.cc (proc_tab): Add /proc/devices and /proc/misc
virtual files.
(format_proc_devices): New function.
(format_proc_misc): New function.
2011-08-19 Christopher Faylor <me.cygwin2011@cgf.cx>
* dtable.cc: Mark some const variables as static.
* environ.cc (conv_start_chars): Move to shared cygwin region and
initialize at compile time.
(match_first_char): New generic function for querying conv_start_chars.
(posify_maybe): Rename from posify.
(environ_init): Remove conv_envvars initialization. Don't check
conv_start_chars, just allow posify_maybe to make the decision.
* fhandler_console.cc (__vt100_conv): Fix formatting. Mark as const.
2011-08-19 Corinna Vinschen <corinna@vinschen.de>
* fhandler_console.cc (fhandler_console::read): Recognize backspace key
using the device independent key code, rather than the device dependent
scan code.
2011-08-18 Christopher Faylor <me.cygwin2011@cgf.cx>
* dcrt0.cc (dll_crt0_0): Remove unneeded __stdcall decoration.
* init.cc: Reflect change to dll_crt0_0 in declaration.
2011-08-18 Corinna Vinschen <corinna@vinschen.de>
* dtable.cc (dtable::get_debugger_info): Add missing braces.
(dtable::stdio_init): Fix incorrect negation of not_open(2) condition.
2011-08-16 Pierre Humblet <Pierre.Humblet@ieee.org>
* net.cc (gethostby_helper): Remove DEBUGGING code from and
streamline the second pass.
2011-08-16 Corinna Vinschen <corinna@vinschen.de>
* dlfcn.cc (dlopen): Reimplement RTLD_NODELETE for Windows 2000 using
internal datastructures. Explain the code.
* ntdll.h (struct _LDR_DATA_TABLE_ENTRY): Define.
(struct _PEB_LDR_DATA): Define.
(struct _PEB): Change PVOID LoaderData to PPEB_LDR_DATA Ldr.
* fhandler_process.cc (format_process_maps): Call NtQueryVirtualMemory
with valid return length pointer. Explain why.
2011-08-16 Corinna Vinschen <corinna@vinschen.de>
* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
2011-08-16 Corinna Vinschen <corinna@vinschen.de>
* autoload.cc (GetModuleHandleExW): Define.
* dlfcn.cc: Throughout mark exported symbols as extern "C".
(dlopen): Unignore flags argument. Define ret to NULL. Fix typo in
comment. Support Glibc flags RTLD_NOLOAD and RTLD_NODELETE.
* include/dlfcn.h: Clean up comments.
(RTLD_NODELETE): Define.
(RTLD_NOLOAD): Define.
(RTLD_DEEPBIND): Define.
2011-08-15 Corinna Vinschen <corinna@vinschen.de>
* pipe.cc (pipe): Just call _pipe with O_BINARY mode. Move code to
generate normalized pathnames from here...
(_pipe): ...to here.
2011-08-13 Corinna Vinschen <corinna@vinschen.de>
* miscfuncs.cc (CreatePipeOverlapped): New function.
(ReadPipeOverlapped): Ditto.
(WritePipeOverlapped): Ditto.
* miscfuncs.h: Declare new functions.
* pinfo.cc (commune_process): Call WritePipeOverlapped instead of
WriteFile. Set timeout to 1 sec.
(_pinfo::commune_request): Call ReadPipeOverlapped instead of ReadFile.
Set timeout to 0.5 secs.
* sigproc.cc (sig_send): Create pipe using CreatePipeOverlapped.
2011-08-12 Christopher Faylor <me.cygwin2011@cgf.cx>
* miscfuncs.cc (create_pipe): Delete obsolete function.
* miscfuncs.h (create_pipe): Delete define.
* pipe.c (fhandler_pipe::create_selectable): Delete obsolete comment.
2011-08-12 Corinna Vinschen <corinna@vinschen.de>
* fhandler_proc.cc (fhandler_proc::closedir): Don't free, but delete
instead.
2011-08-12 Corinna Vinschen <corinna@vinschen.de>
* fhandler.h (fhandler_proc::opendir): Declare.
(fhandler_proc::closedir): Declare.
* fhandler_proc.cc (fhandler_proc::opendir): New method. Fetch list
of active processes here once to avoid potential duplicates and store
in dir->__handle.
(fhandler_proc::closedir): New method. Free dir->__handle.
(fhandler_proc::readdir): Convert pinfo into a reference to the winpids
entry in dir->__handle.
2011-08-11 Corinna Vinschen <corinna@vinschen.de>
* fhandler_proc.cc (fhandler_proc::get_proc_fhandler): Don't allow to
access process info by using the Windows PID.
* fhandler_process.cc (fhandler_process::fstat): Ditto.
(fhandler_process::fill_filebuf): Ditto.
2011-08-11 Corinna Vinschen <corinna@vinschen.de>
* (winpids::add): Make sure to store always a Windows PID in
pidlist, even if pid is a Cygwin PID.
(winpids::enum_processes): Fetch Cygwin processes from listing of
shared cygwin object dir in the native NT namespace. Only if winpid
is true, fetch Windows processes using an additional call to
NtQuerySystemInformation.
2011-08-10 Corinna Vinschen <corinna@vinschen.de>
* fhandler_process.cc (format_process_status): Always print process name
even for zombies.
(get_mem_values): Fix loop fetching working set list to avoid out of
memory conditions. Return all mem values set to 0 for zombies.
* ntdll.h (STATUS_PROCESS_IS_TERMINATING): Define.
2011-08-09 Corinna Vinschen <corinna@vinschen.de>
* heap.cc (eval_initial_heap_size): New function fetching the heap
size from the LoaderFlags field in the PE/COFF header.
(heap_init): Call eval_initial_heap_size rather than
cygwin_shared->heap_chunk_size to fetch the initial heap size.
* shared.cc (shared_info::heap_chunk_size): Remove.
* shared_info.h (class shared_info): Drop heap_chunk member.
(CURR_SHARED_MAGIC): Update.
2011-08-09 Corinna Vinschen <corinna@vinschen.de>
* ntdll.h (STATUS_NOT_FOUND): Define.
* ntea.cc (read_ea): Return correct ENOTSUP rather than EOPNOTSUPP.
Handle STATUS_INVALID_DEVICE_REQUEST and STATUS_NOT_FOUND. Explain
why. Convert conditional to switch statement.
(write_ea): Return correct ENOTSUP rather than EOPNOTSUPP. Handle
STATUS_INVALID_DEVICE_REQUEST. Convert conditional to switch statement.
2011-08-07 Corinna Vinschen <corinna@vinschen.de>
* resource.cc (getrlimit): Just return RLIM_INFINITY in a request for
RLIMIT_AS.
2011-08-07 Corinna Vinschen <corinna@vinschen.de>
* fhandler_process.cc (format_process_maps): Actually print info about
the application heap of the printed process, not of the current process.
2011-08-04 Corinna Vinschen <corinna@vinschen.de>
* net.cc (socketpair): Release sb0 if there's no space left for sb1.
2011-08-03 Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
* cygwin.din (clock_nanosleep): Export.
* posix.sgml (std-notimpl): Move clock_nanosleep from here...
(std-susv4): ... to here.
(std-notes): Note limitations of clock_nanosleep.
* signal.cc (clock_nanosleep): Renamed from nanosleep, adding clock_id
and flags arguments and changing return values throughout.
Improve checks for illegal rqtp values. Add support for
CLOCK_MONOTONIC and TIMER_ABSTIME.
(nanosleep): Rewrite in terms of clock_nanosleep.
(sleep): Ditto.
(usleep): Ditto.
* thread.cc: Mark clock_nanosleep in list of cancellation points.
* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
2011-08-03 Christopher Faylor <me.cygwin2011@cgf.cx>
* dll_init.cc: Use fabort in favor of api_fatal and fork_info->abort
where appropriate throughout.
(fabort): Define.
(dll_list::topsort): Don't print sorting information. Fix formatting.
(dll_list::topsort_visit): Fix formatting.
(dll_list::load_after_fork_impl): Perform comment fixups.
* sigproc.cc (child_info_fork::abort): (for now?) Always print cause of
fork failure.
* include/sys/strace.h (strace_vprintf): Remove _STRACE_NOTALL when
printing. We really do want to see this.
2011-08-03 Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
* cygtls.h (struct _local_storage): Add cw_timer member.
* cygtls.cc (_cygtls::init_thread): Initialize locals.cw_timer.
(_cygtls::fixup_after_fork): Ditto.
* tlsoffsets.h: Regenerate.
* ntdll.h (enum _TIMER_INFORMATION_CLASS): Define.
(struct _TIMER_BASIC_INFORMATION): Define.
(NtQueryTimer): Declare function.
* thread.h (cancelable_wait): Change timeout argument to
PLARGE_INTEGER and provide NULL default.
(fast_mutex::lock): Adjust accordingly.
(pthread_cond::wait): Change timeout argument to PLARGE_INTEGER
and default to NULL.
* thread.cc (cancelable_wait): Change timeout argument to
PLARGE_INTEGER. Initialize _cygtls.locals.cw_timer if needed.
Use NT waitable timers for handling timeout. Return remaining time
to timeout argument if timeout was relative.
(pthread_cond::wait): Change timeout argument to PLARGE_INTEGER.
Adjust to change in cancelable_wait.
(pthread_mutex::lock): Adjust to change in cancelable_wait.
(pthread_spinlock::lock): Ditto.
(pthread::join): Ditto.
(__pthread_cond_dowait): Change waitlength argument to PLARGE_INTEGER.
Adjust to changes in cancelable_wait and pthread_cond::wait.
(pthread_cond_timedwait): Adjust to change in __pthread_cond_dowait.
(pthread_cond_wait): Ditto.
(semaphore::_timedwait): Adjust to change in cancelable_wait.
(semaphore::_wait): Ditto.
* exceptions.cc (handle_sigsuspend): Ditto.
* signal.cc (nanosleep): Ditto.
* wait.cc (wait4): Ditto. Fix copyright dates.
* times.cc (FACTOR, NSPERSEC): Move from here...
* hires.h (FACTOR, NSPERSEC): ...to here.
2011-08-01 Corinna Vinschen <corinna@vinschen.de>
* syscalls.cc (faccessat): Fix parens in flag expression when calling
build_fh_name.
* fhandler_disk_file.cc (fhandler_disk_file::mkdir): Fix typo in
comment.
* fhandler_socket.cc (fhandler_socket::bind): Ditto.
* path.cc (symlink_worker): Ditto.
2011-07-31 Christopher Faylor <me.cygwin2011@cgf.cx>
* dll_init.cc (dll_list::load_after_fork_impl): Add a hint to an error
message.
2011-07-31 Christopher Faylor <me.cygwin2011@cgf.cx>
* sigproc.cc (pending_signals::pending): Define new function.
(sig_dispatch_pending): Avoid calling sig_send if there are no pending
signals.
2011-07-31 Corinna Vinschen <corinna@vinschen.de>
* fhandler.h (class fhandler_dev_mem): Remove dup method declaration.
* fhandler_clipboard.cc (fhandler_dev_clipboard::dup): Accommodate the
fact that the entire fhandler gets copied over to the child in
operator =.
* fhandler_floppy.cc (fhandler_dev_floppy::dup): Ditto.
* fhandler_raw.cc (fhandler_dev_raw::dup): Ditto.
* fhandler_serial.cc (fhandler_serial::dup): Ditto.
* fhandler_socket.cc (fhandler_socket::dup): Ditto.
* fhandler_virtual.cc (fhandler_virtual::dup): Ditto.
* fhandler_mem.cc (fhandler_dev_mem::dup): Ditto. Remove entirely.
2011-07-30 Christopher Faylor <me.cygwin2011@cgf.cx>
* cygthread.cc (cygthread::async_create): Define new function.
* cygthread.h (cygthread::create): Use correct regparm.
(cygthread::standalone): Delete from class and from all constructors.
(cygthread::cygthread): Use three only arguments for detached threads,
(cygthread::async_create): Declare.
and start the thread via QueueUserAPC/async_create.
* dcrt0.cc (dll_crt0_0): Remove handling for
wincap.has_buggy_thread_startup.
(dll_crt0_1): Ditto.
* wincap.cc: Ditto throughout.
* wincap.h: Ditto.
2011-07-30 Christopher Faylor <me.cygwin2011@cgf.cx>
* fhandler.h (fhandler_base_overlapped::size): Declare/define size()
function for consistency.
(fhandler_termios::size): Ditto.
(fhandler_pty_common::size): Ditto.
2011-07-30 Corinna Vinschen <corinna@vinschen.de>
* fhandler_registry.cc (fhandler_registry::dup): Duplicate value_name.
2011-07-29 Corinna Vinschen <corinna@vinschen.de>
Throughout change "WinSock" to "Winsock" in comments.
* fhandler_socket.cc (fhandler_socket::sendmsg): Add missing call to
get_inet_addr to convert AF_LOCAL to AF_INET sockets.
* net.cc (cygwin_socket): Workaround UDP Winsock problem. Add comment
to explain why.
* select.cc: Include winsock2.h rather than winsock.h.
2011-07-26 Corinna Vinschen <corinna@vinschen.de>
* fhandler_disk_file.cc (__DIR_mounts::eval_ino): Create path_conv
with PC_KEEP_HANDLE flag.
* path.h (path_conv::operator =): Duplicate UNICODE path as well.
* security.cc (check_file_access): Use path_conv handle if available.
* syscalls.cc (access): Create fhandler with PC_KEEP_HANDLE flag set.
(euidaccess): Ditto.
(faccessat): Ditto.
2011-07-26 Corinna Vinschen <corinna@vinschen.de>
* ntdll.h: Fix typo in comment.
* path.cc: Ditto.
2011-07-25 Corinna Vinschen <corinna@vinschen.de>
* fhandler_console.cc (fhandler_console::ioctl): Fetch console events
using PeekConsoleInput and return only key down events in buf.
* fhandler_tty.cc (fhandler_pty_slave::ioctl): Always return EINVAL
if PeekNamedPipe fails.
(fhandler_pty_master::ioctl): Ditto.
2011-07-22 Corinna Vinschen <corinna@vinschen.de>
* fhandler_tty.cc (fhandler_pty_slave::ioctl): Drop FIONBIO case.
Handle FIONREAD.
(fhandler_pty_master::ioctl): Ditto. Call fhandler_base::ioctl to
decode default condition.
* fhandler_console.cc (fhandler_console::ioctl): Handle FIONREAD.
2011-07-21 Christopher Faylor <me.cygwin2011@cgf.cx>
Corinna Vinschen <corinna@vinschen.de>
* fhandler.cc: Add #include for asm/socket.h for dealing with FIONREAD.
(fhandler_base::ioctl): Special-case errno for FIONREAD.
* fhandler_dsp.cc (fhandler_dev_dsp::ioctl): Rename parameter for
consistency. Call fhandler_base::ioctl to decode default condition.
* fhandler_serial.cc (fhandler_serial::ioctl): Ditto.
* fhandler_tty.cc (fhandler_pty_slave::ioctl): Call
fhandler_base::ioctl to decode default condition.
* fhandler_windows.cc (fhandler_windows::ioctl): Ditto.
2011-07-21 Corinna Vinschen <corinna@vinschen.de>
* heap.cc (eval_start_address): Simplify test for large address
awareness of executable, which works for 32 and 64 bit systems.
Change comment accordingly.
2011-07-21 Corinna Vinschen <corinna@vinschen.de>
* heap.cc (eval_start_address): New static function to evaluate the
best start address for the application heap.
(heap_init): Call eval_start_address to fetch the start value for
start_address. Move preceeding comment to eval_start_address.
2011-07-21 Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
* cygwin.din (pthread_condattr_getclock): Export.
(pthread_condattr_setclock): Export.
* posix.sgml (std-notimpl): Move pthread_condattr_getclock and
pthread_condattr_setclock from here...
(std-susv4): ... to here.
* sysconf.cc (sca): Set _SC_CLOCK_SELECTION to _POSIX_CLOCK_SELECTION.
* thread.cc: (pthread_condattr::pthread_condattr): Initialize clock_id.
(pthread_cond::pthread_cond): Initialize clock_id.
(pthread_cond_timedwait): Use clock_gettime() instead of gettimeofday()
in order to support all allowed clocks.
(pthread_condattr_getclock): New function.
(pthread_condattr_setclock): New function.
* thread.h (class pthread_condattr): Add clock_id member.
(class pthread_cond): Ditto.
* include/pthread.h: Remove obsolete comment.
(pthread_condattr_getclock): Declare.
(pthread_condattr_setclock): Declare.
* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
2011-07-18 Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
* sysconf.cc (sca): Return -1 for _SC_THREAD_ROBUST_PRIO_INHERIT,
_SC_THREAD_ROBUST_PRIO_PROTECT, and _SC_XOPEN_UUCP.
(SC_MAX): Redefine accordingly.
(csa): Return strings for _CS_POSIX_V7_THREADS_CFLAGS,
_CS_POSIX_V7_THREADS_LDFLAGS, and _CS_V7_ENV.
(CS_MAX): Redefine accordingly.
* include/limits.h (LONG_BIT): Define.
(WORD_BIT): Define.
2011-07-18 Corinna Vinschen <corinna@vinschen.de>
* heap.cc (heap_init): Change type of largest_found to PVOID. Start
querying memory at 0x20000000. Use largest_found pointer when trying
to allocate largest free memory area found.
2011-07-14 Corinna Vinschen <corinna@vinschen.de>
* fhandler_console.cc (fhandler_console::input_tcsetattr): Revert to
setting ENABLE_PROCESSED_INPUT depending on ISIG and IGNBRK.
(fhandler_console::tcgetattr): Set ISIG depending on
ENABLE_PROCESSED_INPUT as well.
2011-07-13 Corinna Vinschen <corinna@vinschen.de>
* fhandler_serial.cc (fhandler_serial::raw_read): Handle non-blocking
case more thoroughly.
2011-07-13 Christopher Faylor <me.cygwin2011@cgf.cx>
* setup_handler (setup_handler): Change break to goto out, missed in
2011-07-06 changes.
2011-07-10 Christopher Faylor <me.cygwin2011@cgf.cx>
* fhandler_tty.cc (fhandler_pty_slave::ioctl): Remove erroneous support
for TIOCLINUX for pty. Get rid of unneeded EINVAL handling in wake of
tty removal. Remove now-unneeded variable.
2011-07-10 Corinna Vinschen <corinna@vinschen.de>
* include/netdb.h (gethostbyname2): Declare.
2011-07-09 Eric Blake <eblake@redhat.com>
* signal.cc (handle_sigprocmask): Return error rather than setting
errno, for pthread_sigmask.
(sigprocmask): Adjust caller.
2011-07-07 Corinna Vinschen <corinna@vinschen.de>
* miscfuncs.cc (yield): Drop thread priority only once.
2011-07-06 Christopher Faylor <me.cygwin2011@cgf.cx>
* exceptions.cc (_cygtls::interrupt_now): Back out previous change
since it could theoretically cause a non-CTRL-C-able program if a
program has suffered memory corruption.
(setup_handler): Ditto.
2011-07-06 Corinna Vinschen <corinna@vinschen.de>
* sched.c (sched_yield): Just call SwitchToThread because yield now
potentially switches CPU.
2011-07-06 Christopher Faylor <me.cygwin2011@cgf.cx>
* exceptions.cc (_cygtls::interrupt_now): Don't check for spinning
here.
(setup_handler): Check for spinning here, assuming that it is
transitory and should not affect the retry loop.
2011-07-06 Christopher Faylor <me.cygwin2011@cgf.cx>
* exceptions.cc (CALL_HANDLER_RETRY_INNER): Rename to reflect different
functionality.
(CALL_HANDLER_RETRY_OUTER): New define.
(setup_handler): Add outer loop to signal handler to try harder to
deliver the signal.
* miscfuncs.cc (yield): Drop priority and use SleepEx() to force thread
rescheduling rather than relying on SwitchToThread().
2011-07-06 Corinna Vinschen <corinna@vinschen.de>
* sigproc.cc (wait_sig): Fix debug output.
2011-07-05 Corinna Vinschen <corinna@vinschen.de>
* fhandler_console.cc (fhandler_console::input_tcsetattr): Make
ENABLE_PROCESSED_INPUT flag only depending on value of IGNBRK.
(fhandler_console::tcgetattr): Don't set ISIG depending on
ENABLE_PROCESSED_INPUT, set IGNBRK instead.
2011-07-05 Corinna Vinschen <corinna@vinschen.de>
* security.cc (get_file_sd): Fix comment.
2011-07-05 Corinna Vinschen <corinna@vinschen.de>
* fhandler.cc (fhandler_base::open): Never create files with WRITE_DAC
access. Explain why.
* fhandler_disk_file.cc (fhandler_base::fstat_helper): Improve debug
output.
2011-07-05 Corinna Vinschen <corinna@vinschen.de>
* fhandler.cc (fhandler_base::open): Don't open file with WRITE_DAC
access on remote filesystem. Explain why.
* fhandler_disk_file.cc (fhandler_disk_file::mkdir): Ditto for
directories.
* fhandler_socket.cc (fhandler_socket::bind): Ditto for sockets.
* path.cc (symlink_worker): Ditto for symlinks.
2011-07-04 Christopher Faylor <me.cygwin2011@cgf.cx>
* environ.cc (tty_is_gone): Wrap warning at 80 characters.
2011-07-04 Corinna Vinschen <corinna@vinschen.de>
Throughout, open console handles with sharing for reading and writing.
* dcrt0.cc (insert_file): Open file with full sharing allowed.
* hookapi.cc (find_first_notloaded_dll): Ditto.
* spawn.cc (av::fixup): Ditto.
2011-07-04 Corinna Vinschen <corinna@vinschen.de>
* dtable.cc (dtable::init_std_file_from_handle): Change test for console
device in call to fh->init to avoid conhost crash on W7.
2011-07-04 Corinna Vinschen <corinna@vinschen.de>
* environ.cc (environ_init): Reinstantiate on-the-fly CYGWIN variable
test and call to parse_options if found.
2011-07-04 Christopher Faylor <me.cygwin2011@cgf.cx>
* fhandler.cc (fhandler_base::open_with_arch): Call close_on_exec last
to avoid setting close_on_exec for archetype.
* fhandler_tty.cc (fhandler_pty_master::setup): Protect {from,to}_pty
handles. Use consistent naming in debug output. Use inheritable
handles and...
(fhandler_pty_master::fixup_after_fork): ...avoid duplicating handles
here.
(fhandler_pty_slave::open): Don't set close_on_exec flag here.
2011-07-01 Christopher Faylor <me.cygwin2011@cgf.cx>
* dtable.cc (cnew): Fix whitespace.
2011-07-01 Corinna Vinschen <corinna@vinschen.de>
* include/sys/param.h (NGROUPS): Redefine as NGROUPS_MAX.
(MAXHOSTNAMELEN): Redefine with same value as MAX_HOSTNAME_LEN. Change
comment.
(MAXPATHLEN): Improve comment.
(MAXSYMLINKS): Define and add comment.
2011-07-01 Corinna Vinschen <corinna@vinschen.de>
* fhandler.cc (fhandler_base::open): Move NFS-specific code into the
code block handling FH_FS stuff.
2011-06-30 Ryan Johnson <ryan.johnson@cs.utoronto.ca>
* dtable.cc (fh_oom): Remove.
(fh_calloc): Remove.
(cnew): Redefine to handle NULL returns from cmalloc.
(build_fh_name): Accommodate new definition of cnew. Remove unneeded
test for fh_oom.
(fh_alloc): Ditto.
2011-06-30 Corinna Vinschen <corinna@vinschen.de>
* fhandler_console.cc (fhandler_console::read): Add comment.
(fhandler_console::input_tcsetattr): Don't set ENABLE_PROCESSED_INPUT
if IGNBRK flag is set.
2011-06-30 Corinna Vinschen <corinna@vinschen.de>
* dtable.cc (fh_oom): New static fhandler storage.
(fh_calloc): New static function. Add a comment to explain why this
is needed.
(cnew): Call fh_calloc as placement argument.
(build_fh_name): Check return code from cnew against address of
fh_oom to test for out of memory condition.
(fh_alloc): Ditto.
(build_fh_pc): Avoid a crash due to useing a NULL fhandler.
* pipe.cc (fhandler_pipe::create): Check if build_fh_dev returned a
valid pointer before using it.
2011-06-28 Corinna Vinschen <corinna@vinschen.de>
* fhandler_process.cc (heap_info::fill_if_match): Rename info to
note that this heap is a Windows heap.
(format_process_maps): Print info about application heap.
2011-06-24 Corinna Vinschen <corinna@vinschen.de>
* fhandler_console.cc (fhandler_console::read): Don't generate ^@ on
Ctrl+Alt+Space.
2011-06-22 Corinna Vinschen <corinna@vinschen.de>
* fhandler_tty.cc (fhandler_pty_master::setup): Create pty pipes
non-inheritable.
2011-06-22 Corinna Vinschen <corinna@vinschen.de>
* fhandler_tty.cc (fhandler_pty_master::setup): Fix crash in debug
output.
2011-06-18 Corinna Vinschen <corinna@vinschen.de>
* path.cc (normalize_win32_path): Skip all slashes after recognizing
a ".." path component. Add comment.
2011-06-17 Corinna Vinschen <corinna@vinschen.de>
* fhandler.cc (fhandler_base::open): Drop local create_options variable.
Use options member instead.
* fhandler.h (class fhandler_base): Change type of access member to
ACCESS_MASK. Change get_access and set_access methods accordingly.
Add options member. Add get_options and set_options methods.
(class fhandler_disk_file): Add prw_handle.
(fhandler_disk_file::prw_open): Declare.
(fhandler_disk_file::close): Declare.
(fhandler_disk_file::dup): Declare.
(fhandler_disk_file::fixup_after_fork): Declare.
* fhandler_disk_file.cc (fhandler_disk_file::fhandler_disk_file):
Initialize prw_handle to NULL.
(fhandler_disk_file::close): Close prw_handle.
(fhandler_disk_file::dup): New method.
(fhandler_disk_file::fixup_after_fork): Set prw_handle to NULL since
prw_handle is not inherited.
(fhandler_disk_file::prw_open): New method. Add long comment to
explain current behaviour.
(fhandler_disk_file::pread): Revert previous change. Change to use
prw_handle if possible.
(fhandler_disk_file::pwrite): Change to use prw_handle if possible.
2011-06-17 Corinna Vinschen <corinna@vinschen.de>
* dcrt0.cc (dll_crt0_1): Call strace.dll_info after call to pinfo_init.
* strace.cc (strace::hello): Drop printing DLL information here since
application info is not always available at this point.
(strace::dll_info): New method to print DLL info.
* include/sys/strace.h (strace::dll_info): Declare.
2011-06-17 Corinna Vinschen <corinna@vinschen.de>
* dtable.cc (handle_to_fn): Accommodate name change of pty named pipes,
otherwise ptys are not recognized.
2011-06-16 Christopher Faylor <me.cygwin2011@cgf.cx>
* fhandler_console.cc (fhandler_console::set_unit): Set
pc.file_attributes() to reflect existence.
* fhandler.h (fhandler_pty_common::fhandler_pty_common): Ditto.
* pinfo.cc (_pinfo::set_ctty): Output device numbers in hex.
2011-06-15 Christopher Faylor <me.cygwin2011@cgf.cx>
* errno.cc (EIO): Lowercase "o" representative string.
2011-06-14 Christopher Faylor <me.cygwin2011@cgf.cx>
* cygheap.h (init_cygheap::ctty_on_hold): Remove conditionalized
variable.
* dcrt0.cc (do_exit): Remove code which handled CYGWIN=tty style ttys.
* devices.in: Remove "/dev/ttym".
* dtable.cc: Rename tty to pty where appropriate throughout.
(dtable::stdio_init): Use new t->is_console rather than using
now-deleted hwnd element in tty structure.
(dtable::init_std_file_from_handle): Remove code which handled
CYGWIN=tty style ttys.
(fh_alloc): Ditto.
* fhandler.h: Rename tty to pty where appropriate.
(fhandler_pty_common): Delete output_done_event, ioctl_request_event,
ioctl_done_event.
(fhandler_pty_master::setup): Delete argument.
(fhandler_tty_master): Delete.
(fhandler_union): Delete __tty_master.
* fhandler_console.cc (use_tty): Delete.
(fhandler_console::get_tty_stuff): Set is_console to true rather than
calling sethwnd.
(fhandler_console::send_winch_maybe): Remove CYGWIN=tty considerations.
(fhandler_console::input_tcsetattr): Ditto.
* fhandler_termios.cc (fhandler_termios::tcsetpgrp): Use new
t->is_console rather than using now-deleted hwnd element in tty
structure.
* fhandler_tty.cc: Rename tty to pty where appropriate throughout.
(tty_master): Delete.
(process_input): Ditto.
(process_output): Ditto.
(process_ioctl): Ditto.
(fhandler_tty_master::*): Ditto.
(fhandler_pty_master::process_slave_output): Remove CYGWIN=tty
considerations.
(fhandler_pty_slave::open): Ditto for *_done_event.
(fhandler_pty_slave::write): Ditto.
(fhandler_pty_slave::ioctl): Ditto.
(fhandler_pty_slave::fch_open_handles): Ditto.
(fhandler_pty_slave::fch_set_sd): Ditto.
(fhandler_pty_slave::fch_close_handles): Ditto.
(fhandler_pty_common::close): Ditto.
(fhandler_pty_master::setup): Ditto. Remove now-unneeded ispty
parameter.
(fhandler_pty_master::open): Reflect argument removal for
tty::allocate.
* select.cc: Rename tty to pty where appropriate throughout.
* sigproc.cc (proc_subproc): Remove CYGWIN=tty considerations.
* tty.cc (ttyslot): Accommodate CYGWIN=tty removal.
(tty_list::init_session): Ditto.
(tty_list::attach): Ditto.
(tty::create_master): Delete.
(tty_list::terminate): Ditto.
(tty_list::allocate): Delete "with_console" parameter. Remove
CYGWIN=tty considerations.
(tty::init): Set is_console = false. Use 'false' for was_opened since
it is a boolean.
* tty.h (*_{DONE,REQUEST}_EVENT): Delete.
(tty_min::is_console): Declare new field which replaces hwnd.
(tty_min::gethwnd): Delete.
(tty_min::sethwnd): Ditto.
(tty_list::allocate): Delete parameter.
(tty_list::terminate): Delete declaration.
* include/sys/cygwin.h (PID_USETTY): Redefine to PID_UNUSED1 and change
comment to reflect its availability.
2011-06-13 Christopher Faylor <me.cygwin2011@cgf.cx>
* fhandler_tty_slave.cc (fhandler_tty_slave::fhandler_tty_slave):
Revert previous change since unit 0 is perfectly valid.
2011-06-12 Christopher Faylor <me.cygwin2011@cgf.cx>
Rename FH_BAD to FH_NADA throughout.
* devices.h (FH_ERROR): New value.
(iscons_dev): Extend to detect all the console device types.
* devices.in: Set aside storage for FH_ERROR.
* dtable.cc (dtable::init_std_file_from_handle): Use iscons_dev to
detect when device is a console.
(fh_alloc): Pass device to console constructor.
(build_fh_pc): Short circuit when we detect that the constructor saw an
error.
* fhandler.h (fhandler_console::fhandler_console): Accept fh_devices
parameter.
(get_tty_stuff): Change to void.
* fhandler_console (fhandler_console::set_unit): Set device to FH_ERROR
on attempt to access anything other than the current console.
(fhandler_console::get_tty_stuff): Change to void return.
(fhandler_console::open): Return EPERM on FH_ERROR device type.
(fhandler_console::fhandler_console): Set the device type appropriately
before calling get_tty_stuff and rely on that function to reset it if
necessary.
2011-06-10 Christopher Faylor <me.cygwin2011@cgf.cx>
* environ.cc (create_upcaseenv): Delete.
(ucenv): Don't honor create_upcaseenv.
(environ_init): Remove early retrieval of CYGWIN environment variable.
Change comment to reflect new behavior.
2011-06-09 Christopher Faylor <me.cygwin2011@cgf.cx>
* child_info.h (CURR_CHILD_INFO_MAGIC): Reset.
(child_info::old_title): Delete.
(child_info::~child_info_spawn): Remove recording of old_title.
* dcrt0.cc (title_buf): Delete.
(child_info_spawn::handle_spawn): Remove recording of old_title.
(dll_crt0_1): Get rid of all title handling.
(do_exit): Ditto.
* environ.cc (known): Delete strip_title and title.
* fhandler_console.cc (fhandler_console::write): Remove recording of
old_title.
* globals.cc (exit_states): Remove ES_TITLE.
(display_title): Delete.
(strip_title_path): Delete.
(old_title): Delete.
* spawn.cc (spawn_guts): Remove old_title accommodation.
2011-06-09 Christopher Faylor <me.cygwin2011@cgf.cx>
* environ.cc (envcache): Delete.
(known): Remove envcache.
(getwinenv): Don't honor envcache setting.
2011-06-09 Christopher Faylor <me.cygwin2011@cgf.cx>
* environ.c: Move code earlier to allow:
(_addenv): Call parse_options() when CYGWIN environment variable is
being changed.
(parse_options): Change parameter to 'const'.
2011-06-08 Christopher Faylor <me.cygwin2011@cgf.cx>
* environ.cc (tty_is_gone): Add missing space to message.
2011-06-08 Christopher Faylor <me.cygwin2011@cgf.cx>
* environ.cc (settings::set_process_state): Delete.
(tty_is_gone): New function.
(known): Change "tty" to call tty_is_gone(). Remove unneeded '&' from
beginning of function address.
(parse_options): Remove set_process_state handling.
* shared_info.h (CURR_USER_MAGIC): Reset.
(user_info::warned_notty): New member.
2011-06-07 Christopher Faylor <me.cygwin2011@cgf.cx>
* fhandler_console.cc (fhandler_console::open_shared_console):
Semi-revert to using fixed location for console stuff.
* shared.cc (offsets): Ditto. Comment.
* shared_info (shared_locations): Re-add SH_SHARED_CONSOLE.
2011-06-05 Christopher Faylor <me.cygwin2011@cgf.cx>
* fhandler_disk_file.cc (fhandler_disk_file::pread): Reset windows file
position pointer back to previous location after successful read.
2011-06-04 Christopher Faylor <me.cygwin2011@cgf.cx>
* fhandler_console.cc (fhandler_console::open_shared_console): Don't
zero handle to open_shared since it is supposed to be an input.
(enum_windows): Set handle input to open_shared to NULL since it does
not represent any previously opened shared region.
* shared.cc (open_shared): Tweak debugging output.
2011-06-03 Christopher Faylor <me.cygwin2011@cgf.cx>
* ntdll.h (FILE_PIPE_*): Define constants.
* select.cc (pipe_data_available): Detect closing state.
2011-06-03 Christopher Faylor <me.cygwin2011@cgf.cx>
* pinfo.cc (_pinfo::set_ctty): Don't reset myself->{pgid,sid} if
terminal has no pgid or sid settings.
2011-06-03 Christopher Faylor <me.cygwin2011@cgf.cx>
* fhandler.cc (fhandler_base_overlapped::wait_overlapped): Only raise
SIGPIPE when writing.
* fhandler.h: Include "tty.h".
(fhandler_termios::_tc): Rename from tc.
(fhandler_termios::tc): New method.
(fhandler_termios::tcinit): Remove an argument.
(fhandler_termios::get_ttyp): Use method to retrieve value.
(fhandler_console::console_state): Move here.
(fhandler_console::dev_state): Delete.
(fhandler_console::shared_console_info): Define.
(fhandler_console::open_shared_console): Move this function under
fhandler_console umbrella.
(fhandler_console::tc): Define. Return static value.
(fhandler_console::focus_aware): Accommodate deletion of dev_state.
(fhandler_console): Add tty_list::get_cttyp as a friend.
* fhandler_console.cc (dev_state): Redefine as a pointer within
shared_console_info and change dev-> to dev. throughout.
(fhandler_console::shared_console_info): Move into fhandler_console.
(fhandler_console::open_shared_console): Move into fhandler_console
change argument to simple bool.
(enum_windows): Accommodate changes to console_state and
open_shared_console.
(console_unit::console_unit): Ditto.
(fhandler_console::get_tty_stuff): Accommodate change to dev_state.
(tty_list::get_cttyp): Accommodate change to
handler_console::shared_console_info.
(fhandler_console::read): Accommodate change from tc to tc ().
(fhandler_console::set_input_state): Ditto.
(fhandler_console::open): Accommodate tcinit argument change and change
from tc to tc().
(fhandler_console::input_tcsetattr): Accomodate change from tc to tc().
(fhandler_console::input_tcsetattr): Ditto.
(fhandler_console::write_normal): Ditto.
(fhandler_console::init): Ditto.
(fhandler_console::igncr_enabled): Ditto.
* fhandler_termios.cc (fhandler_termios::tcinit): Remove first argument.
Expect tc() to have been set up first. Use tc() rather than tc.
(fhandler_termios::tcsetpgrp): Accomodate change from tc to tc().
(fhandler_termios::tcgetpgrp): Ditto.
(fhandler_termios::bg_check): Ditto.
(fhandler_termios::line_edit: Ditto.
(fhandler_tty_master::set_winsize): Ditto.
(fhandler_tty_slave::open): Ditto.
(fhandler_tty_slave::init): Ditto.
(fhandler_pty_master::write): Ditto.
(fhandler_pty_master::setup): Ditto. Accommodate change in arguments
to tcinit.
(fhandler_tty_slave::fch_open_handles): Set _tc directly.
(tty_min::is_orphaned_process_group): Don't assume that parent pid
exists.
* pinfo.cc (_pinfo::set_ctty): Reset myself->{pgid,sid} here if we were
started by a non-Cygwin process but the tty exists.
* shared_info.h (console_state): Delete from here.
* tty.h: Make multiple inclusion safe.
2011-05-31 Christopher Faylor <me.cygwin2011@cgf.cx>
* exceptions.cc (ctrl_c_handler): Simplify test for no parent tty.
* fhandler_console.cc (fhandler_console::get_tty_stuff): Return NULL if
ctty is not tty/console. Improve test for slave tty/pty device.
2011-05-31 Christopher Faylor <me.cygwin2011@cgf.cx>
* external.cc (fillout_pinfo): Don't truncate ctty if it's < 0.
* select.cc (pipe_data_available): Avoid printing debug info by default
or suffer very large strace files.
2011-05-31 Christopher Faylor <me.cygwin2011@cgf.cx>
* select.cc (pipe_data_available): New function - uses
NtQueryInformationFile to return information about pipes.
(peek_pipe): Rewrite to use pipe_data_available for both read and write
tests.
2011-05-30 Christopher Faylor <me.cygwin2011@cgf.cx>
* dtable.cc (dtable::select_write): Add missing argument to
debug_printf.
* fhandler.cc (fhandler_base_overlapped::setup_overlapped): Explicitly
set io_pending to false.
(fhandler_base_overlapped::has_ongoing_io): Call GetOverlappedResult
to force completion of I/O.
(fhandler_base_overlapped::wait_overlapped): Rewrite to correctly deal
with nonblocking reads and to make more race proof.
(fhandler_base_overlapped::raw_write): Deal with new enum values.
(fhandler_base_overlapped::raw_read): Ditto. Don't deal with ongoing
I/O here since it makes no sense in the read context.
* fhandler.h (enum wait_return): Add overlapped_unknown,
overlapped_nonblocking_no_data.
* pipe.cc (pipe): Add debugging output.
2011-05-30 Christopher Faylor <me.cygwin2011@cgf.cx>
* dll_init.cc (dll_list::append): Eliminate increment of unused tot
variable.
* dll_init.h (dll_list::tot): Delete.
(dll_list::populate_all_deps): Delete undefined function.
* fhandler.cc (fhandler_base_overlapped::wait_overlapped): Move EPIPE
handling under error condition.
2011-05-30 Ryan Johnson <ryan.johnson@cs.utoronto.ca>
* dll_init.cc (reserve_upto): Remove.
(release_upto): Ditto.
(dll_list::reserve_space): New function to reserve space needed by
DLL_LOAD dlls early in the fork process.
(dll_list::load_after_fork): Rewrite to use recursion to
track reservations it makes while trying to make dlls land where they
belong.
(dll_list::load_after_fork_impl): New function used by load_after_fork.
(dll_list::alloc): Initialize image base field.
* dll_init.h (dll_list::prefered_base): New field.
(dll_list::reserve_space): Declare new function.
(dll_list::load_after_fork): Declare new function.
* fork.cc (frok::child): call dll_list::reserve_space early, so we can
retry if it fails.
2011-05-30 Tor Perkins <cygwin@noid.net>
* fhandler_termios.cc (fhandler_termios::bg_check): Do not return EIO
when a process group has no leader as this is allowed and does not
imply an orphaned process group. Add a test for orphaned process
groups.
(tty_min::is_orphaned_process_group): Define new function.
* tty.h (tty_min::is_orphaned_process_group): Define new function.
2011-05-30 Ryan Johnson <ryan.johnson@cs.utoronto.ca>
* dll_init.cc (dll_list::find_by_modname): New function to search the
dll list for a module name only (no path).
(dll_list::alloc): Initialize newly-added members of struct dll.
(dll_list::append): New function to factor out the append operation
(used by dll_list::topsort).
(dll_list::populate_deps): New function to identify dll dependencies.
(dll_list::topsort): New function to sort the dll list topologically by
dependencies.
(dll_list::topsort_visit): New helper function for the above.
* dll_init.h (dll::ndeps): New class member.
(dll::deps): Ditto.
(dll::modname): Ditto.
(dll_list::find_by_modname): New function related to topsort.
(dll_list::populate_all_deps): Ditto.
(dll_list::populate_deps): Ditto.
(dll_list::topsort): Ditto.
(dll_list::topsort_visit): Ditto.
(dll_list::append): Ditto.
(pefile): New struct allowing simple introspection of dll images.
* fork.cc (fork): Topologically sort the dll list before forking
2011-05-30 Christopher Faylor <me.cygwin2011@cgf.cx>
* child_info.h (CURR_CHILD_INFO_MAGIC): Refresh.
(child_info::refresh_cygheap): New function.
* spawn.cc (spawn_guts): Call refresh_cygheap before creating a new
process to ensure that cygheap_max is up-to-date.
* fork.cc (frok::parent): Ditto.
2011-05-30 Christopher Faylor <me.cygwin2011@cgf.cx>
* cygheap.cc (cygheap_dummy): Rename from cygheap_at_start.
(cygheap): Accommodate name change to cygheap_dummy.
(cygheap_init): Ditto.
(cygheap_fixup_in_child): Simplify slightly.
* fork.cc (fork): Add an advisory comment.
2011-05-29 Christopher Faylor <me.cygwin2011@cgf.cx>
* fhandler.cc (fhandler_overlapped::wait_overlapped): Make sure that
I/O is cancelled on signal.
2011-05-28 Ryan Johnson <ryan.johnson@cs.utoronto.ca>
* dll_init.cc (dll_list::alloc): Initialize dll::image_size.
(reserve_at): Don't reserve space needed by the target dll if the
latter overlaps the free region to be blocked.
(dll_list::load_after_fork): Use new version of reserve_at.
* dll_init.h (dll::image_size): New member.
(pefile): New struct.
2011-05-28 Christopher Faylor <me.cygwin2011@cgf.cx>
Ryan Johnson <ryan.johnson@cs.utoronto.ca>
* dll_init.c (dll_list::load_after_fork): Don't clear in_forkee here.
* fork.cc (frok::errmsg): Rename from 'error'.
(frok::error): New function. Handle conditional printing of error
messages.
(frok::parent): Record hchild handle for use by error function. Use
throughout. Use error function rather than setting error pointer
directly.
(fork): Clear is_forkee here. Accommodate rename of 'error' to
'errmsg'.
* sigproc.cc (child_info::proc_retry): Detect EXITCODE_FORK_FAILED.
2011-05-28 Christopher Faylor <me.cygwin2011@cgf.cx>
* fhandler.cc (handler_base_overlapped::wait_overlapped): Rework to
attempt to properly set errno and bytes read for non-blocking case.
Change to just rely on res to indicate error conditions.
2011-05-28 Christopher Faylor <me.cygwin2011@cgf.cx>
* fhandler.cc (fhandler_base_overlapped::wait_overlapped): Don't set
io_pending unless ReadFile has returned an error. (this is a partial fix,
accidentally checked in)
2011-05-28 Christopher Faylor <me.cygwin2011@cgf.cx>
* autoload.cc: Call _api_fatal in asm.
* child_info.h: Redefine CURR_CHILD_INFO_MAGIC.
(child_info_fork::abort): Rename from handle_failure. Change
arguments.
* cygtls.h (_local_storage::ttybuf): New field.
* dcrt0.cc (vapi_fatal): Split api_fatal. Add "in forked process" to
message when appropriate.
(api_fatal): Use vapi_fatal.
* devices.h: Make multiple inclusion safe.
(fh_devices): Add FH_CONS* stuff. Reorder slightly.
(device): Eliminate anonymous union. Add more ways to access
minor/major.
(device::setunit): Accommodate no-longer-anonymous union.
(device::is_fs): Ditto.
(device::is_fs_special): Ditto.
(device::major): New function.
(device::minor): Ditto.
(device::is_device): New function.
(device::not_device): Ditto.
(device::operator int): New operator.
(device::operator fh_devices): Ditto.
(device::operator bool): Ditto.
(device::operator DWORD): Ditto.
(device::operator =): Ditto.
(isproc_dev): New function.
(isprocsys_dev): Ditto.
(iscons_dev): Ditto.
(istty_slave_dev): Ditto.
* devices.in: Add new "/dev/cons*" strings. Accommodate
no-longer-anonymous union throughout.
(BRACK): Use more precise method for initialization.
* devices.cc: Regenerate.
* dtable.cc (dtable::stdio_init): Use get_cttyp instead of get_tty.
(dtable::find_archetype): Use new DWORD operator in device to test
archetypes.
(dtable::init_std_file_from_handle): Use different method to initialize
'dev'. Adapt to different ctty handling and accommodate /dev/cons*.
(fh_alloc): Accommodate no-longer-anonymous union. Adapt to new
/dev/cons*.
(build_fh_pc): Make debugging output more useful.
* exceptions.cc (ctrl_c_handler): Use get_cttyp instead of get_tty.
* external.cc (fillout_pinfo): Accommodate new cons* stuff.
* fhandler.cc (fhandler_base::read): Eliminate is_slow() test.
* fhandler.h (fhandler_base::*): Adapt to changes in device.h.
(fhandler_*::is_slow): Delete.
( fhandler_proc::get_proc_fhandler): Return fh_devices type.
* fhandler_console.cc (open_shared_console): New function.
(console_unit): New class.
(console_unit::console_unit): New constructor.
(enum_windows): New function. Declare as friend to console_unit.
(fhandler_console::set_unit): New function.
(fhandler_console::get_tty_stuff): Call set_unit to set the unit number
and determine if initialization is needed. Eliminate flags parameter.
(tty_list::get_cttyp): Rename (sorta) from get_tty. Return pointer to
correct tty_min.
(fhandler_console::open): Adapt to elimination of argument to
get_tty_stuff.
(fhandler_console::output_tcsetattr): Properly detect error condition.
(fhandler_console::fixup_after_fork_exec): Adapt to get_tty_stuff()
setting tc automatically.
* fhandler_proc.cc: Use FH_BAD rather than 0 throughout where using
fh_devices enum.
(fhandler_proc::get_proc_fhandler): Return fh_devices. Adapt to
devices.h changes.
* fhandler_process.cc: Adapt to devices.h changes. Use FH_BAD rather
than 0 throughout where using fh_devices enum.
* fhandler_procnet.cc: Ditto.
* fhandler_procsys.cc: Ditto.
* fhandler_procsysvipc.cc: Ditto.
* fhandler_tape.cc (fhandler_dev_tape::fhandler_dev_tape): Ditto.
* fhandler_termios.cc (handler_termios::bg_check): Use tc->ttyname()
rather than assuming that we can construct a tty.
* fhandler_tty.cc (fhandler_tty_master::fhandler_tty_master): Just
return get_minor() of dev.
(fhandler_pty_master::process_slave_output): Add slightly more
debugging info.
(fhandler_tty_slave::fhandler_tty_slave): Change name from ntty to
unit.
(fhandler_pty_master::open): Ditto.
(fhandler_tty_slave::ioctl): Adapt to change which causes ctty to
represent a complete device.
(fhandler_tty_master::init_console): Add debugging for failure path.
(fhandler_pty_master::setup): Use get_unit() to retrieve unit number
rather than relying on raw ntty.
(fhandler_pty_master::setup): Ditto.
* fhandler_virtual.h (virt_tab_t): Redefine fhandler as fh_devices.
* fork.cc: Remove obsolete vfork stuff.
(frok::child): Don't assume that a ctty == 0 is valid.
* mount.cc (mount_info::conv_to_win32_path): Adapt to device struct
changes.
(mount_info::conv_to_win32_path): Ditto.
* path.cc (path_conv::check): Retrive major/minor numbers via a method
rather than accessing them directly from device. Rely on dev operators
to set/retrieve device information as required by device struct change.
* path.h (isproc_dev): Move to devices.h.
(isprocsys_dev): Ditto.
(isvirtual_dev): Ditto.
(path_conv:{isdevice,isfifo,isspecial,iscygdrive,issocket,get_devn,get_unitn}):
Use device methods to access/manipulate devices.
* pinfo.cc (pinfo::exit): Don't assume that ctty == 0 is valid. Use
iscons_dev to determine if a device is a console.
(_pinfo::_ctty): Use device::parse to generate tty/cons name.
(_pinfo::set_ctty): Don't assume that ctty == 0 is valid. Remove
redundant info from debugging.
* shared.cc (offsets): Remove console offset.
* shared_info.h (shared_locations): Ditto.
* syscalls.cc (umask): Use device methods to manipulate device
information.
(ctermid): Use device::parse to generate term device name.
* tlsoffsets.h: Regenerate.
* tty.cc (ttyslot): Return minor number of ctty since ctty now
represents a full device.
(tty::create_master): Set ctty to a complete device.
(tty_list::attach): Rework to detect new /dev/cons* stuff.
(tty_list::terminate): Adapt to changes to ctty.
(tty_list::init): Adapt to change to setntty - pass in device major
number.
(tty::exists): Use get_unit() to retrive tty unit number.
(tty::open_mutex): Ditto.
(tty::open_inuse): Ditto.
(tty::create_inuse): Ditto.
(tty::get_event): Ditto.
(tty_min::ttyname): Define new function.
* tty.h (tty_min::ntty): Redefine as fh_devices.
(tty::exists): Use get_unit() to retrive tty unit number.
(tty::open_mutex): Ditto.
(tty::open_inuse): Ditto.
(tty::create_inuse): Ditto.
(tty::get_event): Ditto.
(tty_min::ttyname): Declare new function.
(tty::getntty): Declare as const.
(tty_list::operator []): Assure that only minor part of argument is
used.
* dll_init.cc (dll_list::alloc): Detect mismatch of data segments early
issuing an explicit error message if necessary.
* heap.cc (heap_init): Adapt to changes from fork->handle_failure to
fork->abort.
* pinfo.h (EXITCODE_FORK_FAILED): New enum. (from Ryan Johnson)
* sigproc.cc (child_info_fork::abort): Rename from handle_failure.
Change arguments to allow passing in a printf-like message.
* winsup.h (api_fatal): Delete macro definition.
(api_fatal): Redefine from __api_fatal.
(vapi_fatal): Declare new function.
* include/sys/strace.h (strace_vprintf): Define new macro.
* ntdll.h (_SYSTEM_INFORMATION_CLASS): Add SystemHandleInformation.
2011-05-27 Corinna Vinschen <corinna@vinschen.de>
* shared.cc (offsets): Reorder so that console_state is lowest in
memory. Explain why.
(open_shared): Accommodate reordering of offsets array.
* shared_info.h (shared_locations): Reorder SH_SHARED_CONSOLE after
SH_MYSELF.
2011-05-26 Corinna Vinschen <corinna@vinschen.de>
* mount.h (MAX_MOUNTS): Raise to 64.
2011-05-25 Eric Blake <eblake@redhat.com>
* cygtls.h (strerror_r_buf): New buffer.
* errno.cc (strerror): Move guts...
(_strerror_r): ...to new function demanded by newlib.
(strerror_r): Don't clobber strerror buffer.
(_user_strerror): Drop unused declaration.
* tlsoffsets.h: Regenerate.
2011-05-25 Corinna Vinschen <corinna@vinschen.de>
* init.cc (dll_entry): Reinstantiate wow64_test_stack_marker and
previous stack tests.
2011-05-25 Corinna Vinschen <corinna@vinschen.de>
* posix.sgml (std-notes): Add missing <para>.
2011-05-24 Corinna Vinschen <corinna@vinschen.de>
* mount.cc (mount_info::conv_to_win32_path): Remove unused code.
* mount.h (class mount_info): Remove sys_mount_table_counter member.
* shared_info.h (class shared_info): Ditto.
(CURR_SHARED_MAGIC): Update.
2011-05-24 Corinna Vinschen <corinna@vinschen.de>
* pinfo.h (struct _pinfo): Reduce size of progname array slightly.
Explain why.
2011-05-23 Eric Blake <eblake@redhat.com>
* errno.cc (strerror): Print unknown errno as int.
(__xpg_strerror_r): Likewise, and don't clobber strerror buffer.
* cygtls.h (strerror_buf): Resize to allow '-'.
2011-05-23 Corinna Vinschen <corinna@vinschen.de>
* fhandler_process.cc (thread_info::fill_if_match): Reformat.
(format_process_maps): Ditto. Fetch pointer to procinfo structure
from mapped process. Print info about global shared Cygwin regions.
2011-05-21 Corinna Vinschen <corinna@vinschen.de>
* fhandler_process.cc (struct dos_drive_mappings): Use malloc/free
rather than cmalloc/cfree. Check return value from malloc before
using it.
(struct heap_info): Ditto.
(struct thread_info): Ditto. Rename from stack_info. Rename members
and local variables accordingly.
(thread_info::thread_info): Store stack and TEB addresses.
(thread_info::fill_if_match): Print "teb" if a TEB address has been
found. Special case for WOW64, explain why.
(format_process_maps): Fetch PEB address. Print MEM_RESERVE regions
with equal signs to distinguish them from PAGE_NOACCESS regions. Fix
printing of 'p' and 's' to differ between MEM_PRIVATE and MEM_MAPPED
pages, as on Linux. Print 'g' instead of 'p for PAGE_GUARD pages.
Print PEB and SharedUserData area if recognized.
2011-05-20 Corinna Vinschen <corinna@vinschen.de>
* miscfuncs.cc (CygwinCreateThread): Fix condition for adding the
guardsize to the stacksize. Fix accompanying comment.
2011-05-20 Corinna Vinschen <corinna@vinschen.de>
* miscfuncs.cc (CygwinCreateThread): Add accidentally missing comment.
2011-05-20 Corinna Vinschen <corinna@vinschen.de>
* fhandler_process.cc (struct heap_info): Change type of base and end
members to char *. Print "shared" rather than "share".
(struct stack_info): New class to fetch process stack information.
(format_process_maps): Initialize and check for stack information.
2011-05-20 Corinna Vinschen <corinna@vinschen.de>
* miscfuncs.cc (thread_wrapper): Remove statements added for debugging
purposes.
2011-05-20 Corinna Vinschen <corinna@vinschen.de>
* child_info.h (CURR_CHILD_INFO_MAGIC): Update.
(class child_info_fork): Remove stacksize, add stackaddr and guardsize
members.
* dcrt0.cc (child_info_fork::alloc_stack_hard_way): Partial rewrite
to regenerate the stack exactly as in the parent.
(child_info_fork::alloc_stack): Set stackaddr to 0, rather than
stacksize.
(dll_crt0_1): Check for stackaddr before changing the stack addresses
in the TEB.
* fork.cc (frok::child): Check for stackaddr here.
(frok::parent): Set ch.stackaddr and ch.guardsize if not called from
the main thread.
* init.cc (dll_entry): Replace pointer to NT_TIB with pointer to TEB.
Fix incorrectly changed address test before removing _my_tls.
Set StackLimit to NULL on Windows 2000. Explain why.
* miscfuncs.cc (struct thread_wrapper_arg): Store stackbase rather
than stacksize, store commitaddr, remove guardsize. Store all pointers
as char * for easier address arithmetic.
(thread_wrapper): Rewrite to remove OS stack before calling thread
function. Add lots of comments to explain what we do.
(CygwinCreateThread): Reserve our own stack in case we got no
application stack. Add comments.
* ntdll.h (struct _TEB): Extend defintion up to DeallocationStack
member.
* thread.cc (pthread_attr::pthread_attr): Use "(size_t) -1"
rather then 0xffffffff.
* wincap.h (wincaps::has_stack_size_param_is_a_reservation): New
element.
* wincap.cc: Implement above element throughout.
2011-05-19 Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
* thread.cc: Mark psiginfo and psignal as available in list of
optional cancellation points.
2011-05-19 Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
* cygwin.din (__fpurge): Export.
* posix.sgml (std-solaris): Add __fpurge.
* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
2011-05-18 Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
* posix.sgml (std-susv4): Remove chroot, futimes, hstrerror.
(std-deprec): Add chroot.
(std-bsd): Add futimes, hstrerror.
(std-notimpl): Add clock_nanosleep, nexttoward, nexttowardf.
Remove initstate, which is implemented and listed in std-susv4.
2011-05-17 Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
* cygwin.din (error): Export.
(error_at_line): Export.
(error_message_count): Export.
(error_one_per_line): Export.
(error_print_progname): Export.
* errno.cc (error_message_count): Define.
(error_one_per_line): Define.
(error_print_progname): Define.
(_verror): New static function.
(error): New function.
(error_at_line): New function.
* posix.sgml (std-gnu): Add error, error_at_line.
* include/error.h: New header.
* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
2011-05-17 Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
* cygwin.din (clock_getcpuclockid): Export.
(pthread_getcpuclockid): Export.
* hires.h (PID_TO_CLOCKID): New macro.
(CLOCKID_TO_PID): New macro.
(CLOCKID_IS_PROCESS): New macro.
(THREADID_TO_CLOCKID): New macro.
(CLOCKID_TO_THREADID): New macro.
(CLOCKID_IS_THREAD): New macro.
* ntdll.h (enum _THREAD_INFORMATION_CLASS): Add ThreadTimes.
* posix.sgml (std-notimpl): Add clock_getcpuclockid and
pthread_getcpuclockid from here...
(std-susv4): ... to here.
(std-notes): Remove limitations of clock_getres and clock_gettime.
Note limitation of timer_create to CLOCK_REALTIME.
* sysconf.cc (sca): Set _SC_CPUTIME to _POSIX_CPUTIME, and
_SC_THREAD_CPUTIME to _POSIX_THREAD_CPUTIME.
* thread.cc (pthread_getcpuclockid): New function.
* timer.cc (timer_create): Set errno to ENOTSUP for CPU-time clocks.
* times.cc (clock_gettime): Handle CLOCK_PROCESS_CPUTIME_ID and
CLOCK_THREAD_CPUTIME_ID.
(clock_getres): Ditto.
(clock_settime): Set errno to EPERM for CPU-time clocks.
(clock_getcpuclockid): New function.
* include/pthread.h (pthread_getcpuclockid): Declare.
* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
2011-05-17 Corinna Vinschen <corinna@vinschen.de>
* miscfuncs.cc (thread_wrapper): Remove unused _cygtls record.
* mmap.cc (is_mmapped_region): Avoid crash if no mmaps exist.
2011-05-16 Corinna Vinschen <corinna@vinschen.de>
* globals.cc (__getlogin_username): Remove.
* uinfo.cc (getlogin_r): Fetch username from cygheap.
(getlogin): Add static buffer username and fetch username from
getlogin_r.
2011-05-16 Corinna Vinschen <corinna@vinschen.de>
* cygtls.h (struct _local_storage): Remove unused members rarg and
_localtime_buf. Remove username in favor of a global buffer. Reorder
slightly to keep the net.cc stuff together.
* globals.cc (__getlogin_username): New global char buffer.
* tlsoffsets.h: Regenerate.
* uinfo.cc (getlogin): Copy username into __getlogin_username.
2011-05-16 Corinna Vinschen <corinna@vinschen.de>
* heap.cc (heap_init): Rewrite initial heap allocation to use addresses
beyond 0x20000000. Explain why and how.
* shared.cc (shared_info::heap_slop_size): Remove.
* shared_info.h (class shared_info): Remove heap_slop_inited and
heap_slop members. Remove heap_slop_size declaration.
(CURR_SHARED_MAGIC): Update.
* wincap.cc: Throughout, drop heapslop.
* wincap.h (struct wincaps): Drop heapslop.
2011-05-16 Corinna Vinschen <corinna@vinschen.de>
* dcrt0.cc (child_info_fork::alloc_stack_hard_way): Check if the
requested stack is application-provided within the user heap or an
mmapped region. If so, just use it. Add comment to explain why.
* miscfuncs.cc (thread_wrapper): If an application-provided stack
has been given, implement cygtls area at the stackbase. Fix comment.
* mmap.cc (is_mmapped_region): New function.
* winsup.h (is_mmapped_region): Declare.
2011-05-15 Corinna Vinschen <corinna@vinschen.de>
* miscfuncs.cc (thread_wrapper): Add comments to assembler code.
2011-05-15 Corinna Vinschen <corinna@vinschen.de>
* cygwin.din (pthread_attr_getguardsize): Export.
(pthread_attr_setguardsize): Export.
(pthread_attr_setstack): Export.
(pthread_attr_setstackaddr): Export.
* init.cc (dll_entry): Remove wow64_test_stack_marker. Check for
unusual stack address by testing stack addresses from current TEB.
Check validity of _my_tls by testing if it's within the stack as
given in current TEB.
* miscfuncs.cc (struct thread_wrapper_arg): New structure used to
push all required information to thread_wrapper function.
(thread_wrapper): Wrapper function for actual thread function.
If an application stack has been given, change %ebp and %esp so that
the thread function runs on that stack. If the thread has been created
by CygwinCreateThread, set up the POSIX guard pages if necessary.
(CygwinCreateThread): New function.
* miscfuncs.h (CygwinCreateThread): Declare.
* ntdll.h (struct _TEB): Define all members up to Peb.
* posix.sgml (std-susv4): Move pthread_attr_getguardsize,
pthread_attr_setguardsize and pthread_attr_setstack here.
(std-deprec): Add pthread_attr_setstackaddr.
* sysconf.cc (sca): Set _SC_THREAD_ATTR_STACKADDR to
_POSIX_THREAD_ATTR_STACKADDR.
* thread.cc (pthread::precreate): Copy pthread_attr stackaddr and
guardsize members.
(pthread::create): Call CygwinCreateThread.
(pthread_attr::pthread_attr): Initialize guardsize.
(pthread_attr_setstack): New function.
(pthread_attr_setstackaddr): New function.
(pthread_attr_setguardsize): New function.
(pthread_attr_getguardsize): New function.
(pthread_getattr_np): Copy attr.guardsize.
* thread.h (pthread_attr): Add member guardsize.
* include/pthread.h (pthread_attr_getguardsize): Declare.
(pthread_attr_setguardsize): Declare.
* include/cygwin/version.h: Bump API minor number.
2011-05-13 Corinna Vinschen <corinna@vinschen.de>
* fhandler_process.cc (struct heap_info::heap): Convert base to
uintptr_t. Add heap_id, end, flags members.
(heap_info::heap_vm_chunks): Rename from heaps.
(heap_info::heap_info): Rearrange using RtlQueryProcessDebugInformation
to get information of heap virtual memory blocks. Store heap id and
flags, as well as end address of each block.
(heap_info::fill_if_match): Check incoming base address against full
address range of heap chunks. Convert flag values in extra heap
information.
(format_process_maps): Change order so that heap check is done before
MEM_MAPPED check since there are shareable heaps.
* ntdll.h (PDI_HEAP_BLOCKS): Define.
(HEAP_FLAG_NOSERIALIZE): Define.
(HEAP_FLAG_GROWABLE): Define.
(HEAP_FLAG_EXCEPTIONS): Define.
(HEAP_FLAG_NONDEFAULT): Define.
(HEAP_FLAG_SHAREABLE): Define.
(HEAP_FLAG_EXECUTABLE): Define.
(HEAP_FLAG_DEBUGGED): Define.
(struct _DEBUG_HEAP_ARRAY): Define.
(struct _DEBUG_HEAP_BLOCK): Define.
2011-05-12 Corinna Vinschen <corinna@vinschen.de>
Based on newlib patch to strptime by Peter Rosin <peda@lysator.liu.se>:
* libc/time/strptime.c (is_leap_year): New static function.
(first_day): Ditto.
(__strptime): Fill in tm_yday when all of tm_year, tm_mon and tm_mday
are updated. Fill in tm_mon, tm_mday and tm_wday when both of tm_year
and tm_yday are updated.
2011-05-12 Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
* fhandler_proc.cc (format_proc_meminfo): Rewrite to use sysinfo().
Support RAM and swap space larger than 4GB.
Remove output elements not found with modern Linux kernels.
(format_proc_swaps): Support paging files larger than 4GB.
2011-05-11 Corinna Vinschen <corinna@vinschen.de>
* autoload.cc: Remove useless comment.
2011-05-11 Corinna Vinschen <corinna@vinschen.de>
* autoload.cc (EnumProcessModules): Remove.
* dlfcn.cc (dlopen): Make sure errno is set if an error occurs.
(dlsym): Rewrite using RtlQueryProcessDebugInformation instead of
EnumProcessModules.
* ntdll.h (struct _DEBUG_MODULE_ARRAY): Define.
(RtlCreateQueryDebugBuffer): Declare.
(RtlDestroyQueryDebugBuffer): Declare.
(RtlQueryProcessDebugInformation): Declare.
2011-05-11 Corinna Vinschen <corinna@vinschen.de>
* autoload.cc (GetModuleFileNameExW): Remove.
* autoload.cc (GetModuleInformation): Remove.
2011-05-11 Corinna Vinschen <corinna@vinschen.de>
* autoload.cc (QueryWorkingSet): Remove.
2011-05-11 Ryan Johnson <ryan.johnson@cs.utoronto.ca>
* fhandler_process.cc (format_process_maps): Rework to report
all mapped address space in a process (committed or reserved),
identifying the nature of the mapping (mapped file/image, heap,
shared memory) when possible.
(dos_drive_mappings): New helper classes.
(heap_info): Ditto.
* ntdll.h (struct _MEMORY_SECTION_NAME): Define.
2011-05-11 Corinna Vinschen <corinna@vinschen.de>
* autoload.cc (GetProcessMemoryInfo): Remove.
* resource.cc (fill_rusage): Call NtQueryInformationProcess rather than
GetProcessMemoryInfo to drop a psapi dependency.
2011-05-11 Corinna Vinschen <corinna@vinschen.de>
* fhandler_socket.cc (get_inet_addr): Rearrange for better readability.
Make waiting loop interruptible and cancelable. Check for SYSTEM DOS
flag before reading the file. Change return value to return 0 on
success, SOCKET_ERROR on failure.
(fhandler_socket::bind): Only set R/O DOS flag on filesystems not
supporting ACLs.
(fhandler_socket::connect): Accommodate changed return values from
get_inet_addr. Use SOCKET_ERROR instead of -1.
(fhandler_socket::sendto): Accommodate changed return values from
get_inet_addr.
* syslog.cc (connect_syslogd): Ditto.
2011-05-10 Christian Franke <franke@computer.org>
* security.cc (check_registry_access): Handle missing
security descriptor of HKEY_PERFORMANCE_DATA.
2011-05-10 Corinna Vinschen <corinna@vinschen.de>
* lc_msg.h: Regenerate.
2011-05-10 Corinna Vinschen <corinna@vinschen.de>
* fhandler_proc.cc (format_proc_uptime): Don't call GetSystemInfo.
Fetch CPU count from wincap.
(format_proc_stat): Ditto.
* globals.cc (system_info): Move to wincap.
* heap.cc (heap_init): Fetch page size from wincap.
* syscalls.cc (getpagesize): Fetch allocation granularity from wincap.
(getsystempagesize): Fetch page size from wincap.
* wincap.cc (wincap_2003): Default is_server to false.
(wincapc::init): Call GetSystemInfo here. Always set is_server value.
* wincap.h (class wincapc): Add system_info as private member.
(wincapc::cpu_count): New public method.
(wincapc::page_size): Ditto.
(wincapc::allocation_granularity): Ditto.
2011-05-10 Corinna Vinschen <corinna@vinschen.de>
* environ.cc (set_chunksize): Remove.
(parse_thing): Remove forkchunk entry.
* fork.cc (child_copy): Drop handling external chunksize setting.
* wincap.cc: Througout, drop chunksize.
(wincapc::set_chunksize): Remove.
* wincap.h (struct wincaps): Drop chunksize and declaration of
set_chunksize.
2011-05-08 Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
* times.cc (settimeofday): Add EFAULT handler.
Set errno to EINVAL if tv.tv_nsec is invalid, and to EPERM if
SetSystemTime fails. Return -1 in case of failure, all for
compatibility with BSD and Linux.
(clock_settime): New function.
* cygwin.din (clock_settime): Export.
* posix.sgml (std-susv4): Add clock_settime.
Move clock_setres from here...
(std-deprec): ... to here.
(std-notes): Correct limitation of clock_setres to only CLOCK_REALTIME.
Add limitation of clock_settime to only CLOCK_REALTIME.
* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
2011-05-07 Corinna Vinschen <corinna@vinschen.de>
* registry.cc (get_registry_hive_path): Change system_printf to
debug_printf.
(load_registry_hive): Ditto.
2011-05-06 Christopher Faylor <me.cygwin2011@cgf.cx>
* fhandler.h (fhandler_base::close_with_arch): Make non-virtual.
(fhandler_base::open_fs): Move closer to it's close counterpart.
2011-05-06 Christopher Faylor <me.cygwin2011@cgf.cx>
* fhandler.cc (fhandler_base::dup): Avoid duping a handle when an
fhandler has an archetype.
* fhandler_console.cc (fhandler_console::invisible_console): Move to
the top.
(fhandler_console::set_close_on_exec): Don't set close-on-exec on
handle since it's an archetype and you don't know how many things could
be using it.
2011-05-06 Christopher Faylor <me.cygwin2011@cgf.cx>
* fhandler.h (fhandler_dev_dsp): Cosmetic change.
* fhandler_tty.cc (fhandler_pty_master::process_slave_output): Put back
Sleep(10) for tty_master case.
* sigproc.cc (stopped_or_terminated): Don't consider a pid which has
been reaped to be terminated.
2011-05-06 Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
* sysconf.cc (sysinfo): New function.
* cygwin.din (sysinfo): Export.
* posix.sgml (std-gnu): Add sysinfo.
* include/sys/sysinfo.h (struct sysinfo): Define.
(sysinfo): Declare.
* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
2011-05-06 Corinna Vinschen <corinna@vinschen.de>
* libc/minires-os-if.c (get_dns_info): Drop printing uninitialized
value of dwRetVal in debug output.
2011-05-06 Corinna Vinschen <corinna@vinschen.de>
* fhandler.h (fhandler_socket::read): Declare.
(fhandler_socket::write): Declare.
* fhandler_procsys.cc (fhandler_procsys::read): Add FIXME comment.
(fhandler_procsys::write): Ditto.
* fhandler_socket.cc (fhandler_socket::read): New method.
(fhandler_socket::write): New method.
* syscalls.cc: Rearrange order of read/write functions.
(read): Call fhandler read method directly instead of just readv.
(readv): Remove EINTR loop. This is done in all affected fhandler's
now.
(write): Call fhandler write method directly instead of just writev.
Fix debug output.
2011-05-05 Christopher Faylor <me.cygwin2011@cgf.cx>
* cygheap.cc (cygheap::close_ctty): Close ctty via close_with_arch().
* debug.cc (close_handle): Call debugger on failure.
* devices.in (device::tty_to_real_device): Delete.
* devices.h (device::tty_to_real_device): Ditto.
* devices.cc: Regenerate.
* dtable.cc: Delete old ifdef'ed vfork code.
(dtable::release): Don't handle archetype here.
(dtable::init_std_file_from_handle): Consolidate console tests.
Generate major/minor for tty ASAP. Fix incorrect setting of DEV_TTYS*
for serial.
(fh_alloc): New function derived from build_fh_pc. Pass current tty
when building tty.
(build_pc_pc): Use fh_alloc to create. Set name from fh->dev if
appropriate. Generate an archetype or point to one here.
(dtable::dup_worker): Deal with archetypes. Rely on = operator copying
whole class rather than just fhandler_base.
(dtable::fixup_after_exec): Call close_with_arch to handle closing of
fhandlers with archetypes.
* fhandler.cc (fhandler_base::operator =): Call memcpy with fhandler's
size() rather than sizeof fhandler_base.
(fhandler_base::open_with_arch): New function. Handles opening of
fhandler's with archetypes, dealing with usecounts, etc.
(fhandler_base::close_with_arch): Ditto for close.
* fhandler.h: Many changes for archetypes.
(fhandler_base::set_name): Set both normalized path and regular path.
(fhandler_base::open_with_arch): New function.
(fhandler_base::open_setup): Ditto.
(fhandler_base::use_archetype): Ditto.
(fhandler_base::_archetype_usecount): Ditto.
(fhandler_*::size): Ditto.
(fhandler_dev_tape::open): Remove virtual decoration.
(fhandler_console::use_archetype): New function. Return true.
(fhandler_console::open_setup): New function.
(fhandler_console::dup): Delete.
(fhandler_tty_slave::fhandler_tty_slave): Redeclare to take an
argument.
(fhandler_tty_slave::use_archetype): New function. Return true.
(fhandler_tty_slave::cleanup): New function.
(fhandler_pty_master::use_archetype): New function. Return true.
(fhandler_pty_master::cleanup): New function.
(fhandler_pty_master::is_tty_master): New function. Return false.
(fhandler_tty_master::is_tty_master): New function. Return true.
(fhandler_dev_dsp::fhandler_dev_dsp): New function. Return true.
(report_tty_counts): Only report on archetype's usecount if there is
one.
* fhandler_console.cc (fhandler_console::get_tty_stuff): Remove
handling of setsid, set_ctty, set_flags, and manage_console_count.
(fhandler_console::open_setup): New function. Implement functionality
removed from get_tty_stuff.
(fhandler_console::dup): Delete.
(fhandler_console::output_tcsetattr): Set errno on error.
(fhandler_console::fhandler_console): Set device early.
(fhandler_console::init): Use open_with_arch to open console handles.
(fhandler_console::fixup_after_fork_exec): Nuke most of the stuff for
dealing with console handles.
* fhandler_dsp.cc (fhandler_dev_dsp::open): Remove archetype handling.
(fhandler_dev_dsp::write): Ditto.
(fhandler_dev_dsp::read): Ditto.
(fhandler_dev_dsp::close): Ditto.
(fhandler_dev_dsp::dup): Ditto.
(fhandler_dev_dsp::ioctl): Ditto.
(fhandler_dev_dsp::fixup_after_fork): Ditto.
(fhandler_dev_dsp::fixup_after_exec): Ditto.
* fhandler_tty.cc (fhandler_tty_common::__acquire_output_mutex): Add a
little more debugging.
(fhandler_tty_common::__release_output_mutex): Ditto.
(fhandler_pty_master::process_slave_output): Ditto. Don't do signal
handling or pthread_cancel handling in the tty master thread.
(process_output): Minor reorg.
(fhandler_tty_slave::fhandler_tty_slave): Set device based on new ntty
argument.
(fhandler_tty_slave::open): Remove archetype handling. Move some
processing into open_setup().
(fhandler_tty_slave::open_setup): New function.
(fhandler_tty_slave::cleanup): New function.
(fhandler_tty_slave::close): Remove archetype handling. Move some
processing into cleanup().
(fhandler_tty_slave::init): Rename argument from f to h. Open device
using open_with_arch(). Remove archetype handling.
(fhandler_pty_master::dup): Ditto.
(fhandler_pty_master::open): Ditto.
(fhandler_pty_master::close): Ditto. Move some handling to cleanup().
(fhandler_pty_master::cleanup): New function.
(fhandler_tty_master::init_console): Give unique name to captive
console fhandler.
* pinfo.cc (_pinfo::set_ctty): Rename argument from arch to fh.
Eliminate archetype assumption.
* syscalls.cc (close_all_files): Use close_with_arch for closing.
(open): Use open_with_arch() rather than open().
(close): Use close_with_arch() rather than close().
2011-05-05 Corinna Vinschen <corinna@vinschen.de>
* pinfo.h (class push_process_state): New class to push a process state
flag temporarily into myself->process_state.
* fhandler_console.cc (fhandler_console::read): Add push_process_state
handler.
(fhandler_console::write): Call bg_check from here. Add
push_process_state handler.
* fhandler_tty.cc (fhandler_tty_slave::write): Ditto.
(fhandler_tty_slave::read): Ditto.
(fhandler_pty_master::write): Ditto.
(fhandler_pty_master::read): Ditto.
* syscalls.cc (readv): Remove bg_check call and setting process state.
(writev): Ditto.
2011-05-05 Corinna Vinschen <corinna@vinschen.de>
* syscalls.cc (readv): Add myfault handler. Don't check repeatedly
open state of file handler. Streamline loop.
(writev): Add myfault handler.
2011-05-05 Christopher Faylor <me.cygwin2011@cgf.cx>
* fhandler.cc (fhandler_base_overlapped::raw_read): Rename from
read_overlapped.
(fhandler_base_overlapped::raw_e): Rename from write_overlapped.
* fhandler.h (fhandler_*::raw_read): Add reparm decoration.
(fhandler_*::raw_write): Ditto.
(fhandler_base_overlapped::raw_read): Rename from read_overlapped.
(fhandler_base_overlapped::raw_write): Rename from write_overlapped.
(fhandler_pipe::raw_read): Delete.
(fhandler_pipe::raw_write): Ditto.
(fhandler_mailslot::raw_read): Ditto.
* fhandler_fifo.cc (fhandler_fifo::raw_read): Reflect read_overlapped
-> raw_read rename.
(fhandler_fifo::raw_write): Ditto.
* fhandler_mailslot.cc (fhandler_mailslot::raw_read): Delete.
(fhandler_mailslot::raw_write): Reflect read_overlapped -> raw_read
rename.
* pipe.cc (fhandler_pipe::raw_read): Delete.
(fhandler_pipe::raw_write): Ditto.
2011-05-05 Christopher Faylor <me.cygwin2011@cgf.cx>
* fork.cc (fork): Clear PID_REAPED.
* pinfo.cc (pinfo_init): Ditto.
(pinfo::init): Check for PID_REAPED.
* sigproc.cc (stopped_or_terminated): Ditto.
2011-05-05 Christopher Faylor <me.cygwin2011@cgf.cx>
* pinfo.cc (_pinfo::exists): Check for PID_REAPED.
2011-05-05 Corinna Vinschen <corinna@vinschen.de>
* fhandler_disk_file.cc (fhandler_disk_file::pread): Correctly return
with errno set to EBADF if file open mode is incorrect.
(fhandler_disk_file::pwrite): Ditto.
2011-05-05 Corinna Vinschen <corinna@vinschen.de>
* fhandler.cc (is_at_eof): Drop static storage class. Drop err
parameter since we don't change the Win32 error here anymore.
(fhandler_base::raw_read): Accommodate change to is_at_eof.
* fhandler_disk_file.cc (fhandler_disk_file::pread): In binary mode use
direct call to NtReadFile, rather than lseek/read.
(fhandler_disk_file::pwrite): In binary mode use direct call to
NtWriteFile, rather than lseek/write.
2011-05-05 Corinna Vinschen <corinna@vinschen.de>
* dcrt0.cc (dll_crt0_1): Reset locale to "C" even when dynamically
loaded.
2011-05-05 Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
* posix.sgml (std-notimpl): Remove bsd_signal, setcontext, and
swapcontext, marked obsolete in SUSv3 and not present in SUSv4.
2011-05-05 Christian Franke <franke@computer.org>
* fhandler_registry.cc (fhandler_registry::exists): Fix regression
in EACCES handling.
(fhandler_registry::open): Fix "%val" case.
2011-05-04 Christopher Faylor <me.cygwin2011@cgf.cx>
* signal.cc (_pinfo::kill): Return success on kill(0) only if pid
exists or is in PID_EXITED state. Report pid 0 when pid does not exist
rather than pid -1. Make debug output reflect actual function call.
* sigproc.cc (stopped_or_terminated): Set process state to reaped when
we've finished waiting for it.
* include/sys/cygwin.h (PID_REAPED): New enum.
2011-05-04 Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
* cygwin.din (psiginfo): Export.
(psignal): Export.
(sys_siglist): Export.
* posix.sgml (std-notimpl): Move psiginfo and psignal from here...
(std-susv4): ... to here.
(std-deprec): Add sys_siglist.
* strsig.cc (sys_siglist): New array.
(psiginfo): New function.
* include/cygwin/signal.h (sys_siglist): Declare.
(psiginfo): Declare.
* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
2011-05-04 Christopher Faylor <me.cygwin2011@cgf.cx>
* dll_list::detach (dll_list::detach): Avoid doing anything with detach
during a failing fork.
2011-05-04 Christopher Faylor <me.cygwin2011@cgf.cx>
* dll_init.cc (dll_global_dtors): Avoid calling destructors during
failing fork().
2011-05-04 Corinna Vinschen <corinna@vinschen.de>
* fhandler.h (class fhandler_base): Remove uninterruptible_io status
flag.
(fhandler_base::ready_for_read): Remove declaration.
(fhandler_socket::ready_for_read): Ditto.
(fhandler_pipe::ready_for_read): Ditto.
(fhandler_tty_master::is_slow): Remove.
* fhandler_console.cc (fhandler_console::open): Drop setting
uninterruptible_io.
* fhandler_serial.cc (fhandler_serial::open): Ditto.
* fhandler_tty.cc (fhandler_tty_slave::fhandler_tty_slave): Ditto.
(fhandler_tty_master::init_console): Ditto.
* pipe.cc (fhandler_pipe::fhandler_pipe): Ditto.
(fhandler_pipe::open): Ditto.
(_pipe): Ditto.
* select.cc (fhandler_pipe::ready_for_read): Remove.
(fhandler_base::ready_for_read): Remove.
* syscalls.cc (readv): Drop unneeded wait variable. Remove entire test
which might lead to calling ready_for_read. Remove now unused label
out.
2011-05-04 Corinna Vinschen <corinna@vinschen.de>
* fhandler.h (class fhandler_mailslot): Move down in file and change
parent class to fhandler_base_overlapped. Remove declaration of
method write. Add declaraiotns for raw_read and raw_write.
* fhandler_mailslot.cc (fhandler_mailslot::fhandler_mailslot): Call
fhandler_base_overlapped constructor.
(fhandler_mailslot::fstat): Call fhandler_base_overlapped::fstat.
(fhandler_mailslot::open): Drop FILE_SYNCHRONOUS_IO_NONALERT flag from
call to NtOpenFile.
(fhandler_mailslot::raw_read): New method.
(fhandler_mailslot::raw_write): Ditto. Take over length algorithm from
former write method.
(fhandler_mailslot::write): Remove.
(fhandler_mailslot::ioctl): Call fhandler_base_overlapped::ioctl.
2011-05-04 Corinna Vinschen <corinna@vinschen.de>
* fhandler.h (fhandler_dev_tape::_lock): Add bool parameter.
* fhandler_tape.cc (lock): Call _lock with false argument.
(_lock): Take bool cancelable parameter. Handle O_NONBLOCK.
Make cancelable if cancelabe parameter is true.
(fhandler_dev_tape::raw_read): Call _lock with true argument.
(fhandler_dev_tape::raw_write): Ditto.
2011-05-04 Corinna Vinschen <corinna@vinschen.de>
* fhandler_dsp.cc (fhandler_dev_dsp::Audio): Add fh member.
(fhandler_dev_dsp::Audio_out::Audio_out): Take pointer to encapsulating
fhandler_dev_dsp as parameter.
(fhandler_dev_dsp::Audio_in::Audio_in): Ditto.
(fhandler_dev_dsp::Audio::Audio): Take pointer to encapsulating
fhandler_dev_dsp as parameter and store in fh.
(fhandler_dev_dsp::Audio_out::write): Change return type to int and
return number of bytes written. Return -1 if waitforspace returns false
and no bytes have been written so far.
(fhandler_dev_dsp::Audio_out::waitforspace): Change return type to bool.
Handle O_NONBLOCK. Make waiting loop interruptible and cancelable.
Return false in any of these cases, otherwise true.
(fhandler_dev_dsp::Audio_in::read): Set returned nBytes to -1 if
waitfordata returns false and nothing has been read so far.
(fhandler_dev_dsp::Audio_in::waitfordata): Change return type to bool.
Handle O_NONBLOCK. Make waiting loop interruptible and cancelable.
Return false in any of these cases, otherwise true.
(fhandler_dev_dsp::write): Call Audio_out constructor with this as
parameter.
(fhandler_dev_dsp::read): Call Audio_in constructor with this as
parameter.
2011-05-04 Christopher Faylor <me.cygwin2011@cgf.cx>
* thread.h (pthread::static_cancel_self): Mark as noreturn.
(pthread::cancel_self): Ditto.
* thread.cc (pthread::cancel_self): Explicitly use pthread::exit to
avoid a "function returns" error.
2011-05-04 Christopher Faylor <me.cygwin2011@cgf.cx>
* pinfo.h (pinfo::pinfo): Set procinfo to NULL to avoid potential
cleanup of uninitialized garbage. (Suggested by Ryan Johnson)
2011-05-03 Corinna Vinschen <corinna@vinschen.de>
* select.cc (cygwin_select): Make degenerate case cancelable.
(select_stuff::destroy): New inline method to delete memory taken
by select_stuff.
(select_stuff::~select_stuff): Call destroy.
(select_stuff::wait): Add case to allow canceling select.
* select.h (select_stuff::destroy): Declare.
* thread.cc: Mark poll, pselect and poll as cancelable.
2011-05-03 Corinna Vinschen <corinna@vinschen.de>
* fhandler.cc (fhandler_base_overlapped::wait_overlapped): Make
cancelable. Remove test for main thread, always add signal_arrived
to waited objects.
2011-05-03 Corinna Vinschen <corinna@vinschen.de>
* fhandler_tty.cc (fhandler_tty_slave::read): Set WFMO timeout to 0 for
nonblocking case. Drop useless waiter variable. Rewrite wait for
input_available_event to use a switch statement. Handle timeout and
failure more gracefully. Make restartable and cancelable. Rewrite
wait for input_mutex to use WFMO and a switch statement. Handle
timeout and failure more gracefully. Make restartable and cancelable.
2011-05-02 Christopher Faylor <me.cygwin2011@cgf.cx>
* signal.cc (_pinfo::kill): Avoid referencing 'pid' after ESRCH.
2011-05-02 Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
* cygwin.din (pthread_attr_getstack): Export.
(pthread_attr_getstackaddr): Export.
(pthread_getattr_np): Export.
* ntdll.h (enum _THREAD_INFORMATION_CLASS): Add ThreadBasicInformation.
(struct _THREAD_BASIC_INFORMATION): Define.
(NtQueryInformationThread): Declare.
* posix.sgml (std-susv4): Add pthread_attr_getstack.
(std-gnu): Add pthread_getattr_np.
(std-deprec): Add pthread_attr_getstackaddr.
(std-notimpl): Remove pthread_attr_[gs]etstackaddr, as they were
removed from SUSv4.
* thread.cc (pthread_attr::pthread_attr): Initialize stackaddr.
(pthread_attr_getstack): New function.
(pthread_attr_getstackaddr): New function.
(pthread_attr_setstacksize): Return EINVAL if passed size less than
PTHREAD_STACK_MIN, as required by POSIX.
(pthread_getattr_np): New function.
* thread.h (class pthread_attr): Add stackaddr member.
* include/pthread.h (pthread_attr_getstack): Declare.
(pthread_attr_getstackaddr): Declare unconditionally.
(pthread_attr_setstack): Declare inside false conditional for reference.
(pthread_getattr_np): Declare.
* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
2011-05-02 Christopher Faylor <me.cygwin2011@cgf.cx>
* Makefile.in: Allow CFLAGS to be overridden from the environment.
2011-05-02 Corinna Vinschen <corinna@vinschen.de>
* thread.cc (cancelable_wait): Remove test for main thread.
* fhandler_fifo.cc (fhandler_fifo::open_nonserver): Ditto.
2011-05-02 Corinna Vinschen <corinna@vinschen.de>
* fhandler_tty.cc (andler_pty_master::process_slave_output): Make
interruptible and cancelable. Fix nonblocking case.
2011-05-02 Corinna Vinschen <corinna@vinschen.de>
* fhandler_console.cc (fhandler_console::read): Make restartable and
cancelable.
2011-05-02 Christopher Faylor <me.cygwin2011@cgf.cx>
* strace.cc (strace::vprntf): Avoid closing unopened handle.
2011-05-02 Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
* sysconf.cc (sca): Set _SC_SPIN_LOCKS to _POSIX_SPIN_LOCKS.
2011-05-02 Christopher Faylor <me.cygwin2011@cgf.cx>
* dll_init.cc (dll_list::alloc): Reset 'p' in forked process.
* select.cc (select_stuff::wait): Move cleanup() closer to WFMO to
minimize unavoidable (?) race.
2011-05-02 Corinna Vinschen <corinna@vinschen.de>
* fhandler_serial.cc (fhandler_serial::raw_read): Add restartability
after a signal. Add cancelability.
(fhandler_serial::raw_write): Wait for write to succeed if O_NONBLOCK
is not set. Add signal handling and cancelability.
2011-05-01 Corinna Vinschen <corinna@vinschen.de>
* fhandler_windows.cc (fhandler_windows::read): Use
pthread::get_cancel_event to fetch thread's cancel event.
* flock.cc (lf_setlock): Ditto.
* posix_ipc.cc (ipc_cond_timedwait): Ditto.
* thread.cc (pthread::get_cancel_event): New static method.
* thread.h (pthread::get_cancel_event): Declare.
2011-05-01 Corinna Vinschen <corinna@vinschen.de>
* libc/minires-os-if.c (get_dns_info): Remove unnecessary test for
existence of DnsQuery_A.
2011-05-01 Corinna Vinschen <corinna@vinschen.de>
Throughout, use user32 UNICODE functions rather than ANSI functions.
* autoload.cc: Convert all definitions for ANSI user32 functions to
definitions for the corresponding UNICODE function.
(SendMessageA): Remove.
(SendNotifyMessageW): Define.
* fhandler.h (fhandler_windows::is_slow): Remove.
* fhandler_windows.cc (fhandler_windows::write): Use SendNotifyMessageW
call rather than SendMessage to make function always return immediately.
(fhandler_windows::read): Make function interruptible and a cancellation
point. Handle O_NONBLOCK.
* select.cc (peek_serial): Don't wait for signal_arrived here.
* window.cc (wininfo::winthread): Call CreateWindowExW directly rather
than CreateWindow wrapper.
2011-05-01 Corinna Vinschen <corinna@vinschen.de>
* net.cc (fdsock): Drop setting uninterruptible_io to true.
2011-05-01 Corinna Vinschen <corinna@vinschen.de>
* fhandler.h (fhandler_socket::is_slow): Remove.
2011-04-30 Corinna Vinschen <corinna@vinschen.de>
* fcntl.cc (fcntl64): Call pthread_testcancel.
* fhandler_socket.cc (fhandler_socket::connect): Ditto.
(fhandler_socket::accept4): Ditto.
(fhandler_socket::recvfrom): Ditto.
(fhandler_socket::recvmsg): Ditto.
(fhandler_socket::sendto): Ditto.
(fhandler_socket::sendmsg): Ditto.
* flock.cc (lf_setlock): Allow to cancel thread running blocking
file lock. Try to make code more readable.
(lockf): Call pthread_testcancel.
* mmap.cc (msync): Ditto.
* posix_ipc.cc (ipc_cond_timedwait): Call pthread::static_cancel_self
rather than pthread_testcancel.
* select.cc (cygwin_select): Call pthread_testcancel.
* syscalls.cc (pread): Ditto.
(pwrite): Ditto.
(readv): Ditto.
(writev): Ditto.
(open): Ditto.
(close): Ditto.
(fsync): Ditto.
* termios.cc (tcdrain): Ditto.
* thread.cc: Align list of cancellation points with above changes.
Mark not-implemented functions, too.
(cancelable_wait): Don't set unused object indices to WAIT_FAILED
since that could result in wrong behaviour. Set them to the invalid
value WAIT_TIMEOUT + 1 instead.
2011-04-30 Corinna Vinschen <corinna@vinschen.de>
* thread.h (class pthread): Add bool member canceled.
* thread.cc (pthread::pthread): Initialize canceled to false.
(pthread::cancel): Set canceled before setting cancel_event.
(pthread::testcancel): Check for canceled. Only wait for cancel_event
if canceled is true. Explain why.
(pthread::_fixup_after_fork): Set canceled to false.
2011-04-29 Corinna Vinschen <corinna@vinschen.de>
* errno.cc (errmap): Sort. Map ERROR_EXE_MACHINE_TYPE_MISMATCH to
ENOEXEC.
2011-04-29 Corinna Vinschen <corinna@vinschen.de>
* thread.cc: Update comment listing cancellation points per POSIX.
2011-04-29 Corinna Vinschen <corinna@vinschen.de>
* advapi32.cc: Add comment.
(EqualSid): Remove.
(CopySid): Remove.
(AddAccessAllowedAce): Remove.
(AddAccessDeniedAce): Remove.
(MakeSelfRelativeSD): Remove.
* flock.cc: Replace above functions throughout with their ntdll.dll
equivalent.
* sec_acl.cc: Ditto.
* sec_auth.cc: Ditto.
* sec_helper.cc: Ditto.
* security.cc: Ditto.
* security.h: Ditto.
(RtlEqualSid): Declare. Explain why.
(RtlCopySid): Ditto.
2011-04-29 Corinna Vinschen <corinna@vinschen.de>
* advapi32.cc (AccessCheck): Remove.
(PrivilegeCheck): Remove.
(OpenThreadToken): Remove.
* fhandler_tty.cc: Replace above functions throughout with their
ntdll.dll equivalent.
* security.cc: Ditto.
2011-04-29 Corinna Vinschen <corinna@vinschen.de>
* ntdll.h (IsEventSignalled): New inline function.
* cygthread.cc (cygthread::terminate_thread): Use IsEventSignalled in
place of WaitForSingleObject on event with 0 timeout.
* fhandler.cc (fhandler_base_overlapped::has_ongoing_io): Ditto.
* fhandler_fifo.cc (fhandler_fifo::open_nonserver): Ditto.
(fhandler_fifo::wait): Ditto.
* fhandler_termios.cc (fhandler_termios::bg_check): Ditto.
* select.cc (verify_tty_slave): Ditto.
* thread.cc (pthread::testcancel): Ditto.
2011-04-29 Corinna Vinschen <corinna@vinschen.de>
* advapi32.cc (GetTokenInformation): Remove.
(SetTokenInformation): Remove.
* grp.cc: Replace above functions throughout with their ntdll.dll
equivalent.
* sec_auth.cc: Ditto.
* syscalls.cc: Ditto.
* uinfo.cc: Ditto.
2011-04-29 Corinna Vinschen <corinna@vinschen.de>
* posix_ipc.cc (ipc_cond_timedwait): Only wait for pthread's
cancel_event if thread's cancelability isn't disabled.
2011-04-28 Corinna Vinschen <corinna@vinschen.de>
* advapi32.cc (SetSecurityDescriptorDacl): Remove.
(SetSecurityDescriptorGroup): Remove.
(SetSecurityDescriptorOwner): Remove.
* pinfo.cc: Replace above functions throughout with their ntdll.dll
equivalent.
* sec_acl.cc: Ditto.
* sec_helper.cc: Ditto.
* security.cc: Ditto.
* sec_helper.cc (__sec_user): Remove old comment.
2011-04-28 Corinna Vinschen <corinna@vinschen.de>
* posix_ipc.cc (ipc_cond_timedwait): Also wait for pthread's
cancel_event, if any. Call pthread_testcancel if cancel_event has been
signalled.
2011-04-28 Corinna Vinschen <corinna@vinschen.de>
* posix_ipc.cc (ipc_cond_timedwait): Remove pthread_testcancel calls.
(_mq_send): Add pthread_testcancel call at start of function.
(_mq_receive): Ditto.
2011-04-28 Corinna Vinschen <corinna@vinschen.de>
* cygerrno.h (geterrno_from_nt_status): Declare.
* errno.cc (geterrno_from_nt_status): Define.
* flock.cc: Fix copyright dates.
* ntdll.h (enum _TIMER_TYPE): Define.
(PTIMER_APC_ROUTINE): Define.
(NtCancelTimer): Declare.
(NtCreateTimer): Declare.
(NtSetTimer): Declare.
* posix_ipc.cc (ipc_cond_timedwait): Rewrite to make interruptible and
restartable. Call pthread_testcancel in case of timeout to enable
pthread_cancel on waiting thread. Replace WFMO timeout with waiting
for a waitable timer. Explain why. Replace single call to WFMO with
two calls, one for the event, one for the mutex. Don't lock mutex in
case of error.
(ipc_cond_signal): Make void function.
(ipc_cond_close): Ditto.
(_mq_send): Immediately return -1 in case of error from
ipc_cond_timedwait.
(_mq_receive): Ditto.
2011-04-28 Corinna Vinschen <corinna@vinschen.de>
* advapi32.cc (GetSecurityDescriptorDacl): Remove.
(GetSecurityDescriptorGroup): Remove.
(GetSecurityDescriptorOwner): Remove.
* sec_acl.cc: Replace above functions throughout with their ntdll.dll
equivalent. Remove redundant debug output.
* sec_auth.cc: Ditto.
* security.cc: Ditto.
* uinfo.cc: Ditto.
2011-04-28 Corinna Vinschen <corinna@vinschen.de>
* advapi32.cc (InitializeAcl): Remove.
(AddAce): Remove.
(FindFirstFreeAce): Remove.
(GetAce): Remove.
(InitializeSecurityDescriptor): Remove.
(OpenProcessToken): Remove.
* dcrt0.cc: Replace above functions throughout with their ntdll.dll
equivalent.
* fhandler_tty.cc: Ditto.
* flock.cc: Ditto.
* pinfo.cc: Ditto. Drop unnecessary error handling.
* sec_acl.cc: Ditto.
* sec_auth.cc: Ditto.
* sec_helper.cc: Ditto.
* security.cc: Ditto.
2011-04-28 Corinna Vinschen <corinna@vinschen.de>
* advapi32.cc (InitializeSid): Remove.
(EqualPrefixSid): Remove.
(GetLengthSid): Remove.
(GetSidSubAuthority): Remove.
(GetSidSubAuthorityCount): Remove.
(GetSidIdentifierAuthority): Remove.
* fhandler_disk_file.cc: Replace above functions throughout with their
ntdll.dll equivalent.
* sec_auth.cc: Ditto.
* sec_helper.cc: Ditto.
* security.cc: Ditto.
2011-04-28 Corinna Vinschen <corinna@vinschen.de>
* advapi32.cc (AllocateLocallyUniqueId): Remove.
* fhandler_disk_file.cc (fhandler_base::open_fs): Replace call to
AllocateLocallyUniqueId with call to NtAllocateLocallyUniqueId;
* posix_ipc.cc (mq_open): Ditto. Drop error handling for that call.
(sem_open): Ditto.
2011-04-28 Corinna Vinschen <corinna@vinschen.de>
* autoload.cc (GetSecurityInfo): Remove.
* ntdll.h (RtlConvertToAutoInheritSecurityObject): Declare.
(RtlDeleteSecurityObject): Declare.
(RtlGetControlSecurityDescriptor): Declare.
(RtlLengthSecurityDescriptor): Declare.
* security.cc (file_mapping): New global variable.
(get_file_sd): Rewrite. Clean up code. Get rid of GetSecurityInfo
call.
(alloc_sd): Call RtlSetControlSecurityDescriptor to set
SE_DACL_PROTECTED flag.
(check_file_access): Remove mapping. Use file_mapping instead.
(check_registry_access): Rename mapping to reg_mapping.
* wincap.cc: Througout, drop use_get_sec_info_on_dirs,
* wincap.h (struct wincaps): Drop use_get_sec_info_on_dirs.
2011-04-24 Corinna Vinschen <corinna@vinschen.de>
* include/fenv.h: Add missing _FENV_H_ define.
2011-04-23 Corinna Vinschen <corinna@vinschen.de>
* registry.cc (reg_key::get_dword): Rename from get_int, use DWORD
rather than int type. Avoid compiler warning.
(reg_key::set_dword): Rename from set_int, use DWORD rather than int
type. Change return type to NTSTATUS.
(reg_key::get_string): Change return type to NTSTATUS.
(reg_key::set_string): Ditto.
* registry.h: Accommodate above changes.
* environ.cc (regopt): Test return value of reg_key::get_string as
NTSTATUS.
* sched.cc (sched_rr_get_interval): Change local int vars to DWORD.
Call reg_key::get_dword instead of reg_key::get_int.
* shared.cc (init_installation_root): Test return value of
reg_key::get_string as NTSTATUS.
(shared_info::heap_slop_size): Call reg_key::get_dword rather than
reg_key::get_int.
(shared_info::heap_chunk_size): Ditto.
* shared_info.h (CURR_SHARED_MAGIC): Update.
(class shared_info): Change heap_chunk and heap_slop to DWORD values.
2011-04-21 Corinna Vinschen <corinna@vinschen.de>
* cygtls.cc (_cygtls::init_thread): Drop setting locals.process_logmask.
* cygtls.cc (_cygtls::remove): Always free mallocated TLS storage on
thread exit. Drop freeing locals.process_ident.
* cygtls.h (struct _local_storage): Remove syslog-related members.
* syslog.cc (syslog_globals): New static storage for global syslog
settings. Use throughout instead of _my_tls.locals.
(openlog): Set new syslog_globals.process_ident value more carefully.
* tlsoffsets.h: Regenerate.
2011-04-21 Thomas Stalder <cygwinml@gmail.com>
* include/sys/poll.h: Include signal.h to get definition of sigset_t.
2011-04-20 Christopher Faylor <me.cygwin2011@cgf.cx>
* cygheap.cc (init_cygheap::close_ctty): Avoid closing console-cttys
since they don't use archetypes and this will just result in double
frees.
* dll_init.cc (dll_list::protect): Define.
(dll_list::alloc): Guard list access.
(dll_list::detach): Ditto.
* dll_init.h (dll_list::protect): Declare new muto.
(dll_list::guard): Define/declare function to guard list access.
* fhandler_termios.cc (fhandler_termios::sigflush): Avoid SEGV in
pathological condition of get_ttyp() == NULL.
2011-04-20 Christopher Faylor <me.cygwin2011@cgf.cx>
* select.cc (serial_cleanup): Make sure that device_specific_pipe is
always deleted regardless of whether it has a unique thread associated
with it
(socket_cleanup): Ditto.
(mailslot_cleanup): Ditto.
2011-04-20 Corinna Vinschen <corinna@vinschen.de>
* devices.h: Renumber internal devices so that FH_PROCESS is part of
the /proc family of virtual devices.
(FH_PROC_MAX_MINOR): Define.
* path.h (isproc_dev): Use FH_PROC_MAX_MINOR rather than FH_PROC.
2011-04-19 Peter Rosin <peda@lysator.liu.se>
* select.cc (pipe_cleanup): Make sure that device_specific_pipe is
always deleted regardless of whether it has a unique thread associated
with it.
2011-04-19 Jon TURNEY <jon.turney@dronecode.org.uk>
* thread.cc (semaphore::init): We cannot reliably infer anything from
the existing contents of sem, so merely warn rather than return EBUSY
if it looks like we are reinitialising a semaphore.
2011-04-19 Corinna Vinschen <corinna@vinschen.de>
* autoload.cc (GetConsoleWindow): Drop.
(GetSystemWindowsDirectoryW): Drop.
* fhandler_console.cc (beep): Call GetSystemWindowsDirectoryW instead of
GetWindowsDirectoryW.
* uinfo.cc (cygheap_user::env_systemroot): Call
GetSystemWindowsDirectoryW and convert to multibyte on the fly.
* winlean.h (GetWindowsDirectoryW): Redefine to something invalid.
Explain why.
2011-04-19 Corinna Vinschen <corinna@vinschen.de>
* Makefile.in (DLL_IMPORTS): Drop advapi32.dll.
* autoload.cc: Enable autoloading advapi32 functions.
* environ.cc (regopt): Use wide char arguments in reg_key functions.
* fhandler_console.cc (beep): Ditto. Use WCHAR throughout.
* registry.cc (reg_key): Rewrite reg_key class to use native NT registry
functions. Use WCHAR string parameters throughout. Use PCWSTR rather
than const WCHAR. Drop multibyte char functionality. Drop unused
methods.
(get_registry_hive_path): Use RtlQueryRegistryValues to fetch path from
registry.
(load_registry_hive): Drop useless check for user hive being available.
Load hive using NtLoadKey.
* registry.h: Accommodate above changes.
* sched.cc (sched_rr_get_interval): Use wide char arguments in reg_key
functions.
* shared.cc (init_installation_root): Ditto.
(shared_info::init_obcaseinsensitive): Use RtlQueryRegistryValues to
fetch obcaseinsensitive value.
(shared_info::heap_slop_size): Use wide char arguments in reg_key
functions.
(shared_info::heap_chunk_size): Ditto.
* syscalls.cc (gethostid): Ditto.
* winsup.h (__WIDE): Define.
(_WIDE): Define.
* libc/minires-os-if.c (get_registry_dns_items): Don't fetch values
from registry. Just extract them from given UNICODE_STRING parameter.
(get_registry_dns): Fetch all registry values at once using
RtlQueryRegistryValues.
2011-04-19 Corinna Vinschen <corinna@vinschen.de>
* net.cc (get_ipv4fromreg_ipcnt): Rearrange to fetch all registry
values at once using RtlQueryRegistryValues.
(get_ipv4fromreg): Ditto.
2011-04-19 Corinna Vinschen <corinna@vinschen.de>
* fhandler_registry.cc (fhandler_registry::fstat): Use RegQueryInfoKeyW.
2011-04-19 Corinna Vinschen <corinna@vinschen.de>
* fhandler_proc.cc (read_value): Remove definition.
(print): Simplify.
(format_proc_cpuinfo): Drop useless call to GetSystemInfo. Rearrange
to use Rtl registry functions. Rename dwOldThreadAffinityMask to
orig_affinity_mask.
2011-04-18 Corinna Vinschen <corinna@vinschen.de>
* localtime.cc (tzload): Don't change global timezone information
when called from gmtime or gmtime_r.
(tzparse): Ditto.
2011-04-18 Corinna Vinschen <corinna@vinschen.de>
* cygtls.cc (_cygtls::remove): Always close sockevt handle.
2011-04-18 Corinna Vinschen <corinna@vinschen.de>
* cygwin.din (ppoll): Export.
* poll.cc (ppoll): Implement.
* posix.sgml (std-gnu): Add ppoll.
* include/cygwin/version.h: Bump API minor number.
* include/sys/poll.h (ppoll): Declare.
2011-04-18 Corinna Vinschen <corinna@vinschen.de>
* fhandler_socket.cc (fhandler_socket::evaluate_events): Handle the
FD_CLOSE event specially when called from accept. Explain why.
(fhandler_socket::shutdown): Fake success on not-connected socket and
trigger socket event if the read side of a socket is affected. Explain
why.
* poll.cc (poll): Check for saw_shutdown_read on sockets to generate
POLLHUP as well.
2011-04-18 Corinna Vinschen <corinna@vinschen.de>
* Fix various copyrights.
2011-04-17 Christopher Faylor <me.cygwin2011@cgf.cx>
* signal.cc (_pinfo::kill): Set this_process_state when process
exists.
2011-04-17 Christopher Faylor <me.cygwin2011@cgf.cx>
* signal.cc (_pinfo::kill): Return 0 when attempting to test for
existence of an existed process which has not yet been reaped.
2011-04-17 Christopher Faylor <me.cygwin2011@cgf.cx>
* cygheap.h (init_cygheap::ctty): Use base class so that console can
join in the fun.
* dtable.cc (dtable::stdio_init): Remove special-case call to
set_console_ctty ().
* exceptions.cc (sigpacket::process): Conditionally flush terminal
input on certain signals.
* fhandler.h (fhandler_console::get_tty_stuff): Make non-static.
(fhandler_termios::get_ttyp): Move here.
(fhandler_termios::sigflush): Declare.
(fhandler_tty_common::get_ttyp): Delete.
* fhandler_console.cc (fhandler_console::get_tty_stuff): Pass this as
"arch" argument.
(set_console_ctty): Delete.
(tty_list::get_tty): Just return pointer to shared console region,
delaying get_tty_stuff until open().
(fhandler_console::init): Treat NULL handle as signifying that console
should be opened with O_NOCTTY flag. Rename handle argument to the
more common 'h'.
* fhandler_termios.cc (fhandler_termios::sigflush): Define.
* fhandler_tty.cc (handler_tty_master::init_console): Pass NULL as
first argument to fhandler_console::init.
* pinfo.cc (_pinfo::set_ctty): Change third parameter to
fhandler_termios *. Add extra debugging.
* pinfo.h (_pinfo::set_ctty): Change third parameter to
fhandler_termios *.
* exceptions.cc (handle_sigsuspend): Don't special-case non-main threads.
2011-04-15 Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
* thread.cc (pthread_setschedprio): New function.
* include/pthread.h (pthread_setschedprio): Declare.
* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
* cygwin.din (pthread_setschedprio): Export.
* posix.sgml (std-notimpl) Move pthread_setschedprio from here...
(std-susv4) ...to here.
2011-04-10 Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
* fhandler_proc.cc (proc_tab): Add /proc/swaps virtual file.
(format_proc_swaps): New function.
2011-04-06 Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
* Makefile.in: Move srcdir definition before others which uses it.
2011-04-06 Jon TURNEY <jon.turney@dronecode.org.uk>
* dll_init.cc (reserve_at, release_at): New functions.
(load_after_fork): If the DLL was loaded higher than the required
address, assume that it loaded at it's base address and also reserve
memory there to force it to be relocated.
2011-04-04 Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
* include/cygwin/types.h: Move #include <sys/sysmacros.h> to
end of header so that it gets the dev_t typedef.
* include/sys/sysmacros.h (gnu_dev_major, gnu_dev_minor,
gnu_dev_makedev): Prototype and define as inline functions.
(major, minor, makedev): Redefine in terms of gnu_dev_*.
2011-04-04 Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
* include/cygwin/types.h: Move multiple inclusion guards to
beginning and end of header.
2011-04-04 Christopher Faylor <me.cygwin2011@cgf.cx>
* Makefile.in: Move Makefile.common include earlier to fix problems
with relative ${srcdir} path which confuses make.
2011-04-04 Corinna Vinschen <corinna@vinschen.de>
Drop NT4 support.
* autoload.cc (DnsQuery_A): Fatal if not available.
(DnsRecordListFree): Ditto.
(DsGetDcNameW): Ditto.
(NetGetAnyDCName): Remove.
(NetGetDCName): Remove.
(EnumProcessModules): Fatal if not available.
(GetModuleFileNameExW): Ditto.
(GetModuleInformation): Ditto.
(GetProcessMemoryInfo): Ditto.
(QueryWorkingSet): Ditto.
(LsaRegisterLogonProcess): Ditto.
* fenv.cc (_feinitialise): Drop supports_sse condition.
* fhandler_disk_file.cc (path_conv::isgood_inode): Fix comment.
(fhandler_base::fstat_by_name): Drop has_fileid_dirinfo condition.
(fhandler_disk_file::opendir): Ditto.
* fhandler_netdrive.cc (fhandler_netdrive::readdir): Fix comment.
* fhandler_proc.cc (format_proc_partitions): Drop NT4-only code.
* fhandler_process.cc (get_process_state): Ditto.
* kernel32.cc (GetWindowsDirectoryW): Remove.
(GetWindowsDirectoryA): Remove.
* miscfuncs.cc (nice_to_winprio): Drop NT4-only code.
* mount.cc (fs_info::update): Fix comments.
* net.cc (get_2k_ifs): Drop NT4-only code.
* sec_auth.cc (get_logon_server): Ditto.
(lsaauth): Drop NT4-specific error handling.
* security.cc (alloc_sd): Set SE_DACL_PROTECTED unconditionally.
* select.cc (select_stuff::wait): Always use MWMO_INPUTAVAILABLE.
(peek_windows): Drop NT4-only condition in call to PeekMessage.
* syscalls.cc (gethostid): Remove NT4-only workaround.
* wincap.cc: Througout, drop has_dacl_protect,
has_broken_if_oper_status, has_process_io_counters,
has_terminal_services, has_extended_priority_class, has_guid_volumes,
has_fileid_dirinfo, has_mwmo_inputavailable and supports_sse from
wincaps.
(wincap_nt4sp4): Remove.
(wincap_minimal): Set to wincap_2000.
(wincapc::init): Rely on availability of OSVERSIONINFOEX structure.
Treat error from GetVersionEx as fatal. Treat NT4 as fatal.
* wincap.h (struct wincaps): Drop has_dacl_protect,
has_broken_if_oper_status, has_process_io_counters,
has_terminal_services, has_extended_priority_class, has_guid_volumes,
has_fileid_dirinfo, has_mwmo_inputavailable and supports_sse flags
and methods.
* winlean.h (GetWindowsDirectoryW) Define as GetSystemWindowsDirectoryW.
(GetWindowsDirectoryA): Define as GetSystemWindowsDirectoryA.
2011-04-04 Corinna Vinschen <corinna@vinschen.de>
* dtable.cc (dtable::init_std_file_from_handle): Fix a comment to
reflect the current state.
2011-04-04 Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
* Makefile.in (fhandler_proc_CFLAGS): Define USERNAME, HOSTNAME,
and GCC_VERSION.
* fhandler_proc.cc (format_proc_version): Add build machine and GCC
version information as on Linux.
2011-04-04 Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
Corinna Vinschen <corinna@vinschen.de>
* devices.h (fh_devices): Define FH_PROC_MIN_MINOR.
Reorder major-0 devices so that all /proc directories fall
between FH_PROC and FH_PROC_MIN_MINOR.
* path.h (isproc_dev): Redefine accordingly.
2011-04-04 Corinna Vinschen <corinna@vinschen.de>
* cygserver_setpwd.h (setlsapwd): Add username parameter to declaration.
* external.cc (cygwin_internal): In the CW_SET_PRIV_KEY case, fetch
additional username parameter.
* setlsapwd.cc (setlsapwd): Add username parameter. Allow admin to
set the hidden password for other users.
2011-04-04 Corinna Vinschen <corinna@vinschen.de>
* sec_auth.cc (get_user_groups): Mark well-known groups as well-known.
(get_user_local_groups): Ditto.
(verify_token): Drop useless label.
* sec_helper.cc (cygsid::get_sid): Check for well-known SID if
well_known isn't set.
* security.h (well_known_sid_type): New inline function.
2011-04-02 Corinna Vinschen <corinna@vinschen.de>
* autoload.cc (FindFirstVolumeA): Remove.
(FindNextVolumeA): Remove.
(FindVolumeClose): Remove.
(GetVolumeNameForVolumeMountPointA): Remove.
* ntdll.h (NtFlushBuffersFile): Declare.
* syscalls.cc (sync_worker): Rewrite using native NT functions.
(sync): Ditto.
2011-04-02 Corinna Vinschen <corinna@vinschen.de>
* fhandler_proc.cc (format_proc_partitions): Express length in WCHAR
size.
2011-04-02 Corinna Vinschen <corinna@vinschen.de>
* autoload.cc (GetExtendedTcpTable): Remove.
(GetTcpTable): Remove.
(CharNextExA): Remove.
(FindWindowA): Remove.
(ShowWindowAsync): Remove.
* dcrt0.cc (disable_dep): Remove unused function.
(dll_crt0_0): Drop comment babbling about TS & DEP.
* fhandler_socket.cc (address_in_use): Remove unused function.
* wincap.cc: Throughout, drop ts_has_dep_problem from wincaps.
(wincapc::init): Drop code setting ts_has_dep_problem flag.
* wincap.h (struct wincaps): Drop ts_has_dep_problem flags and method.
2011-04-01 Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
Implement /proc/sysvipc/*
* devices.in (dev_procsysvipc_storage): Add.
* devices.cc: Regenerate.
* devices.h (fh_devices): Add FH_PROCSYSVIPC.
* dtable.cc (build_fh_pc): Add case FH_PROCSYSVIPC.
* fhandler.h (class fhandler_procsysvipc): Declare.
(fhandler_union): Add __procsysvipc.
* fhandler_proc.cc (proc_tab): Add sysvipc virt_directory.
* fhandler_procsysvipc.cc: New file.
* Makefile.in (DLL_OFILES): Add fhandler_procsysvipc.o.
* path.h (isproc_dev): Add FH_PROCSYSVIPC to conditional.
2011-04-01 Corinna Vinschen <corinna@vinschen.de>
* Makefile.in (DLL_OFILES): Add avapi32.o.
* advapi32.cc: New file.
* autoload.cc: Add block of remaining advapi32 functions used by
Cygwin. Keep commented out. Explain why.
2011-04-01 Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
* fhandler_proc.cc (format_proc_loadavg): Add running/total
processes as fourth component of output.
* fhandler_process.cc (get_process_state): Make non-static.
Add FIXME about generating an 'O' flag.
2011-04-01 Corinna Vinschen <corinna@vinschen.de>
* fhandler_random.cc (fhandler_dev_random::crypt_gen_random):
Use CryptAcquireContextW.
* ntdll.h (STATUS_PROCEDURE_NOT_FOUND): Define.
* sec_auth.cc (open_local_policy): Rename NTSTATUS variable ret to
status. Drop usage of LsaNtStatusToWinError.
(verify_token): Call NtQuerySecurityObject instead of
GetKernelObjectSecurity.
(create_token): Rename NTSTATUS variable ret to status. Rename ret2 to
sub_status. Drop usage of LsaNtStatusToWinError. In case LsaLogonUser
fails, report the sub_status as well.
2011-04-01 Corinna Vinschen <corinna@vinschen.de>
* libc/strptime.c: Remove misleading comment.
2011-03-31 Corinna Vinschen <corinna@vinschen.de>
* ntdll.h: Allow usage from plain C code.
(FSCTL_PIPE_IMPERSONATE): Define.
(enum _THREAD_INFORMATION_CLASS): Define.
(RTL_QUERY_REGISTRY_xxx): Define.
(RTL_REGISTRY_xxx): Define.
(PRTL_QUERY_REGISTRY_ROUTINE): Define.
(struct _RTL_QUERY_REGISTRY_TABLE): Define.
(enum _KEY_VALUE_INFORMATION_CLASS): Define.
(struct _KEY_VALUE_PARTIAL_INFORMATION): Define.
(NtAccessCheck): Declare.
(NtAllocateLocallyUniqueId): Declare.
(NtCreateKey): Declare.
(NtDuplicateToken): Declare.
(NtLoadKey): Declare.
(NtOpenKey): Declare.
(NtOpenProcessToken): Declare.
(NtOpenThreadToken): Declare.
(NtPrivilegeCheck): Declare.
(NtQueryInformationToken): Declare.
(NtQueryValueKey): Declare.
(NtSetInformationThread): Declare.
(NtSetInformationToken): Declare.
(NtSetValueKey): Declare.
(RtlAbsoluteToSelfRelativeSD): Declare.
(RtlAddAccessAllowedAce): Declare.
(RtlAddAccessDeniedAce): Declare.
(RtlAddAce): Declare.
(RtlCheckRegistryKey): Declare.
(RtlCopySid): Declare.
(RtlCreateAcl): Declare.
(RtlCreateRegistryKey): Declare.
(RtlCreateSecurityDescriptor): Declare.
(RtlEqualPrefixSid): Declare.
(RtlEqualSid): Declare.
(RtlFirstFreeAce): Declare.
(RtlGetAce): Declare.
(RtlGetDaclSecurityDescriptor): Declare.
(RtlGetGroupSecurityDescriptor): Declare.
(RtlGetOwnerSecurityDescriptor): Declare.
(RtlIdentifierAuthoritySid): Declare.
(RtlInitializeSid): Declare.
(RtlLengthSid): Declare.
(RtlQueryRegistryValues): Declare.
(RtlSetControlSecurityDescriptor): Declare.
(RtlSetDaclSecurityDescriptor): Declare.
(RtlSetGroupSecurityDescriptor): Declare.
(RtlSetOwnerSecurityDescriptor): Declare.
(RtlSubAuthorityCountSid): Declare.
(RtlSubAuthoritySid): Declare.
(RtlWriteRegistryValue): Declare.
2011-03-31 Corinna Vinschen <corinna@vinschen.de>
* uinfo.cc (cygheap_user::init): Don't call GetUserName. Fetch username
from Windows environment instead. Explain why.
(cygheap_user::env_domain): Use MAX_DOMAIN_NAME_LEN rather than DNLEN
to specify the size of the domain name buffer.
2011-03-30 Corinna Vinschen <corinna@vinschen.de>
* hires.h: Fix copyright.
* times.cc: Ditto.
(FACTOR): Add comment.
(NSPERSEC): Ditto.
(JITTER): New definition. Comment.
(systime_ns): Avoid gratuitous copying of the value returned by
GetSystemTimeAsFileTime.
(corelocaltime, localtime, gmtime): Remove very old, unused code block.
(cygwin_tzset): Remove.
(hires_ms::timeGetTime_ns): Add missing semicolon in comment.
(hires_ms::nsecs): Redefine check for difference between internal
timer value and system time.
2011-03-30 Corinna Vinschen <corinna@vinschen.de>
* times.cc (hires_ms::resolution): Make sure resolution is never 0.
(clock_setres): Ditto.
2011-03-29 Corinna Vinschen <corinna@vinschen.de>
* cygtls.h (struct _local_storage): Redefine process_ident as wchar_t
pointer.
* syslog.cc (CYGWIN_LOG_NAME): Convert to wide char constant.
(openlog): Convert incoming ident string to wide char. Fix formatting.
(vsyslog): Print ident string as wide char string. Convert message
string to wide char and call UNICODE Win32 Event functions to make sure
to use correct codeset.
* tlsoffset.h: Regenerate.
2011-03-29 Corinna Vinschen <corinna@vinschen.de>
* fhandler_socket.cc (get_inet_addr): Make externally available.
* autoload.cc (GetUdpTable): Define.
* syslog.cc (connect_syslogd): Use get_inet_addr rather than _stat64
to check for local socket file. Create socket with type returned by
get_inet_addr. If connect on UDP socket works, test if there's
really a listening peer, otherwise fall back to Windows event log.
(try_connect_syslogd): Use syslogd_inited flag to check if syslogd
is available.
2011-03-29 Corinna Vinschen <corinna@vinschen.de>
* uinfo.cc (cygheap_user::env_domain): Use LookupAccountSidW and
convert user and domain to multibyte strings to make sure to use
correct codeset.
2011-03-29 Corinna Vinschen <corinna@vinschen.de>
* autoload.cc (UuidCreate): Remove.
(UuidCreateSequential): Remove.
* passwd.cc (internal_getpwsid): Avoid a strict-aliasing compiler
error with gcc 4.5.1.
* fhandler_floppy.cc (fhandler_dev_floppy::get_drive_info): Ditto.
* ntdll.h (NtAllocateUuids): Declare.
* syscalls.cc (gethostid): Use NtAllocateUuids function rather than
UuidCreateSequential/UuidCreate to get rid of rpcrt4 dependency.
2011-03-29 Corinna Vinschen <corinna@vinschen.de>
* cygwin.din (pthread_spin_destroy): Export.
(pthread_spin_init): Export.
(pthread_spin_lock): Export.
(pthread_spin_trylock): Export.
(pthread_spin_unlock): Export.
* posix.sgml (std-susv4): Add pthread_spin_destroy, pthread_spin_init,
pthread_spin_lock, pthread_spin_trylock, pthread_spin_unlock.
(std-notimpl): Remove pthread_spin_[...].
* pthread.cc (pthread_spin_init): New function.
* thread.cc (pthread_spinlock::is_good_object): New function.
(pthread_mutex::pthread_mutex): Rearrange initializers to accommodate
protected data in pthread_mutex.
(pthread_spinlock::pthread_spinlock): New constructor.
(pthread_spinlock::lock): New method.
(pthread_spinlock::unlock): New method.
(pthread_spinlock::init): New method.
(pthread_spin_lock): New function.
(pthread_spin_trylock): New function.
(pthread_spin_unlock): New function.
(pthread_spin_destroy): New function.
* thread.h (PTHREAD_SPINLOCK_MAGIC): Define.
(class pthread_mutex): Change access level of members shared with
derived classes to protected.
(pthread_mutex::set_shared): New protected method.
(class pthread_spinlock): New class, derived class of pthread_mutex.
* include/pthread.h (pthread_spin_destroy): Declare.
(pthread_spin_init): Declare.
(pthread_spin_lock): Declare.
(pthread_spin_trylock): Declare.
(pthread_spin_unlock): Declare.
* include/cygwin/types.h (pthread_spinlock_t): New typedef.
* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
2011-03-29 Corinna Vinschen <corinna@vinschen.de>
* net.cc (SIO_BASE_HANDLE): Define.
(fdsock): If we got an LSP handle, try to create a copy of the base
handle instead. Change comment to explain.
2011-03-29 Corinna Vinschen <corinna@vinschen.de>
* include/cygwin/version.h: Bump CYGWIN_VERSION_DLL_MINOR to 10.
2011-03-29 Corinna Vinschen <corinna@vinschen.de>
* autoload.cc (winmm): Remove time functions. Don't treat
unloadable wave functions as fatal.
* hires.h (hires_ms::timeGetTime_ns): New private method.
(hires_ms::dmsecs): Call timeGetTime_ns here.
* ntdll.h (struct _KSYSTEM_TIME): Define.
(KUSER_SHARED_DATA): Redefine to allow access to InterruptTime.
(SharedUserData): Define here.
(NtQueryTimerResolution): Declare.
(NtSetTimerResolution): Declare.
* path.cc (SharedUserData): Move to ntdll.h.
* times.cc (hires_ms::timeGetTime_ns): New private method.
Use throughout instead of timeGetTime. Document entire functionality
of timeGetTime in case we need it.
(hires_ms::resolution): Try a call to NtQueryTimerResolution
to fetch current period. Fall back to heuristic if that fails.
Cast to DWORD in assignments to minperiod.
(clock_setres): Align period to possible values per a call to
NtQueryTimerResolution. Explain why. Replace calls to timeBeginPeriod
and timeEndPeriod with underlying call to NtSetTimerResolution. Use
status code from NtSetTimerResolution to compute errno.
Convert period to ULONGLONG and store 100ns value to simplify code.
2011-03-29 Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
Corinna Vinschen <corinna@vinschen.de>
* include/sys/xattr.h: New file.
2011-03-28 Jon TURNEY <jon.turney@dronecode.org.uk>
* thread.cc (semaphore::init, destroy, close): Standards conformance
fix. On a failure, return -1 and set errno.
* thread.h (semaphore::terminate): Save errno since semaphore::close()
may now modify it.
2011-03-27 Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
* cygwin.din (strchrnul): Export.
* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
* posix.sgml (std-gnu): Add strchrnul.
2011-03-27 Christopher Faylor <me.cygwin2011@cgf.cx>
* dll_init.cc (dll::init): Accommodate ill-behaved dlls who don't fill
out p.envptr.
2011-03-25 Corinna Vinschen <corinna@vinschen.de>
* mmap.cc (mmap64): Add a cheat to let a certain autoconf test succeed
on 64 bit systems. Explain why.
2011-03-23 Christopher Faylor <me.cygwin2011@cgf.cx>
* wincap.cc (wincap_2003): Set use_dont_resolve_hack to true.
2011-03-23 Christopher Faylor <me.cygwin2011@cgf.cx>
* autoload.cc (dll_load): Change error message to make it clear if a
newer DLL is being run.
2011-03-20 Corinna Vinschen <corinna@vinschen.de>
* fenv.cc (_feinitialise): Don't use SSE instructions on systems not
supporting them.
* wincap.h (wincaps::supports_sse): New element.
* wincap.cc: Implement above element throughout.
2011-03-18 Corinna Vinschen <corinna@vinschen.de>
* cygwin.sc: Raise default cygheap size to 2 Megs.
2011-03-18 Christopher Faylor <me.cygwin2011@cgf.cx>
* fhandler.h (DEFAULT_PIPEBUFSIZE): Reset to 64K.
2011-03-18 Corinna Vinschen <corinna@vinschen.de>
* mmap.cc (mmap_record::alloc_fh): Initialize name strings in fdev to
empty strings or suffer a SEGV. Drop second parameter in call to
build_fh_dev.
2011-03-18 Corinna Vinschen <corinna@vinschen.de>
* mmap.cc (class mmap_record): Pack 4 byte-aligned. Convert member dev
to plain int.
(mmap_record::alloc_fh): Create temporary device from dev and use in
call to build_fh_dev.
2011-03-18 Corinna Vinschen <corinna@vinschen.de>
* mmap.cc (mmap_record::page_map): Define as variable array rather than
as pointer.
(mmap_record::alloc_page_map): Remove.
(mmap_record::free_page_map): Remove.
(mmap_record::init_page_map): New method.
(mmap_record::add_record): Take mmap_record parameter by reference
rather than by value.
(mmap_record::map_pages): Fix comment.
(mmap_list::add_record): Allocate space for mmap_record including the
page_map in a single ccalloc call. Call init_page_map afterwards.
(mmap_list::del_record): Remove call to mmap_record::free_page_map.
2011-03-16 Corinna Vinschen <corinna@vinschen.de>
* crt0.c (mainCRTStartup): Move call to _feinitialise from here...
* dcrt0.cc (_dll_crt0): ...to here.
2011-03-16 Corinna Vinschen <corinna@vinschen.de>
* winver.rc: Fix copyright dates.
2011-03-14 Corinna Vinschen <corinna@vinschen.de>
* fhandler_disk_file.cc (fhandler_base::fstat_by_handle): Only use
file id as inode number if it masters the isgood_inode check.
2011-03-13 Christopher Faylor <me.cygwin2011@cgf.cx>
* fhandler.cc (fhandler_base_overlapped::wait_overlapped): Remove
special treatment for ERROR_NO_SYSTEM_RESOURCES. Cancel I/O and reset
the overlapped handle on error.
(fhandler_base_overlapped::write_overlapped): Limit writes to
max_atomic_write bytes in blocking case. Incorporate code from
now-defunct write_overlapped_fallback. Fix serious oversight where ptr
was not advanced as buffer was written.
(fhandler_base_overlapped::write_overlapped_fallback): Eliminate.
* fhandler.h (fhandler_base_overlapped::write_overlapped_fallback):
Ditto for declaration.
(DEFAULT_PIPEBUFSIZE): Lower size to slightly less than documented
worst-case atomic write size.
(fhandler_overlapped::wait_return): Remove unused element.
2011-03-09 Christopher Faylor <me.cygwin2011@cgf.cx>
* fhandler.cc (fhandler_base_overlapped::wait_overlapped): Handle
overlapped_fallback error condition like other error conditions. Set
res carefully and specifically for each condition rather than resorting
to a default.
(fhandler_base_overlapped::write_overlapped): Preserve errno in
overlapped_fallback condition. Correct write_overlapped_fallback to
avoid inappropriate looping.
(fhandler_base_overlapped::write_overlapped_fallback): Add some more
comments.
2011-03-09 Christopher Faylor <me.cygwin2011@cgf.cx>
* fhandler.cc (fhandler_base_overlapped::write_overlapp): Oops!
Accommodate change in arguments to wait_overlapped.
2011-03-09 Christopher Faylor <me+cygwin@cgf.cx>
* errno.cc (errmap): Change mapping of NO_SYSTEM_RESOURCES to EFBIG.
* fhandler.cc (MAX_OVERLAPPED_WRITE_LEN): New constant.
(MIN_OVERLAPPED_WRITE_LEN): Ditto.
(fhandler_base_overlapped::close): Accommodate change in arguments to
wait_overlapped.
(fhandler_base_overlapped::setup_overlapped): Add __stdcall and regparm
modifiers.
(fhandler_base_overlapped::destroy_overlapped): Ditto.
(fhandler_base_overlapped::has_ongoing_io): Ditto.
(fhandler_base_overlapped::wait_overlapped): Modify to return an enum
returning various states. Accept nonblocking parameter.
(fhandler_base_overlapped::read_overlapped): Add __stdcall and regparm
modifiers. Rework to attempt to be smarter about reacting to states
returned by wait_overlapped.
(fhandler_base_overlapped::write_overlapped): Ditto. Add fallback
option for when wait_overlapped detects that smaller chunks must be
written.
(fhandler_base_overlapped::write_overlapped_fallback): Ditto.
* fhandler.h (DEFAULT_PIPEBUFSIZE): Move definition here from pipe.cc.
(fhandler_base::has_ongoing_io): Define with __stdcall and regparm
modifiers.
(fhandler_base_overlapped::wait_return): New enum.
(fhandler_base_overlapped::max_atomic_write): New variable.
(fhandler_base_overlapped:: wait_overlapped): Accommodate changes
mentioned above to arguments and modifiers.
(fhandler_base_overlapped::setup_overlapped): Ditto for modifiers.
(fhandler_base_overlapped::read_overlapped): Ditto.
(fhandler_base_overlapped::write_overlapped): Ditto.
(fhandler_base_overlapped::destroy_overlapped): Ditto.
(fhandler_base_overlapped::has_ongoing_io): Ditto.
(fhandler_base_overlapped::fhandler_base_overlapped): Zero
max_atomic_write.
* fhandler_fifo.cc (fhandler_fifo::fhandler_fifo): Set max_atomic_write
to the size of the DEFAULT_PIPEBUFSIZE.
(fhandler_fifo::wait): Accommodate change in arguments to
wait_overlapped.
* pipe.cc (fhandler_pipe::fhandler_pipe): Set max_atomic_write to the
size of the DEFAULT_PIPEBUFSIZE.
(fhandler_pipe::create_selectable): Allow minimum size of DEFAULT_PIPEBUFSIZE.
(DEFAULT_PIPEBUFSIZE): Delete here, move to fhandler.h.
2011-03-08 Corinna Vinschen <corinna@vinschen.de>
* security.cc: Fix copyright dates.
2011-03-08 Corinna Vinschen <corinna@vinschen.de>
* fhandler.cc (fhandler_base::open): When creating a file on a
filesystem supporting ACLs, create the file with WRITE_DAC access.
Explain why.
* fhandler_disk_file.cc (fhandler_disk_file::mkdir): Ditto for
directories.
* fhandler_socket.cc (fhandler_socket::bind): Ditto for sockets.
* path.cc (symlink_worker): Ditto for symlinks.
* security.cc (get_file_sd): Always call GetSecurityInfo for directories
on XP and Server 2003. Improve comment to explain why.
(set_file_attribute): Explicitely cast mode_t value to bool in call to
get_file_sd.
* wincap.h (wincaps::use_get_sec_info_on_dirs): New element.
* wincap.cc: Implement above element throughout.
2011-03-04 Corinna Vinschen <corinna@vinschen.de>
* fhandler_procsys.cc (fhandler_procsys::exists): Rewrite.
(fhandler_procsys::fill_filebuf): Fill buffer with valid string even if
reading the symlink fails.
2011-03-03 Corinna Vinschen <corinna@vinschen.de>
* posix_ipc.cc (ipc_cond_timedwait): If ipc_mutex_unlock fails, return
actual error number.
(_mq_send): Break loop if ipc_cond_timedwait returns with error.
(_mq_receive): Ditto.
2011-03-03 Corinna Vinschen <corinna@vinschen.de>
* errno.cc (__xpg_strerror_r): Add accidentally missing condition.
2011-03-02 Corinna Vinschen <corinna@vinschen.de>
* fhandler_procsys.cc (fhandler_procsys::open): Call worker exists
method, rather than wrapper.
2011-03-01 Christopher Faylor <me+cygwin@cgf.cx>
* autoload.cc (dll_load): Avoid in_forkee test since this apparently
fails even when not forked.
2011-03-01 Christopher Faylor <me+cygwin@cgf.cx>
* include/cygwin/version.h: Bump CYGWIN_VERSION_DLL_MINOR to 9.
2011-02-28 Christopher Faylor <me+cygwin@cgf.cx>
* autoload.cc (dll_load): Only perform DONT_RESOLVE_DLL_REFERENCES hack
on systems which need it.
* wincap.cc (use_dont_resolve_hack): Set as appropriate.
* wincap.h (use_dont_resolve_hack): Define.
2011-02-28 Christopher Faylor <me+cygwin@cgf.cx>
* autoload.cc (dll_load): Make inline. Clarify logic.
2011-02-27 Corinna Vinschen <corinna@vinschen.de>
* autoload.cc (dll_load): Only call LoadLibraryExW with
DONT_RESOLVE_DLL_REFERENCES if a normal LoadLibrary call failed with
ERROR_INVALID_ADDRESS.
(LsaRegisterLogonProcess): Align comment to previous change.
2011-02-26 Christopher Faylor <me+cygwin@cgf.cx>
* autoload.cc: Use LoadDLLfuncEx3 for all winmm functions. Accommodate
changes to LoadDLLprime.
(LoadDLLprime): Take an extra argument indicating whether this dll
needs special handling on fork. Place this information in the "handle"
location.
(LoadDLLfuncEx3): Eliminate "func" handling. Pass new
no_resolve_on_fork argument to LoadDLLprime.
(dll_load): New function.
(std_dll_init): Accommodate changes to dll_info::handle. Use dll_load
to load DLL in both cases where it is used.
2011-02-26 Corinna Vinschen <corinna@vinschen.de>
* autoload.cc: Make autoloaded ntdll function non-optional. Ditto for
secur32 functions, except for LsaRegisterLogonProcess. Change return
value to ERROR_PROC_NOT_FOUND. Explain why.
* sec_auth.cc (lsaauth): Handle ERROR_PROC_NOT_FOUND from call to
LsaRegisterLogonProcess when generating the errno value.
2011-02-22 Corinna Vinschen <corinna@vinschen.de>
* dcrt0.cc: Fix copyright dates.
* winsup.h: Ditto.
* syscalls.cc (_read): Move EXPORT_ALIAS to its rightful place.
2011-02-21 Christopher Faylor <me+cygwin@cgf.cx>
* cygwin.din: Mark __assert* and _abort as NOSIGFE.
2011-02-21 Corinna Vinschen <corinna@vinschen.de>
* fhandler_socket (fhandler_socket::readv): Call recv_internal directly,
rather than recvmsg.
(fhandler_socket::writev): Call send_internal directly, rather than
sendmsg.
* net.cc (cygwin_recv): Call fhandler_socket::recvfrom directly, rather
than cygwin_recvfrom.
(cygwin_send): Call fhandler_socket::sendto directly, rather than
cygwin_sendto.
2011-02-20 Christopher Faylor <me+cygwin@cgf.cx>
* fhandler.cc (fhandler_base_overlapped::close): Finish any pending I/O
before closing.
(fhandler_base_overlapped::wait_overlapped): Defensively zero bytes
read. Add more info to debugging output.
2011-02-18 Christopher Faylor <me+cygwin@cgf.cx>
* dcrt0.cc (dll_crt0_1): Add a CYGHEAP_DEBUG conditional for debugging
which allocates a lot of space at startup.
2011-02-18 Corinna Vinschen <corinna@vinschen.de>
* cygwin.sc: Set alignment of .cygheap section to 64K.
2011-02-15 Corinna Vinschen <corinna@vinschen.de>
* spawn.cc (spawn_guts): Only set PID_NOTCYGWIN in _P_OVERLAY mode.
Drop flag if creating new process failed.
2011-02-15 Corinna Vinschen <corinna@vinschen.de>
* Throughout fix copyright dates.
2011-02-15 Corinna Vinschen <corinna@vinschen.de>
* devices.in: Throughout use slashes instead of backslashes in the
native path of devices not backed by native NT devices.
* devices.cc: Regenerate.
* globals.cc (ro_u_pmem): Use correct case.
(ro_u_globalroot): New R/O unicode string.
* path.cc (path_conv::check): Fix incorrect handling of /proc/sys
block devices if they are just visited due to a component check.
(symlink_info::posixify): Fix typo in comment.
(cygwin_conv_path): Use ro_u_globalroot instead of string constant.
(fast_cwd_version): New shared variable to store FAST_CWD version
used on the system.
(find_fast_cwd_pointer): Rename from find_fast_cwd_pointers. Don't
set global fast_cwd_ptr pointer here. Return pointer value instead.
(find_fast_cwd): New function to set fast_cwd_ptr and fast_cwd_version.
(cwdstuff::override_win32_cwd): Call find_fast_cwd from here.
Check for fast_cwd_version to differ between old and new FAST_CWD
structure. Check old_cwd for NULL to avoid SEGV. Don't set CWD if
we have neitehr a valid fast_cwd_ptr, nor a valid CWD handle in the
process parameter block.
(cwdstuff::set): Create Win32 path taking /proc/sys paths into account.
* spawn.cc (spawn_guts): Recode creating runpath. Also take /proc/sys
paths into account. Drop special CWD handling when starting non-Cygwin
processes.
2011-02-15 Corinna Vinschen <corinna@vinschen.de>
* fhandler_procsys.cc (fhandler_procsys::opendir): Avoid SEGV if
opening object directory fails.
* fhandler_virtual.cc (fhandler_virtual::opendir): Don't leak memory.
2011-02-15 Corinna Vinschen <corinna@vinschen.de>
* fhandler_disk_file.cc (fhandler_disk_file::readdir_helper): Don't
append slash if there is one already.
2011-02-15 Corinna Vinschen <corinna@vinschen.de>
Revert change from 2010-08-31:
* path.cc (normalize_posix_path): Drop support for //./ and //?/
prefixes.
(path_conv::check): Ditto.
2011-02-15 Corinna Vinschen <corinna@vinschen.de>
* fhandler_disk_file.cc (fhandler_disk_file::readdir_helper): Use POSIX
path to check for symlink.
2011-02-14 Corinna Vinschen <corinna@vinschen.de>
* config/i386/profile.h: Sync with Mingw.
2011-02-13 Corinna Vinschen <corinna@vinschen.de>
* path.cc (struct _FAST_CWD): Redefine to new layout used since patch
for KB 2393802. Adjust comments throughout.
(struct _FAST_CWD_OLD): Rename former definition.
(cwdstuff::override_win32_cwd): Check if the OS is using the old or the
new FAST_CWD structure layout and handle accordingly.
2011-02-11 Christopher Faylor <me+cygwin@cgf.cx>
* mkstatic: Make sure that we are not cd'ed to temporary directory on
exit to avoid bogus warnings on directory cleanup.
* speclib: Ditto.
* mkimport: Ditto.
2011-02-11 Christopher Faylor <me+cygwin@cgf.cx>
* cygwin.sc: Eliminate __cygheap_mid.
* cygheap.cc: Ditto.
2011-02-11 Christopher Faylor <me+cygwin@cgf.cx>
* cygheap.cc (_cygheap_mid): Drop unneeded section attribute.
(cygheap_init): Just zero cygheap structure.
* cygwin.sc: Keep 16 byte alignment but drop all other alignments
related to cygheap. Eliminate unused __cygheap_end1.
2011-02-11 Corinna Vinschen <corinna@vinschen.de>
* cygwin.sc: Raise default cygheap size to 1 Meg. Set alignment to
standard 64K.
2011-02-11 Corinna Vinschen <corinna@vinschen.de>
* include/endian.h: Move definitions of __BIG_ENDIAN, __LITTLE_ENDIAN,
and __BYTE_ORDER into ...
* include/bits/endian.h: New file.
* include/arpa/nameser_compat.h: Include endian.h rather than defining
BYTE_ORDER here.
* include/asm/byteorder.h: Include bits/endian.h. Drop definition of
__LITTLE_ENDIAN.
* include/netinet/ip.h: Include bits/endian.h. Drop definitions of
BIG_ENDIAN, LITTLE_ENDIAN, and BYTE_ORDER. Use underscored variants
of aforementioned constants.
* include/netinet/tcp.h: Ditto.
* include/sys/param.h: Drop disabled definitions of BIG_ENDIAN,
LITTLE_ENDIAN, and BYTE_ORDER.
* include/netinet/ip.h: Reformat. Define setsockopt IP_TOS options
matching recent RFCs. Tweak comments.
2011-02-10 Eric Blake <eblake@redhat.com>
* errno.cc (includes): Avoid compilation failure if <string.h>
settles on wrong strerror_r signature.
* errno.cc (__xpg_strerror_r): New function.
(strerror_r): Update to copy newlib's fixes.
(strerror): Set errno on failure.
(_sys_errlist): Cause EINVAL failure for reserved values.
* cygwin.din: Export new function.
* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Combine
this into minor 236.
2011-02-09 Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
* cygwin.din (pthread_yield): Export as alias to sched_yield.
* include/pthread.h (pthread_yield): Declare.
* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
* posix.sgml (std-deprec): Add pthread_yield.
2011-02-09 Christopher Faylor <me+cygwin@cgf.cx>
* cygheap.cc: Add some __stdcall decoration where appropriate.
* lib/cygwin_crt0.c: __attribute -> __attribute__.
2011-02-09 Christopher Faylor <me+cygwin@cgf.cx>
* hookapi.cc (hook_or_detect_cygwin): Prevent i from being considered
uninitialized by gcc.
2011-02-09 Christopher Faylor <me+cygwin@cgf.cx>
* exception.h: Remove DEBUG_EXCEPTION left over debugging ifdef.
2011-02-08 Christopher Faylor <me+cygwin@cgf.cx>
* dll_init.cc: Fix typo in comment.
2011-02-07 Corinna Vinschen <corinna@vinschen.de>
* configure.in: Remove AC_ALLOCA test and test for __builtin_memset.
* configure: Regenerate.
2011-02-07 Corinna Vinschen <corinna@vinschen.de>
* fhandler_console.cc (fhandler_console::write_normal): Remove
erroneous premature return after collecting truncated multibyte
sequence in trunc_buf. Rather fall through to printing routine.
Fix return value to take trunc_buf content into account. Improve
comments.
2011-02-05 Christopher Faylor <me+cygwin@cgf.cx>
* autoload.cc (wsock_init): Properly define WSAStartup function pointer
to avoid stack damage.
2011-02-02 Corinna Vinschen <corinna@vinschen.de>
* libc/bsdlib.cc: Include err.h.
2011-02-02 Eric Blake <eblake@redhat.com>
* include/err.h: Fix loss of semicolons in previous patch.
2011-02-02 Corinna Vinschen <corinna@vinschen.de>
* include/err.h (err): Add noreturn attribute.
(errx): Ditto.
(verr): Ditto.
(verrx): Ditto.
2011-02-02 Corinna Vinschen <corinna@vinschen.de>
* path.cc (conv_path_list): Remove enclosing quotes and trailing
backslashes from Win32 environment path lists.
2011-02-01 Christian Franke <franke@computer.org>
* fhandler.cc (fhandler_base::fsync): Ignore ERROR_INVALID_FUNCTION
error from FlushFileBuffers().
2011-01-31 Corinna Vinschen <corinna@vinschen.de>
* syscalls.cc (utmp_data): Fix potential buffer overflow.
2011-01-31 Corinna Vinschen <corinna@vinschen.de>
* fhandler_socket.cc (address_in_use): Improve comment readability.
2011-01-30 Corinna Vinschen <corinna@vinschen.de>
* fhandler_socket.cc (address_in_use): Disable. Add comment.
(fhandler_socket::bind): Change comment to explain setting the
SO_EXCLUSIVEADDRUSE socket option. Remove code which checks for
address in use.
* net.cc (cygwin_setsockopt): Never set SO_REUSEADDR option. Improve
comment to compensate for the deleted comment in fhandler_socket::bind.
* wincap.cc: Throughout, drop has_enhanced_socket_security from wincaps.
* wincap.h (struct wincaps): Drop has_enhanced_socket_security flags
and method.
2011-01-28 Peter Foley <jpfoley2@verizon.net>
* configure.in: Define LIBSERVER regardless of cross_host.
* configure: Regenerate.
2011-01-28 Corinna Vinschen <corinna@vinschen.de>
* fhandler_socket.cc (fhandler_socket::wait_for_events): Call
pthread_testcancel in case of timeout to enable pthread_cancel
on waiting thread.
2011-01-27 Corinna Vinschen <corinna@vinschen.de>
* include/features.h (__STDC_ISO_10646__): Move to newlib's
sys/features.h.
2011-01-26 Corinna Vinschen <corinna@vinschen.de>
* fhandler_disk_file.cc (fhandler_base::fstat_by_nfs_ea): Fix
computation of st_blocks.
(fhandler_base::fstat_helper): Fix formatting.
2011-01-24 Corinna Vinschen <corinna@vinschen.de>
* include/features.h (__STDC_ISO_10646__): Define. Add comment.
2011-01-21 Corinna Vinschen <corinna@vinschen.de>
* syscalls.cc (rename): Fix permission problem with symlinks on NFS.
Rework how NtOpenFile gets called to make it more readable. Change
comment.
2011-01-20 Corinna Vinschen <corinna@vinschen.de>
* exec.cc: Include pinfo.h.
* winf.h: Move definitions of _P_PATH_TYPE_EXEC and _P_MODE from here...
* pinfo.h: ...to here.
(_P_PATH_TYPE_EXEC): Redefine to be bigger than _P_SYSTEM.
(_P_MODE): Redefine so as not to mask out _P_SYSTEM.
* spawn.cc (spawnlp): Add _P_PATH_TYPE_EXEC flag in call to spawnve.
(spawnlpe): Ditto.
(spawnvp): Ditto.
2011-01-19 Corinna Vinschen <corinna@vinschen.de>
* spawn.cc (av::fixup): Reenable #! handling for all exec functions.
Return ENOEXEC in !p_type_exec case only for unrecognized files.
Fix comment formatting.
2011-01-19 Corinna Vinschen <corinna@vinschen.de>
* exec.cc (execlp): Add missing _P_PATH_TYPE_EXEC flag in call to
spawnve.
2011-01-19 Corinna Vinschen <corinna@vinschen.de>
* exec.cc: Rearrange functions in alphabetical order.
(_execve): Drop temporary define and drop export alias.
(execl): Call spawnve.
(execle): New function.
(execlp): New function.
(execv): Call spawnve.
(execve): Drop converting NULL envp to emtpy envp.
(execvp): Call spawnve.
(execvpe): Drop converting NULL envp to emtpy envp. Call spawnve.
(fexecve): Call spawnve.
* spawn.cc (spawnve): Convert NULL envp to emtpy envp. Remove outdated
comment.
(spawnlp): Call spawnve.
(spawnlpe): Ditto.
(spawnvp): Ditto.
(spawnvpe): Fix formatting.
2011-01-19 Corinna Vinschen <corinna@vinschen.de>
* exec.cc (strccpy): Move function from here...
* strfuncs.cc (strccpy): ...to here.
* string.h (strccpy): Declare.
* winsup.h (strccpy): Drop declaration.
2011-01-19 Corinna Vinschen <corinna@vinschen.de>
* errno.cc (errmap): Add error codes for invalid binaries.
* exec.cc (execvp): Call spawnve with _P_PATH_TYPE_EXEC flag
from here.
(execvpe): Ditto.
* spawn.cc (spawn_guts): Filter _P_PATH_TYPE_EXEC from mode and
store in p_type_exec. Call av::fixup with addtional p_type_exec
argument.
(spawnve): Check for filtered mode.
(spawnvpe): Add _P_PATH_TYPE_EXEC flag when calling spawnve.
(av::fixup): Accept additional bool parameter p_type_exec. Only check
for script if p_type_exec is true.
* winf.h (_P_PATH_TYPE_EXEC): Define.
(_P_MODE): Define.
(av::fixup): Declare with additional bool parameter.
2011-01-17 Corinna Vinschen <corinna@vinschen.de>
* fhandler_proc.cc (format_proc_partitions): Fix compiler warning.
2011-01-17 Corinna Vinschen <corinna@vinschen.de>
* path.cc (path_conv::check): Don't follow reparse point symlinks if
PC_SYM_NOFOLLOW_REP flag is set.
(cygwin_conv_path): Set PC_SYM_NOFOLLOW_REP flag when converting from
POSIX to Win32.
* path.h (enum pathconv_arg): Define PC_SYM_NOFOLLOW_REP flag.
2011-01-17 Corinna Vinschen <corinna@vinschen.de>
* fhandler_proc.cc (proc_tab_cmp): Fix typo in comment.
(fhandler_proc::fill_filebuf): Handle return value of 0 from format
function as error.
(format_proc_stat): Set errno when returning 0 size.
(format_proc_partitions): Rewrite method to fetch partition info.
2011-01-13 Corinna Vinschen <corinna@vinschen.de>
* fhandler_disk_file.cc (fhandler_base::fstat_helper): Always set
st_size of directories to 0. Explain why.
2011-01-12 Corinna Vinschen <corinna@vinschen.de>
* posix.sgml: Add madvise to BSD list.
2011-01-12 Corinna Vinschen <corinna@vinschen.de>
* cygwin.din (madvise): Export posix_madvise as madvise.
* include/cygwin/version.h: Bump CYGWIN_VERSION_API_MINOR.
* include/sys/mman.h: Define madvise constants, keep Linux-specific
constants undefined.
(madvise): Declare.
2011-01-12 Corinna Vinschen <corinna@vinschen.de>
* fhandler.h (struct part_t): New type.
(class fhandler_dev_floppy): Convert partitions to part_t pointer.
Add lock_partition method.
* fhandler_floppy.cc (fhandler_dev_floppy::lock_partition): New method
to implement ondemand partition locking.
(fhandler_dev_floppy::write_file): Call lock_partition from here if
writing failed due to a potential write restriction on a disk
partition.
(fhandler_dev_floppy::open): Don't lock partitions here.
(fhandler_dev_floppy::close): Keep track of partition handle reference
count. Close handles and remove partitions pointer ony if count is 0.
(fhandler_dev_floppy::dup): Just copy partitions pointer and increment
reference count.
2011-01-11 Corinna Vinschen <corinna@vinschen.de>
* fhandler.h (MAX_PARTITIONS): New definition.
(class fhandler_dev_floppy): Add partitions array member. Add close
method.
* fhandler_floppy.cc (fhandler_dev_floppy::fhandler_dev_floppy): Zero
out partitions array.
(fhandler_dev_floppy::open): Fix "entire disk" condition for call to
DeviceIoControl (FSCTL_ALLOW_EXTENDED_DASD_IO).
When opening disks for writing, call DeviceIoControl (FSCTL_LOCK_VOLUME)
on all affected disk partitions starting with Vista.
(fhandler_dev_floppy::close): New method.
(fhandler_dev_floppy::dup): Duplicate handles in partitions, if any.
* wincap.h (wincaps::has_restricted_raw_disk_access): New element.
* wincap.cc: Implement above element throughout.
2011-01-11 Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
* termios.cc (cfgetospeed, cfgetispeed): Constify argument per POSIX.
* include/sys/termios.h (cfgetospeed, cfgetispeed): Declare functions.
Move macros after declarations and make conditional on !__cplusplus.
2011-01-11 Corinna Vinschen <corinna@vinschen.de>
* cygtls.cc (_cygtls::init_thread): Call _REENT_INIT_PTR. Drop setting
current locale and calling srand48.
2011-01-02 Christopher Faylor <me+cygwin@cgf.cx>
* ChangeLog-2010: Create from ChangeLog.
* ChangeLog: Start fresh.
|