pax_global_header00006660000000000000000000000064144036230450014513gustar00rootroot0000000000000052 comment=c91d9ac97e33f7df0d63f95110130130d040c6ce ocaml-unix-errno-0.6.2/000077500000000000000000000000001440362304500147175ustar00rootroot00000000000000ocaml-unix-errno-0.6.2/.github/000077500000000000000000000000001440362304500162575ustar00rootroot00000000000000ocaml-unix-errno-0.6.2/.github/workflows/000077500000000000000000000000001440362304500203145ustar00rootroot00000000000000ocaml-unix-errno-0.6.2/.github/workflows/main.yml000066400000000000000000000011621440362304500217630ustar00rootroot00000000000000name: Main workflow on: pull_request: push: jobs: build: strategy: fail-fast: false matrix: os: - macos-latest - ubuntu-latest ocaml-compiler: - 4.08.x - 4.12.x runs-on: ${{ matrix.os }} steps: - name: Checkout code uses: actions/checkout@v2 - name: Use OCaml ${{ matrix.ocaml-compiler }} uses: ocaml/setup-ocaml@v2 with: ocaml-compiler: ${{ matrix.ocaml-compiler }} - run: opam install . --deps-only --with-test - run: opam exec -- make - run: opam exec -- make test ocaml-unix-errno-0.6.2/.gitignore000066400000000000000000000000071440362304500167040ustar00rootroot00000000000000_build ocaml-unix-errno-0.6.2/.merlin000066400000000000000000000001241440362304500162030ustar00rootroot00000000000000PKG ctypes PKG result PKG alcotest S lib S lib_gen S unix S unix_test B _build/** ocaml-unix-errno-0.6.2/CHANGES000066400000000000000000000050211440362304500157100ustar00rootroot00000000000000## 0.6.0 (2021-08-19): * Port to dune ## 0.5.2 (2017-01-20): * Install cmx files ## 0.5.1 (2016-08-05): * Add a missing ctypes findlib dependency. ## 0.5.0 (2016-07-26): * Switch errno from int to Ctypes.sint ## 0.4.2 (2016-06-01): * Add support for ctypes 0.6.0 ## 0.4.1 (2016-05-04): * Fix linking of Errno_host ## 0.4.0 (2016-05-01): * Remove Errno_host.Linux.v4_0_5 and Errno_host.OSX.v10_11_1 * Add Errno_host.Linux.v4_4_6 and Errno_host.OSX.v10_11_4 * Changed the return type of Errno_unix.raise_on_errno to be 'a option * Changed the host parameters of Errno_unix.to_unix and Errno_unix.of_unix to be optional (default Errno_unix.host) * Documented Errno_unix * Add Errno_unix.get_errno * Add Errno_unix.reset_errno * Add Errno_unix.raise_errno * Add Errno_unix.to_errno_exn * Add Errno_unix.with_errno_exn * Add Errno_unix.to_unix_exn * Add ENOTBLK, EREMOTE, and EUSERS which are available on Linux, OS X, and FreeBSD * Add 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, and EHWPOISON which are available on Linux only * Add EPWROFF, EDEVERR, EBADEXEC, EBADARCH, ESHLIBVERS, EBADMACHO, ENOPOLICY, and EQFULL which are available on OS X only * Add EDOOFUS, ENOTCAPABLE, and ECAPMODE which are available on FreeBSD only * Add EPROCLIM, EBADRPC, ERPCMISMATCH, EPROGUNAVAIL, EPROGMISMATCH, EPROCUNAVAIL, EFTYPE, EAUTH, ENEEDAUTH, and ENOATTR which are available on OS X and FreeBSD * Add ENOSTR, ENODATA, ETIME, and ENOSR which are available on Linux and OS X ## 0.3.0 (2015-11-30): * Use result instead of rresult * Split findlib package into errno and errno.unix (depopt ctypes+unix) * Add Errno.{Host.to_defns, string_of_defns, defns_of_string} * Add errno-map executable to print the errno map of the current host * Add errno-srcgen executable to create source for an Errno.Host.t from a map * Move Errno.host_of_defns to Errno.Host.of_defns and Errno.host to Errno.Host.t * Add Errno.iter_defns * Add Errno_host module in errno findlib package with common Errno.Host.t values ## 0.2.0 (2015-07-26): * Use ctypes >= 0.4.0 with stub generation * Separate modules into Unix-dependent and Unix-independent sets * Add support for all POSIX 2008 errnos ## 0.1.0 (2015-07-26): * Initial public release ocaml-unix-errno-0.6.2/LICENSE000066400000000000000000000653651440362304500157430ustar00rootroot00000000000000This repository is distributed under the terms of the GNU Lesser General Public License version 2.1 (included below). As a special exception to the GNU Lesser General Public License, you may link, statically or dynamically, a "work that uses the Library" with a publicly distributed version of the Library to produce an executable file containing portions of the Library, and distribute that executable file under terms of your choice, without any of the additional requirements listed in clause 6 of the GNU Lesser General Public License. By "a publicly distributed version of the Library", we mean either the unmodified Library as distributed, or a modified version of the Library that is distributed under the conditions defined in clause 3 of the GNU Library General Public License. This exception does not however invalidate any other reasons why the executable file might be covered by the GNU Lesser General Public License. ------------ GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! ocaml-unix-errno-0.6.2/Makefile000066400000000000000000000004621440362304500163610ustar00rootroot00000000000000PROFILE=release .PHONY: release build install uninstall clean test doc reindent build: dune build @install --profile=$(PROFILE) install: dune install uninstall: dune uninstall clean: dune clean test: dune runtest # requires odoc doc: dune build @doc reindent: dune build @fmt --auto-promote ocaml-unix-errno-0.6.2/README.md000066400000000000000000000015011440362304500161730ustar00rootroot00000000000000ocaml-unix-errno ================ [ocaml-unix-errno](https://github.com/dsheets/ocaml-unix-errno) provides an errno variant similar to `Unix.error` but including POSIX 2008, Linux, OS X, and FreeBSD constructors. A macro definition type, `defns` is also provided in order to transport a specific errno-integer map as is the case with FUSE or 9p2000.u. The types and their functions reside in `Errno` and are independent of any Unix bindings. This makes the library's types usable from MirageOS on top of Xen. `Errno_unix` provides maps to and from `Unix.error`, the present host's errno map, an errno exception `Error`, and higher-order errno checking functions. The executable `errno-map` will output a tab-delimited map from errno macro name to integer. This map can then be read back using the function `Errno.defns_of_string`. ocaml-unix-errno-0.6.2/dune-project000066400000000000000000000001031440362304500172330ustar00rootroot00000000000000(lang dune 2.8) (name unix-errno) (implicit_transitive_deps false) ocaml-unix-errno-0.6.2/lib/000077500000000000000000000000001440362304500154655ustar00rootroot00000000000000ocaml-unix-errno-0.6.2/lib/dune000066400000000000000000000007731440362304500163520ustar00rootroot00000000000000(rule (with-stdin-from ../maps/linux_4_4_6 (with-stdout-to errno_map_linux_4_4_6.ml (run ../src/errno_srcgen.exe)))) (rule (with-stdin-from ../maps/osx_10_11_4 (with-stdout-to errno_map_osx_10_11_4.ml (run ../src/errno_srcgen.exe)))) (library (name errno) (public_name unix-errno) (wrapped false) (modules errno) (libraries integers result) ) (library (name errno_host) (public_name unix-errno.host) (wrapped false) (modules :standard \ errno) (libraries errno integers result) ) ocaml-unix-errno-0.6.2/lib/errno.ml000066400000000000000000001356731440362304500171630ustar00rootroot00000000000000(* * Copyright (c) 2015 David Sheets * * 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) ocaml-unix-errno-0.6.2/lib/errno.mli000066400000000000000000000204401440362304500173150ustar00rootroot00000000000000(* * Copyright (c) 2014-2015 David Sheets * * 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 | 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 | EPIPE | EPROTO | EPROTONOSUPPORT | EPROTOTYPE | ERANGE | EREMOTE | EROFS | ESHUTDOWN | ESOCKTNOSUPPORT | ESPIPE | ESRCH | ESTALE | ETIMEDOUT | ETOOMANYREFS | 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 (** NB: This module registers a printer for the [Error] exception. *) 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; } module Host : sig type t val of_defns : defns -> t val to_defns : t -> defns end val to_code : host:Host.t -> t -> Signed.sint option val of_code : host:Host.t -> Signed.sint -> t list val to_string : t -> string val iter_defns : defns -> (Signed.sint -> t -> unit) -> (t -> unit) -> unit val string_of_defns : defns -> string val defns_of_string : string -> defns val check_errno : (unit -> 'a) -> ('a, error) Result.result val string_of_error : error -> string ocaml-unix-errno-0.6.2/lib/errno_host.ml000066400000000000000000000016531440362304500202060ustar00rootroot00000000000000(* * Copyright (c) 2014-2015 David Sheets * * 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. * *) module Linux = struct let v4_4_6 = Errno_map_linux_4_4_6.host end module OSX = struct let v10_11_4 = Errno_map_osx_10_11_4.host end ocaml-unix-errno-0.6.2/lib/errno_host.mli000066400000000000000000000016111440362304500203510ustar00rootroot00000000000000(* * Copyright (c) 2014-2015 David Sheets * * 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. * *) module Linux : sig val v4_4_6 : Errno.Host.t end module OSX : sig val v10_11_4 : Errno.Host.t end ocaml-unix-errno-0.6.2/lib_gen/000077500000000000000000000000001440362304500163165ustar00rootroot00000000000000ocaml-unix-errno-0.6.2/lib_gen/dune000066400000000000000000000032521440362304500171760ustar00rootroot00000000000000(library (name errno_bindings) (public_name unix-errno.errno_bindings) (modules unix_errno_bindings) (wrapped false) (libraries ctypes ctypes.stubs) ) (executables (names unix_errno_stubgen_c unix_errno_stubgen_ml) (modules unix_errno_stubgen_c unix_errno_stubgen_ml) (libraries ctypes ctypes.stubs errno_bindings) ) (rule (targets unix_errno_stubs.c) (deps unix_errno_stubgen_c.exe) (action (run %{deps}))) (rule (targets unix_errno_generated.ml) (deps unix_errno_stubgen_ml.exe) (action (with-stdout-to %{targets} (run %{deps})))) (library (name errno_types) (public_name unix-errno.errno_types) (modules unix_errno_types unix_errno_generated) (wrapped false) (libraries ctypes ctypes.stubs integers) ) ; Generate library errno_types_detected using ctypes_stubs ; See https://github.com/cedlemo/ctypes-stubs-generation-notes for more info (executable (name unix_errno_typegen) (modules unix_errno_typegen) (libraries ctypes.stubs errno_types) ) (rule (targets unix_errno_types_detect.c) (deps unix_errno_typegen.exe) (action (with-stdout-to %{targets} (run %{deps} -c))) ) (rule (targets unix_errno_types_detect.exe) (deps unix_errno_types_detect.c) (action (bash "%{cc} %{deps} -I `dirname %{lib:ctypes:ctypes_cstubs_internals.h}` -I %{ocaml_where} -o %{targets}")) ) (rule (targets unix_errno_types_detected.ml) (deps unix_errno_types_detect.exe) (action (with-stdout-to %{targets} (run %{deps} -ml))) ) (library (name errno_types_detected) (public_name unix-errno.errno_types_detected) (modules unix_errno_types_detected) (flags (:standard -w -9-27)) (libraries ctypes integers) (wrapped false) ) ocaml-unix-errno-0.6.2/lib_gen/unix_errno_bindings.ml000066400000000000000000000151011440362304500227130ustar00rootroot00000000000000(* * Copyright (c) 2015 David Sheets * * 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. * *) open Ctypes module C(F: Cstubs.FOREIGN) = struct let reset_errno = F.(foreign "unix_errno_reset" (void @-> returning void)) let get_errno = F.(foreign "unix_errno_get" (void @-> returning sint)) (* OS X and FreeBSD don't have these *) let echrng = F.(foreign "unix_errno_echrng" (void @-> returning sint)) let el2nsync = F.(foreign "unix_errno_el2nsync" (void @-> returning sint)) let el3hlt = F.(foreign "unix_errno_el3hlt" (void @-> returning sint)) let el3rst = F.(foreign "unix_errno_el3rst" (void @-> returning sint)) let elnrng = F.(foreign "unix_errno_elnrng" (void @-> returning sint)) let eunatch = F.(foreign "unix_errno_eunatch" (void @-> returning sint)) let enocsi = F.(foreign "unix_errno_enocsi" (void @-> returning sint)) let el2hlt = F.(foreign "unix_errno_el2hlt" (void @-> returning sint)) let ebade = F.(foreign "unix_errno_ebade" (void @-> returning sint)) let ebadr = F.(foreign "unix_errno_ebadr" (void @-> returning sint)) let exfull = F.(foreign "unix_errno_exfull" (void @-> returning sint)) let enoano = F.(foreign "unix_errno_enoano" (void @-> returning sint)) let ebadrqc = F.(foreign "unix_errno_ebadrqc" (void @-> returning sint)) let ebadslt = F.(foreign "unix_errno_ebadslt" (void @-> returning sint)) let ebfont = F.(foreign "unix_errno_ebfont" (void @-> returning sint)) let enonet = F.(foreign "unix_errno_enonet" (void @-> returning sint)) let enopkg = F.(foreign "unix_errno_enopkg" (void @-> returning sint)) let eadv = F.(foreign "unix_errno_eadv" (void @-> returning sint)) let esrmnt = F.(foreign "unix_errno_esrmnt" (void @-> returning sint)) let ecomm = F.(foreign "unix_errno_ecomm" (void @-> returning sint)) let edotdot = F.(foreign "unix_errno_edotdot" (void @-> returning sint)) let enotuniq = F.(foreign "unix_errno_enotuniq" (void @-> returning sint)) let ebadfd = F.(foreign "unix_errno_ebadfd" (void @-> returning sint)) let eremchg = F.(foreign "unix_errno_eremchg" (void @-> returning sint)) let elibacc = F.(foreign "unix_errno_elibacc" (void @-> returning sint)) let elibbad = F.(foreign "unix_errno_elibbad" (void @-> returning sint)) let elibscn = F.(foreign "unix_errno_elibscn" (void @-> returning sint)) let elibmax = F.(foreign "unix_errno_elibmax" (void @-> returning sint)) let elibexec = F.(foreign "unix_errno_elibexec" (void @-> returning sint)) let erestart = F.(foreign "unix_errno_erestart" (void @-> returning sint)) let estrpipe = F.(foreign "unix_errno_estrpipe" (void @-> returning sint)) let euclean = F.(foreign "unix_errno_euclean" (void @-> returning sint)) let enotnam = F.(foreign "unix_errno_enotnam" (void @-> returning sint)) let enavail = F.(foreign "unix_errno_enavail" (void @-> returning sint)) let eisnam = F.(foreign "unix_errno_eisnam" (void @-> returning sint)) let eremoteio = F.(foreign "unix_errno_eremoteio" (void @-> returning sint)) let enomedium = F.(foreign "unix_errno_enomedium" (void @-> returning sint)) let emediumtype = F.(foreign "unix_errno_emediumtype" (void @-> returning sint)) let enokey = F.(foreign "unix_errno_enokey" (void @-> returning sint)) let ekeyexpired = F.(foreign "unix_errno_ekeyexpired" (void @-> returning sint)) let ekeyrevoked = F.(foreign "unix_errno_ekeyrevoked" (void @-> returning sint)) let ekeyrejected = F.(foreign "unix_errno_ekeyrejected" (void @-> returning sint)) let erfkill = F.(foreign "unix_errno_erfkill" (void @-> returning sint)) let ehwpoison = F.(foreign "unix_errno_ehwpoison" (void @-> returning sint)) (* Linux and FreeBSD don't have these *) let epwroff = F.(foreign "unix_errno_epwroff" (void @-> returning sint)) let edeverr = F.(foreign "unix_errno_edeverr" (void @-> returning sint)) let ebadexec = F.(foreign "unix_errno_ebadexec" (void @-> returning sint)) let ebadarch = F.(foreign "unix_errno_ebadarch" (void @-> returning sint)) let eshlibvers = F.(foreign "unix_errno_eshlibvers" (void @-> returning sint)) let ebadmacho = F.(foreign "unix_errno_ebadmacho" (void @-> returning sint)) let enopolicy = F.(foreign "unix_errno_enopolicy" (void @-> returning sint)) let eqfull = F.(foreign "unix_errno_eqfull" (void @-> returning sint)) (* Linux and OS X don't have these *) let edoofus = F.(foreign "unix_errno_edoofus" (void @-> returning sint)) let enotcapable = F.(foreign "unix_errno_enotcapable" (void @-> returning sint)) let ecapmode = F.(foreign "unix_errno_ecapmode" (void @-> returning sint)) (* Linux doesn't have these *) let eproclim = F.(foreign "unix_errno_eproclim" (void @-> returning sint)) let ebadrpc = F.(foreign "unix_errno_ebadrpc" (void @-> returning sint)) let erpcmismatch = F.(foreign "unix_errno_erpcmismatch" (void @-> returning sint)) let eprogunavail = F.(foreign "unix_errno_eprogunavail" (void @-> returning sint)) let eprogmismatch = F.(foreign "unix_errno_eprogmismatch" (void @-> returning sint)) let eprocunavail = F.(foreign "unix_errno_eprocunavail" (void @-> returning sint)) let eftype = F.(foreign "unix_errno_eftype" (void @-> returning sint)) let eauth = F.(foreign "unix_errno_eauth" (void @-> returning sint)) let eneedauth = F.(foreign "unix_errno_eneedauth" (void @-> returning sint)) let enoattr = F.(foreign "unix_errno_enoattr" (void @-> returning sint)) (* FreeBSD doesn't have these *) let enostr = F.(foreign "unix_errno_enostr" (void @-> returning sint)) let enodata = F.(foreign "unix_errno_enodata" (void @-> returning sint)) let etime = F.(foreign "unix_errno_etime" (void @-> returning sint)) let enosr = F.(foreign "unix_errno_enosr" (void @-> returning sint)) end ocaml-unix-errno-0.6.2/lib_gen/unix_errno_stubgen_c.ml000066400000000000000000000020661440362304500230750ustar00rootroot00000000000000(* * Copyright (c) 2015 David Sheets * * 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. * *) let () = let prefix = "caml_" in let stubs_oc = open_out "unix_errno_stubs.c" in let fmt = Format.formatter_of_out_channel stubs_oc in Format.fprintf fmt "#include \"unix_errno_util.h\"@."; Cstubs.write_c fmt ~prefix (module Unix_errno_bindings.C); close_out stubs_oc; ocaml-unix-errno-0.6.2/lib_gen/unix_errno_stubgen_ml.ml000066400000000000000000000020161440362304500232560ustar00rootroot00000000000000(* * Copyright (c) 2015 David Sheets * * 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. * *) let () = let prefix = "caml_" in let generated_oc = open_out "unix_errno_generated.ml" in let fmt = Format.formatter_of_out_channel generated_oc in Cstubs.write_ml fmt ~prefix (module Unix_errno_bindings.C); close_out generated_oc ocaml-unix-errno-0.6.2/lib_gen/unix_errno_typegen.ml000066400000000000000000000020171440362304500225730ustar00rootroot00000000000000(* * Copyright (c) 2015 David Sheets * * 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. * *) let () = let type_oc = open_out "unix_errno_types_detect.c" in let fmt = Format.formatter_of_out_channel type_oc in Format.fprintf fmt "#include @."; Cstubs.Types.write_c fmt (module Unix_errno_types.C); close_out type_oc; ocaml-unix-errno-0.6.2/lib_gen/unix_errno_types.ml000066400000000000000000000111471440362304500222700ustar00rootroot00000000000000(* * Copyright (c) 2015 David Sheets * * 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. * *) module C(F: Cstubs.Types.TYPE) = struct let e2big = F.(constant "E2BIG" sint) let eacces = F.(constant "EACCES" sint) let eaddrinuse = F.(constant "EADDRINUSE" sint) let eaddrnotavail = F.(constant "EADDRNOTAVAIL" sint) let eafnosupport = F.(constant "EAFNOSUPPORT" sint) let eagain = F.(constant "EAGAIN" sint) let ealready = F.(constant "EALREADY" sint) let ebadf = F.(constant "EBADF" sint) let ebadmsg = F.(constant "EBADMSG" sint) let ebusy = F.(constant "EBUSY" sint) let ecanceled = F.(constant "ECANCELED" sint) let echild = F.(constant "ECHILD" sint) let econnaborted = F.(constant "ECONNABORTED" sint) let econnrefused = F.(constant "ECONNREFUSED" sint) let econnreset = F.(constant "ECONNRESET" sint) let edeadlk = F.(constant "EDEADLK" sint) let edestaddrreq = F.(constant "EDESTADDRREQ" sint) let edom = F.(constant "EDOM" sint) let edquot = F.(constant "EDQUOT" sint) let eexist = F.(constant "EEXIST" sint) let efault = F.(constant "EFAULT" sint) let efbig = F.(constant "EFBIG" sint) let ehostdown = F.(constant "EHOSTDOWN" sint) let ehostunreach = F.(constant "EHOSTUNREACH" sint) let eidrm = F.(constant "EIDRM" sint) let eilseq = F.(constant "EILSEQ" sint) let einprogress = F.(constant "EINPROGRESS" sint) let eintr = F.(constant "EINTR" sint) let einval = F.(constant "EINVAL" sint) let eio = F.(constant "EIO" sint) let eisconn = F.(constant "EISCONN" sint) let eisdir = F.(constant "EISDIR" sint) let eloop = F.(constant "ELOOP" sint) let emfile = F.(constant "EMFILE" sint) let emlink = F.(constant "EMLINK" sint) let emsgsize = F.(constant "EMSGSIZE" sint) let emultihop = F.(constant "EMULTIHOP" sint) let enametoolong = F.(constant "ENAMETOOLONG" sint) let enetdown = F.(constant "ENETDOWN" sint) let enetreset = F.(constant "ENETRESET" sint) let enetunreach = F.(constant "ENETUNREACH" sint) let enfile = F.(constant "ENFILE" sint) let enobufs = F.(constant "ENOBUFS" sint) let enodev = F.(constant "ENODEV" sint) let enoent = F.(constant "ENOENT" sint) let enoexec = F.(constant "ENOEXEC" sint) let enolck = F.(constant "ENOLCK" sint) let enolink = F.(constant "ENOLINK" sint) let enomem = F.(constant "ENOMEM" sint) let enomsg = F.(constant "ENOMSG" sint) let enoprotoopt = F.(constant "ENOPROTOOPT" sint) let enospc = F.(constant "ENOSPC" sint) let enosys = F.(constant "ENOSYS" sint) let enotblk = F.(constant "ENOTBLK" sint) let enotconn = F.(constant "ENOTCONN" sint) let enotdir = F.(constant "ENOTDIR" sint) let enotempty = F.(constant "ENOTEMPTY" sint) let enotrecoverable = F.(constant "ENOTRECOVERABLE" sint) let enotsock = F.(constant "ENOTSOCK" sint) let enotsup = F.(constant "ENOTSUP" sint) let enotty = F.(constant "ENOTTY" sint) let enxio = F.(constant "ENXIO" sint) let eopnotsupp = F.(constant "EOPNOTSUPP" sint) let eoverflow = F.(constant "EOVERFLOW" sint) let eownerdead = F.(constant "EOWNERDEAD" sint) let eperm = F.(constant "EPERM" sint) let epfnosupport = F.(constant "EPFNOSUPPORT" sint) let epipe = F.(constant "EPIPE" sint) let eproto = F.(constant "EPROTO" sint) let eprotonosupport = F.(constant "EPROTONOSUPPORT" sint) let eprototype = F.(constant "EPROTOTYPE" sint) let erange = F.(constant "ERANGE" sint) let eremote = F.(constant "EREMOTE" sint) let erofs = F.(constant "EROFS" sint) let eshutdown = F.(constant "ESHUTDOWN" sint) let esocktnosupport = F.(constant "ESOCKTNOSUPPORT" sint) let espipe = F.(constant "ESPIPE" sint) let esrch = F.(constant "ESRCH" sint) let estale = F.(constant "ESTALE" sint) let etimedout = F.(constant "ETIMEDOUT" sint) let etoomanyrefs = F.(constant "ETOOMANYREFS" sint) let etxtbsy = F.(constant "ETXTBSY" sint) let eusers = F.(constant "EUSERS" sint) let ewouldblock = F.(constant "EWOULDBLOCK" sint) let exdev = F.(constant "EXDEV" sint) end ocaml-unix-errno-0.6.2/maps/000077500000000000000000000000001440362304500156575ustar00rootroot00000000000000ocaml-unix-errno-0.6.2/maps/linux_4_4_6000066400000000000000000000033561440362304500176430ustar00rootroot00000000000000E2BIG 7 EACCES 13 EADDRINUSE 98 EADDRNOTAVAIL 99 EAFNOSUPPORT 97 EAGAIN 11 EALREADY 114 EBADF 9 EBADMSG 74 EBUSY 16 ECANCELED 125 ECHILD 10 ECONNABORTED 103 ECONNREFUSED 111 ECONNRESET 104 EDEADLK 35 EDESTADDRREQ 89 EDOM 33 EDQUOT 122 EEXIST 17 EFAULT 14 EFBIG 27 EHOSTDOWN 112 EHOSTUNREACH 113 EIDRM 43 EILSEQ 84 EINPROGRESS 115 EINTR 4 EINVAL 22 EIO 5 EISCONN 106 EISDIR 21 ELOOP 40 EMFILE 24 EMLINK 31 EMSGSIZE 90 EMULTIHOP 72 ENAMETOOLONG 36 ENETDOWN 100 ENETRESET 102 ENETUNREACH 101 ENFILE 23 ENOBUFS 105 ENODEV 19 ENOENT 2 ENOEXEC 8 ENOLCK 37 ENOLINK 67 ENOMEM 12 ENOMSG 42 ENOPROTOOPT 92 ENOSPC 28 ENOSYS 38 ENOTBLK 15 ENOTCONN 107 ENOTDIR 20 ENOTEMPTY 39 ENOTRECOVERABLE 131 ENOTSOCK 88 ENOTSUP 95 ENOTTY 25 ENXIO 6 EOPNOTSUPP 95 EOVERFLOW 75 EOWNERDEAD 130 EPERM 1 EPFNOSUPPORT 96 EPIPE 32 EPROTO 71 EPROTONOSUPPORT 93 EPROTOTYPE 91 ERANGE 34 EREMOTE 66 EROFS 30 ESHUTDOWN 108 ESOCKTNOSUPPORT 94 ESPIPE 29 ESRCH 3 ESTALE 116 ETIMEDOUT 110 ETOOMANYREFS 109 ETXTBSY 26 EUSERS 87 EWOULDBLOCK 11 EXDEV 18 ECHRNG 44 EL2NSYNC 45 EL3HLT 46 EL3RST 47 ELNRNG 48 EUNATCH 49 ENOCSI 50 EL2HLT 51 EBADE 52 EBADR 53 EXFULL 54 ENOANO 55 EBADRQC 56 EBADSLT 57 EBFONT 59 ENONET 64 ENOPKG 65 EADV 68 ESRMNT 69 ECOMM 70 EDOTDOT 73 ENOTUNIQ 76 EBADFD 77 EREMCHG 78 ELIBACC 79 ELIBBAD 80 ELIBSCN 81 ELIBMAX 82 ELIBEXEC 83 ERESTART 85 ESTRPIPE 86 EUCLEAN 117 ENOTNAM 118 ENAVAIL 119 EISNAM 120 EREMOTEIO 121 ENOMEDIUM 123 EMEDIUMTYPE 124 ENOKEY 126 EKEYEXPIRED 127 EKEYREVOKED 128 EKEYREJECTED 129 ERFKILL 132 EHWPOISON 133 EPWROFF EDEVERR EBADEXEC EBADARCH ESHLIBVERS EBADMACHO ENOPOLICY EQFULL EDOOFUS ENOTCAPABLE ECAPMODE EPROCLIM EBADRPC ERPCMISMATCH EPROGUNAVAIL EPROGMISMATCH EPROCUNAVAIL EFTYPE EAUTH ENEEDAUTH ENOATTR ENOSTR 60 ENODATA 61 ETIME 62 ENOSR 63 ocaml-unix-errno-0.6.2/maps/osx_10_11_4000066400000000000000000000032371440362304500174440ustar00rootroot00000000000000E2BIG 7 EACCES 13 EADDRINUSE 48 EADDRNOTAVAIL 49 EAFNOSUPPORT 47 EAGAIN 35 EALREADY 37 EBADF 9 EBADMSG 94 EBUSY 16 ECANCELED 89 ECHILD 10 ECONNABORTED 53 ECONNREFUSED 61 ECONNRESET 54 EDEADLK 11 EDESTADDRREQ 39 EDOM 33 EDQUOT 69 EEXIST 17 EFAULT 14 EFBIG 27 EHOSTDOWN 64 EHOSTUNREACH 65 EIDRM 90 EILSEQ 92 EINPROGRESS 36 EINTR 4 EINVAL 22 EIO 5 EISCONN 56 EISDIR 21 ELOOP 62 EMFILE 24 EMLINK 31 EMSGSIZE 40 EMULTIHOP 95 ENAMETOOLONG 63 ENETDOWN 50 ENETRESET 52 ENETUNREACH 51 ENFILE 23 ENOBUFS 55 ENODEV 19 ENOENT 2 ENOEXEC 8 ENOLCK 77 ENOLINK 97 ENOMEM 12 ENOMSG 91 ENOPROTOOPT 42 ENOSPC 28 ENOSYS 78 ENOTBLK 15 ENOTCONN 57 ENOTDIR 20 ENOTEMPTY 66 ENOTRECOVERABLE 104 ENOTSOCK 38 ENOTSUP 45 ENOTTY 25 ENXIO 6 EOPNOTSUPP 102 EOVERFLOW 84 EOWNERDEAD 105 EPERM 1 EPFNOSUPPORT 46 EPIPE 32 EPROTO 100 EPROTONOSUPPORT 43 EPROTOTYPE 41 ERANGE 34 EREMOTE 71 EROFS 30 ESHUTDOWN 58 ESOCKTNOSUPPORT 44 ESPIPE 29 ESRCH 3 ESTALE 70 ETIMEDOUT 60 ETOOMANYREFS 59 ETXTBSY 26 EUSERS 68 EWOULDBLOCK 35 EXDEV 18 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 82 EDEVERR 83 EBADEXEC 85 EBADARCH 86 ESHLIBVERS 87 EBADMACHO 88 ENOPOLICY 103 EQFULL 106 EDOOFUS ENOTCAPABLE ECAPMODE EPROCLIM 67 EBADRPC 72 ERPCMISMATCH 73 EPROGUNAVAIL 74 EPROGMISMATCH 75 EPROCUNAVAIL 76 EFTYPE 79 EAUTH 80 ENEEDAUTH 81 ENOATTR 93 ENOSTR 99 ENODATA 96 ETIME 101 ENOSR 98 ocaml-unix-errno-0.6.2/src/000077500000000000000000000000001440362304500155065ustar00rootroot00000000000000ocaml-unix-errno-0.6.2/src/dune000066400000000000000000000003361440362304500163660ustar00rootroot00000000000000(executable (name errno_srcgen) (modules errno_srcgen) (libraries integers unix-errno) ) (executable (name errno_map) (public_name errno-map) (modules errno_map) (libraries unix-errno unix-errno.unix) ) ocaml-unix-errno-0.6.2/src/errno_map.ml000066400000000000000000000015501440362304500200230ustar00rootroot00000000000000(* * Copyright (c) 2015 David Sheets * * 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. * *) Printf.printf "%s" Errno.(string_of_defns (Host.to_defns Errno_unix.host)) ocaml-unix-errno-0.6.2/src/errno_srcgen.ml000066400000000000000000000030251440362304500205260ustar00rootroot00000000000000(* * Copyright (c) 2015 David Sheets * * 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. * *) let buf = Buffer.create 1024 let () = try while true do let line = input_line stdin in Buffer.add_string buf line; Buffer.add_char buf '\n'; done with End_of_file -> () let defns = Errno.defns_of_string (Buffer.contents buf) let () = print_endline "(* Generated by errno-srcgen *)\n" let () = print_endline "let defns = Errno.({" open Printf let field_of_errno errno = String.lowercase_ascii (Errno.to_string errno) let () = Errno.iter_defns defns (fun i errno -> printf " %s = Some (Signed.SInt.of_int64 %LdL);\n" (field_of_errno errno) (Signed.SInt.to_int64 i)) (fun errno -> printf " %s = None;\n" (field_of_errno errno)) let () = print_endline "})\n" let () = print_endline "let host = Errno.Host.of_defns defns" ocaml-unix-errno-0.6.2/unix-errno.opam000066400000000000000000000024011440362304500177000ustar00rootroot00000000000000opam-version: "2.0" synopsis: "Unix errno types, maps, and support" description: """\ unix-errno can be used with or without ctypes and OCaml's Unix module. Without ctypes and Unix, the basic types and functions are provided as well as Errno_host containing errno maps for popular operating systems. The errno-srcgen tool for generating OCaml source representing Errno.Host.t values will also be built. With ctypes and Unix, you'll also receive the errno-map tool for outputting the current host's errno map and the Errno_unix module containing an errno global variable checking function and Unix.error type converters.""" maintainer: "Xapi Project" authors: "David Sheets " license: "ISC" tags: ["errno" "errno.h" "errors" "unix" "syscall"] homepage: "https://github.com/xapi-project/ocaml-unix-errno" bug-reports: "https://github.com/xapi-project/ocaml-unix-errno/issues" depends: [ "ocaml" {>= "4.01.0"} "dune" {>= "2.0"} "alcotest" {with-test} "base-bytes" "result" "ctypes" ] depopts: ["base-unix"] conflicts: [ "ctypes" {< "0.7.0"} ] build: [ ["dune" "subst"] {dev} ["dune" "build" "-p" name "-j" jobs] ["dune" "build" "-p" name "-j" jobs "@runtest"] {with-test} ] dev-repo: "git+https://github.com/xapi-project/ocaml-unix-errno.git" ocaml-unix-errno-0.6.2/unix/000077500000000000000000000000001440362304500157025ustar00rootroot00000000000000ocaml-unix-errno-0.6.2/unix/dune000066400000000000000000000005521440362304500165620ustar00rootroot00000000000000(rule (action (copy ../lib_gen/unix_errno_stubs.c unix_errno_stubs.c))) (library (name unix_errno) (public_name unix-errno.unix) (wrapped false) (foreign_stubs (language c) (names unix_errno_util unix_errno_stubs)) (libraries ctypes ctypes.stubs errno integers unix errno_bindings errno_types errno_types_detected) ) ocaml-unix-errno-0.6.2/unix/errno_unix.ml000066400000000000000000000402241440362304500204260ustar00rootroot00000000000000(* * Copyright (c) 2014-2015 David Sheets * * 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. * *) module Type = Unix_errno_types.C(Unix_errno_types_detected) module C = Unix_errno_bindings.C(Unix_errno_generated) let host = let option i = Some i in let platform i = Signed.SInt.(if i = minus_one then None else Some i) in let defns = Errno.(Type.({ e2big = option e2big; eacces = option eacces; eaddrinuse = option eaddrinuse; eaddrnotavail = option eaddrnotavail; eafnosupport = option eafnosupport; eagain = option eagain; ealready = option ealready; ebadf = option ebadf; ebadmsg = option ebadmsg; ebusy = option ebusy; ecanceled = option ecanceled; echild = option echild; econnaborted = option econnaborted; econnrefused = option econnrefused; econnreset = option econnreset; edeadlk = option edeadlk; edestaddrreq = option edestaddrreq; edom = option edom; edquot = option edquot; eexist = option eexist; efault = option efault; efbig = option efbig; ehostdown = option ehostdown; ehostunreach = option ehostunreach; eidrm = option eidrm; eilseq = option eilseq; einprogress = option einprogress; eintr = option eintr; einval = option einval; eio = option eio; eisconn = option eisconn; eisdir = option eisdir; eloop = option eloop; emfile = option emfile; emlink = option emlink; emsgsize = option emsgsize; emultihop = option emultihop; enametoolong = option enametoolong; enetdown = option enetdown; enetreset = option enetreset; enetunreach = option enetunreach; enfile = option enfile; enobufs = option enobufs; enodev = option enodev; enoent = option enoent; enoexec = option enoexec; enolck = option enolck; enolink = option enolink; enomem = option enomem; enomsg = option enomsg; enoprotoopt = option enoprotoopt; enospc = option enospc; enosys = option enosys; enotblk = option enotblk; enotconn = option enotconn; enotdir = option enotdir; enotempty = option enotempty; enotrecoverable = option enotrecoverable; enotsock = option enotsock; enotsup = option enotsup; enotty = option enotty; enxio = option enxio; eopnotsupp = option eopnotsupp; eoverflow = option eoverflow; eownerdead = option eownerdead; eperm = option eperm; epfnosupport = option epfnosupport; epipe = option epipe; eproto = option eproto; eprotonosupport = option eprotonosupport; eprototype = option eprototype; erange = option erange; eremote = option eremote; erofs = option erofs; eshutdown = option eshutdown; esocktnosupport = option esocktnosupport; espipe = option espipe; esrch = option esrch; estale = option estale; etimedout = option etimedout; etoomanyrefs = option etoomanyrefs; etxtbsy = option etxtbsy; eusers = option eusers; ewouldblock = option ewouldblock; exdev = option exdev; echrng = platform (C.echrng ()); el2nsync = platform (C.el2nsync ()); el3hlt = platform (C.el3hlt ()); el3rst = platform (C.el3rst ()); elnrng = platform (C.elnrng ()); eunatch = platform (C.eunatch ()); enocsi = platform (C.enocsi ()); el2hlt = platform (C.el2hlt ()); ebade = platform (C.ebade ()); ebadr = platform (C.ebadr ()); exfull = platform (C.exfull ()); enoano = platform (C.enoano ()); ebadrqc = platform (C.ebadrqc ()); ebadslt = platform (C.ebadslt ()); ebfont = platform (C.ebfont ()); enonet = platform (C.enonet ()); enopkg = platform (C.enopkg ()); eadv = platform (C.eadv ()); esrmnt = platform (C.esrmnt ()); ecomm = platform (C.ecomm ()); edotdot = platform (C.edotdot ()); enotuniq = platform (C.enotuniq ()); ebadfd = platform (C.ebadfd ()); eremchg = platform (C.eremchg ()); elibacc = platform (C.elibacc ()); elibbad = platform (C.elibbad ()); elibscn = platform (C.elibscn ()); elibmax = platform (C.elibmax ()); elibexec = platform (C.elibexec ()); erestart = platform (C.erestart ()); estrpipe = platform (C.estrpipe ()); euclean = platform (C.euclean ()); enotnam = platform (C.enotnam ()); enavail = platform (C.enavail ()); eisnam = platform (C.eisnam ()); eremoteio = platform (C.eremoteio ()); enomedium = platform (C.enomedium ()); emediumtype = platform (C.emediumtype ()); enokey = platform (C.enokey ()); ekeyexpired = platform (C.ekeyexpired ()); ekeyrevoked = platform (C.ekeyrevoked ()); ekeyrejected = platform (C.ekeyrejected ()); erfkill = platform (C.erfkill ()); ehwpoison = platform (C.ehwpoison ()); epwroff = platform (C.epwroff ()); edeverr = platform (C.edeverr ()); ebadexec = platform (C.ebadexec ()); ebadarch = platform (C.ebadarch ()); eshlibvers = platform (C.eshlibvers ()); ebadmacho = platform (C.ebadmacho ()); enopolicy = platform (C.enopolicy ()); eqfull = platform (C.eqfull ()); edoofus = platform (C.edoofus ()); enotcapable = platform (C.enotcapable ()); ecapmode = platform (C.ecapmode ()); eproclim = platform (C.eproclim ()); ebadrpc = platform (C.ebadrpc ()); erpcmismatch = platform (C.erpcmismatch ()); eprogunavail = platform (C.eprogunavail ()); eprogmismatch = platform (C.eprogmismatch ()); eprocunavail = platform (C.eprocunavail ()); eftype = platform (C.eftype ()); eauth = platform (C.eauth ()); eneedauth = platform (C.eneedauth ()); enoattr = platform (C.enoattr ()); enostr = platform (C.enostr ()); enodata = platform (C.enodata ()); etime = platform (C.etime ()); enosr = platform (C.enosr ()); })) in Errno.Host.of_defns defns let optional_unknown ~host errno = match Errno.to_code ~host errno with | Some i -> Some (Unix.EUNKNOWNERR (Signed.SInt.to_int i)) | None -> None let to_unix ?(host=host) = Errno.(function | E2BIG -> Some Unix.E2BIG | EACCES -> Some Unix.EACCES | EADDRINUSE -> Some Unix.EADDRINUSE | EADDRNOTAVAIL -> Some Unix.EADDRNOTAVAIL | EAFNOSUPPORT -> Some Unix.EAFNOSUPPORT | EAGAIN -> Some Unix.EAGAIN | EALREADY -> Some Unix.EALREADY | EBADF -> Some Unix.EBADF | EBADMSG -> optional_unknown ~host EBADMSG | EBUSY -> Some Unix.EBUSY | ECANCELED -> optional_unknown ~host ECANCELED | ECHILD -> Some Unix.ECHILD | ECONNABORTED -> Some Unix.ECONNABORTED | ECONNREFUSED -> Some Unix.ECONNREFUSED | ECONNRESET -> Some Unix.ECONNRESET | EDEADLK -> Some Unix.EDEADLK | EDESTADDRREQ -> Some Unix.EDESTADDRREQ | EDOM -> Some Unix.EDOM | EDQUOT -> optional_unknown ~host EDQUOT | EEXIST -> Some Unix.EEXIST | EFAULT -> Some Unix.EFAULT | EFBIG -> Some Unix.EFBIG | EHOSTDOWN -> Some Unix.EHOSTDOWN | EHOSTUNREACH -> Some Unix.EHOSTUNREACH | EIDRM -> optional_unknown ~host EIDRM | EILSEQ -> optional_unknown ~host EILSEQ | EINPROGRESS -> Some Unix.EINPROGRESS | EINTR -> Some Unix.EINTR | EINVAL -> Some Unix.EINVAL | EIO -> Some Unix.EIO | EISCONN -> Some Unix.EISCONN | EISDIR -> Some Unix.EISDIR | ELOOP -> Some Unix.ELOOP | EMFILE -> Some Unix.EMFILE | EMLINK -> Some Unix.EMLINK | EMSGSIZE -> Some Unix.EMSGSIZE | EMULTIHOP -> optional_unknown ~host EMULTIHOP | ENAMETOOLONG -> Some Unix.ENAMETOOLONG | ENETDOWN -> Some Unix.ENETDOWN | ENETRESET -> Some Unix.ENETRESET | ENETUNREACH -> Some Unix.ENETUNREACH | ENFILE -> Some Unix.ENFILE | ENOBUFS -> Some Unix.ENOBUFS | ENODEV -> Some Unix.ENODEV | ENOENT -> Some Unix.ENOENT | ENOEXEC -> Some Unix.ENOEXEC | ENOLCK -> Some Unix.ENOLCK | ENOLINK -> optional_unknown ~host ENOLINK | ENOMEM -> Some Unix.ENOMEM | ENOMSG -> optional_unknown ~host ENOMSG | ENOPROTOOPT -> Some Unix.ENOPROTOOPT | ENOSPC -> Some Unix.ENOSPC | ENOSYS -> Some Unix.ENOSYS | ENOTBLK -> optional_unknown ~host ENOTBLK | ENOTCONN -> Some Unix.ENOTCONN | ENOTDIR -> Some Unix.ENOTDIR | ENOTEMPTY -> Some Unix.ENOTEMPTY | ENOTRECOVERABLE -> optional_unknown ~host ENOTRECOVERABLE | ENOTSOCK -> Some Unix.ENOTSOCK | ENOTSUP -> optional_unknown ~host ENOTSUP | ENOTTY -> Some Unix.ENOTTY | ENXIO -> Some Unix.ENXIO | EOPNOTSUPP -> Some Unix.EOPNOTSUPP | EOVERFLOW -> Some Unix.EOVERFLOW | EOWNERDEAD -> optional_unknown ~host EOWNERDEAD | EPERM -> Some Unix.EPERM | EPFNOSUPPORT -> Some Unix.EPFNOSUPPORT | EPIPE -> Some Unix.EPIPE | EPROTO -> optional_unknown ~host EPROTO | EPROTONOSUPPORT -> Some Unix.EPROTONOSUPPORT | EPROTOTYPE -> Some Unix.EPROTOTYPE | ERANGE -> Some Unix.ERANGE | EREMOTE -> optional_unknown ~host EREMOTE | EROFS -> Some Unix.EROFS | ESHUTDOWN -> Some Unix.ESHUTDOWN | ESOCKTNOSUPPORT -> Some Unix.ESOCKTNOSUPPORT | ESPIPE -> Some Unix.ESPIPE | ESRCH -> Some Unix.ESRCH | ESTALE -> optional_unknown ~host ESTALE | ETIMEDOUT -> Some Unix.ETIMEDOUT | ETOOMANYREFS -> Some Unix.ETOOMANYREFS | ETXTBSY -> optional_unknown ~host ETXTBSY | EUSERS -> optional_unknown ~host EUSERS | EWOULDBLOCK -> Some Unix.EWOULDBLOCK | EXDEV -> Some Unix.EXDEV | ECHRNG -> optional_unknown ~host ECHRNG | EL2NSYNC -> optional_unknown ~host EL2NSYNC | EL3HLT -> optional_unknown ~host EL3HLT | EL3RST -> optional_unknown ~host EL3RST | ELNRNG -> optional_unknown ~host ELNRNG | EUNATCH -> optional_unknown ~host EUNATCH | ENOCSI -> optional_unknown ~host ENOCSI | EL2HLT -> optional_unknown ~host EL2HLT | EBADE -> optional_unknown ~host EBADE | EBADR -> optional_unknown ~host EBADR | EXFULL -> optional_unknown ~host EXFULL | ENOANO -> optional_unknown ~host ENOANO | EBADRQC -> optional_unknown ~host EBADRQC | EBADSLT -> optional_unknown ~host EBADSLT | EBFONT -> optional_unknown ~host EBFONT | ENONET -> optional_unknown ~host ENONET | ENOPKG -> optional_unknown ~host ENOPKG | EADV -> optional_unknown ~host EADV | ESRMNT -> optional_unknown ~host ESRMNT | ECOMM -> optional_unknown ~host ECOMM | EDOTDOT -> optional_unknown ~host EDOTDOT | ENOTUNIQ -> optional_unknown ~host ENOTUNIQ | EBADFD -> optional_unknown ~host EBADFD | EREMCHG -> optional_unknown ~host EREMCHG | ELIBACC -> optional_unknown ~host ELIBACC | ELIBBAD -> optional_unknown ~host ELIBBAD | ELIBSCN -> optional_unknown ~host ELIBSCN | ELIBMAX -> optional_unknown ~host ELIBMAX | ELIBEXEC -> optional_unknown ~host ELIBEXEC | ERESTART -> optional_unknown ~host ERESTART | ESTRPIPE -> optional_unknown ~host ESTRPIPE | EUCLEAN -> optional_unknown ~host EUCLEAN | ENOTNAM -> optional_unknown ~host ENOTNAM | ENAVAIL -> optional_unknown ~host ENAVAIL | EISNAM -> optional_unknown ~host EISNAM | EREMOTEIO -> optional_unknown ~host EREMOTEIO | ENOMEDIUM -> optional_unknown ~host ENOMEDIUM | EMEDIUMTYPE -> optional_unknown ~host EMEDIUMTYPE | ENOKEY -> optional_unknown ~host ENOKEY | EKEYEXPIRED -> optional_unknown ~host EKEYEXPIRED | EKEYREVOKED -> optional_unknown ~host EKEYREVOKED | EKEYREJECTED -> optional_unknown ~host EKEYREJECTED | ERFKILL -> optional_unknown ~host ERFKILL | EHWPOISON -> optional_unknown ~host EHWPOISON | EPWROFF -> optional_unknown ~host EPWROFF | EDEVERR -> optional_unknown ~host EDEVERR | EBADEXEC -> optional_unknown ~host EBADEXEC | EBADARCH -> optional_unknown ~host EBADARCH | ESHLIBVERS -> optional_unknown ~host ESHLIBVERS | EBADMACHO -> optional_unknown ~host EBADMACHO | ENOPOLICY -> optional_unknown ~host ENOPOLICY | EQFULL -> optional_unknown ~host EQFULL | EDOOFUS -> optional_unknown ~host EDOOFUS | ENOTCAPABLE -> optional_unknown ~host ENOTCAPABLE | ECAPMODE -> optional_unknown ~host ECAPMODE | EPROCLIM -> optional_unknown ~host EPROCLIM | EBADRPC -> optional_unknown ~host EBADRPC | ERPCMISMATCH -> optional_unknown ~host ERPCMISMATCH | EPROGUNAVAIL -> optional_unknown ~host EPROGUNAVAIL | EPROGMISMATCH -> optional_unknown ~host EPROGMISMATCH | EPROCUNAVAIL -> optional_unknown ~host EPROCUNAVAIL | EFTYPE -> optional_unknown ~host EFTYPE | EAUTH -> optional_unknown ~host EAUTH | ENEEDAUTH -> optional_unknown ~host ENEEDAUTH | ENOATTR -> optional_unknown ~host ENOATTR | ENOSTR -> optional_unknown ~host ENOSTR | ENODATA -> optional_unknown ~host ENODATA | ETIME -> optional_unknown ~host ETIME | ENOSR -> optional_unknown ~host ENOSR | EUNKNOWNERR x -> Some (Unix.EUNKNOWNERR (Signed.SInt.to_int x)) ) let of_unix ?(host=host) = Unix.(function | E2BIG -> [Errno.E2BIG] | EACCES -> [Errno.EACCES] | EADDRINUSE -> [Errno.EADDRINUSE] | EADDRNOTAVAIL -> [Errno.EADDRNOTAVAIL] | EAFNOSUPPORT -> [Errno.EAFNOSUPPORT] | EAGAIN -> [Errno.EAGAIN] | EALREADY -> [Errno.EALREADY] | EBADF -> [Errno.EBADF] | EBUSY -> [Errno.EBUSY] | ECHILD -> [Errno.ECHILD] | ECONNABORTED -> [Errno.ECONNABORTED] | ECONNREFUSED -> [Errno.ECONNREFUSED] | ECONNRESET -> [Errno.ECONNRESET] | EDEADLK -> [Errno.EDEADLK] | EDESTADDRREQ -> [Errno.EDESTADDRREQ] | EDOM -> [Errno.EDOM] | EEXIST -> [Errno.EEXIST] | EFAULT -> [Errno.EFAULT] | EFBIG -> [Errno.EFBIG] | EHOSTDOWN -> [Errno.EHOSTDOWN] | EHOSTUNREACH -> [Errno.EHOSTUNREACH] | EINPROGRESS -> [Errno.EINPROGRESS] | EINTR -> [Errno.EINTR] | EINVAL -> [Errno.EINVAL] | EIO -> [Errno.EIO] | EISCONN -> [Errno.EISCONN] | EISDIR -> [Errno.EISDIR] | ELOOP -> [Errno.ELOOP] | EMFILE -> [Errno.EMFILE] | EMLINK -> [Errno.EMLINK] | EMSGSIZE -> [Errno.EMSGSIZE] | ENAMETOOLONG -> [Errno.ENAMETOOLONG] | ENETDOWN -> [Errno.ENETDOWN] | ENETRESET -> [Errno.ENETRESET] | ENETUNREACH -> [Errno.ENETUNREACH] | ENFILE -> [Errno.ENFILE] | ENOBUFS -> [Errno.ENOBUFS] | ENODEV -> [Errno.ENODEV] | ENOENT -> [Errno.ENOENT] | ENOEXEC -> [Errno.ENOEXEC] | ENOLCK -> [Errno.ENOLCK] | ENOMEM -> [Errno.ENOMEM] | ENOPROTOOPT -> [Errno.ENOPROTOOPT] | ENOSPC -> [Errno.ENOSPC] | ENOSYS -> [Errno.ENOSYS] | ENOTCONN -> [Errno.ENOTCONN] | ENOTDIR -> [Errno.ENOTDIR] | ENOTEMPTY -> [Errno.ENOTEMPTY] | ENOTSOCK -> [Errno.ENOTSOCK] | ENOTTY -> [Errno.ENOTTY] | ENXIO -> [Errno.ENXIO] | EOPNOTSUPP -> [Errno.EOPNOTSUPP] | EOVERFLOW -> [Errno.EOVERFLOW] | EPERM -> [Errno.EPERM] | EPFNOSUPPORT -> [Errno.EPFNOSUPPORT] | EPIPE -> [Errno.EPIPE] | EPROTONOSUPPORT -> [Errno.EPROTONOSUPPORT] | EPROTOTYPE -> [Errno.EPROTOTYPE] | ERANGE -> [Errno.ERANGE] | EROFS -> [Errno.EROFS] | ESHUTDOWN -> [Errno.ESHUTDOWN] | ESOCKTNOSUPPORT -> [Errno.ESOCKTNOSUPPORT] | ESPIPE -> [Errno.ESPIPE] | ESRCH -> [Errno.ESRCH] | ETIMEDOUT -> [Errno.ETIMEDOUT] | ETOOMANYREFS -> [Errno.ETOOMANYREFS] | EWOULDBLOCK -> [Errno.EWOULDBLOCK] | EXDEV -> [Errno.EXDEV] | EUNKNOWNERR x -> Errno.of_code ~host (Signed.SInt.of_int x) ) let get_errno = C.get_errno let reset_errno = C.reset_errno let raise_errno ?(call="") ?(label="") code = raise Errno.(Error { errno = of_code ~host code; call; label; }) let raise_on_errno ?(call="") ?(label="") fn = reset_errno (); match fn () with | Some r -> r | None -> raise_errno ~call ~label (get_errno ()) let to_errno_exn = function | Unix.Unix_error (err, call, label) -> let errno = of_unix err in Errno.Error { Errno.errno; call; label } | exn -> exn let with_errno_exn fn = try fn () with e -> raise (to_errno_exn e) let rec unix_error_of_errno = function | [] -> None | err::rest -> match to_unix err with | Some err -> Some err | None -> unix_error_of_errno rest let to_unix_exn = function | Errno.Error { Errno.errno; call; label } as e -> begin match unix_error_of_errno errno with | Some err -> Unix.Unix_error (err, call, label) | None -> e end | exn -> exn let with_unix_exn fn = try fn () with e -> raise (to_unix_exn e) ocaml-unix-errno-0.6.2/unix/errno_unix.mli000066400000000000000000000055101440362304500205760ustar00rootroot00000000000000(* * Copyright (c) 2014-2015 David Sheets * * 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. * *) val host : Errno.Host.t (** [host] is the bidirectional error number map for the host upon which this code is executing. *) val to_unix : ?host:Errno.Host.t -> Errno.t -> Unix.error option (** [to_unix ?host errno] is the {!Unix.error} corresponding to [errno] if one exists. If [host] is not supplied, {!host} will be used. *) val of_unix : ?host:Errno.Host.t -> Unix.error -> Errno.t list (** [of_unix ?host error] is the list of symbolic error numbers corresponding to the {!Unix.error}, [error]. If [host] is not supplied, {!host} will be used. *) val get_errno : unit -> Signed.sint (** [get_errno ()] returns the current value of the C [errno] thread-local variable. *) val reset_errno : unit -> unit (** [reset_errno ()] sets the current value of the C [errno] thread-local variable to 0. *) val raise_errno : ?call:string -> ?label:string -> Signed.sint -> 'a (** [raise_errno ?call ?label errno] raises {!Errno.Error} after converting [errno] to the appropriate variants via {!host}. [call] and [label] default to the empty string. *) val raise_on_errno : ?call:string -> ?label:string -> (unit -> 'a option) -> 'a (** [raise_on_errno ?call ?label fn] raises {!Errno.Error} using the code in the C [errno] variable if [fn] returns [None]. [call] and [label] default to the empty string. *) val to_errno_exn : exn -> exn (** [to_errno_exn exn] converts [exn] into an {!Errno.Error} if it is a {!Unix.Unix_error} and otherwise does not modify it. *) val with_errno_exn : (unit -> 'a) -> 'a (** [with_errno_exn fn] raises {!Errno.Error} instead of {!Unix.Unix_error} if [fn] raises the latter. *) val to_unix_exn : exn -> exn (** [to_unix_exn exn] converts [exn] into a {!Unix.Unix_error} if it is an {!Errno.Error} and an errno code exists on the present host. Otherwise, [to_unix_exn] does not modify [exn]. *) val with_unix_exn : (unit -> 'a) -> 'a (** [with_unix_exn fn] raises {!Unix.Unix_error} instead of {!Errno.Error} if [fn] raises the latter and an errno code exists on the present host. *) ocaml-unix-errno-0.6.2/unix/unix_errno_util.c000066400000000000000000000313211440362304500212730ustar00rootroot00000000000000#ifndef __FreeBSD__ # define _GNU_SOURCE # define _POSIX_C_SOURCE 200809L # define _DARWIN_C_SOURCE #endif #include #define FORCE_CHECK 0 #define LINUX defined(__linux__) #define APPLE defined(__APPLE__) #define FREEBSD defined(__FreeBSD__) void unix_errno_reset() { errno = 0; } int unix_errno_get() { return errno; } // NOT OS X or FreeBSD int unix_errno_echrng() { #define ECHRNG_UNAVAILABLE (APPLE || FREEBSD) #if !FORCE_CHECK && ECHRNG_UNAVAILABLE && !defined(ECHRNG) return -1; #else return ECHRNG; #endif } int unix_errno_el2nsync() { #define EL2NSYNC_UNAVAILABLE (APPLE || FREEBSD) #if !FORCE_CHECK && EL2NSYNC_UNAVAILABLE && !defined(EL2NSYNC) return -1; #else return EL2NSYNC; #endif } int unix_errno_el3hlt() { #define EL3HLT_UNAVAILABLE (APPLE || FREEBSD) #if !FORCE_CHECK && EL3HLT_UNAVAILABLE && !defined(EL3HLT) return -1; #else return EL3HLT; #endif } int unix_errno_el3rst() { #define EL3RST_UNAVAILABLE (APPLE || FREEBSD) #if !FORCE_CHECK && EL3RST_UNAVAILABLE && !defined(EL3RST) return -1; #else return EL3RST; #endif } int unix_errno_elnrng() { #define ELNRNG_UNAVAILABLE (APPLE || FREEBSD) #if !FORCE_CHECK && ELNRNG_UNAVAILABLE && !defined(ELNRNG) return -1; #else return ELNRNG; #endif } int unix_errno_eunatch() { #define EUNATCH_UNAVAILABLE (APPLE || FREEBSD) #if !FORCE_CHECK && EUNATCH_UNAVAILABLE && !defined(EUNATCH) return -1; #else return EUNATCH; #endif } int unix_errno_enocsi() { #define ENOCSI_UNAVAILABLE (APPLE || FREEBSD) #if !FORCE_CHECK && ENOCSI_UNAVAILABLE && !defined(ENOCSI) return -1; #else return ENOCSI; #endif } int unix_errno_el2hlt() { #define EL2HLT_UNAVAILABLE (APPLE || FREEBSD) #if !FORCE_CHECK && EL2HLT_UNAVAILABLE && !defined(EL2HLT) return -1; #else return EL2HLT; #endif } int unix_errno_ebade() { #define EBADE_UNAVAILABLE (APPLE || FREEBSD) #if !FORCE_CHECK && EBADE_UNAVAILABLE && !defined(EBADE) return -1; #else return EBADE; #endif } int unix_errno_ebadr() { #define EBADR_UNAVAILABLE (APPLE || FREEBSD) #if !FORCE_CHECK && EBADR_UNAVAILABLE && !defined(EBADR) return -1; #else return EBADR; #endif } int unix_errno_exfull() { #define EXFULL_UNAVAILABLE (APPLE || FREEBSD) #if !FORCE_CHECK && EXFULL_UNAVAILABLE && !defined(EXFULL) return -1; #else return EXFULL; #endif } int unix_errno_enoano() { #define ENOANO_UNAVAILABLE (APPLE || FREEBSD) #if !FORCE_CHECK && ENOANO_UNAVAILABLE && !defined(ENOANO) return -1; #else return ENOANO; #endif } int unix_errno_ebadrqc() { #define EBADRQC_UNAVAILABLE (APPLE || FREEBSD) #if !FORCE_CHECK && EBADRQC_UNAVAILABLE && !defined(EBADRQC) return -1; #else return EBADRQC; #endif } int unix_errno_ebadslt() { #define EBADSLT_UNAVAILABLE (APPLE || FREEBSD) #if !FORCE_CHECK && EBADSLT_UNAVAILABLE && !defined(EBADSLT) return -1; #else return EBADSLT; #endif } int unix_errno_ebfont() { #define EBFONT_UNAVAILABLE (APPLE || FREEBSD) #if !FORCE_CHECK && EBFONT_UNAVAILABLE && !defined(EBFONT) return -1; #else return EBFONT; #endif } int unix_errno_enonet() { #define ENONET_UNAVAILABLE (APPLE || FREEBSD) #if !FORCE_CHECK && ENONET_UNAVAILABLE && !defined(ENONET) return -1; #else return ENONET; #endif } int unix_errno_enopkg() { #define ENOPKG_UNAVAILABLE (APPLE || FREEBSD) #if !FORCE_CHECK && ENOPKG_UNAVAILABLE && !defined(ENOPKG) return -1; #else return ENOPKG; #endif } int unix_errno_eadv() { #define EADV_UNAVAILABLE (APPLE || FREEBSD) #if !FORCE_CHECK && EADV_UNAVAILABLE && !defined(EADV) return -1; #else return EADV; #endif } int unix_errno_esrmnt() { #define ESRMNT_UNAVAILABLE (APPLE || FREEBSD) #if !FORCE_CHECK && ESRMNT_UNAVAILABLE && !defined(ESRMNT) return -1; #else return ESRMNT; #endif } int unix_errno_ecomm() { #define ECOMM_UNAVAILABLE (APPLE || FREEBSD) #if !FORCE_CHECK && ECOMM_UNAVAILABLE && !defined(ECOMM) return -1; #else return ECOMM; #endif } int unix_errno_edotdot() { #define EDOTDOT_UNAVAILABLE (APPLE || FREEBSD) #if !FORCE_CHECK && EDOTDOT_UNAVAILABLE && !defined(EDOTDOT) return -1; #else return EDOTDOT; #endif } int unix_errno_enotuniq() { #define ENOTUNIQ_UNAVAILABLE (APPLE || FREEBSD) #if !FORCE_CHECK && ENOTUNIQ_UNAVAILABLE && !defined(ENOTUNIQ) return -1; #else return ENOTUNIQ; #endif } int unix_errno_ebadfd() { #define EBADFD_UNAVAILABLE (APPLE || FREEBSD) #if !FORCE_CHECK && EBADFD_UNAVAILABLE && !defined(EBADFD) return -1; #else return EBADFD; #endif } int unix_errno_eremchg() { #define EREMCHG_UNAVAILABLE (APPLE || FREEBSD) #if !FORCE_CHECK && EREMCHG_UNAVAILABLE && !defined(EREMCHG) return -1; #else return EREMCHG; #endif } int unix_errno_elibacc() { #define ELIBACC_UNAVAILABLE (APPLE || FREEBSD) #if !FORCE_CHECK && ELIBACC_UNAVAILABLE && !defined(ELIBACC) return -1; #else return ELIBACC; #endif } int unix_errno_elibbad() { #define ELIBBAD_UNAVAILABLE (APPLE || FREEBSD) #if !FORCE_CHECK && ELIBBAD_UNAVAILABLE && !defined(ELIBBAD) return -1; #else return ELIBBAD; #endif } int unix_errno_elibscn() { #define ELIBSCN_UNAVAILABLE (APPLE || FREEBSD) #if !FORCE_CHECK && ELIBSCN_UNAVAILABLE && !defined(ELIBSCN) return -1; #else return ELIBSCN; #endif } int unix_errno_elibmax() { #define ELIBMAX_UNAVAILABLE (APPLE || FREEBSD) #if !FORCE_CHECK && ELIBMAX_UNAVAILABLE && !defined(ELIBMAX) return -1; #else return ELIBMAX; #endif } int unix_errno_elibexec() { #define ELIBEXEC_UNAVAILABLE (APPLE || FREEBSD) #if !FORCE_CHECK && ELIBEXEC_UNAVAILABLE && !defined(ELIBEXEC) return -1; #else return ELIBEXEC; #endif } int unix_errno_erestart() { #define ERESTART_UNAVAILABLE (APPLE || FREEBSD) #if !FORCE_CHECK && ERESTART_UNAVAILABLE && !defined(ERESTART) return -1; #else return ERESTART; #endif } int unix_errno_estrpipe() { #define ESTRPIPE_UNAVAILABLE (APPLE || FREEBSD) #if !FORCE_CHECK && ESTRPIPE_UNAVAILABLE && !defined(ESTRPIPE) return -1; #else return ESTRPIPE; #endif } int unix_errno_euclean() { #define EUCLEAN_UNAVAILABLE (APPLE || FREEBSD) #if !FORCE_CHECK && EUCLEAN_UNAVAILABLE && !defined(EUCLEAN) return -1; #else return EUCLEAN; #endif } int unix_errno_enotnam() { #define ENOTNAM_UNAVAILABLE (APPLE || FREEBSD) #if !FORCE_CHECK && ENOTNAM_UNAVAILABLE && !defined(ENOTNAM) return -1; #else return ENOTNAM; #endif } int unix_errno_enavail() { #define ENAVAIL_UNAVAILABLE (APPLE || FREEBSD) #if !FORCE_CHECK && ENAVAIL_UNAVAILABLE && !defined(ENAVAIL) return -1; #else return ENAVAIL; #endif } int unix_errno_eisnam() { #define EISNAM_UNAVAILABLE (APPLE || FREEBSD) #if !FORCE_CHECK && EISNAM_UNAVAILABLE && !defined(EISNAM) return -1; #else return EISNAM; #endif } int unix_errno_eremoteio() { #define EREMOTEIO_UNAVAILABLE (APPLE || FREEBSD) #if !FORCE_CHECK && EREMOTEIO_UNAVAILABLE && !defined(EREMOTEIO) return -1; #else return EREMOTEIO; #endif } int unix_errno_enomedium() { #define ENOMEDIUM_UNAVAILABLE (APPLE || FREEBSD) #if !FORCE_CHECK && ENOMEDIUM_UNAVAILABLE && !defined(ENOMEDIUM) return -1; #else return ENOMEDIUM; #endif } int unix_errno_emediumtype() { #define EMEDIUMTYPE_UNAVAILABLE (APPLE || FREEBSD) #if !FORCE_CHECK && EMEDIUMTYPE_UNAVAILABLE && !defined(EMEDIUMTYPE) return -1; #else return EMEDIUMTYPE; #endif } int unix_errno_enokey() { #define ENOKEY_UNAVAILABLE (APPLE || FREEBSD) #if !FORCE_CHECK && ENOKEY_UNAVAILABLE && !defined(ENOKEY) return -1; #else return ENOKEY; #endif } int unix_errno_ekeyexpired() { #define EKEYEXPIRED_UNAVAILABLE (APPLE || FREEBSD) #if !FORCE_CHECK && EKEYEXPIRED_UNAVAILABLE && !defined(EKEYEXPIRED) return -1; #else return EKEYEXPIRED; #endif } int unix_errno_ekeyrevoked() { #define EKEYREVOKED_UNAVAILABLE (APPLE || FREEBSD) #if !FORCE_CHECK && EKEYREVOKED_UNAVAILABLE && !defined(EKEYREVOKED) return -1; #else return EKEYREVOKED; #endif } int unix_errno_ekeyrejected() { #define EKEYREJECTED_UNAVAILABLE (APPLE || FREEBSD) #if !FORCE_CHECK && EKEYREJECTED_UNAVAILABLE && !defined(EKEYREJECTED) return -1; #else return EKEYREJECTED; #endif } int unix_errno_erfkill() { #define ERFKILL_UNAVAILABLE (APPLE || FREEBSD) #if !FORCE_CHECK && ERFKILL_UNAVAILABLE && !defined(ERFKILL) return -1; #else return ERFKILL; #endif } int unix_errno_ehwpoison() { #define EHWPOISON_UNAVAILABLE (APPLE || FREEBSD) #if !FORCE_CHECK && EHWPOISON_UNAVAILABLE && !defined(EHWPOISON) return -1; #else return EHWPOISON; #endif } // NOT FreeBSD or Linux int unix_errno_epwroff() { #define EPWROFF_UNAVAILABLE (LINUX || FREEBSD) #if !FORCE_CHECK && EPWROFF_UNAVAILABLE && !defined(EPWROFF) return -1; #else return EPWROFF; #endif } int unix_errno_edeverr() { #define EDEVERR_UNAVAILABLE (LINUX || FREEBSD) #if !FORCE_CHECK && EDEVERR_UNAVAILABLE && !defined(EDEVERR) return -1; #else return EDEVERR; #endif } int unix_errno_ebadexec() { #define EBADEXEC_UNAVAILABLE (LINUX || FREEBSD) #if !FORCE_CHECK && EBADEXEC_UNAVAILABLE && !defined(EBADEXEC) return -1; #else return EBADEXEC; #endif } int unix_errno_ebadarch() { #define EBADARCH_UNAVAILABLE (LINUX || FREEBSD) #if !FORCE_CHECK && EBADARCH_UNAVAILABLE && !defined(EBADARCH) return -1; #else return EBADARCH; #endif } int unix_errno_eshlibvers() { #define ESHLIBVERS_UNAVAILABLE (LINUX || FREEBSD) #if !FORCE_CHECK && ESHLIBVERS_UNAVAILABLE && !defined(ESHLIBVERS) return -1; #else return ESHLIBVERS; #endif } int unix_errno_ebadmacho() { #define EBADMACHO_UNAVAILABLE (LINUX || FREEBSD) #if !FORCE_CHECK && EBADMACHO_UNAVAILABLE && !defined(EBADMACHO) return -1; #else return EBADMACHO; #endif } int unix_errno_enopolicy() { #define ENOPOLICY_UNAVAILABLE (LINUX || FREEBSD) #if !FORCE_CHECK && ENOPOLICY_UNAVAILABLE && !defined(ENOPOLICY) return -1; #else return ENOPOLICY; #endif } int unix_errno_eqfull() { #define EQFULL_UNAVAILABLE (LINUX || FREEBSD) #if !FORCE_CHECK && EQFULL_UNAVAILABLE && !defined(EQFULL) return -1; #else return EQFULL; #endif } // NOT OS X or Linux int unix_errno_edoofus() { #define EDOOFUS_UNAVAILABLE (LINUX || APPLE) #if !FORCE_CHECK && EDOOFUS_UNAVAILABLE && !defined(EDOOFUS) return -1; #else return EDOOFUS; #endif } int unix_errno_enotcapable() { #define ENOTCAPABLE_UNAVAILABLE (LINUX || APPLE) #if !FORCE_CHECK && ENOTCAPABLE_UNAVAILABLE && !defined(ENOTCAPABLE) return -1; #else return ENOTCAPABLE; #endif } int unix_errno_ecapmode() { #define ECAPMODE_UNAVAILABLE (LINUX || APPLE) #if !FORCE_CHECK && ECAPMODE_UNAVAILABLE && !defined(ECAPMODE) return -1; #else return ECAPMODE; #endif } // NOT Linux int unix_errno_eproclim() { #define EPROCLIM_UNAVAILABLE (LINUX) #if !FORCE_CHECK && EPROCLIM_UNAVAILABLE && !defined(EPROCLIM) return -1; #else return EPROCLIM; #endif } int unix_errno_ebadrpc() { #define EBADRPC_UNAVAILABLE (LINUX) #if !FORCE_CHECK && EBADRPC_UNAVAILABLE && !defined(EBADRPC) return -1; #else return EBADRPC; #endif } int unix_errno_erpcmismatch() { #define ERPCMISMATCH_UNAVAILABLE (LINUX) #if !FORCE_CHECK && ERPCMISMATCH_UNAVAILABLE && !defined(ERPCMISMATCH) return -1; #else return ERPCMISMATCH; #endif } int unix_errno_eprogunavail() { #define EPROGUNAVAIL_UNAVAILABLE (LINUX) #if !FORCE_CHECK && EPROGUNAVAIL_UNAVAILABLE && !defined(EPROGUNAVAIL) return -1; #else return EPROGUNAVAIL; #endif } int unix_errno_eprogmismatch() { #define EPROGMISMATCH_UNAVAILABLE (LINUX) #if !FORCE_CHECK && EPROGMISMATCH_UNAVAILABLE && !defined(EPROGMISMATCH) return -1; #else return EPROGMISMATCH; #endif } int unix_errno_eprocunavail() { #define EPROCUNAVAIL_UNAVAILABLE (LINUX) #if !FORCE_CHECK && EPROCUNAVAIL_UNAVAILABLE && !defined(EPROCUNAVAIL) return -1; #else return EPROCUNAVAIL; #endif } int unix_errno_eftype() { #define EFTYPE_UNAVAILABLE (LINUX) #if !FORCE_CHECK && EFTYPE_UNAVAILABLE && !defined(EFTYPE) return -1; #else return EFTYPE; #endif } int unix_errno_eauth() { #define EAUTH_UNAVAILABLE (LINUX) #if !FORCE_CHECK && EAUTH_UNAVAILABLE && !defined(EAUTH) return -1; #else return EAUTH; #endif } int unix_errno_eneedauth() { #define ENEEDAUTH_UNAVAILABLE (LINUX) #if !FORCE_CHECK && ENEEDAUTH_UNAVAILABLE && !defined(ENEEDAUTH) return -1; #else return ENEEDAUTH; #endif } int unix_errno_enoattr() { #define ENOATTR_UNAVAILABLE (LINUX) #if !FORCE_CHECK && ENOATTR_UNAVAILABLE && !defined(ENOATTR) return -1; #else return ENOATTR; #endif } // NOT FreeBSD int unix_errno_enostr() { #define ENOSTR_UNAVAILABLE (FREEBSD) #if !FORCE_CHECK && ENOSTR_UNAVAILABLE && !defined(ENOSTR) return -1; #else return ENOSTR; #endif } int unix_errno_enodata() { #define ENODATA_UNAVAILABLE (FREEBSD) #if !FORCE_CHECK && ENODATA_UNAVAILABLE && !defined(ENODATA) return -1; #else return ENODATA; #endif } int unix_errno_etime() { #define ETIME_UNAVAILABLE (FREEBSD) #if !FORCE_CHECK && ETIME_UNAVAILABLE && !defined(ETIME) return -1; #else return ETIME; #endif } int unix_errno_enosr() { #define ENOSR_UNAVAILABLE (FREEBSD) #if !FORCE_CHECK && ENOSR_UNAVAILABLE && !defined(ENOSR) return -1; #else return ENOSR; #endif } ocaml-unix-errno-0.6.2/unix/unix_errno_util.h000066400000000000000000000036271440362304500213100ustar00rootroot00000000000000void unix_errno_reset(); int unix_errno_get(); // linux int unix_errno_echrng(); int unix_errno_el2nsync(); int unix_errno_el3hlt(); int unix_errno_el3rst(); int unix_errno_elnrng(); int unix_errno_eunatch(); int unix_errno_enocsi(); int unix_errno_el2hlt(); int unix_errno_ebade(); int unix_errno_ebadr(); int unix_errno_exfull(); int unix_errno_enoano(); int unix_errno_ebadrqc(); int unix_errno_ebadslt(); int unix_errno_ebfont(); int unix_errno_enonet(); int unix_errno_enopkg(); int unix_errno_eadv(); int unix_errno_esrmnt(); int unix_errno_ecomm(); int unix_errno_edotdot(); int unix_errno_enotuniq(); int unix_errno_ebadfd(); int unix_errno_eremchg(); int unix_errno_elibacc(); int unix_errno_elibbad(); int unix_errno_elibscn(); int unix_errno_elibmax(); int unix_errno_elibexec(); int unix_errno_erestart(); int unix_errno_estrpipe(); int unix_errno_euclean(); int unix_errno_enotnam(); int unix_errno_enavail(); int unix_errno_eisnam(); int unix_errno_eremoteio(); int unix_errno_enomedium(); int unix_errno_emediumtype(); int unix_errno_enokey(); int unix_errno_ekeyexpired(); int unix_errno_ekeyrevoked(); int unix_errno_ekeyrejected(); int unix_errno_erfkill(); int unix_errno_ehwpoison(); // osx int unix_errno_epwroff(); int unix_errno_edeverr(); int unix_errno_ebadexec(); int unix_errno_ebadarch(); int unix_errno_eshlibvers(); int unix_errno_ebadmacho(); int unix_errno_enopolicy(); int unix_errno_eqfull(); // freebsd int unix_errno_edoofus(); int unix_errno_enotcapable(); int unix_errno_ecapmode(); // osx + freebsd int unix_errno_eproclim(); int unix_errno_ebadrpc(); int unix_errno_erpcmismatch(); int unix_errno_eprogunavail(); int unix_errno_eprogmismatch(); int unix_errno_eprocunavail(); int unix_errno_eftype(); int unix_errno_eauth(); int unix_errno_eneedauth(); int unix_errno_enoattr(); // osx + linux int unix_errno_enostr(); int unix_errno_enodata(); int unix_errno_etime(); int unix_errno_enosr(); ocaml-unix-errno-0.6.2/unix_test/000077500000000000000000000000001440362304500167415ustar00rootroot00000000000000ocaml-unix-errno-0.6.2/unix_test/dune000066400000000000000000000001071440362304500176150ustar00rootroot00000000000000(test (name test) (libraries alcotest unix-errno unix-errno.unix)) ocaml-unix-errno-0.6.2/unix_test/test.ml000066400000000000000000000025751440362304500202630ustar00rootroot00000000000000(* * Copyright (c) 2015 David Sheets * * 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. * *) module ErrnoMap = struct let roundtrip () = let defns = Errno.Host.to_defns Errno_unix.host in print_endline "after defns_of_host"; let s = Errno.string_of_defns defns in print_endline "after string_of_defns"; let rdefns = Errno.defns_of_string s in print_endline "after defns_of_string"; let rs = Errno.string_of_defns rdefns in print_endline "after string_of_defns2"; Alcotest.(check string) "roundtrip local defns" s rs let tests = [ "roundtrip", `Quick, roundtrip; ] end let tests = [ "errno-map", ErrnoMap.tests; ] ;; Alcotest.run "unix-errno" tests