ocaml: Add handling for errno EINVAL.

This commit is contained in:
Richard W.M. Jones
2015-06-18 09:52:16 +01:00
parent b467afb621
commit 94ea635fb1
2 changed files with 11 additions and 0 deletions

View File

@@ -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\"

View File

@@ -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)