Skip to content

Commit

Permalink
Merge branch 'opensuse'
Browse files Browse the repository at this point in the history
  • Loading branch information
marmarek committed Feb 5, 2024
2 parents 6427a74 + 7f1c854 commit 260ddfb
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
4 changes: 4 additions & 0 deletions vchan/Makefile.linux
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ CFLAGS += -g -Wall -Wextra -Werror -fPIC -O2 -D_GNU_SOURCE -MD -MP -MF [email protected]
all: libvchan-xen.so vchan-xen.pc
-include *.dep

# xenctrl.h does not provide any #define to distinguish API versions
XENCTRL_VERSION := $(shell pkg-config --modversion xencontrol)
CFLAGS += $(shell if printf '%s\n' '4.18.0' '$(XENCTRL_VERSION)' | \
sort -CV; then echo -DHAVE_XC_DOMAIN_GETINFO_SINGLE; fi)
SO_VER = 1

libvchan-xen.so.$(SO_VER): init.o io.o
Expand Down
2 changes: 1 addition & 1 deletion vchan/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ static domid_t parse_domid(const char *ptr) {
libvchan_t *libvchan_server_init(int domain, int port, size_t read_min, size_t write_min) {
libvchan_t *ctrl;

ctrl = calloc(sizeof(*ctrl), 1);
ctrl = calloc(1, sizeof(*ctrl));
if (!ctrl)
return NULL;

Expand Down
10 changes: 10 additions & 0 deletions vchan/io.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,24 @@
/* check if domain is still alive */
int libvchan__check_domain_alive(xc_interface *xc_handle, int dom) {
struct evtchn_status evst;
#ifdef HAVE_XC_DOMAIN_GETINFO_SINGLE
xc_domaininfo_t dominfo;
#else
xc_dominfo_t dominfo;
#endif
int ret;

/* first try using domctl, more reliable but available in a privileged
* domain only */
#ifdef HAVE_XC_DOMAIN_GETINFO_SINGLE
ret = xc_domain_getinfo_single(xc_handle, dom, &dominfo);
if (ret == 0)
return !(dominfo.flags & XEN_DOMINF_dying);
#else
ret = xc_domain_getinfo(xc_handle, dom, 1, &dominfo);
if (ret == 1)
return dominfo.domid == (uint32_t)dom && !dominfo.dying;
#endif
else if (ret == -1 && errno == ESRCH)
return 0;
/* otherwise fallback to xc_evtchn_status method */
Expand Down

0 comments on commit 260ddfb

Please sign in to comment.