Message ID | 20201214163623.2127-5-bouyer@netbsd.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | NetBSD fixes | expand |
On Mon, Dec 14, 2020 at 05:36:03PM +0100, Manuel Bouyer wrote: > --- > tools/debugger/gdbsx/xg/xg_main.c | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > diff --git a/tools/debugger/gdbsx/xg/xg_main.c b/tools/debugger/gdbsx/xg/xg_main.c > index a4e8653168..fa2741ccf8 100644 > --- a/tools/debugger/gdbsx/xg/xg_main.c > +++ b/tools/debugger/gdbsx/xg/xg_main.c > @@ -49,7 +49,11 @@ > #include "xg_public.h" > #include <xen/version.h> > #include <xen/domctl.h> > +#ifdef __NetBSD__ > +#include <xen/xenio.h> > +#else > #include <xen/sys/privcmd.h> > +#endif > #include <xen/foreign/x86_32.h> > #include <xen/foreign/x86_64.h> > > @@ -126,12 +130,19 @@ xg_init() > int flags, saved_errno; > > XGTRC("E\n"); > +#ifdef __NetBSD__ > + if ((_dom0_fd=open("/kern/xen/privcmd", O_RDWR)) == -1) { > + perror("Failed to open /kern/xen/privcmd\n"); > + return -1; > + } > +#else > 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; > } > } > +#endif I don't think you need to ifdef here, instead just add to the existing if, ie: if ((_dom0_fd=open("/dev/xen/privcmd", O_RDWR)) == -1 && (_dom0_fd=open("/proc/xen/privcmd", O_RDWR)) == -1 && (_dom0_fd=open("/kern/xen/privcmd", O_RDWR)) == -1) { perror("Failed to open /dev/xen/privcmd, /proc/xen/privcmd or /kern/xen/privcmd\n"); return -1; } Thanks, Roger.
diff --git a/tools/debugger/gdbsx/xg/xg_main.c b/tools/debugger/gdbsx/xg/xg_main.c index a4e8653168..fa2741ccf8 100644 --- a/tools/debugger/gdbsx/xg/xg_main.c +++ b/tools/debugger/gdbsx/xg/xg_main.c @@ -49,7 +49,11 @@ #include "xg_public.h" #include <xen/version.h> #include <xen/domctl.h> +#ifdef __NetBSD__ +#include <xen/xenio.h> +#else #include <xen/sys/privcmd.h> +#endif #include <xen/foreign/x86_32.h> #include <xen/foreign/x86_64.h> @@ -126,12 +130,19 @@ xg_init() int flags, saved_errno; XGTRC("E\n"); +#ifdef __NetBSD__ + if ((_dom0_fd=open("/kern/xen/privcmd", O_RDWR)) == -1) { + perror("Failed to open /kern/xen/privcmd\n"); + return -1; + } +#else 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; } } +#endif /* Although we return the file handle as the 'xc handle' the API * does not specify / guarentee that this integer is in fact * a file handle. Thus we must take responsiblity to ensure