[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] tools/libxl: Fix the errno



On Fri, 2015-03-20 at 16:17 +0800, Wen Congyang wrote:
> After commit 6d896e13, we should pass -errno on read failure.

Hrm, this means that 6d896e13 was a more subtle interface change than I
was expecting (I'd forgotten that errno wasn't negative in userspace).

This means that someone needs to audit all of the callbacks and check
that they do the right thing. But...

I'm not at all convinced that this is true for the bootloader ones: They
treat -1 as pollhup, which is not the same as -EPERM, which is because
the same callback is reused as callback_pollhup, with a comment:
       /* pollhup gets called with errnoval==-1 which is not otherwise
        * possible since errnos are nonnegative, so it's unambiguous */
which is now no longer true.

Do the new callers actually need the number of bytes read/written or was
this just something which seemed like a good idea since it was in hand?

If it isn't needed then lets go back to the old semantics and pass 0 on
EOF or bytes_to_read have been read (essentially "0 bytes left to
read"), I expect the recipient of the callback should know (or could
remember) the initial value of bytes_to_read? 

Otherwise I think the only sensible approach would be to add a new
parameter to the callback for the number of bytes and but errnoval back
to the old semantics.

Or perhaps requiring a separater callback vs. pollhup_callback could
solve this too, they would have different prototypes.

Please can one of you look into this ASAP, otherwise I think we should
revert until it can get fixed.

Ian.


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.