search for: exn

Displaying 20 results from an estimated 237 matches for "exn".

Did you mean: en
2011 Jul 23
0
[LLVMdev] RFC: Exception Handling Rewrite
...dr constant [18 x i8] c"caught double %g\0A\00", align 1 > > define i32 @_Z3foov() uwtable optsize ssp { > entry: > invoke void @_Z3barv() optsize > to label %try.cont unwind label %lpad > > invoke.cont7: > %tmp0 = tail call i8* @__cxa_begin_catch(i8* %exn) nounwind > %tmp1 = bitcast i8* %tmp0 to i32* > %exn.scalar = load i32* %tmp1, align 4 > %call = tail call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([19 x i8]* @.str, i64 0, i64 0), > i32 %exn.scalar) optsize > tail call void @...
2011 Jul 23
14
[LLVMdev] RFC: Exception Handling Rewrite
..., align 1 @.str1 = private unnamed_addr constant [18 x i8] c"caught double %g\0A\00", align 1 define i32 @_Z3foov() uwtable optsize ssp { entry: invoke void @_Z3barv() optsize to label %try.cont unwind label %lpad invoke.cont7: %tmp0 = tail call i8* @__cxa_begin_catch(i8* %exn) nounwind %tmp1 = bitcast i8* %tmp0 to i32* %exn.scalar = load i32* %tmp1, align 4 %call = tail call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([19 x i8]* @.str, i64 0, i64 0), i32 %exn.scalar) optsize tail call void @__cxa_end_catch() no...
2006 Mar 23
0
Re: [Xen-changelog] Improve error handling, in particular fixing the ProtocolError that is thrown
...C_SOCKET > +from xen.xend.XendClient import XML_RPC_SOCKET, ERROR_INVALID_DOMAIN > > def lookup(domid): > - return XendDomain.instance().domain_lookup_by_name_or_id(domid) > + try: > + return XendDomain.instance().domain_lookup_by_name_or_id(domid) > + except exn: > + log.exception(exn) > + raise exn > > def dispatch(domid, fn, args): > info = lookup(domid) > - return getattr(info, fn)(*args) > + if info: > + try: > + return getattr(info, fn)(*args) > + except exn: > +...
2016 Jul 07
2
Re: [PATCH 1/3] mllib: add checking for btrfs subvolume
...t; let inspect_mount_root_ro = > inspect_mount_root ~mount_opts_fn:(fun _ -> "ro") > + > +let is_btrfs_subvolume g fs = > + let device = g#mountable_device fs in > + let subvol = > + try > + g#mountable_subvolume fs > + with Guestfs.Error msg as exn -> > + if g#last_errno () = Guestfs.Errno.errno_EINVAL then "" > + else raise exn in > + device <> "" && subvol <> "" Firstly I think device <> "" is always true. Secondly it wasn't obvious to me until I...
2006 Jun 16
5
[PATCH][XM-TEST] Fix bugzilla # 674 by changing the xm-test Console.py to wait for the command prompt.
Lots of xm-test tests are failing with console timeouts on some machines at the moment. I reproduced the problem and found it was due to some probing activity in the boot process of the -xen kernel. The behaviour of the current xm-test code is to assume that the boot process has finished after performing three one-second waits for input---when the probing activity introduces more than three
2019 Sep 05
2
[PATCH 0/1] Build fix for future OCaml 4.09
This is a simple fix for building also with the upcoming OCaml 4.09, which has a slight API change in the C library. This does not cover embedded copies such as ocaml-augeas, and ocaml-libvirt, which are being fixed separately, and will then be synchronized. Pino Toscano (1): ocaml: make const the return value of caml_named_value() common/mlpcre/pcre-c.c | 2 +- common/mltools/uri-c.c |
2017 Oct 19
1
[PATCH] v2v: Fix RPM file owned test (RHBZ#1503958).
...This function returns only one package in all the cases. - *) - let cmd = [| "dpkg"; "-S"; path |] in - debug "%s" (String.concat " " (Array.to_list cmd)); - let lines = - try g#command_lines cmd - with Guestfs.Error msg as exn -> - if String.find msg "no path found matching pattern" >= 0 then - raise Not_found - else - raise exn in - if Array.length lines = 0 then - error (f_"internal error: file_owner: dpkg command returned no output"); -...
2019 Sep 05
1
[PATCH] ocaml: Change calls to caml_named_value() to cope with const value* return.
...nged, 5 insertions(+), 10 deletions(-) diff --git a/common/mlpcre/pcre-c.c b/common/mlpcre/pcre-c.c index be054a004..d23f17e05 100644 --- a/common/mlpcre/pcre-c.c +++ b/common/mlpcre/pcre-c.c @@ -73,12 +73,11 @@ init (void) static void raise_pcre_error (const char *msg, int errcode) { - value *exn = caml_named_value ("PCRE.Error"); value args[2]; args[0] = caml_copy_string (msg); args[1] = Val_int (errcode); - caml_raise_with_args (*exn, 2, args); + caml_raise_with_args (*caml_named_value ("PCRE.Error"), 2, args); } /* Wrap and unwrap pcre regular express...
2009 Nov 19
1
[PATCH] (Alternate?) locking patch
...ode 100644 new mode 100755 index c261ea2..30491e0 --- a/src/generator.ml +++ b/src/generator.ml @@ -10176,18 +10176,39 @@ let output_to filename = in close +let perror msg = function + | Unix.Unix_error (err, _, _) -> + eprintf "%s: %s\n" msg (Unix.error_message err) + | exn -> + eprintf "%s: %s\n" msg (Printexc.to_string exn) + (* Main program. *) let () = check_functions (); - if not (Sys.file_exists "HACKING") then ( - eprintf "\ + let lock_fd = + try Unix.openfile "HACKING" [Unix.O_RDWR] 0 + with + | U...
2016 Aug 01
3
[PATCH] v2v: fixed file_owner function
...quot;rpm"; "-qf"; "--qf"; "%{NAME}\\n"; path |] in debug "%s" (String.concat " " (Array.to_list cmd)); - (try g#command cmd + (try + let pkgs = g#command_lines cmd in + pkgs.(0) with Guestfs.Error msg as exn -> if String.find msg "is not owned" >= 0 then raise Not_found else raise exn + | Invalid_argument msg -> + raise Not_found ) | format -> -- 2.9.2
2016 Aug 05
3
[PATCH] v2v: do not hide the error, rather report it
...| 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/v2v/linux.ml b/v2v/linux.ml index e57dad6..46cb3ba 100644 --- a/v2v/linux.ml +++ b/v2v/linux.ml @@ -109,8 +109,8 @@ let rec file_owner (g : G.guestfs) inspect path = raise Not_found else raise exn - | Invalid_argument msg -> - raise Not_found + | Invalid_argument "index out of bounds" -> + error (f_"internal error: file_owner: rpm command returned no output") ) | format -> -- 2.9.2
2019 Sep 05
0
[PATCH 1/1] ocaml: make const the return value of caml_named_value()
...changed, 4 insertions(+), 4 deletions(-) diff --git a/common/mlpcre/pcre-c.c b/common/mlpcre/pcre-c.c index be054a004..62a6dd5da 100644 --- a/common/mlpcre/pcre-c.c +++ b/common/mlpcre/pcre-c.c @@ -73,7 +73,7 @@ init (void) static void raise_pcre_error (const char *msg, int errcode) { - value *exn = caml_named_value ("PCRE.Error"); + const value *exn = caml_named_value ("PCRE.Error"); value args[2]; args[0] = caml_copy_string (msg); diff --git a/common/mltools/uri-c.c b/common/mltools/uri-c.c index 2a8837cd9..db6fe23fc 100644 --- a/common/mltools/uri-c.c +++ b/co...
2016 Jul 07
0
Re: [PATCH 1/3] mllib: add checking for btrfs subvolume
...; inspect_mount_root ~mount_opts_fn:(fun _ -> "ro") > > + > > +let is_btrfs_subvolume g fs = > > + let device = g#mountable_device fs in > > + let subvol = > > + try > > + g#mountable_subvolume fs > > + with Guestfs.Error msg as exn -> > > + if g#last_errno () = Guestfs.Errno.errno_EINVAL then "" > > + else raise exn in > > + device <> "" && subvol <> "" > > Firstly I think device <> "" is always true. > > Secondly i...
2016 Aug 23
1
[PATCH] mllib: do not assume $PATH is set
...utils.ml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mllib/common_utils.ml b/mllib/common_utils.ml index fdca713..9210cf8 100644 --- a/mllib/common_utils.ml +++ b/mllib/common_utils.ml @@ -319,7 +319,9 @@ let protect ~f ~finally = match r with Either ret -> ret | Or exn -> raise exn let which executable = - let paths = String.nsplit ":" (Sys.getenv "PATH") in + let paths = + try String.nsplit ":" (Sys.getenv "PATH") + with Not_found -> [] in let paths = filter_map ( fun p -> let path = p //...
2017 Jul 14
0
[PATCH 02/27] daemon: Allow parts of the daemon and APIs to be written in OCaml.
...rbose () then + eprintf "chroot: %s: running ā€˜%sā€™\n%!" t.chroot t.name; + + let rfd, wfd = pipe () in + + let pid = fork () in + if pid = 0 then ( + (* Child. *) + close rfd; + + chdir t.chroot; + chroot t.chroot; + + let ret = + try Either (func arg) + with exn -> Or exn in + + try + let chan = out_channel_of_descr wfd in + output_value chan ret; + Pervasives.flush chan; + Exit._exit 0 + with + exn -> + prerr_endline (Printexc.to_string exn); + Exit._exit 1 + ); + + (* Parent. *) + close wfd; + + let...
2016 Aug 09
2
Re: [PATCH 2/8] v2v: add basic support for the "deb" package manager
...r: failed to process string '%s'") pkg else if pkg.[i] = ' ' && (pkg.[i-1] = ':' || pkg.[i-1] = ',') then String.sub pkg 0 (i-1) else loop (i+1) in loop 1 with Guestfs.Error msg as exn -> if String.find msg "no path found matching pattern" >= 0 then raise Not_found else raise exn ) The other concern is, whether we should escape the argument somehow. The fact is that dpkg-query accepts a glob expression, not just a sim...
2017 Jul 20
2
Re: [PATCH 02/27] daemon: Allow parts of the daemon and APIs to be written in OCaml.
...An interface like: val f : t -> ('a -> 'b) -> 'a -> 'b val fn : t -> (unit -> unit) -> 'a With the implementation like: let f t func arg = fn (fun () -> func arg) let fn func = ... let ret = try Either (func ()) with exn -> Or exn in This way, when calling more more than a single-parameter function, it is slightly easier to read (IMHO, of course): let res = Chroot.f chroot (fun () -> ...) in than let res = Chroot.f chroot (fun () -> ...) () in This is mostly syntactic sugar. > > > +/* Co...
2017 Jul 19
2
Re: [PATCH 02/27] daemon: Allow parts of the daemon and APIs to be written in OCaml.
...p inside the guest. > */ > @@ -1205,3 +1212,46 @@ cleanup_free_mountable (mountable_t *mountable) > free (mountable->volume); > } > } > + > +/* Convert an OCaml exception to a reply_with_error_errno call > + * as best we can. > + */ > +extern void ocaml_exn_to_reply_with_error (const char *func, value exn); > + > +void > +ocaml_exn_to_reply_with_error (const char *func, value exn) > +{ Shouldn't this use CAMLparam1 + CAMLreturn? > diff --git a/daemon/sysroot-c.c b/daemon/sysroot-c.c > new file mode 100644 > index 000000000.....
2017 Mar 23
0
[PATCH v5 03/10] mllib: ocaml wrapper for lib/osinfo
...uestfs.h" +#include "guestfs-internal.h" +#include "osinfo.h" + +#pragma GCC diagnostic ignored "-Wmissing-prototypes" + +struct callback_wrapper_args { + /* In both case we are pointing to local roots, hence why these are + * value* not value. + */ + value *exnp; /* Safe place to store any exception + raised by callback */ + value *fvp; /* callback. */ +}; + +static int read_osinfo_db_callback_wrapper (guestfs_h *g, const char *path, void *opaque); + +value +guestfs_int_mllib_read_osinf...
2016 Jul 07
7
[PATCH 0/3] fix btrfs subvolume procession in tools
This patcheset fixes errors in virt-sysprep and virt-sparsify. Here we have a common functionality: is_btrfs_subvolume. Doesn't it make sense to turn it into guestfs API? Also I found an issue. In 'virt-sysprep fs-uuids', the uuids for ALL filesystems are regenerated as many times as many roots are in guest. Is it done intentionally? Maxim Perevedentsev (3): mllib: add checking