gdbsx: prefer privcmd character device
authorDoug Goldstein <cardoe@cardoe.com>
Tue, 31 Oct 2017 15:20:11 +0000 (10:20 -0500)
committerWei Liu <wei.liu2@citrix.com>
Thu, 2 Nov 2017 16:42:40 +0000 (16:42 +0000)
Prefer using the character device over the proc file if the character
device exists.

CC: Elena Ufimtseva <elena.ufimtseva@oracle.com>
CC: Ian Jackson <ian.jackson@eu.citrix.com>
CC: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
CC: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
Reviewed-by: Elena Ufimtseva <elena.ufimtseva@oracle.com>
Release-acked-by: Julien Grall <julien.grall@linaro.org>
tools/debugger/gdbsx/xg/xg_main.c

index 7ebf91435bc5c59e9f2c0beaf67239f4a2a6367a..cc640d1d8272d84e6109691b6de8d364b646e233 100644 (file)
@@ -126,9 +126,11 @@ xg_init()
     int flags, saved_errno;
 
     XGTRC("E\n");
-    if ((_dom0_fd=open("/proc/xen/privcmd", O_RDWR)) == -1) {
-        perror("Failed to open /proc/xen/privcmd\n");
-        return -1;
+    if ((_dom0_fd=open("/dev/xen/privcmd", O_RDWR)) == -1) {
+        if ((_dom0_fd=open("/proc/xen/privcmd", O_RDWR)) == -1) {
+            perror("Failed to open /dev/xen/privcmd or /proc/xen/privcmd\n");
+            return -1;
+        }
     }
     /* Although we return the file handle as the 'xc handle' the API
      * does not specify / guarentee that this integer is in fact