|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH for-4.7 3/4] tools/xsplice: fix mixing system errno values with Xen ones.
On Fri, Apr 29, 2016 at 04:21:19PM +0200, Roger Pau Monne wrote:
> Avoid using system errno values when comparing with Xen errno values.
>
> Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
> ---
> Cc: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
> Cc: Ross Lagerwall <ross.lagerwall@xxxxxxxxxx>
> Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
> Cc: Wei Liu <wei.liu2@xxxxxxxxxx>
> ---
> Using errno values inside of hypercall structs is not right IMHO, but there
> are already several occurrences of this. Although I'm adding the correct XEN_
> prefixes here, it's very likely that new additions/modifications to this
> file will not take this into account, breaking it for OSes != Linux.
This seems to be a rather thorny issue.
I have a gut feeling that returning XEN_ errno to userspace program is
layering violation. They should always be translated to OS level errno
by privcmd driver.
Aren't FreeBSD and NetBSD already doing that?
Wei.
> ---
> tools/misc/xen-xsplice.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/tools/misc/xen-xsplice.c b/tools/misc/xen-xsplice.c
> index 695be7f..b31115c 100644
> --- a/tools/misc/xen-xsplice.c
> +++ b/tools/misc/xen-xsplice.c
> @@ -13,6 +13,8 @@
> #include <xenctrl.h>
> #include <xenstore.h>
>
> +#include <xen/errno.h>
> +
> static xc_interface *xch;
>
> void show_help(void)
> @@ -233,7 +235,7 @@ struct {
> .function = xc_xsplice_revert,
> },
> { .allow = XSPLICE_STATE_CHECKED,
> - .expected = -ENOENT,
> + .expected = -XEN_ENOENT,
> .name = "unload",
> .function = xc_xsplice_unload,
> },
> @@ -276,7 +278,7 @@ int action_func(int argc, char *argv[], unsigned int idx)
> name, errno, strerror(errno));
> return -1;
> }
> - if ( status.rc == -EAGAIN )
> + if ( status.rc == -XEN_EAGAIN )
> {
> fprintf(stderr, "%s failed. Operation already in progress\n", name);
> return -1;
> @@ -319,7 +321,7 @@ int action_func(int argc, char *argv[], unsigned int idx)
>
> if ( status.state != original_state )
> break;
> - if ( status.rc && status.rc != -EAGAIN )
> + if ( status.rc && status.rc != -XEN_EAGAIN )
> {
> rc = status.rc;
> break;
> --
> 2.6.4 (Apple Git-63)
>
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |