mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
mllib: Add unsetenv(3) binding to Unix_utils.
Missing from the OCaml stdlib. This implementation is the same as the one in Jane St's Core, except we don't bother to throw an exception on error.
This commit is contained in:
@@ -45,6 +45,7 @@ extern void unix_error (int errcode, char * cmdname, value arg) Noreturn;
|
||||
extern value guestfs_int_mllib_dev_t_makedev (value majv, value minv);
|
||||
extern value guestfs_int_mllib_dev_t_major (value devv);
|
||||
extern value guestfs_int_mllib_dev_t_minor (value devv);
|
||||
extern value guestfs_int_mllib_unsetenv (value strv);
|
||||
extern int guestfs_int_mllib_exit (value rv) __attribute__((noreturn));
|
||||
extern value guestfs_int_mllib_fnmatch (value patternv, value strv, value flagsv);
|
||||
extern value guestfs_int_mllib_sync (value unitv);
|
||||
@@ -73,6 +74,14 @@ guestfs_int_mllib_dev_t_minor (value devv)
|
||||
return Val_int (minor (Int_val (devv)));
|
||||
}
|
||||
|
||||
/* NB: This is a "noalloc" call. */
|
||||
value
|
||||
guestfs_int_mllib_unsetenv (value strv)
|
||||
{
|
||||
unsetenv (String_val (strv));
|
||||
return Val_unit;
|
||||
}
|
||||
|
||||
/* NB: This is a "noalloc" call. */
|
||||
int
|
||||
guestfs_int_mllib_exit (value rv)
|
||||
|
||||
@@ -22,6 +22,10 @@ module Dev_t = struct
|
||||
external minor : int -> int = "guestfs_int_mllib_dev_t_minor" "noalloc"
|
||||
end
|
||||
|
||||
module Env = struct
|
||||
external unsetenv : string -> unit = "guestfs_int_mllib_unsetenv" "noalloc"
|
||||
end
|
||||
|
||||
module Exit = struct
|
||||
external _exit : int -> 'a = "guestfs_int_mllib_exit" "noalloc"
|
||||
end
|
||||
|
||||
@@ -32,6 +32,11 @@ module Dev_t : sig
|
||||
(** minor(3) *)
|
||||
end
|
||||
|
||||
module Env : sig
|
||||
val unsetenv : string -> unit
|
||||
(** Unset named environment variable, see unsetenv(3). *)
|
||||
end
|
||||
|
||||
module Exit : sig
|
||||
val _exit : int -> 'a
|
||||
(** Call _exit directly, ie. do not run OCaml atexit handlers. *)
|
||||
|
||||
Reference in New Issue
Block a user