mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 10:11:27 +01:00
libxl: libxl_ctx_init checks for xenstored pid file
This is a proxy for whether xenstored is running. Otherwise the failure modes are unfortunate (hangs, or mysterious error messages). If and when we have a stubdom xenstored this will need to be revisited, if not before. Signed-off-by: Kamala Narasimhan <kamala.narasimhan@citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
This commit is contained in:
1 parent
45244f3cd1
commit
326a7b743e
2 files changed
+9
No files matched your search
@@ -40,12 +40,20 @@
|
||||
|
||||
int libxl_ctx_init(libxl_ctx *ctx, int version, xentoollog_logger *lg)
|
||||
{
|
||||
struct stat stat_buf;
|
||||
|
||||
if (version != LIBXL_VERSION)
|
||||
return ERROR_VERSION;
|
||||
memset(ctx, 0, sizeof(libxl_ctx));
|
||||
ctx->lg = lg;
|
||||
memset(&ctx->version_info, 0, sizeof(libxl_version_info));
|
||||
|
||||
if ( stat(XENSTORE_PID_FILE, &stat_buf) != 0 ) {
|
||||
LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "Is xenstore daemon running?\n"
|
||||
"failed to stat %s", XENSTORE_PID_FILE);
|
||||
return ERROR_FAIL;
|
||||
}
|
||||
|
||||
ctx->xch = xc_interface_open(lg,lg,0);
|
||||
if (!ctx->xch) {
|
||||
LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, errno,
|
||||
|
||||
@@ -110,6 +110,7 @@ typedef struct {
|
||||
#define AUTO_PHP_SLOT 0x100
|
||||
#define SYSFS_PCI_DEV "/sys/bus/pci/devices"
|
||||
#define SYSFS_PCIBACK_DRIVER "/sys/bus/pci/drivers/pciback"
|
||||
#define XENSTORE_PID_FILE "/var/run/xenstore.pid"
|
||||
|
||||
#define PROC_PCI_NUM_RESOURCES 7
|
||||
#define PCI_BAR_IO 0x01
|
||||
|
||||