diff --git a/generator/ocaml.ml b/generator/ocaml.ml index d2a4690d7..05c7456a2 100644 --- a/generator/ocaml.ml +++ b/generator/ocaml.ml @@ -132,6 +132,7 @@ val last_errno : t -> int which you can use to test the return value of {!Guestfs.last_errno}. *) module Errno : sig + val errno_EINVAL : int val errno_ENOTSUP : int val errno_EPERM : int val errno_ESRCH : int @@ -286,6 +287,8 @@ external event_to_string : event list -> string external last_errno : t -> int = \"ocaml_guestfs_last_errno\" module Errno = struct + external einval : unit -> int = \"ocaml_guestfs_get_EINVAL\" \"noalloc\" + let errno_EINVAL = einval () external enotsup : unit -> int = \"ocaml_guestfs_get_ENOTSUP\" \"noalloc\" let errno_ENOTSUP = enotsup () external eperm : unit -> int = \"ocaml_guestfs_get_EPERM\" \"noalloc\" diff --git a/ocaml/guestfs-c.c b/ocaml/guestfs-c.c index f1a941c09..9603f041a 100644 --- a/ocaml/guestfs-c.c +++ b/ocaml/guestfs-c.c @@ -63,6 +63,7 @@ value ocaml_guestfs_set_event_callback (value gv, value closure, value events); value ocaml_guestfs_delete_event_callback (value gv, value eh); value ocaml_guestfs_event_to_string (value events); value ocaml_guestfs_last_errno (value gv); +value ocaml_guestfs_get_EINVAL (value unitv); value ocaml_guestfs_get_ENOTSUP (value unitv); value ocaml_guestfs_get_EPERM (value unitv); value ocaml_guestfs_get_ESRCH (value unitv); @@ -442,6 +443,13 @@ ocaml_guestfs_last_errno (value gv) CAMLreturn (rv); } +/* NB: "noalloc" function. */ +value +ocaml_guestfs_get_EINVAL (value unitv) +{ + return Val_int (EINVAL); +} + /* NB: "noalloc" function. */ value ocaml_guestfs_get_ENOTSUP (value unitv)