[libvirt] [PATCH] Cygwin's GCC doesn't like this .sa_handler initialization for some reason

Matthias Bolte matthias.bolte at googlemail.com
Tue Apr 27 08:03:54 UTC 2010


2010/4/27 Stefan Berger <stefanb at us.ibm.com>:
>
> libvir-list-bounces at redhat.com wrote on 04/26/2010 03:20:47 PM:
>
>
>> > static struct sigaction zero_sigaction = {0};
>> > struct sigaction action_stop = zero_sigaction;
>> > action_stop.sa_handler = stop;
>> >
>> > But don't go changing this commit just for that theoretical platform.
>> >
>>
>> Thanks, pushed.
>>
>
> Does it compile for you on cygwin?

It does, but not all my patches have reached the GIT repo yet.

> I need to make the following changes just to get it to link properly:
>
>
> diff --git a/src/Makefile.am b/src/Makefile.am
> index fc64927..723d221 100644
> --- a/src/Makefile.am
> +++ b/src/Makefile.am
> @@ -928,7 +928,7 @@ libvirt.def: libvirt.syms
>  libvirt_la_SOURCES =
>  libvirt_la_LIBADD += \
>                      $(CYGWIN_EXTRA_LIBADD) ../gnulib/lib/libgnu.la
> -libvirt_la_LDFLAGS = $(VERSION_SCRIPT_FLAGS)$(LIBVIRT_SYMBOL_FILE) \
> +libvirt_la_LDFLAGS = \
>                       -version-info $(LIBVIRT_VERSION_INFO) \
>                      $(COVERAGE_CFLAGS:-f%=-Wc,-f%) \
>                      $(LIBXML_LIBS) \

Ah, I forgot to post a patch that fixes version script handling for
Cygwin. In contrast to MinGW's ld, Cygwin's ld handles version scripts
properly:

https://www.redhat.com/archives/libvir-list/2010-April/msg01202.html

> diff --git a/src/remote/remote_protocol.c b/src/remote/remote_protocol.c
> index c9816dd..854b0fd 100644
> --- a/src/remote/remote_protocol.c
> +++ b/src/remote/remote_protocol.c
> @@ -413,12 +413,12 @@ xdr_remote_node_get_info_ret (XDR *xdrs,
> remote_node_get_info_ret *objp)
>                           if (!xdr_int (xdrs, &objp->threads))
>                                   return FALSE;
>                  } else {
> -                        (void)IXDR_PUT_INT32(buf, objp->cpus);
> -                        (void)IXDR_PUT_INT32(buf, objp->mhz);
> -                        (void)IXDR_PUT_INT32(buf, objp->nodes);
> -                        (void)IXDR_PUT_INT32(buf, objp->sockets);
> -                        (void)IXDR_PUT_INT32(buf, objp->cores);
> -                        (void)IXDR_PUT_INT32(buf, objp->threads);
> +                        (void)IXDR_PUT_LONG(buf, objp->cpus);
> +                        (void)IXDR_PUT_LONG(buf, objp->mhz);
> +                        (void)IXDR_PUT_LONG(buf, objp->nodes);
> +                        (void)IXDR_PUT_LONG(buf, objp->sockets);
> +                        (void)IXDR_PUT_LONG(buf, objp->cores);
> +                        (void)IXDR_PUT_LONG(buf, objp->threads);
>                  }
>                  return TRUE;
>          } else if (xdrs->x_op == XDR_DECODE) {
> @@ -442,12 +442,12 @@ xdr_remote_node_get_info_ret (XDR *xdrs,
> remote_node_get_info_ret *objp)
>                           if (!xdr_int (xdrs, &objp->threads))
>                                   return FALSE;
>                  } else {
> -                        objp->cpus = IXDR_GET_INT32(buf);
> -                        objp->mhz = IXDR_GET_INT32(buf);
> -                        objp->nodes = IXDR_GET_INT32(buf);
> -                        objp->sockets = IXDR_GET_INT32(buf);
> -                        objp->cores = IXDR_GET_INT32(buf);
> -                        objp->threads = IXDR_GET_INT32(buf);
> +                        objp->cpus = IXDR_GET_LONG(buf);
> +                        objp->mhz = IXDR_GET_LONG(buf);
> +                        objp->nodes = IXDR_GET_LONG(buf);
> +                        objp->sockets = IXDR_GET_LONG(buf);
> +                        objp->cores = IXDR_GET_LONG(buf);
> +                        objp->threads = IXDR_GET_LONG(buf);
>                  }
>           return TRUE;
>          }
>
> Virsh doesn't work then, but at least it links after these changes.
>
>   Stefan
>

I just pushed a patch to fix this.

virsh works for me. I tested it with a connection to a remote libvirtd
using a plain unencrypted TCP connection: virsh -c
qemu+tcp://<server>/system

Matthias




More information about the libvir-list mailing list