[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: [libvirt] PATCH: Fix build on Mingw32
- From: Jim Meyering <jim meyering net>
- To: "Daniel P. Berrange" <berrange redhat com>
- Cc: libvir-list redhat com
- Subject: Re: [libvirt] PATCH: Fix build on Mingw32
- Date: Tue, 03 Mar 2009 11:18:45 +0100
Daniel P. Berrange wrote:
> pread() and pwrite() do not exist on mingw, and the nodedevxml2xmltest
> was adding libvirt_driver_qemu.la for some unknown reason - probably a
> cut & paste error. This broke the test compile when qemu was turned off
> as it is on mingw32.
Although the new code doesn't have exactly the same semantics as
pread/pwrite (new code doesn't restore each file pointer to its
original position), it looks like no caller relied on the file
pointers remaining unchanged.
On a related note, don't these need EAGAIN handling?
Maybe EINTR, too.
> diff --git a/src/pci.c b/src/pci.c
> --- a/src/pci.c
> +++ b/src/pci.c
> @@ -156,7 +156,8 @@ pciRead(pciDevice *dev, unsigned pos, ui
> if (pciOpenConfig(dev) < 0)
> return -1;
>
> - if (pread(dev->fd, buf, buflen, pos) < 0) {
> + if (lseek(dev->fd, pos, SEEK_SET) != pos ||
> + read(dev->fd, buf, buflen) < 0) {
> char ebuf[1024];
> VIR_WARN(_("Failed to read from '%s' : %s"), dev->path,
> virStrerror(errno, ebuf, sizeof(ebuf)));
> @@ -195,7 +196,8 @@ pciWrite(pciDevice *dev, unsigned pos, u
> if (pciOpenConfig(dev) < 0)
> return -1;
>
> - if (pwrite(dev->fd, buf, buflen, pos) < 0) {
> + if (lseek(dev->fd, pos, SEEK_SET) != pos ||
> + write(dev->fd, buf, buflen) < 0) {
> char ebuf[1024];
> VIR_WARN(_("Failed to write to '%s' : %s"), dev->path,
> virStrerror(errno, ebuf, sizeof(ebuf)));
> diff --git a/tests/Makefile.am b/tests/Makefile.am
> --- a/tests/Makefile.am
> +++ b/tests/Makefile.am
> @@ -185,7 +185,7 @@ endif
> nodedevxml2xmltest_SOURCES = \
> nodedevxml2xmltest.c \
> testutils.c testutils.h
> -nodedevxml2xmltest_LDADD = ../src/libvirt_driver_qemu.la $(LDADDS)
> +nodedevxml2xmltest_LDADD = $(LDADDS)
>
> virshtest_SOURCES = \
> virshtest.c \
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]