Location: OpenVMS/vmspython/python/local/vms/starlet/_starlet.pyx

Jean-Francois Pieronne
Fix a bug in getjpiw when pid is -1 (wildcard operation)
   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
# -*- coding: ISO-8859-15 -*-
# file: _starlet.pyx
# build:
# $ cython _starlet.pyx -2 -I "../itemList" ! --line-directives
# $ python /python_vms/build_module.py _starlet
# test:
from _itemList cimport itemList, pyvms_itmlst2ile3, pyvms_ile3todict
cdef extern from "Python.h":
char* PyByteArray_AsString(object bytearray) except NULL
cdef extern from *:
pass
cdef extern from "ovstarlet.h":
enum: DSC_K_DTYPE_T "DSC$K_DTYPE_T"
enum: DSC_K_CLASS_S "DSC$K_CLASS_S"
enum: QUI__CHARACTERISTICS "QUI$_CHARACTERISTICS"
enum: CLI_M_NOWAIT "CLI$M_NOWAIT"
enum: SS__TIMEOUT "SS$_TIMEOUT"
enum: SS__NORMAL "SS$_NORMAL"
enum: EFN_C_ENF "EFN$C_ENF"
enum: PQL__LISTEND "PQL$_LISTEND"
enum: LCK_M_XVALBLK "LCK$M_XVALBLK"
enum: LCK_M_VALBLK "LCK$M_VALBLK"
enum: SS__SUSPENDED "SS$_SUSPENDED"
enum: SS__REJECT "SS$_REJECT"
enum: AFR_K_USER_LENGTH "AFR$K_USER_LENGTH"
ctypedef unsigned long long uint64 "unsigned __int64"
ctypedef unsigned long long longCharPtr
struct dsc_descriptor "dsc$descriptor":
unsigned short dsc_w_length "dsc$w_length"
unsigned char dsc_b_dtype "dsc$b_dtype"
unsigned char dsc_b_class "dsc$b_class"
void *dsc_a_pointer "dsc$a_pointer"
struct dsc_descriptor_s "dsc$descriptor_s":
unsigned short dsc_w_length "dsc$w_length"
unsigned char dsc_b_dtype "dsc$b_dtype"
unsigned char dsc_b_class "dsc$b_class"
void *dsc_a_pointer "dsc$a_pointer"
ctypedef struct ILE3:
unsigned short int ile3_w_length "ile3$w_length"
unsigned short int ile3_w_code "ile3$w_code"
void *ile3_ps_bufaddr "ile3$ps_bufaddr"
unsigned short int *ile3_ps_retlen_addr "ile3$ps_retlen_addr"
ctypedef struct ILE2:
unsigned short int ile2_w_length "ile2$w_length"
unsigned short int ile2_w_code "ile2$w_code"
void *ile2_ps_bufaddr "ile2$ps_bufaddr"
ctypedef struct LKSB:
unsigned short int lksb_w_status "lksb$w_status"
unsigned short int lksb_w_reserved "lksb$w_reserved"
unsigned int lksb_l_lkid "lksb$l_lkid"
unsigned char lksb_b_valblk "lksb$b_valblk" [16]
ctypedef struct XLKSB:
unsigned short int xlksb_w_status "xlksb$w_status"
unsigned short int xlksb_w_reserved "xlksb$w_reserved"
unsigned int xlksb_l_lkid "xlksb$l_lkid"
unsigned char xlksb_b_xvalblk "xlksb$b_xvalblk" [64]
ctypedef struct IOSB:
unsigned long iosb_l_getxxi_status "iosb$l_getxxi_status"
unsigned long iosb_l_reg_status "iosb$l_reg_status"
ctypedef struct IOSA:
unsigned short iosa_w_iosb_status "iosa$w_iosb_status"
ctypedef struct ITEMTYPE:
unsigned int stenvdef_l_item_code "stenvdef$l_item_code"
unsigned int stenvdef_l_buf_len "stenvdef$l_buf_len"
long long stenvdef_q_buf_addr "stenvdef$q_buf_addr"
long long stenvdef_q_ret_addr "stenvdef$q_ret_addr"
ctypedef struct IOS_ICC:
unsigned short ios_icc_w_status "ios_icc$w_status"
unsigned int ios_icc_l_remstat "ios_icc$l_remstat"
unsigned int ios_icc_l_rcv_len "ios_icc$l_rcv_len"
unsigned int ios_icc_l_req_handle "ios_icc$l_req_handle"
unsigned int ios_icc_l_reply_len "ios_icc$l_reply_len"
unsigned int ios_icc_l_replyto_handle "ios_icc$l_replyto_handle"
unsigned int ios_icc_l_txrcv_len "ios_icc$l_txrcv_len"
longCharPtr ios_icc_a_reply_buffer "ios_icc$a_reply_buffer"
unsigned int ios_icc_l_txreply_len "ios_icc$l_txreply_len"
ctypedef struct AFRDEF:
unsigned long long afr_q_fault_pc "afr$q_fault_pc"
unsigned long long afr_q_fault_va "afr$q_fault_va"
# char afr_t_image_name "afr$t_image_name" [256]
# char afr_t_user_name "afr$t_user_name" [16]
struct array_descriptor:
pass
struct _generic_64:
pass
ctypedef struct VA_RANGE:
void* va_range_ps_start_va "va_range$ps_start_va"
void* va_range_ps_end_va "va_range$ps_end_va"
struct _iosb:
pass
ctypedef struct AsynchronousStatus:
unsigned int status
ctypedef struct QUOTA_ENTRY:
char quota
int value
ctypedef struct LocalUserProxy:
unsigned short length
char username[32]
void DESCSTR(...)
void DYNAMIC_ARRAY_DESCRIPTOR(...)
void SIGTORET()
void cgetmsg(int, char*, int)
int sys_acquire_galaxy_lock "sys$acquire_galaxy_lock" (...)
int sys_add_holder "sys$add_holder" (...)
int sys_add_ident "sys$add_ident" (...)
int sys_add_proxy "sys$add_proxy" (...)
int sys_adjwsl "sys$adjwsl" (...)
int sys_alloc "sys$alloc" (...)
int sys_ascefc "sys$ascefc" (...)
int sys_asctim "sys$asctim" (...)
int sys_asctoid "sys$asctoid" (...)
int sys_ascutc "sys$ascutc" (...)
int sys_assign "sys$assign" (...)
int sys_audit_event "sys$audit_event" (...)
int sys_audit_eventw "sys$audit_eventw" (...)
int sys_avoid_preempt "sys$avoid_preempt" (...)
int sys_bintim "sys$bintim" (...)
int sys_binutc "sys$binutc" (...)
int sys_brkthruw "sys$brkthruw" (...)
int sys_cancel "sys$cancel" (...)
int sys_check_access "sys$check_access" (...)
int sys_check_privilegew "sys$check_privilegew" (...)
int sys_chkpro "sys$chkpro" (...)
int sys_clref "sys$clref" (...)
int sys_cpu_capabilities "sys$cpu_capabilities" (...)
int sys_create_bufobj "sys$create_bufobj" (...)
int sys_create_galaxy_lock "sys$create_galaxy_lock" (...)
int sys_create_galaxy_lock_table "sys$create_galaxy_lock_table" (...)
int sys_create_uid "sys$create_uid" (...)
int sys_create_user_profile "sys$create_user_profile" (...)
int sys_crelnm "sys$crelnm" (...)
int sys_crelnt "sys$crelnt" (...)
int sys_crembx "sys$crembx" (...)
int sys_creprc "sys$creprc" (...)
int sys_cvt_filename "sys$cvt_filename" (...)
int sys_dacefc "sys$dacefc" (...)
int sys_dalloc "sys$dalloc" (...)
int sys_dassgn "sys$dassgn" (...)
int sys_delete "sys$delete" (...)
int sys_delete_galaxy_lock "sys$delete_galaxy_lock" (...)
int sys_delete_galaxy_lock_table "sys$delete_galaxy_lock_table" (...)
int sys_delete_intrusion "sys$delete_intrusion" (...)
int sys_delete_proxy "sys$delete_proxy" (...)
int sys_dellnm "sys$dellnm" (...)
int sys_delmbx "sys$delmbx" (...)
int sys_delprc "sys$delprc" (...)
int sys_deq "sys$deq" (...)
int sys_device_path_scan "sys$device_path_scan" (...)
int sys_device_scan "sys$device_scan" (...)
int sys_disconnect "sys$disconnect" (...)
int sys_dismou "sys$dismou" (...)
int sys_display "sys$display" (...)
int sys_display_proxy "sys$display_proxy" (...)
int sys_dlcefc "sys$dlcefc" (...)
int sys_enq "sys$enq" (...)
int sys_enqw "sys$enqw" (...)
int sys_erapat "sys$erapat" (...)
int sys_expreg "sys$expreg" (...)
int sys_filescan "sys$filescan" (...)
int sys_find_held "sys$find_held" (...)
int sys_find_holder "sys$find_holder" (...)
int sys_finish_rdb "sys$finish_rdb" (...)
int sys_forcex "sys$forcex" (...)
int sys_format_audit "sys$format_audit" (...)
int sys_free_user_capability "sys$free_user_capability" (...)
int sys_get_align_fault_data "sys$get_align_fault_data" (...)
int sys_getdviw "sys$getdviw" (...)
int sys_getenv "sys$getenv" (...)
int sys_getjpiw "sys$getjpiw" (...)
int sys_getlkiw "sys$getlkiw" (...)
int sys_getmsg "sys$getmsg" (...)
int sys_getquiw "sys$getquiw" (...)
int sys_getrmi "sys$getrmi" (...)
int sys_getsyiw "sys$getsyiw" (...)
int sys_gettim "sys$gettim" (...)
int sys_getuai "sys$getuai" (...)
int sys_getutc "sys$getutc" (...)
int sys_get_galaxy_lock_info "sys$get_galaxy_lock_info" (...)
int sys_get_galaxy_lock_size "sys$get_galaxy_lock_size" (...)
int sys_get_security "sys$get_security" (...)
int sys_get_user_capability "sys$get_user_capability" (...)
int sys_grantid "sys$grantid" (...)
int sys_hash_password "sys$hash_password" (...)
int sys_icc_accept "sys$icc_accept" (...)
int sys_icc_close_assoc "sys$icc_close_assoc" (...)
int sys_icc_connectw "sys$icc_connectw" (...)
int sys_icc_disconnectw "sys$icc_disconnectw" (...)
int sys_icc_open_assoc "sys$icc_open_assoc" (...)
int sys_icc_receivew "sys$icc_receivew" (...)
int sys_icc_reject "sys$icc_reject" (...)
int sys_icc_replyw "sys$icc_replyw" (...)
int sys_icc_transceivew "sys$icc_transceivew" (...)
int sys_icc_transmitw "sys$icc_transmitw" (...)
int sys_idtoasc "sys$idtoasc" (...)
int sys_init_vol "sys$init_vol" (...)
int sys_io_cleanup "sys$io_cleanup" (...)
int sys_io_fastpathw "sys$io_fastpathw" (...)
int sys_io_performw "sys$io_performw" (...)
int sys_io_cleanup "sys$io_cleanup" (...)
int sys_io_setup "sys$io_setup" (...)
int sys_mod_holder "sys$mod_holder" (...)
int sys_mod_ident "sys$mod_ident" (...)
int sys_mount "sys$mount" (...)
int sys_numtim "sys$numtim" (...)
int sys_numutc "sys$numutc" (...)
int sys_format_acl "sys$format_acl" (...)
int sys_parse_acl "sys$parse_acl" (...)
int sys_perm_dis_align_fault_report "sys$perm_dis_align_fault_report" (...)
int sys_perm_report_align_fault "sys$perm_report_align_fault" (...)
int sys_persona_assume "sys$persona_assume" (...)
int sys_persona_clone "sys$persona_clone" (...)
int sys_persona_create "sys$persona_create" (...)
int sys_persona_create_extension "sys$persona_create_extension" (...)
int sys_persona_delegate "sys$persona_delegate" (...)
int sys_persona_delete "sys$persona_delete" (...)
int sys_persona_delete_extension "sys$persona_delete_extension" (...)
int sys_persona_extension_lookup "sys$persona_extension_lookup" (...)
int sys_persona_find "sys$persona_find" (...)
int sys_persona_modify "sys$persona_modify" (...)
int sys_persona_query "sys$persona_query" (...)
int sys_persona_reserve "sys$persona_reserve" (...)
int sys_power_control "sys$power_control" (...)
int sys_process_affinity "sys$process_affinity" (...)
int sys_process_capabilities "sys$process_capabilities" (...)
int sys_process_scan "sys$process_scan" (...)
int sys_purgws "sys$purgws" (...)
int sys_readef "sys$readef" (...)
int sys_registryw "sys$registryw" (...)
int sys_release_galaxy_lock "sys$release_galaxy_lock" (...)
int sys_rem_holder "sys$rem_holder" (...)
int sys_rem_ident "sys$rem_ident" (...)
int sys_resched "sys$resched" (...)
int sys_resume "sys$resume" (...)
int sys_revokid "sys$revokid" (...)
int sys_scan_intrusion "sys$scan_intrusion" (...)
int sys_schdwk "sys$schdwk" (...)
int sys_setddir "sys$setddir" (...)
int sys_setdfprot "sys$setdfprot" (...)
int sys_setef "sys$setef" (...)
int sys_setime "sys$setime" (...)
int sys_setpri "sys$setpri" (...)
int sys_setprn "sys$setprn" (...)
int sys_setprv "sys$setprv" (...)
int sys_setshlv "sys$setshlv" (...)
int sys_setswm "sys$setswm" (...)
int sys_setuai "sys$setuai" (...)
int sys_setup_avoid_preempt "sys$setup_avoid_preempt" (...)
int sys_set_devicew "sys$set_devicew" (...)
int sys_set_implicit_affinity "sys$set_implicit_affinity" (...)
int sys_set_process_propertiesw "sys$set_process_propertiesw" (...)
int sys_set_resource_domain "sys$set_resource_domain" (...)
int sys_set_security "sys$set_security" (...)
int sys_snderr "sys$snderr" (...)
int sys_sndjbcw "sys$sndjbcw" (...)
int sys_start_align_fault_report "sys$start_align_fault_report" (...)
int sys_stop_align_fault_report "sys$stop_align_fault_report" (...)
int sys_subsystem "sys$subsystem" (...)
int sys_suspnd "sys$suspnd" (...)
int sys_timcon "sys$timcon" (...)
int sys_trnlnm "sys$trnlnm" (...)
int sys_verify_proxy "sys$verify_proxy" (...)
int sys_waitfr "sys$waitfr" (...)
int sys_wake "sys$wake" (...)
int sys_hiber "sys$hiber" (...)
int sys_wfland "sys$wfland" (...)
int sys_wflor "sys$wflor" (...)
from libc.stdio cimport printf, puts
from libc.stdlib cimport malloc, free
from libc.string cimport memset, strncpy, memcpy
from cpython cimport PY_MAJOR_VERSION, PyObject, Py_XINCREF, Py_XDECREF, \
PySequence_Check, PyTuple_New, PyTuple_SetItem
cdef class Xlksb(object):
cdef XLKSB xlksb
def __init__(self):
memset(&(self.xlksb), 0, sizeof(self.xlksb))
property w_status:
def __get__(self):
return self.xlksb.xlksb_w_status
def __set__(self, unsigned short value):
self.xlksb.xlksb_w_status = value
property l_lkid:
def __get__(self):
return self.xlksb.xlksb_l_lkid
def __set__(self, unsigned int value):
self.xlksb.xlksb_l_lkid = value
property b_xvalblk:
def __get__(self):
return self.xlksb.xlksb_b_xvalblk[:64]
def __set__(self, valblk):
set_valblk(self, valblk, 64)
property b_valblk:
def __get__(self):
return self.xlksb.xlksb_b_xvalblk[:16]
def __set__(self, valblk):
set_valblk(self, valblk, 16)
cdef object lst2envlst(itmlst):
cdef int itmcard = len(itmlst)
# Use a 256 bytes buffers
cdef int sz = (itmcard + 1) * (sizeof(ITEMTYPE) + 256 + 16)
cdef itemList itm
cdef buf
cdef object buff = bytearray(sz)
cdef ITEMTYPE* pitem = <ITEMTYPE *>PyByteArray_AsString(buff)
cdef char *pdata = <char *>pitem + (itmcard + 1) * sizeof(ITEMTYPE)
cdef int i
for i from 0 <= i < itmcard:
pitem.stenvdef_l_item_code = itmlst[i]
pitem.stenvdef_l_buf_len = 256
pitem.stenvdef_q_buf_addr = <long long>pdata
pdata += 256
pitem.stenvdef_q_ret_addr = <long long>pdata
pdata += 16
pitem += 1
pitem.stenvdef_l_item_code = 0
pitem.stenvdef_l_buf_len = 0
pitem.stenvdef_q_buf_addr = 0
pitem.stenvdef_q_ret_addr = 0
return buff
cdef object envlst2dict(envlst, int itmcard):
cdef object res = {}
cdef ITEMTYPE* pitem = <ITEMTYPE *>PyByteArray_AsString(envlst)
cdef char *pdata = <char *>pitem + (itmcard + 1) * sizeof(ITEMTYPE)
cdef unsigned long long* rtlen
while (True):
if pitem.stenvdef_l_item_code == 0: break
rtlen = <unsigned long long *>(pdata + 256)
res[pitem.stenvdef_l_item_code] = pdata[:rtlen[0]]
pitem += 1
pdata += 256 + 16
return res
cdef set_valblk(Xlksb self, valblk, int sz):
cdef char* valPtr = NULL
cdef object oval = None
if len(valblk) > sz:
raise ValueError('Invalid valblk length')
if isinstance(valblk, basestring):
valblk = getstr(valblk)
oval = bytearray(valblk)
if len(oval) > sz:
raise ValueError('Invalid valblk length')
valPtr = PyByteArray_AsString(oval)
memset(self.xlksb.xlksb_b_xvalblk, 0,
sizeof(self.xlksb.xlksb_b_xvalblk))
strncpy(<char *>self.xlksb.xlksb_b_xvalblk, valPtr, len(oval))
oval = None
valPtr = NULL
cdef checkStatus(unsigned int s):
cdef char msg[256]
if s & 1 == 0:
cgetmsg(s, msg, sizeof(msg))
raise VMSError(s, msg)
cdef inline checkstr(text):
if not isinstance(text, basestring):
raise TypeError("expected string or Unicode object, %s found" %
type(text))
cdef getstr(text):
if isinstance(text, unicode):
return text.encode('ISO-8859-15')
elif text is None or (PY_MAJOR_VERSION < 3) and isinstance(text, str):
return text
else:
raise ValueError("expected string or Unicode object, %s found" %
type(text))
cdef inline DESCFROMSTR(dsc_descriptor_s* dsc, src):
dsc.dsc_b_dtype = DSC_K_DTYPE_T
dsc.dsc_b_class = DSC_K_CLASS_S
# dsc.dsc_a_pointer = <char *>src
if isinstance(src, bytearray):
dsc.dsc_a_pointer = <char *>PyByteArray_AsString(src)
else:
dsc.dsc_a_pointer = <char *><bytes>src
dsc.dsc_w_length = len(src)
cdef inline dsc_descriptor_s* DESCFROMOPTSTR(dsc_descriptor_s* dsc, string) \
except *:
if string is not None:
DESCFROMSTR(dsc, string)
return dsc
else:
return NULL
cdef inline unsigned long long id2long(unsigned int iid[2]):
lid = iid[1]
lid = lid << 32
lid += iid[0]
return lid
cdef inline long2id(unsigned long long lid):
return (lid & 0xFFFFFFFF, lid >> 32)
cdef inline int* IOPTPTR(int* iv, val) except *:
if val is None:
return NULL
else:
iv[0] = val
return iv
cdef inline unsigned int* UIOPTPTR(unsigned int* iv, val) except *:
if val is None:
return NULL
else:
iv[0] = val
return iv
cdef inline long long* LLOPTPTR(long long* iv, val) except *:
if val is None:
return NULL
else:
iv[0] = val
return iv
cdef inline unsigned long long* ULLOPTPTR(unsigned long long* iv, val) \
except *:
if val is None:
return NULL
else:
iv[0] = val
return iv
cdef inline short* SOPTPTR(short* iv, val) except *:
if val is None:
return NULL
else:
iv[0] = val
return iv
cdef inline unsigned short* USOPTPTR(unsigned short* iv, val) except *:
if val is None:
return NULL
else:
iv[0] = val
return iv
cdef inline unsigned char* UCOPTPTR(unsigned char* iv, val) except *:
if val is None:
return NULL
else:
iv[0] = val
return iv
def acquire_galaxy_lock(unsigned long long handle,
unsigned int timeout=0,
unsigned int flags=0):
"status = acquire_galaxy_lock(handle, timeout=0, flags=0)"
s = sys_acquire_galaxy_lock(handle, timeout, flags)
checkStatus(s)
return s
def add_holder(unsigned int rights_id, unsigned long long rights_holder,
unsigned int attrib=0):
"status = add_holder(rights_id, rights_holder, attrib=0)"
s = sys_add_holder(rights_id, <_generic_64 *>&rights_holder, attrib)
checkStatus(s)
return s
def add_ident(name, unsigned int id=0, unsigned int attrib=0):
"status, resid = add_ident(name, id=0, attrib=0)"
cdef unsigned int resid = 0
name = getstr(name)
cdef dsc_descriptor_s nameD
DESCFROMSTR(&nameD, name)
s = sys_add_ident(&nameD, id, attrib, &resid)
checkStatus(s)
return s, resid
def add_proxy(rem_node, rem_user, local_user, unsigned int flags=0):
"status = add_proxy(rem_node, rem_user, local_user [,flags])"
rem_node = getstr(rem_node)
rem_user = getstr(rem_user)
local_user = getstr(local_user)
cdef dsc_descriptor_s remNodeD, remUserD, localUserD
DESCFROMSTR(&remNodeD, rem_node)
DESCFROMSTR(&remUserD, rem_user)
DESCFROMSTR(&localUserD, local_user)
s = sys_add_proxy(&remNodeD, &remUserD, &localUserD, flags)
checkStatus(s)
return s
def adjwsl(int pagecnt=0):
"status, wsetlm = adjwsl(pagecnt=0)"
cdef unsigned int wsetlm = 0
s = sys_adjwsl(pagecnt, &wsetlm)
checkStatus(s)
return s, wsetlm
def alloc(devnam, unsigned int accmode=0, unsigned int flags=0):
"status, phybuf = alloc(devnam, accmode=0, flags=0)"
devnam = getstr(devnam)
cdef dsc_descriptor_s devnamD
DESCFROMSTR(&devnamD, devnam)
cdef unsigned short phylen = 0
cdef dsc_descriptor_s phybufD
cdef char phybuf[257]
DESCSTR(phybufD, phybuf)
s = sys_alloc(&devnamD, &phylen, &phybufD, accmode, flags)
checkStatus(s)
return s, phybuf[:phylen]
def ascefc(unsigned int efn, name, unsigned char prot=0, unsigned char perm=0):
"status = ascefc(efn, name, prot=0, perm=0)"
name = getstr(name)
cdef dsc_descriptor_s nameD
DESCFROMSTR(&nameD, name)
if efn == 0:
efn = EFN_C_ENF
s = sys_ascefc(efn, &nameD, prot, perm)
checkStatus(s)
return s
def asctim(tim=None, unsigned long cvtflg=0):
"status, timbuf = asctim([tim ,cvtflg])"
cdef long long itim
cdef long long* itimPtr = LLOPTPTR(&itim, tim)
cdef unsigned short retlen = 0
cdef char timbuf[257]
cdef dsc_descriptor_s timbufD
DESCSTR(timbufD, timbuf)
s = sys_asctim(&retlen, &timbufD, <_generic_64 *>itimPtr, cvtflg)
checkStatus(s)
return s, timbuf[:retlen]
def asctoid(name):
"status, rights_id, attrib = asctoid(name)"
name = getstr(name)
cdef dsc_descriptor_s nameD
DESCFROMSTR(&nameD, name)
cdef unsigned int rights_id
cdef unsigned int attrib
s = sys_asctoid(&nameD, &rights_id, &attrib)
checkStatus(s)
return s, rights_id, attrib
def ascutc(tim=None, unsigned int cvtflg=0):
"status, timbuf = ascutc([tim] [,cvtflg])"
cdef char timbuf[257]
cdef dsc_descriptor_s timbufD
DESCSTR(timbufD, timbuf)
cdef unsigned short retlen = 0
cdef unsigned long long itim[2]
cdef unsigned long long* itimPtr = NULL
if tim is not None:
itimPtr = &(itim[0])
itim[0] = tim & 0xFFFFFFFFFFFFFFFF
itim[1] = tim >> 64
s = sys_ascutc(&retlen, &timbufD, <unsigned int *>itimPtr, cvtflg)
checkStatus(s)
return s, timbuf[:retlen]
def assign(devnam, unsigned int acmode=0, mbxnam=None, unsigned int flags=0):
"status, channel = assign(devnam, acmode=0, mbxnam=None, flags=0)"
cdef unsigned short channel = 0
devnam = getstr(devnam)
cdef dsc_descriptor_s devnamD
DESCFROMSTR(&devnamD, devnam)
mbxnam = getstr(mbxnam)
cdef dsc_descriptor_s mbxnamD
cdef dsc_descriptor_s* mbxnamPtr = \
DESCFROMOPTSTR(&mbxnamD, mbxnam)
s = sys_assign(&devnamD, &channel, acmode, mbxnamPtr, flags)
checkStatus(s)
return s, channel
def audit_event(unsigned int efn=EFN_C_ENF, unsigned int flags=0, itmlst=None):
"status, audsts [,resdic] = audit_event(efn=EFN_C_ENF, flags=0, \
itmlst=None)"
if efn == 0:
efn=EFN_C_ENF
cdef unsigned int audsts = 0
cdef ILE3* ile3Ptr = NULL
cdef object ile3 = None
if itmlst is not None:
ile3 = pyvms_itmlst2ile3(itmlst, 0)
ile3Ptr = <ILE3 *>PyByteArray_AsString(ile3)
s = sys_audit_event(efn, flags, ile3Ptr, &audsts, NULL, 0)
checkStatus(s)
if itmlst is None:
return s, audsts
ile3 = pyvms_ile3todict(itmlst, ile3, 0)
if len(ile3) == 0:
return s, audsts
return s, audsts, ile3
def audit_eventw(unsigned int efn=EFN_C_ENF, unsigned int flags=0, itmlst=None):
"status, audsts [,resdic] = audit_eventw(efn=EFN_C_ENF, flags=0, \
itmlst=None)"
if efn == 0:
efn=EFN_C_ENF
cdef unsigned int audsts = 0
cdef ILE3* ile3Ptr = NULL
cdef object ile3 = None
if itmlst is not None:
ile3 = pyvms_itmlst2ile3(itmlst, 0)
ile3Ptr = <ILE3 *>PyByteArray_AsString(ile3)
s = sys_audit_event(efn, flags, ile3Ptr, &audsts, NULL, 0)
checkStatus(s)
if itmlst is None:
return s, audsts
ile3 = pyvms_ile3todict(itmlst, ile3, 0)
if len(ile3) == 0:
return s, audsts
return s, audsts, ile3
def avoid_preempt(int enable):
"status = avoid_preempt(enable)"
s = sys_avoid_preempt(enable)
checkStatus(s)
return s
def bintim(timbuf):
"status, tim = bintim(timbuf)"
timbuf = getstr(timbuf)
cdef dsc_descriptor_s timbufD
cdef long long retval
DESCFROMSTR(&timbufD, timbuf)
s = sys_bintim(&timbufD, <_generic_64 *>&retval)
checkStatus(s)
return s, retval
def binutc(timbuf):
"status, utc = binutc(timbuf)"
timbuf = getstr(timbuf)
cdef dsc_descriptor_s timbufD
cdef unsigned long long retval[2]
DESCFROMSTR(&timbufD, timbuf)
s = sys_binutc(&timbufD, <unsigned int *>retval)
checkStatus(s)
cdef object res = retval[1]
res = res << 64
res = res + retval[0]
return s, res
def brkthruw(unsigned int efn, msgbuf, sendto=None,
unsigned int sndtyp=0, unsigned int carcon=0, unsigned int flags=0,
unsigned int reqid=0, unsigned int timout=0):
"status succ_cnt, fail_cnt, nobroad_cnt = \
brkthruw(efn, msgbuf, sendto=None, sndtyp=0, carcon=0, flags=0, reqid=0, \
timout=0)"
msgbuf = getstr(msgbuf)
cdef dsc_descriptor_s msgbufD
DESCFROMSTR(&msgbufD, msgbuf)
cdef unsigned short iosb[4]
iosb[0] = 1
iosb[1] = iosb[2] = iosb[3] = 0
cdef dsc_descriptor_s sendtoD
cdef dsc_descriptor_s* sendtoPtr = \
DESCFROMOPTSTR(&sendtoD, sendto)
if efn == 0:
efn = EFN_C_ENF
s = sys_brkthruw(efn, &msgbufD, sendtoPtr, sndtyp, <_iosb *>iosb,
carcon, flags, reqid, timout, NULL, 0)
checkStatus(s)
checkStatus(iosb[0])
return long(iosb[0]), iosb[1], iosb[2], iosb[3]
def cancel(unsigned short channel):
"status = cancel(channel)"
s = sys_cancel(channel)
checkStatus(s)
return s
def check_access(unsigned int objtyp, objnam=None, usrnam=None, itmlst=None,
contxt=None, clsnam=None, objpro=None, usrpro=None):
"status [,contxt], resdic = check_access(objtyp objnam=None, usrnam=None, \
itmlst=None, contxt=None, clsnam=None, objpro=None, usrpro=None)"
objnam = getstr(objnam)
usrnam = getstr(usrnam)
clsnam = getstr(clsnam)
cdef dsc_descriptor_s objnamD, usrnamD, clsnamD, objproD, usrproD
cdef dsc_descriptor_s* objnamPtr = \
DESCFROMOPTSTR(&objnamD, objnam)
cdef dsc_descriptor_s* usrnamPtr = \
DESCFROMOPTSTR(&usrnamD, usrnam)
cdef dsc_descriptor_s* clsnamPtr = \
DESCFROMOPTSTR(&clsnamD, clsnam)
cdef dsc_descriptor_s* objproPtr = \
DESCFROMOPTSTR(&objproD, objpro)
cdef dsc_descriptor_s* usrproPtr = \
DESCFROMOPTSTR(&usrproD, usrpro)
cdef unsigned int uicontxt
cdef unsigned int* uicontxtPtr = NULL
if contxt is not None:
uicontxtPtr = &uicontxt
if contxt == -1:
uicontxt = -1
else:
uicontxt = contxt
cdef ILE3* ile3Ptr = NULL
cdef object ile3 = None
if itmlst is not None:
ile3 = pyvms_itmlst2ile3(itmlst, 0)
ile3Ptr = <ILE3 *>PyByteArray_AsString(ile3)
s = sys_check_access(&objtyp, objnamPtr, usrnamPtr, ile3Ptr, uicontxtPtr,
clsnamPtr, objproPtr, usrproPtr)
checkStatus(s)
cdef object res = [s,]
if contxt is not None:
res.append(uicontxt)
if itmlst is not None:
ile3 = pyvms_ile3todict(itmlst, ile3, 0)
if len(ile3) > 0:
res.append(ile3)
return tuple(res)
def check_privilegew(unsigned int efn, unsigned long long prvadr,
altprv=None, flags=None, itmlst=None):
"status, audsts [,resdic] = check_privilegew(efn, prv, altprv=None, \
flags=None, itmlst=None)"
if efn == 0:
efn = EFN_C_ENF
cdef unsigned long long ialtprv
cdef unsigned long long* ialtprvPtr = ULLOPTPTR(&ialtprv, altprv)
cdef unsigned int iflags = 0
if flags is not None:
iflags = flags
cdef ILE3* ile3Ptr = NULL
cdef object ile3 = None
if itmlst is not None:
ile3 = pyvms_itmlst2ile3(itmlst, 0)
ile3Ptr = <ILE3 *>PyByteArray_AsString(ile3)
cdef unsigned int audsts
s = sys_check_privilegew(efn, <_generic_64 *>&prvadr,
<_generic_64 *>ialtprvPtr, iflags, ile3Ptr,
&audsts, NULL, 0)
checkStatus(s)
if itmlst is None:
return s, audsts
else:
ile3 = pyvms_ile3todict(itmlst, ile3, 0)
if len(ile3) > 0:
return s, audsts, ile3
else:
return s, audsts
def chkpro(itmlst, objpro=None, usrpro=None):
"status, resdic = chkpro(itmlst, objpro=None, usrpro=None)"
cdef ILE3* ile3Ptr = NULL
cdef object ile3 = None
ile3 = pyvms_itmlst2ile3(itmlst, 0)
ile3Ptr = <ILE3 *>PyByteArray_AsString(ile3)
cdef dsc_descriptor_s objproD, usrproD
cdef dsc_descriptor_s* objproPtr = \
DESCFROMOPTSTR(&objproD, objpro)
cdef dsc_descriptor_s* usrproPtr = \
DESCFROMOPTSTR(&usrproD, usrpro)
s = sys_chkpro(ile3Ptr, objproPtr, usrproPtr)
checkStatus(s)
ile3 = pyvms_ile3todict(itmlst, ile3, 0)
if len(ile3) > 0:
return s, ile3
else:
return s
def clref(unsigned int efn):
"status = clref(efn)"
s = sys_clref(efn)
checkStatus(s)
return s
def cpu_capabilities(int cpu_id, select_mask=None, modify_mask=None,
flags=None):
"status, prev_mask = cpu_capabilities(cpu_id, select_mask=None, \
modify_mask=None, flags=None)"
cdef unsigned int ism, imm, ifl
cdef unsigned int* ismPtr = UIOPTPTR(&ism, select_mask)
cdef unsigned int* immPtr = UIOPTPTR(&imm, modify_mask)
cdef unsigned int* iflPtr = UIOPTPTR(&ifl, flags)
cdef unsigned int prev_mask = 0
s = sys_cpu_capabilities(cpu_id, <_generic_64 *>ismPtr,
<_generic_64 *>immPtr, <_generic_64 *>&prev_mask,
<_generic_64 *>iflPtr)
checkStatus(s)
return s, prev_mask
def create_galaxy_lock(unsigned int lcktbl_handle, name, unsigned int size,
unsigned int timeout, unsigned int ipl,
unsigned int rank):
"status, handle = create_galaxy_lock(lcktbl_handle, name, size, timeout, \
ipl, rank)"
cdef dsc_descriptor_s nameD
name = getstr(name)
DESCFROMSTR(&nameD, name)
cdef unsigned long long handle
s = sys_create_galaxy_lock(lcktbl_handle, &nameD, size, timeout, ipl,
rank, <uint64 *>&handle)
checkStatus(s)
return s, handle
def create_galaxy_lock_table(name, unsigned int accmode,
unsigned long long section_size,
unsigned int section_type,
unsigned int prot, unsigned int lock_size):
"status, lcktbl_handle = create_galaxy_lock_table(name, accmode, \
section_size, section_type, prot, lock_size)"
cdef unsigned int lcktbl_handle
cdef dsc_descriptor_s nameD
name = getstr(name)
DESCFROMSTR(&nameD, name)
s = sys_create_galaxy_lock_table(&nameD, accmode, section_size,
section_type, prot, lock_size,
&lcktbl_handle)
checkStatus(s)
return s, lcktbl_handle
def create_uid():
"status, res = create_uid()"
cdef unsigned long long retval[2]
s = sys_create_uid(<unsigned int*>retval)
checkStatus(s)
cdef object res = retval[1]
res = res << 64
res = res + retval[0]
return s, res
def create_user_profile(usrnam, itmlst=None, unsigned int flags=0, contxt=None):
"status, usrpro [,resdic] [,contxt] = create_user_profile(usrnam, \
itmlst=None, unsigned int flags=0, contxt=None)"
cdef dsc_descriptor_s usrnamD
cdef dsc_descriptor_s* usrnamPtr = \
DESCFROMOPTSTR(&usrnamD, usrnam)
cdef unsigned int retlen
cdef unsigned int icontxt
cdef unsigned int* icontxtPtr = NULL
if contxt is not None:
icontxtPtr = &icontxt
if contxt == -1:
icontxt = -1
else:
icontxt = contxt
cdef ILE3* ile3Ptr = NULL
cdef object ile3 = None
if itmlst is not None:
ile3 = pyvms_itmlst2ile3(itmlst, 1)
ile3Ptr = <ILE3 *>PyByteArray_AsString(ile3)
s = sys_create_user_profile(usrnamPtr, 0, 0, 0, &retlen, 0)
checkStatus(s)
cdef object buf = bytearray(retlen)
cdef char* bufPtr = PyByteArray_AsString(buf)
s = sys_create_user_profile(usrnamPtr, ile3Ptr, flags, bufPtr, &retlen,
icontxtPtr)
checkStatus(s)
if itmlst is None and contxt is None:
return s, bufPtr[:retlen]
if itmlst is None:
return s, bufPtr[:retlen], icontxt
ile3 = pyvms_ile3todict(itmlst, ile3, 0)
if len(ile3) > 0:
if contxt is None:
return s, bufPtr[:retlen], ile3
return s, bufPtr[:retlen], ile3, icontxt
if contxt is None:
return s, bufPtr[:retlen]
return s, bufPtr[:retlen], icontxt
def crelnm(attr, tabnam, lognam, acmode=None, itmlst=None):
"status [,resdic] = crelnm(attr, tabnam, lognam, acmode=None, itmlst=None)"
cdef unsigned int iattr
cdef unsigned int* iattrPtr = UIOPTPTR(&iattr, attr)
tabnam = getstr(tabnam)
lognam = getstr(lognam)
cdef dsc_descriptor_s tabnamD, lognamD
DESCFROMSTR(&tabnamD, tabnam)
DESCFROMSTR(&lognamD, lognam)
cdef unsigned char iacmode
cdef unsigned char* iacmodePtr = UCOPTPTR(&iacmode, acmode)
cdef ILE3* ile3Ptr = NULL
cdef object ile3 = None
if itmlst is not None:
ile3 = pyvms_itmlst2ile3(itmlst, 0)
ile3Ptr = <ILE3 *>PyByteArray_AsString(ile3)
s = sys_crelnm(iattrPtr, &tabnamD, &lognamD, iacmodePtr, ile3Ptr)
checkStatus(s)
if itmlst is None:
return s
else:
ile3 = pyvms_ile3todict(itmlst, ile3, 0)
if len(ile3) > 0:
return s, ile3
return s
def crelnt(attr=None, quota=None, promsk=None, tabnam=None, partab=None,
acmode=None):
"status, resnam = crelnt(attr=None, quota=None, promsk=None, \
tabnam=None, partab=None, acmode=None)"
cdef unsigned int iattr
cdef unsigned int* iattrPtr = UIOPTPTR(&iattr, attr)
tabnam = getstr(tabnam)
cdef dsc_descriptor_s tabnamD
cdef dsc_descriptor_s* tabnamPtr = \
DESCFROMOPTSTR(&tabnamD, tabnam)
partab = getstr(partab)
cdef dsc_descriptor_s partabD
cdef dsc_descriptor_s* partabPtr = \
DESCFROMOPTSTR(&partabD, partab)
cdef char resname[32]
cdef dsc_descriptor_s resnameD
DESCSTR(resnameD, resname)
cdef unsigned short reslen = 0
cdef unsigned int iquota
cdef unsigned int* iquotaPtr = UIOPTPTR(&iquota, quota)
cdef unsigned short ipromsk
cdef unsigned short* ipromskPtr = USOPTPTR(&ipromsk, promsk)
cdef unsigned char iacmode
cdef unsigned char* iacmodePtr = UCOPTPTR(&iacmode, acmode)
s = sys_crelnt(iattrPtr, &resnameD, &reslen, iquotaPtr, ipromskPtr,
tabnamPtr, partabPtr, iacmodePtr)
checkStatus(s)
return s, resname[:reslen]
def crembx(unsigned int prmflg=0, unsigned int maxmsg=0,
unsigned int bufquo=0, unsigned int promsk=0,
unsigned int acmode=0, lognam=None, unsigned int flags=0):
"status, chan = crembx(prmflg=0, maxmsg=0, bufquo=0, promsk=0, acmode=0, \
lognam=None, flags=0)"
cdef unsigned short chan = 0
lognam = getstr(lognam)
cdef dsc_descriptor_s lognamD
cdef dsc_descriptor_s* lognamPtr = \
DESCFROMOPTSTR(&lognamD, lognam)
s = sys_crembx(prmflg, &chan, maxmsg, bufquo, promsk, acmode, lognamPtr,
flags, 0)
checkStatus(s)
return s, chan
def creprc(image=None, input=None, output=None, error=None, prv=None,
quota=None, prcnam=None, unsigned int baspri=0, unsigned int uic=0,
unsigned short mbxunt=0, unsigned int stsflg=0, itmlst=None,
node=None, unsigned int home_rad=0):
"status, pid [,resdic] = creprc(image=None, input=None, output=None, \
error=None, prv=None, quota=None, prcnam=None, baspri=0, uic=0, \
mbxunt=0, stsflg=0, itmlst=None, node=None, home_rad=0)"
image = getstr(image)
input = getstr(input)
output = getstr(output)
error = getstr(error)
prcnam = getstr(prcnam)
node = getstr(node)
cdef dsc_descriptor_s imageD
cdef dsc_descriptor_s* imagePtr = \
DESCFROMOPTSTR(&imageD, image)
cdef dsc_descriptor_s inputD
cdef dsc_descriptor_s* inputPtr = \
DESCFROMOPTSTR(&inputD, input)
cdef dsc_descriptor_s outputD
cdef dsc_descriptor_s* outputPtr = \
DESCFROMOPTSTR(&outputD, output)
cdef dsc_descriptor_s errorD
cdef dsc_descriptor_s* errorPtr = \
DESCFROMOPTSTR(&errorD, error)
cdef dsc_descriptor_s prcnamD
cdef dsc_descriptor_s* prcnamPtr = \
DESCFROMOPTSTR(&prcnamD, prcnam)
cdef dsc_descriptor_s nodeD
cdef dsc_descriptor_s* nodePtr = \
DESCFROMOPTSTR(&prcnamD, node)
cdef unsigned long long iprv
cdef unsigned long long* iprvPtr = ULLOPTPTR(&iprv, prv)
cdef QUOTA_ENTRY quotaEntry[256]
cdef QUOTA_ENTRY* quotaEntryPtr = NULL
cdef ILE3* ile3Ptr = NULL
cdef object ile3 = None
if itmlst is not None:
ile3 = pyvms_itmlst2ile3(itmlst, 0)
ile3Ptr = <ILE3 *>PyByteArray_AsString(ile3)
cdef int sz
cdef int i
cdef unsigned int pid
if quota is not None:
quotaEntryPtr = quotaEntry
sz = len(quota)
for i in range(sz):
quotaEntry[i].quota = quota[i][0]
quotaEntry[i].value = quota[i][1]
quotaEntry[sz].quota = PQL__LISTEND
s = sys_creprc(&pid, imagePtr, inputPtr, outputPtr, errorPtr,
<_generic_64 *>iprvPtr, <unsigned int *>quotaEntryPtr,
prcnamPtr, baspri, uic, mbxunt, stsflg, ile3Ptr, nodePtr,
home_rad)
checkStatus(s)
if itmlst is not None:
ile3 = pyvms_ile3todict(itmlst, ile3, 0)
if len(ile3) > 0:
return s, pid, ile3
else:
return s, pid
return s, pid
def cvt_filename(unsigned int cvttyp, srcstr, unsigned int inflags):
"status, outbuf, outflags = cvt_filename(cvttyp, srcstr, inflags)"
srcstr = getstr(srcstr)
cdef dsc_descriptor_s srcstrD
DESCFROMOPTSTR(&srcstrD, srcstr)
cdef char outbuf[257]
cdef dsc_descriptor_s outbufD
DESCSTR(outbufD, outbuf)
cdef unsigned short retlen = 0
cdef unsigned int outflags
s = sys_cvt_filename(cvttyp, &srcstrD, inflags, &outbufD, &retlen,
&outflags)
checkStatus(s)
return s, outbuf[:retlen], outflags
def dacefc(unsigned int efn):
"status = dacefc(efn)"
s = sys_dacefc(efn)
checkStatus(s)
return s
def dalloc(devnam=None, unsigned int acmode=0):
"status = dalloc([devnam=None, acmode0)"
devnam = getstr(devnam)
cdef dsc_descriptor_s devnamD
cdef dsc_descriptor_s* devnamPtr = \
DESCFROMOPTSTR(&devnamD, devnam)
s = sys_dalloc(devnamPtr, acmode)
checkStatus(s)
return s
def dassgn(unsigned short chan):
"status = dassgn(chan)"
s = sys_dassgn(chan)
checkStatus(s)
return s
def delete_galaxy_lock(unsigned long long lock_handle):
"status = delete_galaxy_lock(lock_handle)"
s = sys_delete_galaxy_lock(lock_handle)
checkStatus(s)
return s
def delete_galaxy_lock_table(unsigned int lcktbl_handle):
"status = delete_galaxy_lock_table(lcktbl_handle)"
s = sys_delete_galaxy_lock_table(lcktbl_handle)
checkStatus(s)
return s
def delete_intrusion(user_criteria, unsigned int flags=0):
"status = delete_intrusion(user_criteria [,flags])"
cdef dsc_descriptor_s userD
cdef object ile3 = None
cdef void* ptr = NULL
if isinstance(user_criteria, itemList):
ile3 = pyvms_itmlst2ile3(user_criteria, 0)
ptr = PyByteArray_AsString(ile3)
else:
user_criteria = getstr(user_criteria)
DESCFROMSTR(&userD, user_criteria)
ptr = &userD
s = sys_delete_intrusion(ptr, flags)
checkStatus(s)
return s
def delete_proxy(rem_node, rem_user, local_user=None, unsigned int flags=0):
"status = delete_proxy(rem_node, rem_user, local_user=None, flags=0)"
rem_node = getstr(rem_node)
rem_user = getstr(rem_user)
local_user = getstr(local_user)
cdef dsc_descriptor_s remNodeD
DESCFROMSTR(&remNodeD, rem_node)
cdef dsc_descriptor_s remUserD
DESCFROMSTR(&remUserD, rem_user)
cdef dsc_descriptor_s localUserD
cdef dsc_descriptor_s* localUserPtr = \
DESCFROMOPTSTR(&localUserD, local_user)
s = sys_delete_proxy(&remNodeD, &remUserD, localUserPtr, flags)
checkStatus(s)
return s
def dellnm(tabnam, lognam=None, acmode=None):
"status = dellnm(tabnam, lognam=None, acmode=None)"
tabnam = getstr(tabnam)
lognam = getstr(lognam)
cdef dsc_descriptor_s tabnamD
DESCFROMSTR(&tabnamD, tabnam)
cdef dsc_descriptor_s lognamD
cdef dsc_descriptor_s* lognamPtr = \
DESCFROMOPTSTR(&lognamD, lognam)
cdef unsigned char iacmode
cdef unsigned char* iacmodePtr = UCOPTPTR(&iacmode, acmode)
s = sys_dellnm(&tabnamD, lognamPtr, iacmodePtr)
checkStatus(s)
return s
def delmbx(unsigned short int chan):
"status = delmbx(chan)"
s = sys_delmbx(chan)
checkStatus(s)
return s
def delprc(pid=None, prcnam=None):
"status = delprc(pid=None, prcnam=None)"
cdef unsigned int ipid
cdef unsigned int* ipidPtr = UIOPTPTR(&ipid, pid)
cdef dsc_descriptor_s prcnamD
cdef dsc_descriptor_s* prcnamPtr = \
DESCFROMOPTSTR(&prcnamD, prcnam)
s = sys_delprc(ipidPtr, prcnamPtr)
checkStatus(s)
return s
def deq(unsigned int lkid=0, valblk=None, unsigned int acmode=0,
unsigned int flags=0):
"status, valblk = deq(lkid=0, valblk=None, acmode=0, flags=0)"
cdef char* valPtr = NULL
cdef object oval = None
cdef sz = 0
if valblk is not None:
if flags & LCK_M_XVALBLK:
sz = 64
else:
sz = 16
if len(valblk) > sz:
raise ValueError('Invalid valblk length')
if isinstance(valblk, basestring):
valblk = getstr(valblk)
oval = bytearray(valblk)
oval += '\0x00' * (sz - len(oval))
valPtr = PyByteArray_AsString(oval)
s = sys_deq(lkid, valPtr, acmode, flags)
checkStatus(s)
return s, oval
def device_path_scan(unsigned short chan=0, devnam=None, itmlst=None,
unsigned int contxt=0):
"status, contxt [,resdic] = device_path_scan(chan=0, devnam=None, \
itmlst=None, contxt=None)"
cdef dsc_descriptor_s devnamD
cdef dsc_descriptor_s* devnamPtr = \
DESCFROMOPTSTR(&devnamD, devnam)
cdef ILE3* ile3Ptr = NULL
cdef object ile3 = None
if itmlst is not None:
ile3 = pyvms_itmlst2ile3(itmlst, 0)
ile3Ptr = <ILE3 *>PyByteArray_AsString(ile3)
s = sys_device_path_scan(chan, devnamPtr, ile3Ptr, &contxt, NULL)
checkStatus(s)
if itmlst is None:
return s, contxt
ile3 = pyvms_ile3todict(itmlst, ile3, 0)
if len(ile3) > 0:
return s, contxt, ile3
return s, contxt
def device_scan(search_devnam=None, itmlst=None, unsigned long long contxt=0):
"status, devnam, contxt [,resdic] = device_scan(search_devnam=None, \
itmlst=None, contxt)"
cdef dsc_descriptor_s searchDevnamD
cdef dsc_descriptor_s* searchDevnamPtr = \
DESCFROMOPTSTR(&searchDevnamD, search_devnam)
cdef ILE3* ile3Ptr = NULL
cdef object ile3 = None
if itmlst is not None:
ile3 = pyvms_itmlst2ile3(itmlst, 0)
ile3Ptr = <ILE3 *>PyByteArray_AsString(ile3)
cdef char devnam[257]
cdef dsc_descriptor_s devnamD
DESCSTR(devnamD, devnam)
cdef unsigned short retlen = 0
s = sys_device_scan(&devnamD, &retlen, searchDevnamPtr, ile3Ptr,
<_generic_64 *>&contxt)
checkStatus(s)
if itmlst is None:
return s, devnam[:retlen], contxt
ile3 = pyvms_ile3todict(itmlst, ile3, 0)
if len(ile3) > 0:
return s, devnam[:retlen], contxt, ile3
return s, devnam[:retlen], contxt
def dismou(devnam, unsigned int flags=0):
"status = dismou(devnam, flags=0)"
cdef dsc_descriptor_s devnamD
DESCFROMSTR(&devnamD, devnam)
s = sys_dismou(&devnamD, flags)
checkStatus(s)
return s
def display_proxy(rem_node, rem_user, unsigned int flags=0, contxt=None):
"status, proxy_node, proxy_user, default_user, local_users[, contxt] = \
display_proxy(rem_node, rem_user, local_users, flags=0, contxt=0)"
cdef dsc_descriptor_s remNodeD
DESCFROMSTR(&remNodeD, rem_node)
cdef dsc_descriptor_s remUserD
DESCFROMSTR(&remUserD, rem_user)
cdef unsigned short bufferSizes[4]
bufferSizes[0] = bufferSizes[1] = bufferSizes[2] = bufferSizes[3] = 0
cdef LocalUserProxy localUsers[16]
assert(sizeof(localUsers) == 576)
memset(localUsers, 0, sizeof(localUsers))
cdef char proxyNode[1025]
cdef char proxyUser[33]
cdef char defaultUser[33]
cdef dsc_descriptor_s proxyNodeD, proxyUserD, defaultUserD
DESCSTR(proxyNodeD, proxyNode)
DESCSTR(proxyUserD, proxyUser)
DESCSTR(defaultUserD, defaultUser)
cdef unsigned int icontxt = 0
cdef unsigned int* icontxtPtr = NULL
if contxt is not None:
icontxt = contxt
icontxtPtr = &icontxt
s = sys_display_proxy(&remNodeD, &remUserD, bufferSizes, &proxyNodeD,
&proxyUserD, &defaultUserD,
<unsigned int *>localUsers, flags, icontxtPtr)
checkStatus(s)
cdef object olocalUsers = PyTuple_New(bufferSizes[2])
cdef int i
cdef object val
for i from 0 <= i < bufferSizes[2]:
val = localUsers[i].username[:localUsers[i].length]
# PyTuple_SetItem "steals" a reference
Py_XINCREF(<PyObject *>val)
PyTuple_SetItem(olocalUsers, i, val)
if contxt is None:
return (s, proxyNode[:bufferSizes[1]], proxyUser[:bufferSizes[0]],
defaultUser[:bufferSizes[3]], olocalUsers)
else:
return (s, proxyNode[:bufferSizes[1]], proxyUser[:bufferSizes[0]],
defaultUser[:bufferSizes[3]], olocalUsers, icontxt)
def dlcefc(name):
"status = dlcefc(name)"
name = getstr(name)
cdef dsc_descriptor_s nameD
DESCFROMSTR(&nameD, name)
s = sys_dlcefc(&nameD)
checkStatus(s)
return s
def enq(unsigned int efn, unsigned int lkmode, unsigned lockid=0,
valblk=None, unsigned int flags=0, resnam=None, unsigned int parid=0,
unsigned int acmode=0, unsigned int rsdm_id=0, range=None,
unsigned int priority=0):
"status, xlksb = enq(efn, lkmode, lockid=0, \
valblk=None, flags=0, resnam=None, parid=0, acmode=0, rsdm_id=0,range=None, \
priority=0)"
resnam = getstr(resnam)
cdef dsc_descriptor_s resnamD
cdef dsc_descriptor_s* resnamPtr = \
DESCFROMOPTSTR(&resnamD, resnam)
cdef Xlksb lksb = Xlksb()
lksb.xlksb.xlksb_l_lkid = lockid
if efn == 0:
efn = EFN_C_ENF
if valblk is not None and (flags & LCK_M_VALBLK) == 0:
raise ValueError("valblk specified and flag LCK_M_VALBLK not set")
if valblk is not None:
if flags & LCK_M_XVALBLK:
set_valblk(lksb, valblk, 64)
else:
set_valblk(lksb, valblk, 16)
s = sys_enq(efn, lkmode, <LKSB *>&lksb.xlksb, flags, resnamPtr, parid,
NULL, 0, NULL, acmode, 0, 0)
checkStatus(s)
return s, lksb
def enqw(unsigned int efn, unsigned int lkmode, unsigned lockid=0,
valblk=None, unsigned int flags=0, resnam=None, unsigned int parid=0,
unsigned int acmode=0, unsigned int rsdm_id=0, range=None,
unsigned int priority=0):
"status, xlksb = enqw(efn, lkmode, lockid=0, \
valblk=None, flags=0, resnam=None, parid=0, acmode=0, rsdm_id=0,range=None, \
priority=0)"
resnam = getstr(resnam)
cdef dsc_descriptor_s resnamD
cdef dsc_descriptor_s* resnamPtr = \
DESCFROMOPTSTR(&resnamD, resnam)
cdef Xlksb lksb = Xlksb()
lksb.xlksb.xlksb_l_lkid = lockid
if efn == 0:
efn = EFN_C_ENF
if valblk is not None and (flags & LCK_M_VALBLK) == 0:
raise ValueError("valblk specified and flag LCK_M_VALBLK not set")
if valblk is not None:
if flags & LCK_M_XVALBLK:
set_valblk(lksb, valblk, 64)
else:
set_valblk(lksb, valblk, 16)
s = sys_enqw(efn, lkmode, <LKSB *>&lksb.xlksb, flags, resnamPtr, parid,
NULL, 0, NULL, acmode, 0, 0)
checkStatus(s)
checkStatus(lksb.xlksb.xlksb_w_status)
return s, lksb
def erapat(int type=0, unsigned int count=0):
"status, pat = erapat(type=0, count=0)"
cdef unsigned int pat = 0
s = sys_erapat(type, count, &pat)
checkStatus(s)
return s, pat
def expreg(unsigned int pagcnt, unsigned int acmode=0, char region=0):
"status, start, end = expreg(pagcnt, acmode=0, region=0)"
cdef VA_RANGE retadr
s = sys_expreg(pagcnt, &retadr, acmode, region)
checkStatus(s)
return (s, <unsigned int>retadr.va_range_ps_start_va,
<unsigned int>retadr.va_range_ps_end_va)
def filescan(srcstr, valuelst):
"status, fdflags, auxout [,resdic] = filescan(srcstr, valuelst)"
cdef dsc_descriptor_s srcstrD
DESCFROMSTR(&srcstrD, srcstr)
cdef unsigned int fdflags
cdef char auxout[4097]
cdef dsc_descriptor_s auxoutD
DESCSTR(auxoutD, auxout)
cdef unsigned short retlen = 0
cdef ILE2 valuelst2[12] # maximum 11 items
memset(valuelst2, 0, sizeof(valuelst2))
cdef int i
if len(valuelst) > 11:
raise ValueError("Too many items requested, maximum is 11")
for i in range(len(valuelst)):
valuelst2[i].ile2_w_code = valuelst[i].code
s = sys_filescan(&srcstrD, valuelst2, &fdflags, &auxoutD, &retlen)
checkStatus(s)
cdef object resdic = dict()
for i in range(len(valuelst)):
resdic[valuelst2[i].ile2_w_code] = \
(<char *>valuelst2[i].ile2_ps_bufaddr)[:valuelst2[i].ile2_w_length]
return s, fdflags, auxout[:retlen], resdic
def find_held(unsigned long long holder, contxt=None):
"status, id, attrib [,contxt] = find_held(holder, contxt=None)"
cdef unsigned int id, attrib, icontxt
cdef unsigned int* icontxtPtr = NULL
if contxt is not None:
icontxt = contxt
icontxtPtr = &icontxt
s = sys_find_held(<_generic_64 *>&holder, &id, &attrib, icontxtPtr)
checkStatus(s)
if contxt is None:
return s, id, attrib
else:
return s, id, attrib, icontxt
def find_holder(unsigned int id, contxt=None):
"status, holder, attrib [,contxt] = find_holder(id, contxt=None)"
cdef unsigned int attrib, icontxt
cdef unsigned long long holder
cdef unsigned int* icontxtPtr = NULL
if contxt is not None:
icontxt = contxt
icontxtPtr = &icontxt
s = sys_find_holder(id, <_generic_64 *>&holder, &attrib, icontxtPtr)
checkStatus(s)
if contxt is None:
return s, holder, attrib
else:
return s, holder, attrib, icontxt
def finish_rdb(unsigned int contxt):
"status, contxt = finish_rdb(contxt)"
s = sys_finish_rdb(&contxt)
checkStatus(s)
return s, contxt
def forcex(pid=None, prcnam=None, unsigned int code=0):
"status, pid = forcex(pid=None, prcnam=None, code=0)"
cdef unsigned int ipid = 0
if pid is not None:
ipid = pid
cdef dsc_descriptor_s prcnamD
cdef dsc_descriptor_s* prcnamPtr = \
DESCFROMOPTSTR(&prcnamD, prcnam)
s = sys_forcex(&ipid, prcnamPtr, code)
checkStatus(s)
return s, ipid
def format_acl(aclent, width=None, trm=None,
unsigned short indent=0, accnam=None):
"status, aclstr = acl_acl(aclent, width=None, trm=None, indent=0, \
accnam=None)"
cdef unsigned short iwidth = 0
trm = getstr(trm)
cdef dsc_descriptor_s aclentD
DESCFROMSTR(&aclentD, aclent)
cdef unsigned short retlen
cdef char aclstr[1025]
cdef dsc_descriptor_s aclstrD
DESCSTR(aclstrD, aclstr)
cdef dsc_descriptor_s trmD
cdef dsc_descriptor_s* trmPtr = \
DESCFROMOPTSTR(&trmD, trm)
cdef dsc_descriptor_s accnamD[32]
cdef dsc_descriptor_s* accnamPtr = NULL
memset(accnamD, 0, sizeof(accnamD))
if width is not None:
iwidth = width
cdef int i
cdef char* accnamc
if accnam is not None:
if len(accnam) != 32:
raise ValueError("accnam should have 32 elements")
accnamPtr = accnamD
for i in range(32):
accnamD[i].dsc_b_dtype = DSC_K_DTYPE_T
accnamD[i].dsc_b_class = DSC_K_CLASS_S
accnamD[i].dsc_w_length = len(accnam[i])
accnamc = accnam[i]
accnamD[i].dsc_a_pointer = accnamc
s = sys_format_acl(&aclentD, &retlen, &aclstrD, &iwidth, trmPtr,
&indent, <unsigned int *>accnamD, NULL)
checkStatus(s)
return s, aclstr[:retlen]
def format_audit(unsigned int fmttyp, audmsg, width=None, trmdsc=None,
routine=None, fmtflg=None):
"status, outbuf = format_audit(fmttyp, audmsg, width=None, trmdsc=None, \
routine=None, fmtflg=None)"
cdef char* audmsgPtr = audmsg
cdef unsigned short retlen
cdef char outbuf[32768]
cdef dsc_descriptor_s outbufD
DESCSTR(outbufD, outbuf)
cdef unsigned short iwidth
cdef unsigned short* iwidthPtr = USOPTPTR(&iwidth, width)
cdef unsigned int ifmtflg = 0
if fmtflg is not None:
ifmtflg = fmtflg
cdef dsc_descriptor_s trmdscD
cdef dsc_descriptor_s* trmdscPtr = \
DESCFROMOPTSTR(&trmdscD, trmdsc)
s = sys_format_audit(fmttyp, <unsigned int *>audmsgPtr, &retlen,
&outbufD, iwidthPtr, <unsigned int *>trmdscPtr,
NULL, ifmtflg)
checkStatus(s)
return s, outbuf[:retlen]
def free_user_capability(int cap_num, flags=None):
"status, prev_mask = free_user_capability(cap_num [,flags])"
cdef unsigned long long prev_mask, iflags
cdef unsigned long long* iflagsPtr = ULLOPTPTR(&iflags, flags)
s = sys_free_user_capability(&cap_num, <_generic_64 *>&prev_mask,
<_generic_64 *>iflagsPtr)
checkStatus(s)
return s, prev_mask
def get_align_fault_data(buffer_items):
"status, return_size = get_align_fault_data(buffer)"
cdef object buffer = bytearray(buffer_items * AFR_K_USER_LENGTH)
cdef char* bufPtr = PyByteArray_AsString(buffer)
cdef int buflen = len(buffer)
cdef int rs
s = sys_get_align_fault_data(bufPtr, buflen, &rs)
checkStatus(s)
cdef object lst = PyTuple_New(rs / AFR_K_USER_LENGTH)
cdef int i = 0
cdef int offset = 0
cdef AFRDEF* afrPtr
cdef object v
while offset < rs:
afrPtr = <AFRDEF *>(&bufPtr[offset]);
v = (afrPtr.afr_q_fault_pc, afrPtr.afr_q_fault_va)
Py_XINCREF(<PyObject *>v)
PyTuple_SetItem(lst, i, v)
offset += AFR_K_USER_LENGTH;
i += 1
return s, lst
def getdviw(unsigned int efn=EFN_C_ENF, unsigned short chan=0,
devnam=None, itmlst=None):
"status [,resdic] = getdviw(efn=EFN_C_ENF, chan=0, devnam=None, \
itmlst=None)"
if efn == 0:
efn=EFN_C_ENF
cdef dsc_descriptor_s devnamD
cdef dsc_descriptor_s* devnamPtr = \
DESCFROMOPTSTR(&devnamD, devnam)
cdef IOSB iosb
memset(&iosb, 0, sizeof(iosb))
cdef ILE3* ile3Ptr = NULL
cdef object ile3 = None
if itmlst is not None:
ile3 = pyvms_itmlst2ile3(itmlst, 0)
ile3Ptr = <ILE3 *>PyByteArray_AsString(ile3)
s = sys_getdviw(efn, chan, devnamPtr, ile3Ptr, &iosb, 0, 0, 0)
checkStatus(s)
s = iosb.iosb_l_getxxi_status
checkStatus(s)
if itmlst is None:
return s
ile3 = pyvms_ile3todict(itmlst, ile3, 0)
if len(ile3) == 0:
return s
return s, ile3
def getenv(*itmlst):
"status, resdic = getenv(itm,...)"
cdef ITEMTYPE* itmPtr = NULL
cdef object envlst = lst2envlst(itmlst)
itmPtr = <ITEMTYPE *>PyByteArray_AsString(envlst)
s = sys_getenv(itmPtr)
checkStatus(s)
return s, envlst2dict(envlst, len(itmlst))
def getjpiw(unsigned int efn=EFN_C_ENF, pid=None, prcnam=None, itmlst=None,
unsigned int flags=0):
"status [,pid] [,resdic] = getjpiw(efn=EFN_C_ENF, pid=None, prcnam=None, \
itmlst=None, flags=0)\nIf flags is 1 then status code SS$_SUSPENDED is \
returned instead of been signaled"
if efn == 0:
efn=EFN_C_ENF
cdef unsigned int ipid
cdef unsigned int* ipidPtr;
if pid == -1:
ipidPtr = &ipid;
ipid = -1;
else:
ipidPtr = UIOPTPTR(&ipid, pid)
cdef dsc_descriptor_s prcnamD
cdef dsc_descriptor_s* prcnamPtr = \
DESCFROMOPTSTR(&prcnamD, prcnam)
cdef IOSB iosb
memset(&iosb, 0, sizeof(iosb))
cdef ILE3* ile3Ptr = NULL
cdef object ile3 = None
if itmlst is not None:
ile3 = pyvms_itmlst2ile3(itmlst, 0)
ile3Ptr = <ILE3 *>PyByteArray_AsString(ile3)
s = sys_getjpiw(efn, ipidPtr, prcnamPtr, ile3Ptr, &iosb, 0, 0)
if flags == 1 and (s == SS__SUSPENDED or
iosb.iosb_l_getxxi_status != SS__SUSPENDED):
s = SS__SUSPENDED
else:
checkStatus(s)
s = iosb.iosb_l_getxxi_status
checkStatus(s)
if itmlst is None:
if pid is None:
return s
return s, ipid
ile3 = pyvms_ile3todict(itmlst, ile3, 0)
if len(ile3) == 0:
if pid is None:
return s, ipid
if pid is None:
return s, ile3
return s, ipid, ile3
def getlkiw(unsigned int efn=EFN_C_ENF, lkid=None, itmlst=None):
"status, lkid [,resdic] = getlkiw(efn=EFN_C_ENF, lkid=None, itmlst=None)"
if efn == 0:
efn=EFN_C_ENF
cdef unsigned int ilkid
cdef unsigned int* ilkidPtr = UIOPTPTR(&ilkid, lkid)
cdef IOSB iosb
memset(&iosb, 0, sizeof(iosb))
cdef ILE3* ile3Ptr = NULL
cdef object ile3 = None
if itmlst is not None:
ile3 = pyvms_itmlst2ile3(itmlst, 1)
ile3Ptr = <ILE3 *>PyByteArray_AsString(ile3)
s = sys_getlkiw(efn, ilkidPtr, ile3Ptr, &iosb, 0, 0, 0)
checkStatus(s)
s = iosb.iosb_l_getxxi_status
checkStatus(s)
if itmlst is None:
return s, ilkid
ile3 = pyvms_ile3todict(itmlst, ile3, 1)
if len(ile3) == 0:
return s, ilkid
return s, ilkid, ile3
def getmsg(unsigned int msgid, unsigned int flags=0):
"status, buf, fao_count, user_spec = getmsg(msgid, flags=0)"
cdef unsigned short retlen = 0
cdef char buf[1025]
cdef dsc_descriptor_s bufD
DESCSTR(bufD, buf)
cdef unsigned char outargs[4]
s = sys_getmsg(msgid, &retlen, &bufD, flags, outargs)
checkStatus(s)
return s, buf[:retlen], outargs[1], outargs[2]
def getquiw(unsigned int efn=EFN_C_ENF, func=None,
contxt=None, itmlst=None):
"status [, contxt] [,resdic] = getquiw(efn=EFN_C_ENF, func=None, \
contxt=None, itmlst=None)"
if efn == 0:
efn=EFN_C_ENF
if func is None:
raise ValueError("func parameter required")
cdef unsigned short ifunc = func
cdef IOSB iosb
memset(&iosb, 0, sizeof(iosb))
cdef ILE3* ile3Ptr = NULL
cdef object ile3 = None
if itmlst is not None:
ile3 = pyvms_itmlst2ile3(itmlst, 0)
ile3Ptr = <ILE3 *>PyByteArray_AsString(ile3)
cdef int icontxt
cdef int* icontxtPtr = IOPTPTR(&icontxt, contxt)
s = sys_getquiw(efn, ifunc, <unsigned int *>icontxtPtr, ile3Ptr,
&iosb, 0, 0)
checkStatus(s)
s = iosb.iosb_l_getxxi_status
checkStatus(s)
if itmlst is None:
if contxt is None:
return s
return s, icontxt
ile3 = pyvms_ile3todict(itmlst, ile3, 0)
if len(ile3) == 0:
if contxt is None:
return s
return s, icontxt
if contxt is None:
return s, ile3
return s, icontxt, ile3
def getrmi(unsigned int efn=EFN_C_ENF, nullarg1=None, nullarg2=None,
itmlst=None):
"status [,resdic] = getrmiw(efn=EFN_C_ENF, nullarg1=None, nullarg2=None, \
itmlst=None)"
if itmlst is None:
raise ValueError("itmlst parameter required")
cdef IOSB iosb
memset(&iosb, 0, sizeof(iosb))
cdef ILE3* ile3Ptr = NULL
cdef object ile3 = None
ile3 = pyvms_itmlst2ile3(itmlst, 1)
ile3Ptr = <ILE3 *>PyByteArray_AsString(ile3)
s = sys_getrmi(efn, 0, 0, ile3Ptr, &iosb, 0, 0)
checkStatus(s)
s = iosb.iosb_l_getxxi_status
checkStatus(s)
ile3 = pyvms_ile3todict(itmlst, ile3, 1)
return s, ile3
def getsyiw(unsigned int efn=EFN_C_ENF, csid=None, nodename=None, itmlst=None):
"status [,csid] [,resdic] = getsyiw(efn=EFN_C_ENF, csid=None, \
nodename=None, itmlst=None)"
if itmlst is None:
raise ValueError("itmlst parameter required")
cdef unsigned int icsid
cdef unsigned int* icsidPtr = NULL
if csid == -1:
icsidPtr = &icsid
icsid = <unsigned int>-1
else:
icsidPtr = UIOPTPTR(&icsid, csid)
cdef dsc_descriptor_s nodenameD
cdef dsc_descriptor_s* nodenamePtr = \
DESCFROMOPTSTR(&nodenameD, nodename)
cdef IOSB iosb
memset(&iosb, 0, sizeof(iosb))
cdef ILE3* ile3Ptr = NULL
cdef object ile3 = None
ile3 = pyvms_itmlst2ile3(itmlst, 1)
ile3Ptr = <ILE3 *>PyByteArray_AsString(ile3)
s = sys_getsyiw(efn, <unsigned int *>icsidPtr, nodenamePtr, ile3Ptr,
&iosb, 0, 0)
checkStatus(s)
s = iosb.iosb_l_getxxi_status
checkStatus(s)
ile3 = pyvms_ile3todict(itmlst, ile3, 1)
if csid is None:
if len(ile3) == 0:
return s
return s, ile3
if len(ile3) == 0:
return s, icsid
return s, icsid, ile3
def gettim():
"status, tim = gettim()"
cdef unsigned long long timval
s = sys_gettim(<_generic_64 *>&timval)
checkStatus(s)
return s, timval
def getuai(unsigned int efn=EFN_C_ENF, contxt=None, usrnam=None, itmlst=None):
"status [,contxt] [,resdic] = getuai(efn=EFN_C_ENF, contxt=None, \
usrnam=None, itmlst=None)"
if efn == 0:
efn=EFN_C_ENF
if usrnam is None:
raise ValueError("usrnam parameter required")
if itmlst is None:
raise ValueError("itmlst parameter required")
cdef dsc_descriptor_s usrnamD
DESCFROMSTR(&usrnamD, usrnam)
cdef IOSB iosb
memset(&iosb, 0, sizeof(iosb))
iosb.iosb_l_getxxi_status = SS__NORMAL
cdef ILE3* ile3Ptr = NULL
cdef object ile3 = None
ile3 = pyvms_itmlst2ile3(itmlst, 0)
ile3Ptr = <ILE3 *>PyByteArray_AsString(ile3)
cdef int icontxt
cdef int* icontxtPtr = NULL
if contxt is not None:
icontxtPtr = &icontxt
if contxt == -1:
icontxt = -1
else:
icontxt = contxt
s = sys_getuai(efn, <unsigned int *>icontxtPtr, &usrnamD, ile3Ptr, &iosb,
0, 0)
checkStatus(s)
s = iosb.iosb_l_getxxi_status
checkStatus(s)
ile3 = pyvms_ile3todict(itmlst, ile3, 0)
if contxt is None:
if len(ile3) == 0:
return s
return s, ile3
return s, icontxt, ile3
def getutc():
"status, utc = getutc()"
cdef unsigned long long retval[2]
s = sys_getutc(<unsigned int *>retval)
checkStatus(s)
cdef object res = retval[1]
res = res << 64
res = res + retval[0]
return s, res
def get_galaxy_lock_info(unsigned long long lock_handle):
"status, name, timeout, size, ipl, rank, flags = \
get_galaxy_lock_info(lock_handle)"
cdef char name[17]
cdef unsigned int timeout, size, ipl, rank
cdef unsigned short flags, retlen
s = sys_get_galaxy_lock_info(lock_handle, name, &timeout, &size, &ipl,
&rank, &flags, &retlen)
checkStatus(s)
return s, name[:retlen], timeout, size, ipl, rank, flags
def get_galaxy_lock_size():
"status, min_size, max_size = get_galaxy_lock_size()"
cdef unsigned int min_size, max_size
s = sys_get_galaxy_lock_size(&min_size, &max_size)
checkStatus(s)
return s, min_size, max_size
def get_security(clsnam=None, objnam=None, objhan=None, unsigned int flags=0,
itmlst=None, contxt=None, acmode=None):
"status [,contxt] [,resdic] = get_security(clsnam=None, objnam=None, \
objhan=None, flags=0, itmlst=None, contxt=None, acmode=None)"
cdef dsc_descriptor_s clsnamD
cdef dsc_descriptor_s* clsnamPtr= \
DESCFROMOPTSTR(&clsnamD, clsnam)
cdef dsc_descriptor_s objnamD
cdef dsc_descriptor_s* objnamPtr = \
DESCFROMOPTSTR(&objnamD, objnam)
cdef unsigned int iobjhan = 0
cdef unsigned int* iobjhanPtr = UIOPTPTR(&iobjhan, objhan)
cdef ILE3* ile3Ptr = NULL
cdef object ile3 = None
if itmlst is not None:
ile3 = pyvms_itmlst2ile3(itmlst, 0)
ile3Ptr = <ILE3 *>PyByteArray_AsString(ile3)
cdef unsigned int icontxt
cdef unsigned int* icontxtPtr = UIOPTPTR(&icontxt, contxt)
cdef unsigned int iacmode
cdef unsigned int* iacmodePtr = UIOPTPTR(&iacmode, acmode)
s = sys_get_security(clsnamPtr, objnamPtr, iobjhanPtr, flags,
ile3Ptr, icontxtPtr, iacmodePtr)
checkStatus(s)
if contxt is None:
if itmlst is None:
return s
ile3 = pyvms_ile3todict(itmlst, ile3, 0)
if len(ile3) > 0:
return s, ile3
return s
if itmlst is None:
return s, icontxt
ile3 = pyvms_ile3todict(itmlst, ile3, 0)
if len(ile3) > 0:
return s, icontxt, ile3
return s, icontxt
def get_user_capability(int cap_num, flags=None):
"status, select_num, select_mask, prev_mask = \
get_user_capability(cap_num, flags=None)"
cdef int select_num
cdef unsigned long long select_mask, prev_mask
cdef unsigned long long iflags
cdef unsigned long long* iflagsPtr = ULLOPTPTR(&iflags, flags)
s = sys_get_user_capability(&cap_num, &select_num,
<_generic_64 *>&select_mask,
<_generic_64 *>&prev_mask,
<_generic_64 *>iflagsPtr)
checkStatus(s)
return s, select_num, select_mask, prev_mask
def grantid(pid=None, prcnam=None, id=None, name=None,
unsigned int segment=0):
"status, pid, od, prvatr = grantid(pid=None, prcnam=None, id=None, \
name=None, segment=0)"
cdef unsigned int ipid = 0
if pid == -1:
ipid = -1
elif pid is None:
ipid = 0
else:
ipid = pid
cdef dsc_descriptor_s prcnamD
cdef dsc_descriptor_s* prcnamPtr = \
DESCFROMOPTSTR(&prcnamD, prcnam)
# cdef unsigned int iid[2]
# if isinstance( id, (int, long))
# if id is None:
# iid[0] = iid[1] = 0
# else:
# iid[0] = id[0]
# iid[1] = id[1]
cdef unsigned long long iid = 0
if id is not None:
iid = id
cdef dsc_descriptor_s nameD
cdef dsc_descriptor_s* namePtr = \
DESCFROMOPTSTR(&nameD, name)
cdef unsigned int prvatr
s = sys_grantid(&ipid, prcnamPtr, <_generic_64 *>&iid, namePtr, &prvatr,
segment)
checkStatus(s)
# return s, ipid, (iid[0], iid[1]), prvatr
return s, ipid, iid, prvatr
def hash_password(pwd, unsigned char alg, unsigned short salt, usrnam):
"status, hash = hash_password(pwd, alg, salt, usrnam)"
pwd = getstr(pwd)
cdef dsc_descriptor_s pwdD
DESCFROMSTR(&pwdD, pwd)
usrnam = getstr(usrnam)
cdef dsc_descriptor_s usrnamD
DESCFROMSTR(&usrnamD, usrnam)
cdef unsigned long long hash
s = sys_hash_password(&pwdD, alg, salt, &usrnamD, <_generic_64 *>&hash)
checkStatus(s)
return s, hash
def icc_accept(unsigned int conn_handle, accept_buf=None,
unsigned int user_context=0, unsigned int flags=0):
"status = icc_accept(conn_handle, accept_buf=None, user_context=None, \
flags=0)"
cdef dsc_descriptor_s abD
cdef dsc_descriptor_s* abPtr = \
DESCFROMOPTSTR(&abD, accept_buf)
cdef unsigned int accept_len = 0
if accept_buf is not None:
accept_len = len(accept_buf)
s = sys_icc_accept(conn_handle, abPtr, accept_len, user_context, flags)
checkStatus(s)
return s
def icc_close_assoc(unsigned int assoc_handle):
"status = icc_close_assoc(assoc_handle)"
s = sys_icc_close_assoc(assoc_handle)
checkStatus(s)
return s
def icc_connectw(unsigned int assoc_handle, remote_assoc, remote_node=None,
unsigned int user_context=0, conn_buf=None, unsigned int flags=0):
"status, conn_handle, return_buf = icc_connectw(assoc_handle, \
remote_assoc, remote_node=None, user_context=0, conn_buf=None, flags=0)"
cdef IOS_ICC ios
memset(&ios, 0, sizeof(ios))
cdef unsigned int conn_handle
cdef dsc_descriptor_s raD
cdef dsc_descriptor_s* raPtr = \
DESCFROMOPTSTR(&raD, remote_assoc)
cdef dsc_descriptor_s rnD
cdef dsc_descriptor_s* rnPtr = \
DESCFROMOPTSTR(&rnD, remote_node)
cdef char* cbPtr = NULL
cdef unsigned int cblen = 0
if conn_buf is not None:
cbPtr = conn_buf
cblen = len(conn_buf)
cdef char buff[1000]
cdef unsigned int retlen
s = sys_icc_connectw(&ios, 0, 0, assoc_handle, &conn_handle, raPtr, rnPtr,
user_context, cbPtr, cblen, buff, sizeof(buff),
&retlen, flags)
checkStatus(s)
s = ios.ios_icc_w_status
if s == SS__REJECT:
s = ios.ios_icc_l_remstat
checkStatus(s)
return s, conn_handle, buff[:retlen]
def icc_disconnectw(unsigned int conn_handle, disc_buf=None):
"status = icc_disconnectw(conn_handle, disc_buf=None)"
cdef IOSB iosb
memset(&iosb, 0, sizeof(iosb))
cdef char* dbPtr = NULL
cdef unsigned int dblen = 0
if disc_buf is not None:
dbPtr = disc_buf
dblen = len(disc_buf)
s = sys_icc_disconnectw(conn_handle, &iosb, 0, 0, dbPtr, dblen)
checkStatus(s)
s = iosb.iosb_w_status
checkStatus(s)
return s
def icc_open_assoc(assoc_name=None, logical_name=None, logical_table=None,
unsigned int maxflowbufcnt=0, unsigned int prot=0):
"status, assoc_handle = icc_open_assoc([assoc_name=None, \
logical_name=None, logical_table=None, maxflowbufcnt=0, prot=0)"
cdef unsigned int assoc_handle
cdef dsc_descriptor_s anD
cdef dsc_descriptor_s* anPtr = \
DESCFROMOPTSTR(&anD, assoc_name)
cdef dsc_descriptor_s lnD
cdef dsc_descriptor_s* lnPtr = \
DESCFROMOPTSTR(&lnD, logical_name)
cdef dsc_descriptor_s ltD
cdef dsc_descriptor_s* ltPtr = \
DESCFROMOPTSTR(&ltD, logical_table)
s = sys_icc_open_assoc(&assoc_handle, anPtr, lnPtr, ltPtr, 0, 0, 0,
maxflowbufcnt, prot)
checkStatus(s)
return s
def icc_receivew(unsigned int conn_handle):
"status, recv_buf, request_handle, reply_len = icc_receivew(conn_handle)"
cdef IOS_ICC ios
memset(&ios, 0, sizeof(ios))
cdef unsigned int rl
cdef char buf[1000]
s = sys_icc_receivew(conn_handle, &ios, 0, 0, buf, sizeof(buf))
checkStatus(s)
s = ios.ios_icc_w_status
checkStatus(s)
return (s, buf[:ios.ios_icc_l_rcv_len], ios.ios_icc_l_req_handle,
ios.ios_icc_l_reply_len)
def icc_reject(unsigned int conn_handle, reject_buf=None,
unsigned int reason=0):
"status = icc_reject(conn_handle, reject_buf=None, reason=0)"
cdef char* rb = NULL
cdef unsigned int rbl = 0
if reject_buf is not None:
rb = reject_buf
rbl = len(reject_buf)
s = sys_icc_reject(conn_handle, rb, rbl, reason)
checkStatus(s)
return s
def icc_replyw(unsigned int request_handle, unsigned int conn_handle,
reply_buf=None):
"status = icc_replyw(request_handle, conn_handle, reply_buf=None)"
cdef IOS_ICC ios
memset(&ios, 0, sizeof(ios))
cdef char* rb = NULL
cdef unsigned int rbl = 0
if reply_buf is not None:
rb = reply_buf
rbl = len(reply_buf)
ios.ios_icc_l_replyto_handle = request_handle
s = sys_icc_replyw(conn_handle, &ios, 0, 0, rb, rbl)
checkStatus(s)
s = ios.ios_icc_w_status
checkStatus(s)
return s
def icc_transceivew(unsigned int conn_handle, send_buf):
"status, reply_buf = icc_transceivew(conn_handle, send_buf)"
cdef IOS_ICC ios
# The maximum transmission side for both SYS$ICC_TRANSCEIVE is 1 Mb
cdef object buff = bytearray(1024 * 1024)
cdef char* buffPtr = buff
cdef char* sb = send_buf
cdef unsigned int sbl = len(send_buf)
memset(&ios, 0, sizeof(ios))
ios.ios_icc_a_reply_buffer = <longCharPtr>PyByteArray_AsString(buff)
ios.ios_icc_l_rxreply_len = len(buff)
s = sys_icc_transceivew(conn_handle, &ios, 0, 0, sb, sbl)
checkStatus(s)
s = ios.ios_icc_w_status
checkStatus(s)
return s, buffPtr[:ios.ios_icc_l_txrcv_len]
def icc_transmitw(unsigned int conn_handle, send_buf=None):
"status = icc_transmitw(conn_handle [,send_buf])"
cdef IOS_ICC ios
memset(&ios, 0, sizeof(ios))
cdef char* sb = NULL
cdef unsigned int sbl = 0
if send_buf is not None:
sb = send_buf
sbl = len(send_buf)
s = sys_icc_transmitw(conn_handle, &ios, 0, 0, sb, sbl)
checkStatus(s)
s = ios.ios_icc_w_status
checkStatus(s)
return s
def idtoasc(unsigned int id, contxt=None):
"status, nambuf, resid, attrib, contxt = idtoasc(id [,contxt])"
cdef unsigned int icontxt
cdef unsigned int* icontxtPtr = UIOPTPTR(&icontxt, contxt)
cdef unsigned short reslen
cdef char nambuf[257]
cdef dsc_descriptor_s nambufD
DESCSTR(nambufD, nambuf)
cdef unsigned int resid, attrib
s = sys_idtoasc(id, &reslen, &nambufD, &resid, &attrib, icontxtPtr)
checkStatus(s)
if contxt is None:
return s, nambuf[:reslen], resid, attrib
return s, nambuf[:reslen], resid, attrib, icontxt
def init_vol(devnam, volnam, itmlst=None):
"status = init_vol(devnam, volnam, itmlst=None)"
cdef dsc_descriptor_s devnamD
DESCFROMSTR(&devnamD, devnam)
cdef dsc_descriptor_s volnamD
DESCFROMSTR(&volnamD, volnam)
cdef ILE3* ile3Ptr = NULL
cdef object ile3 = None
if itmlst is not None:
ile3 = pyvms_itmlst2ile3(itmlst, 0)
ile3Ptr = <ILE3 *>PyByteArray_AsString(ile3)
s = sys_init_vol(&devnamD, &volnamD, ile3Ptr)
checkStatus(s)
return s
def io_cleanup(unsigned long long fandl):
"status = io_cleanup(fandl)"
s = sys_io_cleanup(fandl)
checkStatus(s)
return s
def io_fastpathw(unsigned int efn, unsigned int cpu_mask,
int function_code, int mask_length=0):
"status = io_fastpathw(efn, cpu_mask, function_code)"
if efn == 0:
efn=EFN_C_ENF
s = sys_io_fastpathw(efn, cpu_mask, function_code, 0, 0, mask_length)
checkStatus(s)
return s
def io_performw(unsigned long long fandl, unsigned short chan, buf,
unsigned long long devdata):
"status = io_performw(fandl, chan, buf, devdata)"
cdef IOSA iosa
memset(&iosa, 0, sizeof(iosa))
cdef char* bufPtr = buf
cdef unsigned long long buflen = len(buf)
cdef oval = bytearray(buflen + 511)
cdef char* bufal = PyByteArray_AsString(oval)
# The process buffer address. Must be aligned on a 512-byte boundary.
cdef unsigned long bufaddr
bufaddr = <unsigned long>bufal
bufaddr += 511
bufaddr &= 0xFFFFFFFFFFFFFE00
memcpy(<void *>bufaddr, bufPtr, buflen);
s = sys_io_performw(fandl, chan, &iosa, <char *>bufaddr, buflen, devdata)
checkStatus(s)
s = iosa.iosa_w_iosb_status
checkStatus(s)
return s
def io_cleanup(uint64 fandle):
"status = io_cleanup(fandle)"
s = sys_io_cleanup(fandle)
checkStatus(s)
return s
def io_setup(unsigned int func, unsigned long long bufobj, unsigned int flags):
"status, fandle = io_setup(func, bufobj, flags)"
cdef IOSA iosa
memset(&iosa, 0, sizeof(iosa))
cdef unsigned long long fandle
s = sys_io_setup(func, <_generic_64 *>&bufobj, <_generic_64 *>&iosa,
0, flags, <uint64 *>&fandle)
checkStatus(s)
return s, fandle
def mod_holder(unsigned int id, unsigned long long holder,
unsigned int set_attrib, unsigned int clr_attrib):
"status = mod_holder(id, holder, set_attrib=0, clr_attrib=0)"
s = sys_mod_holder(id, <_generic_64 *>&holder, set_attrib, clr_attrib)
checkStatus(s)
return s
def mod_ident(unsigned int id, unsigned int set_attrib=0,
unsigned int clr_attrib=0, new_name=None,
unsigned int new_value=0):
"status = mod_ident(id, set_attrib=0, clr_attrib=0, new_name=None, \
new_value=0)"
cdef dsc_descriptor_s nnD
cdef dsc_descriptor_s* nnPtr = \
DESCFROMOPTSTR(&nnD, new_name)
s = sys_mod_ident(id, set_attrib, clr_attrib, nnPtr, new_value)
checkStatus(s)
return s
def mount(itmlst):
"status [,resdic] = mount(itmlst)"
cdef ILE3* ile3Ptr = NULL
cdef object ile3 = pyvms_itmlst2ile3(itmlst, 0)
ile3Ptr = <ILE3 *>PyByteArray_AsString(ile3)
s = sys_mount(ile3Ptr)
checkStatus(s)
ile3 = pyvms_ile3todict(itmlst, ile3, 0)
if len(ile3) == 0:
return s
return s, ile3
def numtim(tim=None):
"status, tuple = numtim(tim=None)"
cdef long long itim
cdef long long* itimPtr = LLOPTPTR(&itim, tim)
cdef unsigned short int timbuf[7]
s = sys_numtim(timbuf, <_generic_64 *>itimPtr)
checkStatus(s)
return s, (timbuf[0], timbuf[1], timbuf[2], timbuf[3], timbuf[4],
timbuf[5], timbuf[6])
def numutc(utc=None):
"status, tuple = numutc(utc=None)"
cdef unsigned long long iutc[2]
cdef unsigned long long* iutcPtr = NULL
cdef short timbuf[13]
if utc is not None:
iutcPtr = &(iutc[0])
iutc[0] = utc & 0xFFFFFFFFFFFFFFFF
iutc[1] = utc >> 64
s = sys_numutc(<unsigned short *>timbuf, <unsigned int *>iutcPtr)
checkStatus(s)
return s, (timbuf[0], timbuf[1], timbuf[2], timbuf[3], timbuf[4], timbuf[5],
timbuf[6], timbuf[7], timbuf[8], timbuf[9], timbuf[10],
timbuf[11], timbuf[12])
def parse_acl(aclstr, accnam=None):
"status, aclent, errpos = parse_acl(aclstr, accnam=None)"
cdef dsc_descriptor_s aclstrD
DESCFROMSTR(&aclstrD, aclstr)
cdef dsc_descriptor_s accnamD[32]
cdef dsc_descriptor_s* accnamPtr = NULL
cdef char aclent[2048]
cdef dsc_descriptor_s aclentD
DESCSTR(aclentD, aclent)
cdef unsigned short errpos
cdef unsigned int i
if accnam is not None:
if len(accnam) != 32:
raise ValueError("Size mismatch. Expected 32 elements")
for i from 0 <= i < 32:
DESCFROMSTR(&(accnamD[i]), accnam[i])
accnamPtr = &(accnamD[0])
s = sys_parse_acl(&aclstrD, &aclentD, &errpos, accnamPtr, 0)
checkStatus(s)
return s, aclent[:aclent[0]], errpos
def perm_dis_align_fault_report():
"status = perm_dis_align_fault_report()"
s = sys_perm_dis_align_fault_report()
checkStatus(s)
return s
def perm_report_align_fault():
"status = perm_report_align_fault()"
s = sys_perm_report_align_fault()
checkStatus(s)
return s
def persona_assume(unsigned int persona, unsigned int flags=0,
unsigned int acmode=0):
"status, previous = persona_assume(persona, flags=0, acmode=0)"
cdef unsigned int previous
s = sys_persona_assume(&persona, flags, &previous, acmode)
checkStatus(s)
return s, previous
def persona_clone(input=None):
"status, persona = persona_clone(input)"
cdef unsigned int persona, iinput
cdef unsigned int* iinputPtr = UIOPTPTR(&iinput, input)
s = sys_persona_clone(&persona, iinputPtr)
checkStatus(s)
return s, persona
def persona_create(usrnam=None, unsigned int flags=0, usrpro=None,
itmlst=None):
"status, persona = persona_create(usrnam=None, flags=0, usrpro=None, \
itmlst=None)"
cdef dsc_descriptor_s usrnamD, usrproD
cdef dsc_descriptor_s* usrnamPtr = \
DESCFROMOPTSTR(&usrnamD, usrnam)
cdef dsc_descriptor_s* usrproPtr = \
DESCFROMOPTSTR(&usrproD, usrpro)
cdef ILE3* ile3Ptr = NULL
cdef object ile3 = None
if itmlst is not None:
ile3 = pyvms_itmlst2ile3(itmlst, 0)
ile3Ptr = <ILE3 *>PyByteArray_AsString(ile3)
cdef unsigned int persona
s = sys_persona_create(&persona, usrnamPtr, flags, usrproPtr, ile3Ptr)
checkStatus(s)
return s, persona
def persona_create_extension(unsigned int persona, unsigned int extensionID,
buffer, unsigned int flags):
"s = persona_create_extension()persona, extensionID, buffer, flags"
cdef unsigned int sz = len(buffer)
cdef char* bufPtr = buffer
s = sys_persona_create_extension(&persona, &extensionID, bufPtr,
&sz, &flags)
checkStatus(s)
return s
def persona_delegate(unsigned int serverPID, unsigned int persona,
input=None):
"status = persona_delegate(serverPID, persona, input=None)"
cdef unsigned int iinput
cdef unsigned int* iinputPtr = UIOPTPTR(&iinput, input)
s = sys_persona_delegate(&serverPID, &persona, iinputPtr)
checkStatus(s)
return s
def persona_delete(unsigned int persona):
"status = persona_delete(persona)"
s = sys_persona_delete(&persona)
checkStatus(s)
return s
def persona_delete_extension(unsigned int persona, unsigned int extensionID):
"status = persona_delete_extension(persona, extensionID)"
s = sys_persona_delete_extension(&persona, &extensionID)
checkStatus(s)
return s
def persona_extension_lookup(extensionName):
"status, extensionID = persona_extension_lookup(extensionName)"
cdef dsc_descriptor_s extensionNameD
DESCFROMSTR(&extensionNameD, extensionName)
cdef unsigned int extensionID
s = sys_persona_extension_lookup(&extensionNameD, &extensionID)
checkStatus(s)
return s, extensionID
def persona_find(itmlst, unsigned int contxt):
"status, persona, contxt = persona_find(itmlst, contxt)"
cdef object ile3 = pyvms_itmlst2ile3(itmlst, 0)
cdef ILE3* ile3Ptr = <ILE3 *>PyByteArray_AsString(ile3)
cdef unsigned int persona
s = sys_persona_find(&persona, ile3Ptr, &contxt)
checkStatus(s)
return s, persona, contxt
def persona_modify(unsigned int persona, itmlst):
"status = persona_modify(persona, itmlst)"
cdef object ile3 = pyvms_itmlst2ile3(itmlst, 0)
cdef ILE3* ile3Ptr = <ILE3 *>PyByteArray_AsString(ile3)
s = sys_persona_modify(&persona, ile3Ptr)
checkStatus(s)
return s
def persona_query(unsigned int persona, itmlst):
"status [,resdic] = persona_query(persona, itmlst)"
cdef object ile3 = pyvms_itmlst2ile3(itmlst, 0)
cdef ILE3* ile3Ptr = <ILE3 *>PyByteArray_AsString(ile3)
s = sys_persona_query(&persona, ile3Ptr)
checkStatus(s)
ile3 = pyvms_ile3todict(itmlst, ile3, 0)
if len(ile3) > 0:
return s, ile3
return s
def persona_reserve(unsigned int clientPID):
"status, persona = persona_reserve(clientID)"
cdef unsigned int persona
s = sys_persona_reserve(&clientPID, &persona)
checkStatus(s)
return s, persona
#def power_control(unsigned long long power_setting):
# "status, current_value = power_control(power_setting)"
# cdef unsigned long long current_value
# s = sys_power_control(&power_setting, &current_value)
# checkStatus(s)
# return s, current_value
def process_affinity(pid=None, prcnam=None, select_mask=None,
modify_mask=None, flags=None):
"status, prev_mask = process_affinity(pid=None, prcnam=None, \
select_mask = None, modify_mask=None, flags=None)"
cdef unsigned int ipid
cdef unsigned int* ipidPtr = UIOPTPTR(&ipid, pid)
cdef dsc_descriptor_s prcnamD
cdef dsc_descriptor_s* prcnamPtr = \
DESCFROMOPTSTR(&prcnamD, prcnam)
cdef unsigned long long ism
cdef unsigned long long* ismPtr = ULLOPTPTR(&ism, select_mask)
cdef unsigned long long imm
cdef unsigned long long* immPtr = ULLOPTPTR(&imm, modify_mask)
cdef unsigned long long prev_mask
cdef unsigned long long iflags
cdef unsigned long long* iflagsPtr = ULLOPTPTR(&iflags, flags)
s = sys_process_affinity(ipidPtr, prcnamPtr,<_generic_64 *>ismPtr,
<_generic_64 *>immPtr, <_generic_64 *>&prev_mask,
<_generic_64 *>iflagsPtr)
checkStatus(s)
return s, prev_mask
def process_capabilities(pid=None, prcnam=None, select_mask=None,
modify_mask=None, flags=None):
"status, prev_mask = process_capabilities(pid=None, prcnam=None, \
select_mask=None, modify_mask=None, flags=None)"
cdef unsigned int ipid
cdef unsigned int* ipidPtr = UIOPTPTR(&ipid, pid)
cdef dsc_descriptor_s prcnamD
cdef dsc_descriptor_s* prcnamPtr = \
DESCFROMOPTSTR(&prcnamD, prcnam)
cdef unsigned long long ism
cdef unsigned long long* ismPtr = ULLOPTPTR(&ism, select_mask)
cdef unsigned long long imm
cdef unsigned long long* immPtr = ULLOPTPTR(&imm, modify_mask)
cdef unsigned long long prev_mask
cdef unsigned long long iflags
cdef unsigned long long* iflagsPtr = ULLOPTPTR(&iflags, flags)
s = sys_process_capabilities(ipidPtr, prcnamPtr,<_generic_64 *>ismPtr,
<_generic_64 *>immPtr,
<_generic_64 *>&prev_mask,
<_generic_64 *>iflagsPtr)
checkStatus(s)
return s, prev_mask
def process_scan(unsigned int pidctx, itmlst=None):
"status, pidctx [,resdic] = process_scan(pidctx, itmlst=None)"
cdef ILE3* ile3Ptr = NULL
cdef object ile3 = None
if itmlst is not None:
ile3 = pyvms_itmlst2ile3(itmlst, 0)
ile3Ptr = <ILE3 *>PyByteArray_AsString(ile3)
s = sys_process_scan(&pidctx, ile3Ptr)
checkStatus(s)
if itmlst is None:
return s, pidctx
ile3 = pyvms_ile3todict(itmlst, ile3, 0)
if len(ile3) == 0:
return s, pidctx
return s, pidctx, ile3
def purgws(unsigned int start_va, unsigned int end_va):
"status = purgws(start_va, end_va)"
cdef VA_RANGE v
v.va_range_ps_start_va = <void *>start_va
v.va_range_ps_end_va = <void *>end_va
s = sys_purgws(&v)
checkStatus(s)
return s
def readef(unsigned int efn):
"status, state = readef(efn)"
cdef unsigned int state
s = sys_readef(efn, &state)
checkStatus(s)
return s, state
def registryw(unsigned int efn, unsigned int func, itmlst,
unsigned int timeout=0):
"status [,resdic] = registryw(efn, func, itmlst, timeout=0)"
cdef IOSB iosb
memset(&iosb, 0, sizeof(iosb))
if efn == 0:
efn = EFN_C_ENF
cdef ILE3* ile3Ptr = NULL
cdef object ile3 = None
ile3 = pyvms_itmlst2ile3(itmlst, 0)
ile3Ptr = <ILE3 *>PyByteArray_AsString(ile3)
s = sys_registryw(efn, func, 0, ile3Ptr, &iosb, 0, 0, timeout)
checkStatus(s)
s = iosb.iosb_l_reg_status
checkStatus(s)
ile3 = pyvms_ile3todict(itmlst, ile3, 0)
if len(ile3) == 0:
return s
return s, ile3
def release_galaxy_lock(unsigned long long lock_handle):
"status = release_galaxy_lock(lock_handle)"
s = sys_release_galaxy_lock(lock_handle)
checkStatus(s)
return s
def rem_holder(unsigned int id, unsigned long long holder):
"status = rem_holder(id, holder)"
s = sys_rem_holder(id, <_generic_64 *>&holder)
checkStatus(s)
return s
def rem_ident(unsigned int id):
"status = rem_ident(id)"
s = sys_rem_ident(id)
checkStatus(s)
return s
def resched():
"status = resched()"
s = sys_resched()
checkStatus(s)
return s
def resume(pid=None, prcnam=None):
"status, pid = resume(pid=None, prcnam=None)"
cdef unsigned int ipid
cdef unsigned int* ipidPtr = UIOPTPTR(&ipid, pid)
cdef dsc_descriptor_s prcnamD
cdef dsc_descriptor_s* prcnamPtr = \
DESCFROMOPTSTR(&prcnamD, prcnam)
s = sys_resume(ipidPtr, prcnamPtr)
checkStatus(s)
return s
def revokid(pid=None, prcnam=None, id=None, name=None, unsigned int segment=0):
"status, pid, id, prvatr = \
revokid(pid=None, prcnam=None, id=None, name=None, segment=0)"
cdef unsigned int ipid = 0
if pid is not None:
if pid == -1:
ipid = -1
else:
ipid = pid
cdef dsc_descriptor_s prcnamD
cdef dsc_descriptor_s* prcnamPtr = \
DESCFROMOPTSTR(&prcnamD, prcnam)
cdef unsigned long long iid = 0
if id is not None:
iid = id
cdef dsc_descriptor_s nameD
cdef dsc_descriptor_s* namePtr = \
DESCFROMOPTSTR(&nameD, name)
cdef unsigned int prvatr
s = sys_revokid(&ipid, prcnamPtr, <_generic_64 *>&iid, namePtr,
&prvatr, segment)
checkStatus(s)
return s, ipid, iid, prvatr
def scan_intrusion(unsigned int logfail_status, failed_user,
unsigned int job_type, source_terminal=None,
source_node=None, source_user=None, source_address=None,
failed_password=None, parent_user=None,
unsigned int parent_id=0, unsigned int flags=0):
"status = scan_intrusion(logfail_status, failed_user, job_type; \
source_terminal=None, source_node=None,source_user=None, \
source_address=None, failed_password=None, parent_user=None, \
parent_id=0, flags=0)"
cdef dsc_descriptor_s failedUserD, sourceTerminalD, sourceNodeD, sourceUserD
cdef dsc_descriptor_s sourceAddressD, failedPasswordD, parentUserD
DESCFROMSTR(&failedUserD, failed_user)
cdef dsc_descriptor_s* sourceTerminalPtr = \
DESCFROMOPTSTR(&sourceTerminalD, source_terminal)
cdef dsc_descriptor_s* sourceNodePtr = \
DESCFROMOPTSTR(&sourceNodeD, source_node)
cdef dsc_descriptor_s* sourceUserPtr = \
DESCFROMOPTSTR(&sourceUserD, source_user)
cdef dsc_descriptor_s* sourceAddressPtr = \
DESCFROMOPTSTR(&sourceAddressD, source_address)
cdef dsc_descriptor_s* failedPasswordPtr = \
DESCFROMOPTSTR(&failedPasswordD, failed_password)
cdef dsc_descriptor_s* parentUserPtr = \
DESCFROMOPTSTR(&parentUserD, parent_user)
s = sys_scan_intrusion(logfail_status, &failedUserD, job_type,
sourceTerminalPtr, sourceNodePtr, sourceUserPtr,
sourceAddressPtr, failedPasswordPtr, parentUserPtr,
parent_id, flags)
checkStatus(s)
return s
def schdwk(unsigned int pid=0, prcnam=None, daytim=None, reptim=None):
"status, pid = schdwk(pid=None, prcnam=None, daytim=None, reptim=None)"
cdef dsc_descriptor_s prcnamD
cdef dsc_descriptor_s* prcnamPtr = \
DESCFROMOPTSTR(&prcnamD, prcnam)
cdef long long idaytim
cdef long long* idaytimPtr = LLOPTPTR(&idaytim, daytim)
cdef long long ireptim
cdef long long* ireptimPtr = LLOPTPTR(&ireptim, reptim)
s = sys_schdwk(&pid, prcnamPtr, <_generic_64 *>idaytimPtr,
<_generic_64 *>ireptimPtr)
checkStatus(s)
return s
def setddir(newdir):
"status, curdir = setddir(newdir)"
cdef dsc_descriptor_s newdirD
newdir = getstr(newdir)
DESCFROMSTR(&newdirD, newdir)
cdef char curdir[2048]
cdef dsc_descriptor_s curdirD
DESCSTR(curdirD, curdir)
cdef unsigned short retlen
s = sys_setddir(&newdirD, &retlen, &curdirD)
checkStatus(s)
return s, curdir[:retlen]
def setdfprot(newdefprot=None):
"status, curdefprot = setdfprot(newdefprot=None)"
cdef unsigned short inewdefprot
cdef unsigned short* inewdefprotPtr = USOPTPTR(&inewdefprot, newdefprot)
cdef unsigned short curdefprot
s = sys_setdfprot(inewdefprotPtr, &curdefprot)
checkStatus(s)
return s, curdefprot
def setef(unsigned int efn):
"status = setef(efn)"
s = sys_setef(efn)
checkStatus(s)
return s
def setime(tim=None):
"status = setime(tim=None)"
cdef unsigned long long itim
cdef unsigned long long* itimPtr = ULLOPTPTR(&itim, tim)
s = sys_setime(<_generic_64 *>itimPtr)
checkStatus(s)
return s
def setpri(pid=None, prcnam=None, unsigned int pri=0, pol=None):
"status, prvpri, prvpol = setpri(pid=None, prcnam=None, pri=0, pol=None)"
cdef unsigned int prvpri, prvpol
cdef unsigned int ipid
cdef unsigned int* ipidPtr = UIOPTPTR(&ipid, pid)
cdef dsc_descriptor_s prcnamD
cdef dsc_descriptor_s* prcnamPtr = \
DESCFROMOPTSTR(&prcnamD, prcnam)
cdef unsigned int ipol
cdef unsigned int* ipolPtr = UIOPTPTR(&ipol, pol)
s = sys_setpri(ipidPtr, prcnamPtr, pri, &prvpri, ipolPtr, &prvpol)
checkStatus(s)
return s, prvpri, prvpol
def setprn(prcnam=None):
"status = setprn(prcnam=None)"
cdef dsc_descriptor_s prcnamD
cdef dsc_descriptor_s* prcnamPtr = \
DESCFROMOPTSTR(&prcnamD, prcnam)
s = sys_setprn(prcnamPtr)
checkStatus(s)
return s
def setprv(unsigned char enbflg=0, prv=None, unsigned char prmflg=0):
"status, prvprv = setprv(enbflg=0 [,prv] [,prmflg])"
cdef unsigned long long iprv
cdef unsigned long long* iprvPtr = ULLOPTPTR(&iprv, prv)
cdef unsigned long long prvprv
s = sys_setprv(enbflg, <_generic_64 *>iprvPtr, prmflg,
<_generic_64 *>&prvprv)
checkStatus(s)
return s, prvprv
def setshlv(pid=None, prcnam=None, unsigned int shlvflg=0):
"status = setshlv(pid=None, prcnam=None, shlvflg=0)"
cdef unsigned int ipid
cdef unsigned int* ipidPtr = UIOPTPTR(&ipid, pid)
cdef dsc_descriptor_s prcnamD
cdef dsc_descriptor_s* prcnamPtr = \
DESCFROMOPTSTR(&prcnamD, prcnam)
s = sys_setshlv(ipidPtr, prcnamPtr, shlvflg)
checkStatus(s)
return s
def setswm(unsigned char swpflg=0):
"status = setswm(swpflg=0)"
s = sys_setswm(swpflg)
checkStatus(s)
return s
def setuai(unsigned int efn=EFN_C_ENF, contxt=None, usrnam=None, itmlst=None):
"status [,contxt] [,resdic] = setuai(efn=EFN_C_ENF, contxt=None, \
usrnam=None, itmlst=None)"
if efn == 0:
efn = EFN_C_ENF
cdef unsigned int icontxt
cdef unsigned int* icontxtPtr
if contxt is not None:
icontxtPtr = &icontxt
if contxt == -1:
icontxt = -1
else:
icontxt = contxt
cdef dsc_descriptor_s usrnamD
cdef dsc_descriptor_s* usrnamPtr = \
DESCFROMOPTSTR(&usrnamD, usrnam)
cdef ILE3* ile3Ptr = NULL
cdef object ile3 = None
if itmlst is not None:
ile3 = pyvms_itmlst2ile3(itmlst, 0)
ile3Ptr = <ILE3 *>PyByteArray_AsString(ile3)
s = sys_setuai(efn, icontxtPtr, usrnamPtr, ile3Ptr, 0, 0, 0)
checkStatus(s)
if itmlst is None and contxt is None:
return s
if itmlst is None:
return s, icontxt
ile3 = pyvms_ile3todict(itmlst, ile3, 0)
if len(ile3) == 0 and contxt is None:
return s
if len(ile3) == 0:
return s, icontxt
return s, icontxt, ile3
def setup_avoid_preempt(int enable):
"status = setup_avoid_preempt(enable)"
s = sys_setup_avoid_preempt(enable)
checkStatus(s)
return s
def set_devicew(unsigned int efn=EFN_C_ENF, unsigned short chan=0, devnam=None,
itmlst=None, nullarg=None):
"status [,resdic] = set_devicew(efn=EFN_C_ENF, chan=0, devnam=None, \
itmlst, nullarg=None)"
if itmlst is None:
raise ValueError("itmlst is required")
cdef ILE3* ile3Ptr = NULL
cdef object ile3 = None
ile3 = pyvms_itmlst2ile3(itmlst, 0)
ile3Ptr = <ILE3 *>PyByteArray_AsString(ile3)
cdef dsc_descriptor_s devnamD
cdef dsc_descriptor_s* devnamPtr = \
DESCFROMOPTSTR(&devnamD, devnam)
cdef IOSB iosb
memset(&iosb, 0, sizeof(iosb))
s = sys_set_devicew(efn, chan, devnamPtr, ile3Ptr, &iosb, 0, 0, 0)
checkStatus(s)
s = iosb.iosb_l_reg_status
checkStatus(s)
ile3 = pyvms_ile3todict(itmlst, ile3, 0)
if len(ile3) == 0:
return s
return s, ile3
def set_implicit_affinity(pid=None, prcnam=None, state=None, int cpu_id=0):
"status, prev_mask = \
set_implicit_affinity((pid=None, prcnam=None, state=None, cpu_id=0)"
cdef unsigned int ipid
cdef unsigned int* ipidPtr = UIOPTPTR(&ipid, pid)
cdef dsc_descriptor_s prcnamD
cdef dsc_descriptor_s* prcnamPtr = \
DESCFROMOPTSTR(&prcnamD, prcnam)
cdef unsigned long long istate
cdef unsigned long long* istatePtr = ULLOPTPTR(&istate, state)
cdef unsigned long long prev_mask
s = sys_set_implicit_affinity(ipidPtr, prcnamPtr, <_generic_64 *>istatePtr,
cpu_id, <_generic_64 *>&prev_mask)
checkStatus(s)
return s, prev_mask
def set_process_propertiesw(mbz1, pid, prcnam, unsigned int property,
unsigned long long value):
"status, prev_value = \
set_process_propertiesw(mbz1, pid, prcnam, property, value)"
cdef unsigned int ipid
cdef unsigned int* ipidPtr = UIOPTPTR(&ipid, pid)
cdef dsc_descriptor_s prcnamD
cdef dsc_descriptor_s* prcnamPtr = \
DESCFROMOPTSTR(&prcnamD, prcnam)
cdef unsigned long long prev_value
s = sys_set_process_propertiesw(0, ipidPtr, prcnamPtr, property, value,
<uint64 *>&prev_value)
checkStatus(s)
return s, prev_value
def set_resource_domain(unsigned int func, rsdm_id, unsigned int domain_number,
nullarg=None, unsigned int access=0, unsigned int acmode=0):
"status [,rsdm_id] = set_resource_domain(func, rsdm_id=, domain_number, \
nullarg=None, access=0, acmode=0)"
cdef unsigned int iri
cdef unsigned int* iriPtr = &iri
if rsdm_id is not None:
iri = rsdm_id
s = sys_set_resource_domain(func, &iri, domain_number, 0, access, acmode)
checkStatus(s)
if rsdm_id is None:
return s, iri
else:
return s
def set_security(clsnam=None, objnam=None, objhan=None, unsigned int flags=0,
itmlst=None, contxt=None, acmode=None):
"status, contxt [,resdic] = \
set_security(clsnam=None, objnam=None, objhan=None, flags=0, itmlst=None, \
contxt=None, acmode=None)"
cdef dsc_descriptor_s clsnamD, objnamD
cdef dsc_descriptor_s* clsnamPtr = \
DESCFROMOPTSTR(&clsnamD, clsnam)
cdef dsc_descriptor_s* objnamPtr = \
DESCFROMOPTSTR(&objnamD, objnam)
cdef unsigned int iobjhan
cdef unsigned int* iobjhanPtr = UIOPTPTR(&iobjhan, objhan)
cdef ILE3* ile3Ptr = NULL
cdef object ile3 = None
if itmlst is not None:
ile3 = pyvms_itmlst2ile3(itmlst, 0)
ile3Ptr = <ILE3 *>PyByteArray_AsString(ile3)
cdef unsigned int icontxt
cdef unsigned int* icontxtPtr = UIOPTPTR(&icontxt, contxt)
cdef unsigned int iacmode
cdef unsigned int* iacmodePtr = UIOPTPTR(&iacmode, acmode)
s = sys_set_security(clsnamPtr, objnamPtr, iobjhanPtr, flags, ile3Ptr,
icontxtPtr, iacmodePtr)
checkStatus(s)
if itmlst is None and contxt is None:
return s
if itmlst is None:
return s, icontxt
ile3 = pyvms_ile3todict(itmlst, ile3, 0)
if len(ile3) == 0 and contxt is None:
return s
if len(ile3) == 0:
return s, icontxt
return s, icontxt, ile3
def snderr(msgbuf):
"status = snderr(msgbuf)"
msgbuf = getstr(msgbuf)
cdef dsc_descriptor_s msgbufD
DESCFROMSTR(&msgbufD, msgbuf)
s = sys_snderr(&msgbufD)
checkStatus(s)
return s
def sndjbcw(unsigned int efn=EFN_C_ENF, unsigned short func=0,
unsigned int nullarg=0, itmlst=None):
"status [,resdic] = sndjbcw(efn=EFN_C_ENF, func=0, nullarg=0, itmlst=0)"
if efn == 0:
efn = EFN_C_ENF
cdef ILE3* ile3Ptr = NULL
cdef object ile3 = None
if itmlst is not None:
ile3 = pyvms_itmlst2ile3(itmlst, 0)
ile3Ptr = <ILE3 *>PyByteArray_AsString(ile3)
cdef IOSB iosb
memset(&iosb, 0, sizeof(iosb))
s = sys_sndjbcw(efn, func, 0, ile3Ptr, &iosb, 0, 0)
checkStatus(s)
s = iosb.iosb_l_reg_status
checkStatus(s)
if itmlst is None:
return s
ile3 = pyvms_ile3todict(itmlst, ile3, 0)
if len(ile3) == 0:
return s
return s, ile3
def start_align_fault_report(int report_method, report_buffer):
"s = start_align_fault_report(report_method, report_buffer)"
cdef char* afrPtr = NULL
cdef int buflen = 0
if report_buffer is not None:
afrPtr = PyByteArray_AsString(report_buffer)
buflen = len(report_buffer)
s = sys_start_align_fault_report(report_method, afrPtr, buflen)
checkStatus(s)
return s
def stop_align_fault_report():
" s = stop_align_fault_report()"
s = sys_stop_align_fault_report()
checkStatus(s)
return s
def subsystem(unsigned int enbflg):
"status = subsystem(enbflg)"
s = sys_subsystem(enbflg)
checkStatus(s)
return s
def suspnd(pid=None, prcnam=None, unsigned int flags=0):
"status,pid = suspnd(pid=None, prcnam=None, flags=0)"
cdef unsigned int ipid
cdef unsigned int* ipidPtr = UIOPTPTR(&ipid, pid)
cdef dsc_descriptor_s prcnamD
cdef dsc_descriptor_s* prcnamPtr = \
DESCFROMOPTSTR(&prcnamD, prcnam)
s = sys_suspnd(ipidPtr, prcnamPtr, flags)
checkStatus(s)
return s
def timcon(tim, unsigned int cvtflg):
"status,utc = timcon(tim, cvtflg)"
cdef unsigned long long itimu[2]
cdef unsigned long long itimv
if cvtflg == 0: # UTC time is converted to 64-bit system value
itimu[0] = tim & 0xFFFFFFFFFFFFFFFF
itimu[1] = tim >> 64
elif cvtflg == 1: # 64-bit system format is converted to UTC time
itimv = tim
else:
raise ValueError('cvtflg must be 0 or 1')
s = sys_timcon(<_generic_64 *>&itimv, <unsigned int *>itimu, cvtflg)
checkStatus(s)
if cvtflg == 0:
return s, itimv
cdef object res = itimu[1]
res = res << 64
res = res + itimu[0]
return s, res
def time_to_utc(tim):
"status,utc = time_to_utc(tim)"
return timcon(tim, 1)
def utc_to_time(utc):
"status,tim = utc_to_time(utc)"
return timcon(utc, 0)
def trnlnm(attr, tabnam, lognam, acmode=None, itmlst=None):
"status [,resdic] = trnlnm(attr, tabnam, lognam, acmode=None, itmlst=None)"
cdef unsigned int iattr
cdef unsigned int* iattrPtr = UIOPTPTR(&iattr, attr)
tabnam = getstr(tabnam)
lognam = getstr(lognam)
cdef dsc_descriptor_s tabnamD, lognamD
DESCFROMSTR(&tabnamD, tabnam)
DESCFROMSTR(&lognamD, lognam)
cdef unsigned char iacmode
cdef unsigned char* iacmodePtr = UCOPTPTR(&iacmode, acmode)
cdef ILE3* ile3Ptr = NULL
cdef object ile3 = None
if itmlst is not None:
ile3 = pyvms_itmlst2ile3(itmlst, 0)
ile3Ptr = <ILE3 *>PyByteArray_AsString(ile3)
s = sys_trnlnm(iattrPtr, &tabnamD, &lognamD, iacmodePtr, ile3Ptr)
checkStatus(s)
if itmlst is None:
return s
else:
ile3 = pyvms_ile3todict(itmlst, ile3, 0)
if len(ile3) > 0:
return s, ile3
return s
def verify_proxy(rem_node, rem_user, proposed_user=None, unsigned int flags=0):
"status, local_user = \
verify_proxy(rem_node, rem_user, proposed_user=None, flags=0)"
cdef char local_user[33]
cdef dsc_descriptor_s remNodeD, remUserD, proposedUserD, localUserD
DESCSTR(localUserD, local_user)
DESCFROMSTR(&remNodeD, rem_node)
DESCFROMSTR(&remUserD, rem_user)
cdef dsc_descriptor_s* proposedUserPtr = \
DESCFROMOPTSTR(&proposedUserD, proposed_user)
cdef unsigned short retlen
s = sys_verify_proxy(&remNodeD, &remUserD, proposedUserPtr, &localUserD,
&retlen, flags)
checkStatus(s)
return s, local_user[:retlen]
def waitfr(unsigned int efn):
"status = waitfr(efn)"
s = sys_waitfr(efn)
checkStatus(s)
return s
def wake(pid=None, prcnam=None):
"status = wake(pid=None, prcnam=None)"
cdef unsigned int ipid
cdef unsigned int* ipidPtr = UIOPTPTR(&ipid, pid)
cdef dsc_descriptor_s prcnamD
cdef dsc_descriptor_s* prcnamPtr = \
DESCFROMOPTSTR(&prcnamD, prcnam)
s = sys_wake(ipidPtr, prcnamPtr)
checkStatus(s)
return s
def hiber():
"status = hiber()"
s = sys_hiber()
checkStatus(s)
return s
def wfland(unsigned int efn, unsigned int mask):
"status = wfland(efn, mask)"
s = sys_wfland(efn, mask)
checkStatus(s)
return s
def wflor(unsigned int efn, unsigned int mask):
"status = wflor(efn, mask)"
s = sys_wflor(efn, mask)
checkStatus(s)
return s