All of lore.kernel.org
 help / color / mirror / Atom feed
From: Olaf Hering <olaf@aepfle.de>
To: "Roger Pau Monné" <roger.pau@entel.upc.edu>
Cc: xen-devel@lists.xensource.com
Subject: Re: ioctl handling in netbsd_privcmd_hypercall()
Date: Wed, 18 Jan 2012 19:01:23 +0100	[thread overview]
Message-ID: <20120118180123.GA7169@aepfle.de> (raw)
In-Reply-To: <CAPLaKK7aEG6jR-ABNo0jHsqK+56K0=1Nm_fsi7T-JW+HEa7wTA@mail.gmail.com>

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

> 2012/1/18 Olaf Hering <olaf@aepfle.de>:
> >
> > 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@lists.xensource.com
http://lists.xensource.com/xen-devel

  reply	other threads:[~2012-01-18 18:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-18 16:21 ioctl handling in netbsd_privcmd_hypercall() Olaf Hering
2012-01-18 17:37 ` Roger Pau Monné
2012-01-18 18:01   ` Olaf Hering [this message]
2012-01-19 10:11     ` Roger Pau Monné

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120118180123.GA7169@aepfle.de \
    --to=olaf@aepfle.de \
    --cc=roger.pau@entel.upc.edu \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.