mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
Replace the current use of the unstable xc_domain_getinfo_single() interface with the stable domctl XEN_DOMCTL_get_domain_state call via the new libxenmanage library. This will remove the last usage of libxenctrl by Xenstore, so update the library dependencies accordingly. For now only do a direct replacement without using the functionality of obtaining information about domains having changed the state. Signed-off-by: Juergen Gross <jgross@suse.com> Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
60 lines
1.2 KiB
C
60 lines
1.2 KiB
C
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
|
|
/*
|
|
* Live Update for Xen Store Daemon.
|
|
* Copyright (C) 2022 Juergen Gross, SUSE LLC
|
|
*/
|
|
|
|
#include <syslog.h>
|
|
#include <unistd.h>
|
|
#include <sys/stat.h>
|
|
|
|
#include "talloc.h"
|
|
#include "core.h"
|
|
#include "lu.h"
|
|
|
|
#ifndef NO_LIVE_UPDATE
|
|
char *lu_exec(const void *ctx, int argc, char **argv)
|
|
{
|
|
argv[0] = lu_status->filename;
|
|
execvp(argv[0], argv);
|
|
|
|
return "Error activating new binary.";
|
|
}
|
|
|
|
static const char *lu_binary(const void *ctx, struct connection *conn,
|
|
const char *filename)
|
|
{
|
|
const char *ret;
|
|
struct stat statbuf;
|
|
|
|
syslog(LOG_INFO, "live-update: binary %s\n", filename);
|
|
|
|
if (stat(filename, &statbuf))
|
|
return "File not accessible.";
|
|
if (!(statbuf.st_mode & (S_IXOTH | S_IXGRP | S_IXUSR)))
|
|
return "File not executable.";
|
|
|
|
ret = lu_begin(conn);
|
|
if (ret)
|
|
return ret;
|
|
|
|
lu_status->filename = talloc_strdup(lu_status, filename);
|
|
if (!lu_status->filename)
|
|
return "Allocation failure.";
|
|
|
|
errno = 0;
|
|
return NULL;
|
|
}
|
|
|
|
const char *lu_arch(const void *ctx, struct connection *conn, const char **vec,
|
|
int num)
|
|
{
|
|
if (num == 2 && !strcmp(vec[0], "-f"))
|
|
return lu_binary(ctx, conn, vec[1]);
|
|
|
|
errno = EINVAL;
|
|
return NULL;
|
|
}
|
|
#endif
|