[Libguestfs] [nbdkit PATCH v3 1/4] plugins: Don't use bogus errno from non-C plugins

Richard W.M. Jones rjones at redhat.com
Fri Jan 27 18:08:13 UTC 2017


On Fri, Jan 27, 2017 at 08:01:17AM -0600, Eric Blake wrote:
> On 01/27/2017 04:11 AM, Richard W.M. Jones wrote:
> > 
> > Actually OCaml is a real compiled language, and the call from C to
> > OCaml code (via caml_callback_exn) is a short piece of asm which
> > preserves errno.
> 
> Which shows my lack of familiarity with OCaml; but I'm guessing that
> also means that OCaml comes with easy ways to directly set errno so that
> it will be visible from C.

Actually no, that would be too easy.  Failing system calls (in OCaml
code) are turned into exceptions.  The exception contains something
which has a 1-1 mapping with the errno, but is not the errno.  In
libguestfs we had to do some mappings for those, so it's a pain.

So in fact I'm not sure if errno is preserved properly or if we should
map the Is_exception_result.

Need to think about this - at the moment I'm in the middle of some
customer crisis.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
libguestfs lets you edit virtual machines.  Supports shell scripting,
bindings from many languages.  http://libguestfs.org




More information about the Libguestfs mailing list