package posix-errno

  1. Overview
  2. Docs
POSIX errno handling and Unix error conversion

Install

dune-project
 Dependency

Authors

Maintainers

Sources

v4.0.1.tar.gz
md5=464f431a8517dba4295286dd61f3ff2c
sha512=36d4c64987848fc06a4296c2141d250d95db0092b2d9d4d95f301f5eaada9a3df8ae9703fc8f2407596f6fb474a69863abd5e3d2c08636eb2c0dd67477d316e8

doc/src/posix-errno.stubs/posix_errno_stubs.ml.html

Source file posix_errno_stubs.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
open Ctypes

module Def (F : Cstubs.FOREIGN) = struct
  open F

  (* Errno access functions *)
  let posix_errno_get_errno =
    foreign "posix_errno_get_errno" (void @-> returning int)

  let posix_errno_set_errno =
    foreign "posix_errno_set_errno" (int @-> returning void)

  (* strerror function - returns OCaml string (cross-platform, not thread-safe) *)
  let strerror = foreign "strerror" (int @-> returning string)

  (* strerror_r function - POSIX version returns int (0 on success) *)
  (* Raises Invalid_argument on Windows *)
  let strerror_r =
    foreign "posix_errno_strerror_r" (int @-> ptr char @-> int @-> returning int)

  (* strlen function to get string length *)
  let strlen = foreign "strlen" (ptr char @-> returning int)
end