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
|
(*
* Copyright (c) 2015 David Sheets <sheets@alum.mit.edu>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
*)
type t =
| E2BIG
| EACCES
| EADDRINUSE
| EADDRNOTAVAIL
| EAFNOSUPPORT
| EAGAIN
| EALREADY
| EBADF
| EBADMSG
| EBUSY
| ECANCELED
| ECHILD
| ECONNABORTED
| ECONNREFUSED
| ECONNRESET
| EDEADLK
| EDESTADDRREQ
| EDOM
| EDQUOT
| EEXIST
| EFAULT
| EFBIG
| EHOSTDOWN (* Linux: Host is down *)
| EHOSTUNREACH
| EIDRM
| EILSEQ
| EINPROGRESS
| EINTR
| EINVAL
| EIO
| EISCONN
| EISDIR
| ELOOP
| EMFILE
| EMLINK
| EMSGSIZE
| EMULTIHOP
| ENAMETOOLONG
| ENETDOWN
| ENETRESET
| ENETUNREACH
| ENFILE
| ENOBUFS
| ENODEV
| ENOENT
| ENOEXEC
| ENOLCK
| ENOLINK
| ENOMEM
| ENOMSG
| ENOPROTOOPT
| ENOSPC
| ENOSYS
| ENOTBLK
| ENOTCONN
| ENOTDIR
| ENOTEMPTY
| ENOTRECOVERABLE
| ENOTSOCK
| ENOTSUP
| ENOTTY
| ENXIO
| EOPNOTSUPP
| EOVERFLOW
| EOWNERDEAD
| EPERM
| EPFNOSUPPORT (* Linux: Protocol family not supported *)
| EPIPE
| EPROTO
| EPROTONOSUPPORT
| EPROTOTYPE
| ERANGE
| EREMOTE
| EROFS
| ESHUTDOWN (* Linux: Cannot send after transport endpoint shutdown *)
| ESOCKTNOSUPPORT (* Linux: Socket type not supported *)
| ESPIPE
| ESRCH
| ESTALE
| ETIMEDOUT
| ETOOMANYREFS (* Linux: Too many references: cannot splice *)
| ETXTBSY
| EUSERS
| EWOULDBLOCK
| EXDEV
| ECHRNG
| EL2NSYNC
| EL3HLT
| EL3RST
| ELNRNG
| EUNATCH
| ENOCSI
| EL2HLT
| EBADE
| EBADR
| EXFULL
| ENOANO
| EBADRQC
| EBADSLT
| EBFONT
| ENONET
| ENOPKG
| EADV
| ESRMNT
| ECOMM
| EDOTDOT
| ENOTUNIQ
| EBADFD
| EREMCHG
| ELIBACC
| ELIBBAD
| ELIBSCN
| ELIBMAX
| ELIBEXEC
| ERESTART
| ESTRPIPE
| EUCLEAN
| ENOTNAM
| ENAVAIL
| EISNAM
| EREMOTEIO
| ENOMEDIUM
| EMEDIUMTYPE
| ENOKEY
| EKEYEXPIRED
| EKEYREVOKED
| EKEYREJECTED
| ERFKILL
| EHWPOISON
| EPWROFF
| EDEVERR
| EBADEXEC
| EBADARCH
| ESHLIBVERS
| EBADMACHO
| ENOPOLICY
| EQFULL
| EDOOFUS
| ENOTCAPABLE
| ECAPMODE
| EPROCLIM
| EBADRPC
| ERPCMISMATCH
| EPROGUNAVAIL
| EPROGMISMATCH
| EPROCUNAVAIL
| EFTYPE
| EAUTH
| ENEEDAUTH
| ENOATTR
| ENOSTR
| ENODATA
| ETIME
| ENOSR
| EUNKNOWNERR of Signed.sint
type error = {
errno : t list;
call : string;
label : string;
}
exception Error of error
type defns = {
e2big : Signed.sint option;
eacces : Signed.sint option;
eaddrinuse : Signed.sint option;
eaddrnotavail : Signed.sint option;
eafnosupport : Signed.sint option;
eagain : Signed.sint option;
ealready : Signed.sint option;
ebadf : Signed.sint option;
ebadmsg : Signed.sint option;
ebusy : Signed.sint option;
ecanceled : Signed.sint option;
echild : Signed.sint option;
econnaborted : Signed.sint option;
econnrefused : Signed.sint option;
econnreset : Signed.sint option;
edeadlk : Signed.sint option;
edestaddrreq : Signed.sint option;
edom : Signed.sint option;
edquot : Signed.sint option;
eexist : Signed.sint option;
efault : Signed.sint option;
efbig : Signed.sint option;
ehostdown : Signed.sint option;
ehostunreach : Signed.sint option;
eidrm : Signed.sint option;
eilseq : Signed.sint option;
einprogress : Signed.sint option;
eintr : Signed.sint option;
einval : Signed.sint option;
eio : Signed.sint option;
eisconn : Signed.sint option;
eisdir : Signed.sint option;
eloop : Signed.sint option;
emfile : Signed.sint option;
emlink : Signed.sint option;
emsgsize : Signed.sint option;
emultihop : Signed.sint option;
enametoolong : Signed.sint option;
enetdown : Signed.sint option;
enetreset : Signed.sint option;
enetunreach : Signed.sint option;
enfile : Signed.sint option;
enobufs : Signed.sint option;
enodev : Signed.sint option;
enoent : Signed.sint option;
enoexec : Signed.sint option;
enolck : Signed.sint option;
enolink : Signed.sint option;
enomem : Signed.sint option;
enomsg : Signed.sint option;
enoprotoopt : Signed.sint option;
enospc : Signed.sint option;
enosys : Signed.sint option;
enotblk : Signed.sint option;
enotconn : Signed.sint option;
enotdir : Signed.sint option;
enotempty : Signed.sint option;
enotrecoverable : Signed.sint option;
enotsock : Signed.sint option;
enotsup : Signed.sint option;
enotty : Signed.sint option;
enxio : Signed.sint option;
eopnotsupp : Signed.sint option;
eoverflow : Signed.sint option;
eownerdead : Signed.sint option;
eperm : Signed.sint option;
epfnosupport : Signed.sint option;
epipe : Signed.sint option;
eproto : Signed.sint option;
eprotonosupport : Signed.sint option;
eprototype : Signed.sint option;
erange : Signed.sint option;
eremote : Signed.sint option;
erofs : Signed.sint option;
eshutdown : Signed.sint option;
esocktnosupport : Signed.sint option;
espipe : Signed.sint option;
esrch : Signed.sint option;
estale : Signed.sint option;
etimedout : Signed.sint option;
etoomanyrefs : Signed.sint option;
etxtbsy : Signed.sint option;
eusers : Signed.sint option;
ewouldblock : Signed.sint option;
exdev : Signed.sint option;
echrng : Signed.sint option;
el2nsync : Signed.sint option;
el3hlt : Signed.sint option;
el3rst : Signed.sint option;
elnrng : Signed.sint option;
eunatch : Signed.sint option;
enocsi : Signed.sint option;
el2hlt : Signed.sint option;
ebade : Signed.sint option;
ebadr : Signed.sint option;
exfull : Signed.sint option;
enoano : Signed.sint option;
ebadrqc : Signed.sint option;
ebadslt : Signed.sint option;
ebfont : Signed.sint option;
enonet : Signed.sint option;
enopkg : Signed.sint option;
eadv : Signed.sint option;
esrmnt : Signed.sint option;
ecomm : Signed.sint option;
edotdot : Signed.sint option;
enotuniq : Signed.sint option;
ebadfd : Signed.sint option;
eremchg : Signed.sint option;
elibacc : Signed.sint option;
elibbad : Signed.sint option;
elibscn : Signed.sint option;
elibmax : Signed.sint option;
elibexec : Signed.sint option;
erestart : Signed.sint option;
estrpipe : Signed.sint option;
euclean : Signed.sint option;
enotnam : Signed.sint option;
enavail : Signed.sint option;
eisnam : Signed.sint option;
eremoteio : Signed.sint option;
enomedium : Signed.sint option;
emediumtype : Signed.sint option;
enokey : Signed.sint option;
ekeyexpired : Signed.sint option;
ekeyrevoked : Signed.sint option;
ekeyrejected : Signed.sint option;
erfkill : Signed.sint option;
ehwpoison : Signed.sint option;
epwroff : Signed.sint option;
edeverr : Signed.sint option;
ebadexec : Signed.sint option;
ebadarch : Signed.sint option;
eshlibvers : Signed.sint option;
ebadmacho : Signed.sint option;
enopolicy : Signed.sint option;
eqfull : Signed.sint option;
edoofus : Signed.sint option;
enotcapable : Signed.sint option;
ecapmode : Signed.sint option;
eproclim : Signed.sint option;
ebadrpc : Signed.sint option;
erpcmismatch : Signed.sint option;
eprogunavail : Signed.sint option;
eprogmismatch : Signed.sint option;
eprocunavail : Signed.sint option;
eftype : Signed.sint option;
eauth : Signed.sint option;
eneedauth : Signed.sint option;
enoattr : Signed.sint option;
enostr : Signed.sint option;
enodata : Signed.sint option;
etime : Signed.sint option;
enosr : Signed.sint option;
}
type index = (Signed.sint, t) Hashtbl.t
let empty_defns = {
e2big = None;
eacces = None;
eaddrinuse = None;
eaddrnotavail = None;
eafnosupport = None;
eagain = None;
ealready = None;
ebadf = None;
ebadmsg = None;
ebusy = None;
ecanceled = None;
echild = None;
econnaborted = None;
econnrefused = None;
econnreset = None;
edeadlk = None;
edestaddrreq = None;
edom = None;
edquot = None;
eexist = None;
efault = None;
efbig = None;
ehostdown = None;
ehostunreach = None;
eidrm = None;
eilseq = None;
einprogress = None;
eintr = None;
einval = None;
eio = None;
eisconn = None;
eisdir = None;
eloop = None;
emfile = None;
emlink = None;
emsgsize = None;
emultihop = None;
enametoolong = None;
enetdown = None;
enetreset = None;
enetunreach = None;
enfile = None;
enobufs = None;
enodev = None;
enoent = None;
enoexec = None;
enolck = None;
enolink = None;
enomem = None;
enomsg = None;
enoprotoopt = None;
enospc = None;
enosys = None;
enotblk = None;
enotconn = None;
enotdir = None;
enotempty = None;
enotrecoverable = None;
enotsock = None;
enotsup = None;
enotty = None;
enxio = None;
eopnotsupp = None;
eoverflow = None;
eownerdead = None;
eperm = None;
epfnosupport = None;
epipe = None;
eproto = None;
eprotonosupport = None;
eprototype = None;
erange = None;
eremote = None;
erofs = None;
eshutdown = None;
esocktnosupport = None;
espipe = None;
esrch = None;
estale = None;
etimedout = None;
etoomanyrefs = None;
etxtbsy = None;
eusers = None;
ewouldblock = None;
exdev = None;
echrng = None;
el2nsync = None;
el3hlt = None;
el3rst = None;
elnrng = None;
eunatch = None;
enocsi = None;
el2hlt = None;
ebade = None;
ebadr = None;
exfull = None;
enoano = None;
ebadrqc = None;
ebadslt = None;
ebfont = None;
enonet = None;
enopkg = None;
eadv = None;
esrmnt = None;
ecomm = None;
edotdot = None;
enotuniq = None;
ebadfd = None;
eremchg = None;
elibacc = None;
elibbad = None;
elibscn = None;
elibmax = None;
elibexec = None;
erestart = None;
estrpipe = None;
euclean = None;
enotnam = None;
enavail = None;
eisnam = None;
eremoteio = None;
enomedium = None;
emediumtype = None;
enokey = None;
ekeyexpired = None;
ekeyrevoked = None;
ekeyrejected = None;
erfkill = None;
ehwpoison = None;
epwroff = None;
edeverr = None;
ebadexec = None;
ebadarch = None;
eshlibvers = None;
ebadmacho = None;
enopolicy = None;
eqfull = None;
edoofus = None;
enotcapable = None;
ecapmode = None;
eproclim = None;
ebadrpc = None;
erpcmismatch = None;
eprogunavail = None;
eprogmismatch = None;
eprocunavail = None;
eftype = None;
eauth = None;
eneedauth = None;
enoattr = None;
enostr = None;
enodata = None;
etime = None;
enosr = None;
}
let to_code ~host = let (defns,_) = host in function
| E2BIG -> defns.e2big
| EACCES -> defns.eacces
| EADDRINUSE -> defns.eaddrinuse
| EADDRNOTAVAIL -> defns.eaddrnotavail
| EAFNOSUPPORT -> defns.eafnosupport
| EAGAIN -> defns.eagain
| EALREADY -> defns.ealready
| EBADF -> defns.ebadf
| EBADMSG -> defns.ebadmsg
| EBUSY -> defns.ebusy
| ECANCELED -> defns.ecanceled
| ECHILD -> defns.echild
| ECONNABORTED -> defns.econnaborted
| ECONNREFUSED -> defns.econnrefused
| ECONNRESET -> defns.econnreset
| EDEADLK -> defns.edeadlk
| EDESTADDRREQ -> defns.edestaddrreq
| EDOM -> defns.edom
| EDQUOT -> defns.edquot
| EEXIST -> defns.eexist
| EFAULT -> defns.efault
| EFBIG -> defns.efbig
| EHOSTDOWN -> defns.ehostdown
| EHOSTUNREACH -> defns.ehostunreach
| EIDRM -> defns.eidrm
| EILSEQ -> defns.eilseq
| EINPROGRESS -> defns.einprogress
| EINTR -> defns.eintr
| EINVAL -> defns.einval
| EIO -> defns.eio
| EISCONN -> defns.eisconn
| EISDIR -> defns.eisdir
| ELOOP -> defns.eloop
| EMFILE -> defns.emfile
| EMLINK -> defns.emlink
| EMSGSIZE -> defns.emsgsize
| EMULTIHOP -> defns.emultihop
| ENAMETOOLONG -> defns.enametoolong
| ENETDOWN -> defns.enetdown
| ENETRESET -> defns.enetreset
| ENETUNREACH -> defns.enetunreach
| ENFILE -> defns.enfile
| ENOBUFS -> defns.enobufs
| ENODEV -> defns.enodev
| ENOENT -> defns.enoent
| ENOEXEC -> defns.enoexec
| ENOLCK -> defns.enolck
| ENOLINK -> defns.enolink
| ENOMEM -> defns.enomem
| ENOMSG -> defns.enomsg
| ENOPROTOOPT -> defns.enoprotoopt
| ENOSPC -> defns.enospc
| ENOSYS -> defns.enosys
| ENOTBLK -> defns.enotblk
| ENOTCONN -> defns.enotconn
| ENOTDIR -> defns.enotdir
| ENOTEMPTY -> defns.enotempty
| ENOTRECOVERABLE -> defns.enotrecoverable
| ENOTSOCK -> defns.enotsock
| ENOTSUP -> defns.enotsup
| ENOTTY -> defns.enotty
| ENXIO -> defns.enxio
| EOPNOTSUPP -> defns.eopnotsupp
| EOVERFLOW -> defns.eoverflow
| EOWNERDEAD -> defns.eownerdead
| EPERM -> defns.eperm
| EPFNOSUPPORT -> defns.epfnosupport
| EPIPE -> defns.epipe
| EPROTO -> defns.eproto
| EPROTONOSUPPORT -> defns.eprotonosupport
| EPROTOTYPE -> defns.eprototype
| ERANGE -> defns.erange
| EREMOTE -> defns.eremote
| EROFS -> defns.erofs
| ESHUTDOWN -> defns.eshutdown
| ESOCKTNOSUPPORT -> defns.esocktnosupport
| ESPIPE -> defns.espipe
| ESRCH -> defns.esrch
| ESTALE -> defns.estale
| ETIMEDOUT -> defns.etimedout
| ETOOMANYREFS -> defns.etoomanyrefs
| ETXTBSY -> defns.etxtbsy
| EUSERS -> defns.eusers
| EWOULDBLOCK -> defns.ewouldblock
| EXDEV -> defns.exdev
| ECHRNG -> defns.echrng
| EL2NSYNC -> defns.el2nsync
| EL3HLT -> defns.el3hlt
| EL3RST -> defns.el3rst
| ELNRNG -> defns.elnrng
| EUNATCH -> defns.eunatch
| ENOCSI -> defns.enocsi
| EL2HLT -> defns.el2hlt
| EBADE -> defns.ebade
| EBADR -> defns.ebadr
| EXFULL -> defns.exfull
| ENOANO -> defns.enoano
| EBADRQC -> defns.ebadrqc
| EBADSLT -> defns.ebadslt
| EBFONT -> defns.ebfont
| ENONET -> defns.enonet
| ENOPKG -> defns.enopkg
| EADV -> defns.eadv
| ESRMNT -> defns.esrmnt
| ECOMM -> defns.ecomm
| EDOTDOT -> defns.edotdot
| ENOTUNIQ -> defns.enotuniq
| EBADFD -> defns.ebadfd
| EREMCHG -> defns.eremchg
| ELIBACC -> defns.elibacc
| ELIBBAD -> defns.elibbad
| ELIBSCN -> defns.elibscn
| ELIBMAX -> defns.elibmax
| ELIBEXEC -> defns.elibexec
| ERESTART -> defns.erestart
| ESTRPIPE -> defns.estrpipe
| EUCLEAN -> defns.euclean
| ENOTNAM -> defns.enotnam
| ENAVAIL -> defns.enavail
| EISNAM -> defns.eisnam
| EREMOTEIO -> defns.eremoteio
| ENOMEDIUM -> defns.enomedium
| EMEDIUMTYPE -> defns.emediumtype
| ENOKEY -> defns.enokey
| EKEYEXPIRED -> defns.ekeyexpired
| EKEYREVOKED -> defns.ekeyrevoked
| EKEYREJECTED -> defns.ekeyrejected
| ERFKILL -> defns.erfkill
| EHWPOISON -> defns.ehwpoison
| EPWROFF -> defns.epwroff
| EDEVERR -> defns.edeverr
| EBADEXEC -> defns.ebadexec
| EBADARCH -> defns.ebadarch
| ESHLIBVERS -> defns.eshlibvers
| EBADMACHO -> defns.ebadmacho
| ENOPOLICY -> defns.enopolicy
| EQFULL -> defns.eqfull
| EDOOFUS -> defns.edoofus
| ENOTCAPABLE -> defns.enotcapable
| ECAPMODE -> defns.ecapmode
| EPROCLIM -> defns.eproclim
| EBADRPC -> defns.ebadrpc
| ERPCMISMATCH -> defns.erpcmismatch
| EPROGUNAVAIL -> defns.eprogunavail
| EPROGMISMATCH -> defns.eprogmismatch
| EPROCUNAVAIL -> defns.eprocunavail
| EFTYPE -> defns.eftype
| EAUTH -> defns.eauth
| ENEEDAUTH -> defns.eneedauth
| ENOATTR -> defns.enoattr
| ENOSTR -> defns.enostr
| ENODATA -> defns.enodata
| ETIME -> defns.etime
| ENOSR -> defns.enosr
| EUNKNOWNERR x -> Some x
let with_code defns symbol code = match symbol with
| E2BIG -> { defns with e2big = code }
| EACCES -> { defns with eacces = code }
| EADDRINUSE -> { defns with eaddrinuse = code }
| EADDRNOTAVAIL -> { defns with eaddrnotavail = code }
| EAFNOSUPPORT -> { defns with eafnosupport = code }
| EAGAIN -> { defns with eagain = code }
| EALREADY -> { defns with ealready = code }
| EBADF -> { defns with ebadf = code }
| EBADMSG -> { defns with ebadmsg = code }
| EBUSY -> { defns with ebusy = code }
| ECANCELED -> { defns with ecanceled = code }
| ECHILD -> { defns with echild = code }
| ECONNABORTED -> { defns with econnaborted = code }
| ECONNREFUSED -> { defns with econnrefused = code }
| ECONNRESET -> { defns with econnreset = code }
| EDEADLK -> { defns with edeadlk = code }
| EDESTADDRREQ -> { defns with edestaddrreq = code }
| EDOM -> { defns with edom = code }
| EDQUOT -> { defns with edquot = code }
| EEXIST -> { defns with eexist = code }
| EFAULT -> { defns with efault = code }
| EFBIG -> { defns with efbig = code }
| EHOSTDOWN -> { defns with ehostdown = code }
| EHOSTUNREACH -> { defns with ehostunreach = code }
| EIDRM -> { defns with eidrm = code }
| EILSEQ -> { defns with eilseq = code }
| EINPROGRESS -> { defns with einprogress = code }
| EINTR -> { defns with eintr = code }
| EINVAL -> { defns with einval = code }
| EIO -> { defns with eio = code }
| EISCONN -> { defns with eisconn = code }
| EISDIR -> { defns with eisdir = code }
| ELOOP -> { defns with eloop = code }
| EMFILE -> { defns with emfile = code }
| EMLINK -> { defns with emlink = code }
| EMSGSIZE -> { defns with emsgsize = code }
| EMULTIHOP -> { defns with emultihop = code }
| ENAMETOOLONG -> { defns with enametoolong = code }
| ENETDOWN -> { defns with enetdown = code }
| ENETRESET -> { defns with enetreset = code }
| ENETUNREACH -> { defns with enetunreach = code }
| ENFILE -> { defns with enfile = code }
| ENOBUFS -> { defns with enobufs = code }
| ENODEV -> { defns with enodev = code }
| ENOENT -> { defns with enoent = code }
| ENOEXEC -> { defns with enoexec = code }
| ENOLCK -> { defns with enolck = code }
| ENOLINK -> { defns with enolink = code }
| ENOMEM -> { defns with enomem = code }
| ENOMSG -> { defns with enomsg = code }
| ENOPROTOOPT -> { defns with enoprotoopt = code }
| ENOSPC -> { defns with enospc = code }
| ENOSYS -> { defns with enosys = code }
| ENOTBLK -> { defns with enotblk = code }
| ENOTCONN -> { defns with enotconn = code }
| ENOTDIR -> { defns with enotdir = code }
| ENOTEMPTY -> { defns with enotempty = code }
| ENOTRECOVERABLE -> { defns with enotrecoverable = code }
| ENOTSOCK -> { defns with enotsock = code }
| ENOTSUP -> { defns with enotsup = code }
| ENOTTY -> { defns with enotty = code }
| ENXIO -> { defns with enxio = code }
| EOPNOTSUPP -> { defns with eopnotsupp = code }
| EOVERFLOW -> { defns with eoverflow = code }
| EOWNERDEAD -> { defns with eownerdead = code }
| EPERM -> { defns with eperm = code }
| EPFNOSUPPORT -> { defns with epfnosupport = code }
| EPIPE -> { defns with epipe = code }
| EPROTO -> { defns with eproto = code }
| EPROTONOSUPPORT -> { defns with eprotonosupport = code }
| EPROTOTYPE -> { defns with eprototype = code }
| ERANGE -> { defns with erange = code }
| EREMOTE -> { defns with eremote = code }
| EROFS -> { defns with erofs = code }
| ESHUTDOWN -> { defns with eshutdown = code }
| ESOCKTNOSUPPORT -> { defns with esocktnosupport = code }
| ESPIPE -> { defns with espipe = code }
| ESRCH -> { defns with esrch = code }
| ESTALE -> { defns with estale = code }
| ETIMEDOUT -> { defns with etimedout = code }
| ETOOMANYREFS -> { defns with etoomanyrefs = code }
| ETXTBSY -> { defns with etxtbsy = code }
| EUSERS -> { defns with eusers = code }
| EWOULDBLOCK -> { defns with ewouldblock = code }
| EXDEV -> { defns with exdev = code }
| ECHRNG -> { defns with echrng = code }
| EL2NSYNC -> { defns with el2nsync = code }
| EL3HLT -> { defns with el3hlt = code }
| EL3RST -> { defns with el3rst = code }
| ELNRNG -> { defns with elnrng = code }
| EUNATCH -> { defns with eunatch = code }
| ENOCSI -> { defns with enocsi = code }
| EL2HLT -> { defns with el2hlt = code }
| EBADE -> { defns with ebade = code }
| EBADR -> { defns with ebadr = code }
| EXFULL -> { defns with exfull = code }
| ENOANO -> { defns with enoano = code }
| EBADRQC -> { defns with ebadrqc = code }
| EBADSLT -> { defns with ebadslt = code }
| EBFONT -> { defns with ebfont = code }
| ENONET -> { defns with enonet = code }
| ENOPKG -> { defns with enopkg = code }
| EADV -> { defns with eadv = code }
| ESRMNT -> { defns with esrmnt = code }
| ECOMM -> { defns with ecomm = code }
| EDOTDOT -> { defns with edotdot = code }
| ENOTUNIQ -> { defns with enotuniq = code }
| EBADFD -> { defns with ebadfd = code }
| EREMCHG -> { defns with eremchg = code }
| ELIBACC -> { defns with elibacc = code }
| ELIBBAD -> { defns with elibbad = code }
| ELIBSCN -> { defns with elibscn = code }
| ELIBMAX -> { defns with elibmax = code }
| ELIBEXEC -> { defns with elibexec = code }
| ERESTART -> { defns with erestart = code }
| ESTRPIPE -> { defns with estrpipe = code }
| EUCLEAN -> { defns with euclean = code }
| ENOTNAM -> { defns with enotnam = code }
| ENAVAIL -> { defns with enavail = code }
| EISNAM -> { defns with eisnam = code }
| EREMOTEIO -> { defns with eremoteio = code }
| ENOMEDIUM -> { defns with enomedium = code }
| EMEDIUMTYPE -> { defns with emediumtype = code }
| ENOKEY -> { defns with enokey = code }
| EKEYEXPIRED -> { defns with ekeyexpired = code }
| EKEYREVOKED -> { defns with ekeyrevoked = code }
| EKEYREJECTED -> { defns with ekeyrejected = code }
| ERFKILL -> { defns with erfkill = code }
| EHWPOISON -> { defns with ehwpoison = code }
| EPWROFF -> { defns with epwroff = code }
| EDEVERR -> { defns with edeverr = code }
| EBADEXEC -> { defns with ebadexec = code }
| EBADARCH -> { defns with ebadarch = code }
| ESHLIBVERS -> { defns with eshlibvers = code }
| EBADMACHO -> { defns with ebadmacho = code }
| ENOPOLICY -> { defns with enopolicy = code }
| EQFULL -> { defns with eqfull = code }
| EDOOFUS -> { defns with edoofus = code }
| ENOTCAPABLE -> { defns with enotcapable = code }
| ECAPMODE -> { defns with ecapmode = code }
| EPROCLIM -> { defns with eproclim = code }
| EBADRPC -> { defns with ebadrpc = code }
| ERPCMISMATCH -> { defns with erpcmismatch = code }
| EPROGUNAVAIL -> { defns with eprogunavail = code }
| EPROGMISMATCH -> { defns with eprogmismatch = code }
| EPROCUNAVAIL -> { defns with eprocunavail = code }
| EFTYPE -> { defns with eftype = code }
| EAUTH -> { defns with eauth = code }
| ENEEDAUTH -> { defns with eneedauth = code }
| ENOATTR -> { defns with enoattr = code }
| ENOSTR -> { defns with enostr = code }
| ENODATA -> { defns with enodata = code }
| ETIME -> { defns with etime = code }
| ENOSR -> { defns with enosr = code }
| EUNKNOWNERR _ -> defns
let of_code ~host code =
let (_,index) = host in
match Hashtbl.find_all index code with
| [] -> [EUNKNOWNERR code]
| errnos -> errnos
let to_string = function
| E2BIG -> "E2BIG"
| EACCES -> "EACCES"
| EADDRINUSE -> "EADDRINUSE"
| EADDRNOTAVAIL -> "EADDRNOTAVAIL"
| EAFNOSUPPORT -> "EAFNOSUPPORT"
| EAGAIN -> "EAGAIN"
| EALREADY -> "EALREADY"
| EBADF -> "EBADF"
| EBADMSG -> "EBADMSG"
| EBUSY -> "EBUSY"
| ECANCELED -> "ECANCELED"
| ECHILD -> "ECHILD"
| ECONNABORTED -> "ECONNABORTED"
| ECONNREFUSED -> "ECONNREFUSED"
| ECONNRESET -> "ECONNRESET"
| EDEADLK -> "EDEADLK"
| EDESTADDRREQ -> "EDESTADDRREQ"
| EDOM -> "EDOM"
| EDQUOT -> "EDQUOT"
| EEXIST -> "EEXIST"
| EFAULT -> "EFAULT"
| EFBIG -> "EFBIG"
| EHOSTDOWN -> "EHOSTDOWN"
| EHOSTUNREACH -> "EHOSTUNREACH"
| EIDRM -> "EIDRM"
| EILSEQ -> "EILSEQ"
| EINPROGRESS -> "EINPROGRESS"
| EINTR -> "EINTR"
| EINVAL -> "EINVAL"
| EIO -> "EIO"
| EISCONN -> "EISCONN"
| EISDIR -> "EISDIR"
| ELOOP -> "ELOOP"
| EMFILE -> "EMFILE"
| EMLINK -> "EMLINK"
| EMSGSIZE -> "EMSGSIZE"
| EMULTIHOP -> "EMULTIHOP"
| ENAMETOOLONG -> "ENAMETOOLONG"
| ENETDOWN -> "ENETDOWN"
| ENETRESET -> "ENETRESET"
| ENETUNREACH -> "ENETUNREACH"
| ENFILE -> "ENFILE"
| ENOBUFS -> "ENOBUFS"
| ENODEV -> "ENODEV"
| ENOENT -> "ENOENT"
| ENOEXEC -> "ENOEXEC"
| ENOLCK -> "ENOLCK"
| ENOLINK -> "ENOLINK"
| ENOMEM -> "ENOMEM"
| ENOMSG -> "ENOMSG"
| ENOPROTOOPT -> "ENOPROTOOPT"
| ENOSPC -> "ENOSPC"
| ENOSYS -> "ENOSYS"
| ENOTBLK -> "ENOTBLK"
| ENOTCONN -> "ENOTCONN"
| ENOTDIR -> "ENOTDIR"
| ENOTEMPTY -> "ENOTEMPTY"
| ENOTRECOVERABLE -> "ENOTRECOVERABLE"
| ENOTSOCK -> "ENOTSOCK"
| ENOTSUP -> "ENOTSUP"
| ENOTTY -> "ENOTTY"
| ENXIO -> "ENXIO"
| EOPNOTSUPP -> "EOPNOTSUPP"
| EOVERFLOW -> "EOVERFLOW"
| EOWNERDEAD -> "EOWNERDEAD"
| EPERM -> "EPERM"
| EPFNOSUPPORT -> "EPFNOSUPPORT"
| EPIPE -> "EPIPE"
| EPROTO -> "EPROTO"
| EPROTONOSUPPORT -> "EPROTONOSUPPORT"
| EPROTOTYPE -> "EPROTOTYPE"
| ERANGE -> "ERANGE"
| EREMOTE -> "EREMOTE"
| EROFS -> "EROFS"
| ESHUTDOWN -> "ESHUTDOWN"
| ESOCKTNOSUPPORT -> "ESOCKTNOSUPPORT"
| ESPIPE -> "ESPIPE"
| ESRCH -> "ESRCH"
| ESTALE -> "ESTALE"
| ETIMEDOUT -> "ETIMEDOUT"
| ETOOMANYREFS -> "ETOOMANYREFS"
| ETXTBSY -> "ETXTBSY"
| EUSERS -> "EUSERS"
| EWOULDBLOCK -> "EWOULDBLOCK"
| EXDEV -> "EXDEV"
| ECHRNG -> "ECHRNG"
| EL2NSYNC -> "EL2NSYNC"
| EL3HLT -> "EL3HLT"
| EL3RST -> "EL3RST"
| ELNRNG -> "ELNRNG"
| EUNATCH -> "EUNATCH"
| ENOCSI -> "ENOCSI"
| EL2HLT -> "EL2HLT"
| EBADE -> "EBADE"
| EBADR -> "EBADR"
| EXFULL -> "EXFULL"
| ENOANO -> "ENOANO"
| EBADRQC -> "EBADRQC"
| EBADSLT -> "EBADSLT"
| EBFONT -> "EBFONT"
| ENONET -> "ENONET"
| ENOPKG -> "ENOPKG"
| EADV -> "EADV"
| ESRMNT -> "ESRMNT"
| ECOMM -> "ECOMM"
| EDOTDOT -> "EDOTDOT"
| ENOTUNIQ -> "ENOTUNIQ"
| EBADFD -> "EBADFD"
| EREMCHG -> "EREMCHG"
| ELIBACC -> "ELIBACC"
| ELIBBAD -> "ELIBBAD"
| ELIBSCN -> "ELIBSCN"
| ELIBMAX -> "ELIBMAX"
| ELIBEXEC -> "ELIBEXEC"
| ERESTART -> "ERESTART"
| ESTRPIPE -> "ESTRPIPE"
| EUCLEAN -> "EUCLEAN"
| ENOTNAM -> "ENOTNAM"
| ENAVAIL -> "ENAVAIL"
| EISNAM -> "EISNAM"
| EREMOTEIO -> "EREMOTEIO"
| ENOMEDIUM -> "ENOMEDIUM"
| EMEDIUMTYPE -> "EMEDIUMTYPE"
| ENOKEY -> "ENOKEY"
| EKEYEXPIRED -> "EKEYEXPIRED"
| EKEYREVOKED -> "EKEYREVOKED"
| EKEYREJECTED -> "EKEYREJECTED"
| ERFKILL -> "ERFKILL"
| EHWPOISON -> "EHWPOISON"
| EPWROFF -> "EPWROFF"
| EDEVERR -> "EDEVERR"
| EBADEXEC -> "EBADEXEC"
| EBADARCH -> "EBADARCH"
| ESHLIBVERS -> "ESHLIBVERS"
| EBADMACHO -> "EBADMACHO"
| ENOPOLICY -> "ENOPOLICY"
| EQFULL -> "EQFULL"
| EDOOFUS -> "EDOOFUS"
| ENOTCAPABLE -> "ENOTCAPABLE"
| ECAPMODE -> "ECAPMODE"
| EPROCLIM -> "EPROCLIM"
| EBADRPC -> "EBADRPC"
| ERPCMISMATCH -> "ERPCMISMATCH"
| EPROGUNAVAIL -> "EPROGUNAVAIL"
| EPROGMISMATCH -> "EPROGMISMATCH"
| EPROCUNAVAIL -> "EPROCUNAVAIL"
| EFTYPE -> "EFTYPE"
| EAUTH -> "EAUTH"
| ENEEDAUTH -> "ENEEDAUTH"
| ENOATTR -> "ENOATTR"
| ENOSTR -> "ENOSTR"
| ENODATA -> "ENODATA"
| ETIME -> "ETIME"
| ENOSR -> "ENOSR"
| EUNKNOWNERR x -> "EUNKNOWNERR_"^(Signed.SInt.to_string x)
let of_string = function
| "E2BIG" -> Some E2BIG
| "EACCES" -> Some EACCES
| "EADDRINUSE" -> Some EADDRINUSE
| "EADDRNOTAVAIL" -> Some EADDRNOTAVAIL
| "EAFNOSUPPORT" -> Some EAFNOSUPPORT
| "EAGAIN" -> Some EAGAIN
| "EALREADY" -> Some EALREADY
| "EBADF" -> Some EBADF
| "EBADMSG" -> Some EBADMSG
| "EBUSY" -> Some EBUSY
| "ECANCELED" -> Some ECANCELED
| "ECHILD" -> Some ECHILD
| "ECONNABORTED" -> Some ECONNABORTED
| "ECONNREFUSED" -> Some ECONNREFUSED
| "ECONNRESET" -> Some ECONNRESET
| "EDEADLK" -> Some EDEADLK
| "EDESTADDRREQ" -> Some EDESTADDRREQ
| "EDOM" -> Some EDOM
| "EDQUOT" -> Some EDQUOT
| "EEXIST" -> Some EEXIST
| "EFAULT" -> Some EFAULT
| "EFBIG" -> Some EFBIG
| "EHOSTDOWN" -> Some EHOSTDOWN
| "EHOSTUNREACH" -> Some EHOSTUNREACH
| "EIDRM" -> Some EIDRM
| "EILSEQ" -> Some EILSEQ
| "EINPROGRESS" -> Some EINPROGRESS
| "EINTR" -> Some EINTR
| "EINVAL" -> Some EINVAL
| "EIO" -> Some EIO
| "EISCONN" -> Some EISCONN
| "EISDIR" -> Some EISDIR
| "ELOOP" -> Some ELOOP
| "EMFILE" -> Some EMFILE
| "EMLINK" -> Some EMLINK
| "EMSGSIZE" -> Some EMSGSIZE
| "EMULTIHOP" -> Some EMULTIHOP
| "ENAMETOOLONG" -> Some ENAMETOOLONG
| "ENETDOWN" -> Some ENETDOWN
| "ENETRESET" -> Some ENETRESET
| "ENETUNREACH" -> Some ENETUNREACH
| "ENFILE" -> Some ENFILE
| "ENOBUFS" -> Some ENOBUFS
| "ENODEV" -> Some ENODEV
| "ENOENT" -> Some ENOENT
| "ENOEXEC" -> Some ENOEXEC
| "ENOLCK" -> Some ENOLCK
| "ENOLINK" -> Some ENOLINK
| "ENOMEM" -> Some ENOMEM
| "ENOMSG" -> Some ENOMSG
| "ENOPROTOOPT" -> Some ENOPROTOOPT
| "ENOSPC" -> Some ENOSPC
| "ENOSYS" -> Some ENOSYS
| "ENOTBLK" -> Some ENOTBLK
| "ENOTCONN" -> Some ENOTCONN
| "ENOTDIR" -> Some ENOTDIR
| "ENOTEMPTY" -> Some ENOTEMPTY
| "ENOTRECOVERABLE" -> Some ENOTRECOVERABLE
| "ENOTSOCK" -> Some ENOTSOCK
| "ENOTSUP" -> Some ENOTSUP
| "ENOTTY" -> Some ENOTTY
| "ENXIO" -> Some ENXIO
| "EOPNOTSUPP" -> Some EOPNOTSUPP
| "EOVERFLOW" -> Some EOVERFLOW
| "EOWNERDEAD" -> Some EOWNERDEAD
| "EPERM" -> Some EPERM
| "EPFNOSUPPORT" -> Some EPFNOSUPPORT
| "EPIPE" -> Some EPIPE
| "EPROTO" -> Some EPROTO
| "EPROTONOSUPPORT" -> Some EPROTONOSUPPORT
| "EPROTOTYPE" -> Some EPROTOTYPE
| "ERANGE" -> Some ERANGE
| "EREMOTE" -> Some EREMOTE
| "EROFS" -> Some EROFS
| "ESHUTDOWN" -> Some ESHUTDOWN
| "ESOCKTNOSUPPORT" -> Some ESOCKTNOSUPPORT
| "ESPIPE" -> Some ESPIPE
| "ESRCH" -> Some ESRCH
| "ESTALE" -> Some ESTALE
| "ETIMEDOUT" -> Some ETIMEDOUT
| "ETOOMANYREFS" -> Some ETOOMANYREFS
| "ETXTBSY" -> Some ETXTBSY
| "EUSERS" -> Some EUSERS
| "EWOULDBLOCK" -> Some EWOULDBLOCK
| "EXDEV" -> Some EXDEV
| "ECHRNG" -> Some ECHRNG
| "EL2NSYNC" -> Some EL2NSYNC
| "EL3HLT" -> Some EL3HLT
| "EL3RST" -> Some EL3RST
| "ELNRNG" -> Some ELNRNG
| "EUNATCH" -> Some EUNATCH
| "ENOCSI" -> Some ENOCSI
| "EL2HLT" -> Some EL2HLT
| "EBADE" -> Some EBADE
| "EBADR" -> Some EBADR
| "EXFULL" -> Some EXFULL
| "ENOANO" -> Some ENOANO
| "EBADRQC" -> Some EBADRQC
| "EBADSLT" -> Some EBADSLT
| "EBFONT" -> Some EBFONT
| "ENONET" -> Some ENONET
| "ENOPKG" -> Some ENOPKG
| "EADV" -> Some EADV
| "ESRMNT" -> Some ESRMNT
| "ECOMM" -> Some ECOMM
| "EDOTDOT" -> Some EDOTDOT
| "ENOTUNIQ" -> Some ENOTUNIQ
| "EBADFD" -> Some EBADFD
| "EREMCHG" -> Some EREMCHG
| "ELIBACC" -> Some ELIBACC
| "ELIBBAD" -> Some ELIBBAD
| "ELIBSCN" -> Some ELIBSCN
| "ELIBMAX" -> Some ELIBMAX
| "ELIBEXEC" -> Some ELIBEXEC
| "ERESTART" -> Some ERESTART
| "ESTRPIPE" -> Some ESTRPIPE
| "EUCLEAN" -> Some EUCLEAN
| "ENOTNAM" -> Some ENOTNAM
| "ENAVAIL" -> Some ENAVAIL
| "EISNAM" -> Some EISNAM
| "EREMOTEIO" -> Some EREMOTEIO
| "ENOMEDIUM" -> Some ENOMEDIUM
| "EMEDIUMTYPE" -> Some EMEDIUMTYPE
| "ENOKEY" -> Some ENOKEY
| "EKEYEXPIRED" -> Some EKEYEXPIRED
| "EKEYREVOKED" -> Some EKEYREVOKED
| "EKEYREJECTED" -> Some EKEYREJECTED
| "ERFKILL" -> Some ERFKILL
| "EHWPOISON" -> Some EHWPOISON
| "EPWROFF" -> Some EPWROFF
| "EDEVERR" -> Some EDEVERR
| "EBADEXEC" -> Some EBADEXEC
| "EBADARCH" -> Some EBADARCH
| "ESHLIBVERS" -> Some ESHLIBVERS
| "EBADMACHO" -> Some EBADMACHO
| "ENOPOLICY" -> Some ENOPOLICY
| "EQFULL" -> Some EQFULL
| "EDOOFUS" -> Some EDOOFUS
| "ENOTCAPABLE" -> Some ENOTCAPABLE
| "ECAPMODE" -> Some ECAPMODE
| "EPROCLIM" -> Some EPROCLIM
| "EBADRPC" -> Some EBADRPC
| "ERPCMISMATCH" -> Some ERPCMISMATCH
| "EPROGUNAVAIL" -> Some EPROGUNAVAIL
| "EPROGMISMATCH" -> Some EPROGMISMATCH
| "EPROCUNAVAIL" -> Some EPROCUNAVAIL
| "EFTYPE" -> Some EFTYPE
| "EAUTH" -> Some EAUTH
| "ENEEDAUTH" -> Some ENEEDAUTH
| "ENOATTR" -> Some ENOATTR
| "ENOSTR" -> Some ENOSTR
| "ENODATA" -> Some ENODATA
| "ETIME" -> Some ETIME
| "ENOSR" -> Some ENOSR
| _ -> None
let iter_defns defns f_exist f_missing =
(match defns.e2big with
| Some x -> f_exist x E2BIG | None -> f_missing E2BIG);
(match defns.eacces with
| Some x -> f_exist x EACCES | None -> f_missing EACCES);
(match defns.eaddrinuse with
| Some x -> f_exist x EADDRINUSE | None -> f_missing EADDRINUSE);
(match defns.eaddrnotavail with
| Some x -> f_exist x EADDRNOTAVAIL | None -> f_missing EADDRNOTAVAIL);
(match defns.eafnosupport with
| Some x -> f_exist x EAFNOSUPPORT | None -> f_missing EAFNOSUPPORT);
(match defns.eagain with
| Some x -> f_exist x EAGAIN | None -> f_missing EAGAIN);
(match defns.ealready with
| Some x -> f_exist x EALREADY | None -> f_missing EALREADY);
(match defns.ebadf with
| Some x -> f_exist x EBADF | None -> f_missing EBADF);
(match defns.ebadmsg with
| Some x -> f_exist x EBADMSG | None -> f_missing EBADMSG);
(match defns.ebusy with
| Some x -> f_exist x EBUSY | None -> f_missing EBUSY);
(match defns.ecanceled with
| Some x -> f_exist x ECANCELED | None -> f_missing ECANCELED);
(match defns.echild with
| Some x -> f_exist x ECHILD | None -> f_missing ECHILD);
(match defns.econnaborted with
| Some x -> f_exist x ECONNABORTED | None -> f_missing ECONNABORTED);
(match defns.econnrefused with
| Some x -> f_exist x ECONNREFUSED | None -> f_missing ECONNREFUSED);
(match defns.econnreset with
| Some x -> f_exist x ECONNRESET | None -> f_missing ECONNRESET);
(match defns.edeadlk with
| Some x -> f_exist x EDEADLK | None -> f_missing EDEADLK);
(match defns.edestaddrreq with
| Some x -> f_exist x EDESTADDRREQ | None -> f_missing EDESTADDRREQ);
(match defns.edom with
| Some x -> f_exist x EDOM | None -> f_missing EDOM);
(match defns.edquot with
| Some x -> f_exist x EDQUOT | None -> f_missing EDQUOT);
(match defns.eexist with
| Some x -> f_exist x EEXIST | None -> f_missing EEXIST);
(match defns.efault with
| Some x -> f_exist x EFAULT | None -> f_missing EFAULT);
(match defns.efbig with
| Some x -> f_exist x EFBIG | None -> f_missing EFBIG);
(match defns.ehostdown with
| Some x -> f_exist x EHOSTDOWN | None -> f_missing EHOSTDOWN);
(match defns.ehostunreach with
| Some x -> f_exist x EHOSTUNREACH | None -> f_missing EHOSTUNREACH);
(match defns.eidrm with
| Some x -> f_exist x EIDRM | None -> f_missing EIDRM);
(match defns.eilseq with
| Some x -> f_exist x EILSEQ | None -> f_missing EILSEQ);
(match defns.einprogress with
| Some x -> f_exist x EINPROGRESS | None -> f_missing EINPROGRESS);
(match defns.eintr with
| Some x -> f_exist x EINTR | None -> f_missing EINTR);
(match defns.einval with
| Some x -> f_exist x EINVAL | None -> f_missing EINVAL);
(match defns.eio with
| Some x -> f_exist x EIO | None -> f_missing EIO);
(match defns.eisconn with
| Some x -> f_exist x EISCONN | None -> f_missing EISCONN);
(match defns.eisdir with
| Some x -> f_exist x EISDIR | None -> f_missing EISDIR);
(match defns.eloop with
| Some x -> f_exist x ELOOP | None -> f_missing ELOOP);
(match defns.emfile with
| Some x -> f_exist x EMFILE | None -> f_missing EMFILE);
(match defns.emlink with
| Some x -> f_exist x EMLINK | None -> f_missing EMLINK);
(match defns.emsgsize with
| Some x -> f_exist x EMSGSIZE | None -> f_missing EMSGSIZE);
(match defns.emultihop with
| Some x -> f_exist x EMULTIHOP | None -> f_missing EMULTIHOP);
(match defns.enametoolong with
| Some x -> f_exist x ENAMETOOLONG | None -> f_missing ENAMETOOLONG);
(match defns.enetdown with
| Some x -> f_exist x ENETDOWN | None -> f_missing ENETDOWN);
(match defns.enetreset with
| Some x -> f_exist x ENETRESET | None -> f_missing ENETRESET);
(match defns.enetunreach with
| Some x -> f_exist x ENETUNREACH | None -> f_missing ENETUNREACH);
(match defns.enfile with
| Some x -> f_exist x ENFILE | None -> f_missing ENFILE);
(match defns.enobufs with
| Some x -> f_exist x ENOBUFS | None -> f_missing ENOBUFS);
(match defns.enodev with
| Some x -> f_exist x ENODEV | None -> f_missing ENODEV);
(match defns.enoent with
| Some x -> f_exist x ENOENT | None -> f_missing ENOENT);
(match defns.enoexec with
| Some x -> f_exist x ENOEXEC | None -> f_missing ENOEXEC);
(match defns.enolck with
| Some x -> f_exist x ENOLCK | None -> f_missing ENOLCK);
(match defns.enolink with
| Some x -> f_exist x ENOLINK | None -> f_missing ENOLINK);
(match defns.enomem with
| Some x -> f_exist x ENOMEM | None -> f_missing ENOMEM);
(match defns.enomsg with
| Some x -> f_exist x ENOMSG | None -> f_missing ENOMSG);
(match defns.enoprotoopt with
| Some x -> f_exist x ENOPROTOOPT | None -> f_missing ENOPROTOOPT);
(match defns.enospc with
| Some x -> f_exist x ENOSPC | None -> f_missing ENOSPC);
(match defns.enosys with
| Some x -> f_exist x ENOSYS | None -> f_missing ENOSYS);
(match defns.enotblk with
| Some x -> f_exist x ENOTBLK | None -> f_missing ENOTBLK);
(match defns.enotconn with
| Some x -> f_exist x ENOTCONN | None -> f_missing ENOTCONN);
(match defns.enotdir with
| Some x -> f_exist x ENOTDIR | None -> f_missing ENOTDIR);
(match defns.enotempty with
| Some x -> f_exist x ENOTEMPTY | None -> f_missing ENOTEMPTY);
(match defns.enotrecoverable with
| Some x -> f_exist x ENOTRECOVERABLE | None -> f_missing ENOTRECOVERABLE);
(match defns.enotsock with
| Some x -> f_exist x ENOTSOCK | None -> f_missing ENOTSOCK);
(match defns.enotsup with
| Some x -> f_exist x ENOTSUP | None -> f_missing ENOTSUP);
(match defns.enotty with
| Some x -> f_exist x ENOTTY | None -> f_missing ENOTTY);
(match defns.enxio with
| Some x -> f_exist x ENXIO | None -> f_missing ENXIO);
(match defns.eopnotsupp with
| Some x -> f_exist x EOPNOTSUPP | None -> f_missing EOPNOTSUPP);
(match defns.eoverflow with
| Some x -> f_exist x EOVERFLOW | None -> f_missing EOVERFLOW);
(match defns.eownerdead with
| Some x -> f_exist x EOWNERDEAD | None -> f_missing EOWNERDEAD);
(match defns.eperm with
| Some x -> f_exist x EPERM | None -> f_missing EPERM);
(match defns.epfnosupport with
| Some x -> f_exist x EPFNOSUPPORT | None -> f_missing EPFNOSUPPORT);
(match defns.epipe with
| Some x -> f_exist x EPIPE | None -> f_missing EPIPE);
(match defns.eproto with
| Some x -> f_exist x EPROTO | None -> f_missing EPROTO);
(match defns.eprotonosupport with
| Some x -> f_exist x EPROTONOSUPPORT | None -> f_missing EPROTONOSUPPORT);
(match defns.eprototype with
| Some x -> f_exist x EPROTOTYPE | None -> f_missing EPROTOTYPE);
(match defns.erange with
| Some x -> f_exist x ERANGE | None -> f_missing ERANGE);
(match defns.eremote with
| Some x -> f_exist x EREMOTE | None -> f_missing EREMOTE);
(match defns.erofs with
| Some x -> f_exist x EROFS | None -> f_missing EROFS);
(match defns.eshutdown with
| Some x -> f_exist x ESHUTDOWN | None -> f_missing ESHUTDOWN);
(match defns.esocktnosupport with
| Some x -> f_exist x ESOCKTNOSUPPORT | None -> f_missing ESOCKTNOSUPPORT);
(match defns.espipe with
| Some x -> f_exist x ESPIPE | None -> f_missing ESPIPE);
(match defns.esrch with
| Some x -> f_exist x ESRCH | None -> f_missing ESRCH);
(match defns.estale with
| Some x -> f_exist x ESTALE | None -> f_missing ESTALE);
(match defns.etimedout with
| Some x -> f_exist x ETIMEDOUT | None -> f_missing ETIMEDOUT);
(match defns.etoomanyrefs with
| Some x -> f_exist x ETOOMANYREFS | None -> f_missing ETOOMANYREFS);
(match defns.etxtbsy with
| Some x -> f_exist x ETXTBSY | None -> f_missing ETXTBSY);
(match defns.eusers with
| Some x -> f_exist x EUSERS | None -> f_missing EUSERS);
(match defns.ewouldblock with
| Some x -> f_exist x EWOULDBLOCK | None -> f_missing EWOULDBLOCK);
(match defns.exdev with
| Some x -> f_exist x EXDEV | None -> f_missing EXDEV);
(match defns.echrng with
| Some x -> f_exist x ECHRNG | None -> f_missing ECHRNG);
(match defns.el2nsync with
| Some x -> f_exist x EL2NSYNC | None -> f_missing EL2NSYNC);
(match defns.el3hlt with
| Some x -> f_exist x EL3HLT | None -> f_missing EL3HLT);
(match defns.el3rst with
| Some x -> f_exist x EL3RST | None -> f_missing EL3RST);
(match defns.elnrng with
| Some x -> f_exist x ELNRNG | None -> f_missing ELNRNG);
(match defns.eunatch with
| Some x -> f_exist x EUNATCH | None -> f_missing EUNATCH);
(match defns.enocsi with
| Some x -> f_exist x ENOCSI | None -> f_missing ENOCSI);
(match defns.el2hlt with
| Some x -> f_exist x EL2HLT | None -> f_missing EL2HLT);
(match defns.ebade with
| Some x -> f_exist x EBADE | None -> f_missing EBADE);
(match defns.ebadr with
| Some x -> f_exist x EBADR | None -> f_missing EBADR);
(match defns.exfull with
| Some x -> f_exist x EXFULL | None -> f_missing EXFULL);
(match defns.enoano with
| Some x -> f_exist x ENOANO | None -> f_missing ENOANO);
(match defns.ebadrqc with
| Some x -> f_exist x EBADRQC | None -> f_missing EBADRQC);
(match defns.ebadslt with
| Some x -> f_exist x EBADSLT | None -> f_missing EBADSLT);
(match defns.ebfont with
| Some x -> f_exist x EBFONT | None -> f_missing EBFONT);
(match defns.enonet with
| Some x -> f_exist x ENONET | None -> f_missing ENONET);
(match defns.enopkg with
| Some x -> f_exist x ENOPKG | None -> f_missing ENOPKG);
(match defns.eadv with
| Some x -> f_exist x EADV | None -> f_missing EADV);
(match defns.esrmnt with
| Some x -> f_exist x ESRMNT | None -> f_missing ESRMNT);
(match defns.ecomm with
| Some x -> f_exist x ECOMM | None -> f_missing ECOMM);
(match defns.edotdot with
| Some x -> f_exist x EDOTDOT | None -> f_missing EDOTDOT);
(match defns.enotuniq with
| Some x -> f_exist x ENOTUNIQ | None -> f_missing ENOTUNIQ);
(match defns.ebadfd with
| Some x -> f_exist x EBADFD | None -> f_missing EBADFD);
(match defns.eremchg with
| Some x -> f_exist x EREMCHG | None -> f_missing EREMCHG);
(match defns.elibacc with
| Some x -> f_exist x ELIBACC | None -> f_missing ELIBACC);
(match defns.elibbad with
| Some x -> f_exist x ELIBBAD | None -> f_missing ELIBBAD);
(match defns.elibscn with
| Some x -> f_exist x ELIBSCN | None -> f_missing ELIBSCN);
(match defns.elibmax with
| Some x -> f_exist x ELIBMAX | None -> f_missing ELIBMAX);
(match defns.elibexec with
| Some x -> f_exist x ELIBEXEC | None -> f_missing ELIBEXEC);
(match defns.erestart with
| Some x -> f_exist x ERESTART | None -> f_missing ERESTART);
(match defns.estrpipe with
| Some x -> f_exist x ESTRPIPE | None -> f_missing ESTRPIPE);
(match defns.euclean with
| Some x -> f_exist x EUCLEAN | None -> f_missing EUCLEAN);
(match defns.enotnam with
| Some x -> f_exist x ENOTNAM | None -> f_missing ENOTNAM);
(match defns.enavail with
| Some x -> f_exist x ENAVAIL | None -> f_missing ENAVAIL);
(match defns.eisnam with
| Some x -> f_exist x EISNAM | None -> f_missing EISNAM);
(match defns.eremoteio with
| Some x -> f_exist x EREMOTEIO | None -> f_missing EREMOTEIO);
(match defns.enomedium with
| Some x -> f_exist x ENOMEDIUM | None -> f_missing ENOMEDIUM);
(match defns.emediumtype with
| Some x -> f_exist x EMEDIUMTYPE | None -> f_missing EMEDIUMTYPE);
(match defns.enokey with
| Some x -> f_exist x ENOKEY | None -> f_missing ENOKEY);
(match defns.ekeyexpired with
| Some x -> f_exist x EKEYEXPIRED | None -> f_missing EKEYEXPIRED);
(match defns.ekeyrevoked with
| Some x -> f_exist x EKEYREVOKED | None -> f_missing EKEYREVOKED);
(match defns.ekeyrejected with
| Some x -> f_exist x EKEYREJECTED | None -> f_missing EKEYREJECTED);
(match defns.erfkill with
| Some x -> f_exist x ERFKILL | None -> f_missing ERFKILL);
(match defns.ehwpoison with
| Some x -> f_exist x EHWPOISON | None -> f_missing EHWPOISON);
(match defns.epwroff with
| Some x -> f_exist x EPWROFF | None -> f_missing EPWROFF);
(match defns.edeverr with
| Some x -> f_exist x EDEVERR | None -> f_missing EDEVERR);
(match defns.ebadexec with
| Some x -> f_exist x EBADEXEC | None -> f_missing EBADEXEC);
(match defns.ebadarch with
| Some x -> f_exist x EBADARCH | None -> f_missing EBADARCH);
(match defns.eshlibvers with
| Some x -> f_exist x ESHLIBVERS | None -> f_missing ESHLIBVERS);
(match defns.ebadmacho with
| Some x -> f_exist x EBADMACHO | None -> f_missing EBADMACHO);
(match defns.enopolicy with
| Some x -> f_exist x ENOPOLICY | None -> f_missing ENOPOLICY);
(match defns.eqfull with
| Some x -> f_exist x EQFULL | None -> f_missing EQFULL);
(match defns.edoofus with
| Some x -> f_exist x EDOOFUS | None -> f_missing EDOOFUS);
(match defns.enotcapable with
| Some x -> f_exist x ENOTCAPABLE | None -> f_missing ENOTCAPABLE);
(match defns.ecapmode with
| Some x -> f_exist x ECAPMODE | None -> f_missing ECAPMODE);
(match defns.eproclim with
| Some x -> f_exist x EPROCLIM | None -> f_missing EPROCLIM);
(match defns.ebadrpc with
| Some x -> f_exist x EBADRPC | None -> f_missing EBADRPC);
(match defns.erpcmismatch with
| Some x -> f_exist x ERPCMISMATCH | None -> f_missing ERPCMISMATCH);
(match defns.eprogunavail with
| Some x -> f_exist x EPROGUNAVAIL | None -> f_missing EPROGUNAVAIL);
(match defns.eprogmismatch with
| Some x -> f_exist x EPROGMISMATCH | None -> f_missing EPROGMISMATCH);
(match defns.eprocunavail with
| Some x -> f_exist x EPROCUNAVAIL | None -> f_missing EPROCUNAVAIL);
(match defns.eftype with
| Some x -> f_exist x EFTYPE | None -> f_missing EFTYPE);
(match defns.eauth with
| Some x -> f_exist x EAUTH | None -> f_missing EAUTH);
(match defns.eneedauth with
| Some x -> f_exist x ENEEDAUTH | None -> f_missing ENEEDAUTH);
(match defns.enoattr with
| Some x -> f_exist x ENOATTR | None -> f_missing ENOATTR);
(match defns.enostr with
| Some x -> f_exist x ENOSTR | None -> f_missing ENOSTR);
(match defns.enodata with
| Some x -> f_exist x ENODATA | None -> f_missing ENODATA);
(match defns.etime with
| Some x -> f_exist x ETIME | None -> f_missing ETIME);
(match defns.enosr with
| Some x -> f_exist x ENOSR | None -> f_missing ENOSR);
()
module Host = struct
type t = defns * index
let index_of_defns defns =
let h = Hashtbl.create 100 in
iter_defns defns (Hashtbl.add h) (fun _ -> ());
h
let of_defns defns = (defns, index_of_defns defns)
let to_defns (defns, _) = defns
end
let string_of_defns defns =
let buf = Buffer.create 1024 in
iter_defns defns
(fun code symbol ->
Buffer.add_string buf (Printf.sprintf "%s\t%s\n" (to_string symbol)
(Signed.SInt.to_string code))
)
(fun symbol ->
Buffer.add_string buf (Printf.sprintf "%s\t\n" (to_string symbol))
);
Buffer.contents buf
let defns_of_string s =
let rec read_lines defns s =
try
let symbol, code, off = Scanf.sscanf s "%s\t%s\n" (fun symbol_s code_s ->
of_string symbol_s,
(if code_s = "" then None else Some (Signed.SInt.of_string code_s)),
String.(length symbol_s + 1 + length code_s + 1)
) in
let defns = match symbol with
| Some symbol -> with_code defns symbol code
| None -> defns
in
read_lines defns String.(sub s off (length s - off))
with End_of_file -> defns
in
read_lines empty_defns s
let check_errno fn =
try Result.Ok (fn ())
with Error e -> Result.Error e
let string_of_error { errno; call; label } =
Printf.sprintf "{ errno = [%s]; call = %s; label = %s }"
(String.concat "; " (List.map to_string errno))
call label
let () = Printexc.register_printer
(function Error e -> Some (string_of_error e)
| _ -> None)
|