Andrew Cooper
2013-Feb-21 15:46 UTC
[PATCH 2 of 5 v2] tools/libxc: Helper function for XEN_SYSCTL_consoleringsize
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> diff -r 1306e69a7018 -r 1ffce9bf90f5 tools/libxc/xc_misc.c --- a/tools/libxc/xc_misc.c +++ b/tools/libxc/xc_misc.c @@ -100,6 +100,26 @@ int xc_readconsolering(xc_interface *xch return ret; } +int xc_consoleringsize(xc_interface *xch, uint64_t * psize) +{ + int ret = -1; + DECLARE_SYSCTL; + + if ( ! psize ) + { + errno = EFAULT; + return ret; + } + + sysctl.cmd = XEN_SYSCTL_consoleringsize; + ret = do_sysctl(xch, &sysctl); + + if ( ! ret ) + *psize = sysctl.u.consoleringsize.size; + + return ret; +} + int xc_send_debug_keys(xc_interface *xch, char *keys) { int ret, len = strlen(keys); diff -r 1306e69a7018 -r 1ffce9bf90f5 tools/libxc/xenctrl.h --- a/tools/libxc/xenctrl.h +++ b/tools/libxc/xenctrl.h @@ -998,6 +998,7 @@ int xc_readconsolering(xc_interface *xch char *buffer, unsigned int *pnr_chars, int clear, int incremental, uint32_t *pindex); +int xc_consoleringsize(xc_interface *xch, uint64_t * psize); int xc_send_debug_keys(xc_interface *xch, char *keys);
Ian Campbell
2013-Mar-12 17:09 UTC
Re: [PATCH 2 of 5 v2] tools/libxc: Helper function for XEN_SYSCTL_consoleringsize
On Thu, 2013-02-21 at 15:46 +0000, Andrew Cooper wrote:> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> > > diff -r 1306e69a7018 -r 1ffce9bf90f5 tools/libxc/xc_misc.c > --- a/tools/libxc/xc_misc.c > +++ b/tools/libxc/xc_misc.c > @@ -100,6 +100,26 @@ int xc_readconsolering(xc_interface *xch > return ret; > } > > +int xc_consoleringsize(xc_interface *xch, uint64_t * psize) > +{ > + int ret = -1; > + DECLARE_SYSCTL; > + > + if ( ! psize ) > + { > + errno = EFAULT;Strictly I think this is an EINVAL event. EFAULT would be when it is non-NULL but dereferencing it faults.