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

Re: [Xen-devel] ioctl handling in netbsd_privcmd_hypercall()



On Wed, Jan 18, Roger Pau Monnà wrote:

> 2012/1/18 Olaf Hering <olaf@xxxxxxxxx>:
> >
> > 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.
> 
> I haven't done this code, so I don't know if there are some hidden
> subtleties here, but according to NetBSD ioctl(2) man page[0], it
> returns -1 on error and errno is set to indicate the error.

Could you check wether a "return ioctl(....);" works as well?

Olaf

> > 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.
> 
> [0] http://netbsd.gw.com/cgi-bin/man-cgi?ioctl+.amd64+NetBSD-current

_______________________________________________
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®.