All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCHv2] 1/3] libxc: prefer using privcmd character device
@ 2015-11-24 20:14 Doug Goldstein
  2015-11-24 20:14 ` [PATCHv2] 2/3] update outdated header comment on privcmd.h Doug Goldstein
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Doug Goldstein @ 2015-11-24 20:14 UTC (permalink / raw)
  To: xen-devel
  Cc: Ian Jackson, Wei Liu, Doug Goldstein, Ian Campbell, Stefano Stabellini

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@eu.citrix.com>
CC: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
CC: Ian Campbell <ian.campbell@citrix.com>
CC: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
---
 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 ))
+    {
+        /* Fallback to /proc/xen/privcmd */
+        fd = open("/proc/xen/privcmd", O_RDWR);
+    }
 
     if ( fd == -1 )
     {
-- 
2.4.10

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-12-01 19:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-24 20:14 [PATCHv2] 1/3] libxc: prefer using privcmd character device Doug Goldstein
2015-11-24 20:14 ` [PATCHv2] 2/3] update outdated header comment on privcmd.h Doug Goldstein
2015-11-24 20:14 ` [PATCHv2] 3/3] xendomains initscript: test for privcmd char device Doug Goldstein
2015-12-01 11:46 ` [PATCHv2] 1/3] libxc: prefer using privcmd character device Ian Campbell
2015-12-01 19:08   ` Doug Goldstein

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.