From: Doug Goldstein Subject: [PATCH 3/4] gdbsx: prefer privcmd character device Date: Tue, 24 Nov 2015 12:47:34 -0600 Message-ID: <1448390855-13505-3-git-send-email-cardoe@cardoe.com> References: <1448390855-13505-1-git-send-email-cardoe@cardoe.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1448390855-13505-1-git-send-email-cardoe@cardoe.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org Cc: Wei Liu , Ian Campbell , Stefano Stabellini , Doug Goldstein , Ian Jackson , Mukesh Rathor List-Id: xen-devel@lists.xenproject.org Prefer using the character device over the proc file if the character device exists. CC: Mukesh Rathor CC: Ian Jackson CC: Stefano Stabellini CC: Ian Campbell CC: Wei Liu Signed-off-by: Doug Goldstein --- tools/debugger/gdbsx/xg/xg_main.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tools/debugger/gdbsx/xg/xg_main.c b/tools/debugger/gdbsx/xg/xg_main.c index 8c8a402..9364aee 100644 --- a/tools/debugger/gdbsx/xg/xg_main.c +++ b/tools/debugger/gdbsx/xg/xg_main.c @@ -127,9 +127,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 -- 2.4.10