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

[Xen-devel] ioctl handling in netbsd_privcmd_hypercall()


  • To: xen-devel@xxxxxxxxxxxxxxxxxxx
  • From: Olaf Hering <olaf@xxxxxxxxx>
  • Date: Wed, 18 Jan 2012 17:21:22 +0100
  • Delivery-date: Wed, 18 Jan 2012 16:22:28 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>

I was looking at the slightly broken error handling in the new
xc_mem_paging_load() function and stumbled over the ioctl() handling in
netbsd_privcmd_hypercall().

Is ioctl() on NetBSD special? I would have expected it returns -1 on
error and the caller can deal with errno if it actually wants to.
But instead it returns the negative errno value or what the hypervisor
returned.

static int netbsd_privcmd_hypercall(xc_interface *xch, xc_osdep_handle h, 
privcmd_hypercall_t *hypercall)
{   
    int fd = (int)h;
    int error = ioctl(fd, IOCTL_PRIVCMD_HYPERCALL, hypercall);

    if (error < 0)
        return -errno;
    else
        return hypercall->retval;
}

I think do_domctl() is supposed to return -1 on error and let the caller
decide what to do. At least thats how its appearently done on Linux and
Solaris.

Olaf

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

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