[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCHv2] 1/3] libxc: prefer using privcmd character device
On Tue, 2015-11-24 at 14:14 -0600, Doug Goldstein wrote: > Prefer using the character device over the proc file if the character > device exists. This follows similar conversions of xenbus to avoid > issues with FMODE_ATOMIC_POS added in Linux 3.14 and newer. > > CC: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> > CC: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx> > CC: Ian Campbell <ian.campbell@xxxxxxxxxx> > CC: Wei Liu <wei.liu2@xxxxxxxxxx> > Signed-off-by: Doug Goldstein <cardoe@xxxxxxxxxx> > --- > Âtools/libxc/xc_linux_osdep.c | 9 ++++++++- > Â1 file changed, 8 insertions(+), 1 deletion(-) > > diff --git a/tools/libxc/xc_linux_osdep.c b/tools/libxc/xc_linux_osdep.c > index 76c55ff..c078b3d 100644 > --- a/tools/libxc/xc_linux_osdep.c > +++ b/tools/libxc/xc_linux_osdep.c > @@ -46,7 +46,14 @@ > Âstatic xc_osdep_handle linux_privcmd_open(xc_interface *xch) > Â{ > ÂÂÂÂÂint flags, saved_errno; > -ÂÂÂÂint fd = open("/proc/xen/privcmd", O_RDWR); > +ÂÂÂÂint fd = open("/dev/xen/privcmd", O_RDWR); /* prefer this newer > interface */ > + > +ÂÂÂÂif ( fd == -1 && ( errno == ENOENT || errno == ENXIO || > +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂerrno == ENODEV || errno == EACCES )) This adds EACCESS to the set Ian suggested would be tolerable in his reply to v1. I'm leaning towards thinking that if the device is present but not openable by the current user then that's a system configuration error which should be reported. Anyone want to argue otherwise? > +ÂÂÂÂ{ > +ÂÂÂÂÂÂÂÂ/* Fallback to /proc/xen/privcmd */ > +ÂÂÂÂÂÂÂÂfd = open("/proc/xen/privcmd", O_RDWR); > +ÂÂÂÂ} > Â > ÂÂÂÂÂif ( fd == -1 ) > ÂÂÂÂÂ{ _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |