search for: ksprintf

Displaying 20 results from an estimated 52 matches for "ksprintf".

Did you mean: sprintf
2019 Mar 25
1
Re: [PATCH 2/4] common/mltools: make sure machine readable output is flushed
...s_utils.ml b/common/mltools/tools_utils.ml > index 5a35708cd..ade4cb37f 100644 > --- a/common/mltools/tools_utils.ml > +++ b/common/mltools/tools_utils.ml > @@ -59,7 +59,11 @@ let machine_readable () = > | None -> None > | Some chan -> > let pr fs = > - ksprintf (output_string chan) fs > + let out s = > + output_string chan s; > + flush chan > + in > + ksprintf out fs > in > Some { pr } I was looking to see if any of the existing calls to machine_readable are using %! (a format directive which ca...
2019 Mar 28
8
[PATCH v2 0/4] OCaml tools: output messages as JSON machine
Enhance the output in machine parseable mode, by outputting all the messages of OCaml tools as JSON to the machine parseable stream. Related, although not strictly needed for this (and thus can be split if requested), is the addition of the fd format for the machine readable stream. Changes from v1: - use Obj.magic to convert int -> Unix.file_descr - add tests Pino Toscano (4):
2018 Mar 16
0
[PATCH v2 4/5] tools: Add machine_output function.
...19 insertions(+) diff --git a/common/mltools/tools_utils.ml b/common/mltools/tools_utils.ml index 09f1bb544..f7abd5c3e 100644 --- a/common/mltools/tools_utils.ml +++ b/common/mltools/tools_utils.ml @@ -102,6 +102,14 @@ let debug fs = let display str = if verbose () then prerr_endline str in ksprintf display fs +let machine_output fs = + let display str = + print_endline "__MACHINEBEGIN__"; + print_endline str; + print_endline "__MACHINEEND__" + in + ksprintf display fs + (* Common function to create a new Guestfs handle, with common options * (e.g. debug, t...
2019 Mar 22
0
[PATCH 2/4] common/mltools: make sure machine readable output is flushed
...ion(-) diff --git a/common/mltools/tools_utils.ml b/common/mltools/tools_utils.ml index 5a35708cd..ade4cb37f 100644 --- a/common/mltools/tools_utils.ml +++ b/common/mltools/tools_utils.ml @@ -59,7 +59,11 @@ let machine_readable () = | None -> None | Some chan -> let pr fs = - ksprintf (output_string chan) fs + let out s = + output_string chan s; + flush chan + in + ksprintf out fs in Some { pr } -- 2.20.1
2019 Mar 28
0
[PATCH v2 1/4] common/mltools: move the code for machine readable up
...e_output with + | NoOutput -> None + | Channel chan -> Some chan + | File f -> Some (open_out f) in + machine_readable_channel := chan + ); + !machine_readable_channel + in + match chan with + | None -> None + | Some chan -> + let pr fs = + ksprintf (output_string chan) fs + in + Some { pr } + (* ANSI terminal colours. *) let istty chan = Unix.isatty (Unix.descr_of_out_channel chan) @@ -236,36 +266,6 @@ let human_size i = ) ) -type machine_readable_fn = { - pr : 'a. ('a, unit, string, unit) format4 -> 'a; -...
2019 Mar 28
0
[PATCH v2 2/4] common/mltools: make sure machine readable output is flushed
...ion(-) diff --git a/common/mltools/tools_utils.ml b/common/mltools/tools_utils.ml index 5a35708cd..ade4cb37f 100644 --- a/common/mltools/tools_utils.ml +++ b/common/mltools/tools_utils.ml @@ -59,7 +59,11 @@ let machine_readable () = | None -> None | Some chan -> let pr fs = - ksprintf (output_string chan) fs + let out s = + output_string chan s; + flush chan + in + ksprintf out fs in Some { pr } -- 2.20.1
2018 Aug 22
1
Re: [PATCH 2/2] OCaml tools: add output selection for --machine-readable
...achine-readable *) | Some pr -> pr "stuff\n"; exit 0 Of course the devil will be in the details as to whether this actually works with our existing callers. > + fprintf (get_machine_readable_channel ()) fs I'm surprised this works and you didn't need to use ksprintf. > (* No elements and machine-readable mode? Print some facts. *) > if elements = [] && machine_readable () then ( > - printf "virt-dib\n"; > + machine_readable_printf "virt-dib\n"; > let formats_list = Output_format.list_formats () in &...
2019 Mar 22
8
[PATCH 0/4] OCaml tools: output messages as JSON machine
Enhance the output in machine parseable mode, by outputting all the messages of OCaml tools as JSON to the machine parseable stream. Related, although not strictly needed for this (and thus can be split if requested), is the addition of the fd format for the machine readable stream. Pino Toscano (4): common/mltools: move the code for machine readable up common/mltools: make sure machine
2014 Mar 17
4
[PATCH 1/4] ocaml: Add Guestfs.Errno submodule exposing useful raw errno numbers.
For use when calling G.last_errno. --- generator/ocaml.ml | 15 +++++++++++++++ ocaml/guestfs-c.c | 8 ++++++++ 2 files changed, 23 insertions(+) diff --git a/generator/ocaml.ml b/generator/ocaml.ml index 78cff89..29a9eb6 100644 --- a/generator/ocaml.ml +++ b/generator/ocaml.ml @@ -121,10 +121,20 @@ val last_errno : t -> int (or [0] if there was no errno). Note that the returned
2012 Sep 21
3
[PATCH] sysprep: handle distro specific sysv scripts
...-x \"$f\" + then + echo '=== Running' $f '===' >>$logfile + $f >>$logfile 2>&1 + rm -f $f + fi + done +fi " firstboot_dir let firstboot_service = sprintf "\ @@ -56,7 +77,7 @@ WantedBy=default.target let failed fs = ksprintf (fun msg -> failwith (s_"firstboot: failed: " ^ msg)) fs -let rec install_service g root = +let rec install_service g distro = g#mkdir_p firstboot_dir; g#mkdir_p (sprintf "%s/scripts" firstboot_dir); g#write (sprintf "%s/firstboot.sh" firstboot_dir) first...
2020 Oct 03
0
[PATCH nbdkit v2 3/3] ocaml: Add bindings for nbdkit_peer_{pid, uid, gid}.
...unit -> int diff --git a/plugins/ocaml/NBDKit.ml b/plugins/ocaml/NBDKit.ml index 739210fa..76fa3a77 100644 --- a/plugins/ocaml/NBDKit.ml +++ b/plugins/ocaml/NBDKit.ml @@ -257,3 +257,7 @@ external _debug : string -> unit = "ocaml_nbdkit_debug" "noalloc" let debug fs = ksprintf _debug fs + +external peer_pid : unit -> int = "ocaml_nbdkit_peer_pid" +external peer_uid : unit -> int = "ocaml_nbdkit_peer_uid" +external peer_gid : unit -> int = "ocaml_nbdkit_peer_gid" diff --git a/plugins/ocaml/bindings.c b/plugins/ocaml/bindings.c index...
2016 Dec 09
0
Re: [PATCH] generator: Share Common_utils code.
...rator/utils.ml > +++ b/generator/utils.ml > @@ -23,6 +23,8 @@ > * makes this a bit harder than it should be. > *) > > +open Common_utils > + > open Unix > open Printf > > @@ -119,85 +121,6 @@ let rstructs_used_by functions = > > let failwithf fs = ksprintf failwith fs > > -let unique = let i = ref 0 in fun () -> incr i; !i This seems to be used only in generator, so I'd leave it here for now (reduces the changes in this patch, and it can always be moved later on when needed). > -let replace_char s c1 c2 = > - let b2 = Bytes.of...
2018 Mar 16
7
[PATCH v2 0/5] Add --print-target with machine-readable version.
This adds --print-target. In addition, v2 provides a machine-readable version (in JSON format). All of the record -> JSON boilerplate in this patch could be eliminated if we moved the baseline to OCaml 4.02. Rich.
2019 Jan 11
3
[PATCH 1/3] mlstdutils: add a very simple test for Std_utils.which
--- common/mlstdutils/std_utils_tests.ml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/common/mlstdutils/std_utils_tests.ml b/common/mlstdutils/std_utils_tests.ml index 81f512cbf..f7b0247a4 100644 --- a/common/mlstdutils/std_utils_tests.ml +++ b/common/mlstdutils/std_utils_tests.ml @@ -29,6 +29,11 @@ let assert_equal_int = assert_equal ~printer:(fun x -> string_of_int x)
2019 Jul 27
3
[PATCH libnbd] lib: Use symbol versions.
This patch adds support for symbol versions. It is based on what libvirt does. The generated syms file looks like: LIBNBD_1.0 { global: nbd_...; nbd_...; local: *; }; In a future stable 1.2 release, new symbols would go into a new section which would look like this: LIBNBD_1.2 { global: nbd_new_symbol; nbd_another_new_symbol; local: *; } LIBNBD_1.0; In my testing the
2016 Dec 08
3
[PATCH 0/2] mllib: Add quote function to Common_utils module.
Doing this allows us to remove the Customize_utils module completely, since it becomes empty. Rich.
2012 Aug 16
5
[PATCH 0/4] Add customization capabilities to virt-sysprep
In the TODO file there's a discussion of perhaps writing a new 'virt-customize' tool. I think it's probably better (or at any rate, easier) to just add this functionality into virt-sysprep. That is what this small series of patches aims to achieve. Note these are not very well tested at the moment. The first patch adds a generic and useful '--firstboot' flag. The
2017 Nov 21
2
[PATCH REPOST 1/2] common/mlstdutils: Add return statement.
No change, just reposting without the "for discussion" tag. I think we should allow this as it seems like a nice coding style for a limited subset of imperative-style code. Rich.
2017 Nov 05
2
[PATCH 0/2] (mainly for discussion) Add ‘return’ statement.
When rewriting the heavily imperative original inspection code, I longed for a ‘return’ statement so I could keep the new code as close as possible to the original. OCaml of course does not have such a statement, but it's relatively simply to implement it in the language. The first patch does so, and the second patch rewrites a sample of the inspection code to use it. Rich.
2012 Apr 06
2
[PATCH] virt-sysprep:add logging feature
Hi Rich, I tried to implement the logging feature, but I can't though compiling with this patch now, could you please give me some comments? The error message is below, --- ocamlfind ocamlopt -g -warn-error CDEFLMPSUVYZX -package unix -I ../src/.libs -I ../ocaml -c sysprep_operation.ml -o sysprep_operation.cmx File "sysprep_operation.ml", line 1, characters 0-1: Error: The