search for: with_fork

Displaying 8 results from an estimated 8 matches for "with_fork".

2017 Nov 05
3
[PATCH 1/2] common/mlstdutils: Add with_open_in and with_open_out functions.
...lue chan pod2text_memo) let pod2text_memo_updated () = if not (!pod2text_memo_atexit) then ( at_exit pod2text_memo_save; diff --git a/v2v/changeuid.ml b/v2v/changeuid.ml index 49290c298..f4c5c90d1 100644 --- a/v2v/changeuid.ml +++ b/v2v/changeuid.ml @@ -66,12 +66,7 @@ let rmdir t path = with_fork t (sprintf "rmdir: %s" path) (fun () -> rmdir path) let output t path f = - with_fork t path ( - fun () -> - let chan = open_out path in - f chan; - close_out chan - ) + with_fork t path (fun () -> with_open_out path f) let make_file t path content =...
2016 Aug 03
3
[PATCH] mllib: move _exit from v2v as Exit module
...6fb..53c0bc3 100644 --- a/v2v/changeuid.ml +++ b/v2v/changeuid.ml @@ -33,9 +33,6 @@ type t = { let create ?uid ?gid () = { uid = uid; gid = gid } -(* Call _exit directly, ie. do not run OCaml atexit handlers. *) -external _exit : int -> unit = "v2v_exit" "noalloc" - let with_fork { uid = uid; gid = gid } name f = let pid = fork () in @@ -46,9 +43,9 @@ let with_fork { uid = uid; gid = gid } name f = (try f () with exn -> eprintf "%s: changeuid: %s: %s\n%!" prog name (Printexc.to_string exn); - _exit 1 + Exit._exit 1 ); -...
2015 Nov 10
7
[PATCH 0/4]: mllib: Add 'may' function, and refactoring.
The 'may' function is a higher-order function (HOF) that replaces: match x with | None -> () | Some x -> f x with: may f x The idea comes from lablgtk (OCaml Gtk bindings) where it is widely used. If this change is clearer than previous code, then this could be used in many more places. However I previously steered clear from using HOFs like this because they can be
2017 Oct 08
0
[PATCH v2 3/4] common/mlstdutils: Introduce Option submodule.
...printf "\n\n"; + printf "%s\n\n" notes + ) op.pod_notes; ) !all_operations let dump_pod_options () = diff --git a/v2v/changeuid.ml b/v2v/changeuid.ml index d02f2f5cf..49290c298 100644 --- a/v2v/changeuid.ml +++ b/v2v/changeuid.ml @@ -40,8 +40,8 @@ let with_fork { uid; gid } name f = if pid = 0 then ( (* Child. *) - may setgid gid; - may setuid uid; + Option.may setgid gid; + Option.may setuid uid; (try f () with exn -> eprintf "%s: changeuid: %s: %s\n%!" prog name (Printexc.to_string exn); diff --git a...
2017 Oct 04
0
[PATCH 2/9] ocaml: Replace pattern matching { field = field } with { field }.
...ame; fn g root side_effects | { perform_on_devices = None } -> () diff --git a/v2v/changeuid.ml b/v2v/changeuid.ml index 24fd91b6e..d02f2f5cf 100644 --- a/v2v/changeuid.ml +++ b/v2v/changeuid.ml @@ -35,7 +35,7 @@ type t = { let create ?uid ?gid () = { uid = uid; gid = gid } -let with_fork { uid = uid; gid = gid } name f = +let with_fork { uid; gid } name f = let pid = fork () in if pid = 0 then ( diff --git a/v2v/input_ova.ml b/v2v/input_ova.ml index 0be38ec27..5f313b6fb 100644 --- a/v2v/input_ova.ml +++ b/v2v/input_ova.ml @@ -255,7 +255,7 @@ object | Some name ->...
2017 Oct 04
11
[PATCH 0/9] build: Require OCaml >= 4.02.
Per my previous email: https://www.redhat.com/archives/libguestfs/2017-September/msg00203.html I'd like to talk about requiring a more modern version of the OCaml compiler. These commits show some of the code changes which would be possible with OCaml >= 3.12 [which it turns out we already require by accident] and also with OCaml >= 4.02. The latter is my favoured option. Rich.
2017 Oct 08
4
[PATCH 0/3] common/mlstdutils: Add Std_utils List and Option modules.
In Std_utils we already extend Char and String. These commits take it a little further by extending List and adding a new Option submodule. All basically simple refactoring. Rich.
2017 Oct 08
7
[[PATCH v2 0/4] common/mlstdutils: Add Std_utils List and Option modules.
This time including the first commit ...