All of lore.kernel.org
 help / color / mirror / Atom feed
* Errors of doing "make install-tools" with xen-4.2-unstable?
@ 2012-05-11 14:08 Bei Guan
  2012-05-11 14:16 ` Ian Campbell
  2012-05-11 14:19 ` Olaf Hering
  0 siblings, 2 replies; 16+ messages in thread
From: Bei Guan @ 2012-05-11 14:08 UTC (permalink / raw)
  To: xen-devel


[-- Attachment #1.1: Type: text/plain, Size: 2802 bytes --]

Hi,

When I do the "make install-tools" with xen-4.2-unstable, there are some
errors about "warn_unused_result".
Is it the error in code or the error in the compiling environment? Thank
you so much.


gcc  -O1 -fno-omit-frame-pointer -m64 -g -fno-strict-aliasing -std=gnu99
-Wall -Wstrict-prototypes -Wdeclaration-after-statement   -D__XEN_TOOLS__
-MMD -MF .tapdisk-queue.o.d  -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
-fno-optimize-sibling-calls -Werror -g -Wno-unused -fno-strict-aliasing
-I../include -I../drivers
-I/root/Xen/xen-4.2-unstable/tools/blktap2/drivers/../../../tools/libxc
-I/root/Xen/xen-4.2-unstable/tools/blktap2/drivers/../../../tools/include
-D_GNU_SOURCE -DUSE_NFS_LOCKS -fPIC -I
/root/Xen/xen-4.2-unstable/tools/blktap2/drivers/../../../tools/libaio/src
-c -o tapdisk-queue.o tapdisk-queue.c
cc1: warnings being treated as errors
tapdisk-queue.c: In function ‘tapdisk_lio_ack_event’:
tapdisk-queue.c:438: error: ignoring return value of ‘read’, declared with
attribute warn_unused_result
make[5]: *** [tapdisk-queue.o] Error 1
make[5]: Leaving directory
`/root/Xen/xen-4.2-unstable/tools/blktap2/drivers'
make[4]: *** [subdir-install-drivers] Error 2
make[4]: Leaving directory `/root/Xen/xen-4.2-unstable/tools/blktap2'
make[3]: *** [subdirs-install] Error 2
make[3]: Leaving directory `/root/Xen/xen-4.2-unstable/tools/blktap2'
make[2]: *** [subdir-install-blktap2] Error 2
make[2]: Leaving directory `/root/Xen/xen-4.2-unstable/tools'
make[1]: *** [subdirs-install] Error 2
make[1]: Leaving directory `/root/Xen/xen-4.2-unstable/tools'
make: *** [install-tools] Error 2
------
root/Xen/xen-4.2-unstable/tools/blktap2/drivers/../../../tools/libaio/src
-c -o tapdisk-log.o tapdisk-log.c
cc1: warnings being treated as errors
tapdisk-log.c: In function ‘tlog_flush’:
tapdisk-log.c:250: error: ignoring return value of ‘write’, declared with
attribute warn_unused_result
------
/root/Xen/xen-4.2-unstable/tools/blktap2/drivers/../../../tools/libaio/src
-c -o tapdisk2.o tapdisk2.c
cc1: warnings being treated as errors
tapdisk2.c: In function ‘main’:
tapdisk2.c:82: error: ignoring return value of ‘chdir’, declared with
attribute warn_unused_result
------
cc1: warnings being treated as errors
tapdisk-stream.c: In function ‘tapdisk_stream_poll_clear’:
tapdisk-stream.c:148: error: ignoring return value of ‘read’, declared with
attribute warn_unused_result
tapdisk-stream.c: In function ‘tapdisk_stream_poll_set’:
tapdisk-stream.c:158: error: ignoring return value of ‘write’, declared
with attribute warn_unused_result
tapdisk-stream.c: In function ‘tapdisk_stream_print_request’:
tapdisk-stream.c:206: error: ignoring return value of ‘write’, declared
with attribute warn_unused_result



Best Regards,
Bei Guan

[-- Attachment #1.2: Type: text/html, Size: 3655 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Errors of doing "make install-tools" with xen-4.2-unstable?
  2012-05-11 14:08 Errors of doing "make install-tools" with xen-4.2-unstable? Bei Guan
@ 2012-05-11 14:16 ` Ian Campbell
  2012-05-11 15:12   ` Bei Guan
  2012-05-11 16:16   ` Keir Fraser
  2012-05-11 14:19 ` Olaf Hering
  1 sibling, 2 replies; 16+ messages in thread
From: Ian Campbell @ 2012-05-11 14:16 UTC (permalink / raw)
  To: Bei Guan; +Cc: xen-devel

On Fri, 2012-05-11 at 15:08 +0100, Bei Guan wrote:
> When I do the "make install-tools" with xen-4.2-unstable, there are
> some errors about "warn_unused_result".
> Is it the error in code or the error in the compiling environment?
> Thank you so much.

This commit
        changeset:   25275:27d63b9f111a
        user:        Keir Fraser <keir@xen.org>
        date:        Thu May 10 11:22:18 2012 +0100
        summary:     blktap2: Do not build with -O0
has caused more warnings to be generated by the compiler, which in turn
leads to build failures. Since this is a compiler specific thing we are
still tracking them all down.

Can you confirm which versionof xen-unstable.hg you are using -- there
have been several fixup patches since the above. If you are completely
up to date and you still see errors we can dig into whatever is left.

Ian. (starting to think that this change wasn't suitable during a
feature freeze....)

> 
> 
> gcc  -O1 -fno-omit-frame-pointer -m64 -g -fno-strict-aliasing
> -std=gnu99 -Wall -Wstrict-prototypes -Wdeclaration-after-statement
> -D__XEN_TOOLS__ -MMD -MF .tapdisk-queue.o.d  -D_LARGEFILE_SOURCE
> -D_LARGEFILE64_SOURCE -fno-optimize-sibling-calls -Werror -g
> -Wno-unused -fno-strict-aliasing -I../include -I../drivers
> -I/root/Xen/xen-4.2-unstable/tools/blktap2/drivers/../../../tools/libxc -I/root/Xen/xen-4.2-unstable/tools/blktap2/drivers/../../../tools/include -D_GNU_SOURCE -DUSE_NFS_LOCKS -fPIC -I /root/Xen/xen-4.2-unstable/tools/blktap2/drivers/../../../tools/libaio/src  -c -o tapdisk-queue.o tapdisk-queue.c 
> cc1: warnings being treated as errors
> tapdisk-queue.c: In function ‘tapdisk_lio_ack_event’:
> tapdisk-queue.c:438: error: ignoring return value of ‘read’, declared
> with attribute warn_unused_result
> make[5]: *** [tapdisk-queue.o] Error 1
> make[5]: Leaving directory
> `/root/Xen/xen-4.2-unstable/tools/blktap2/drivers'
> make[4]: *** [subdir-install-drivers] Error 2
> make[4]: Leaving directory `/root/Xen/xen-4.2-unstable/tools/blktap2'
> make[3]: *** [subdirs-install] Error 2
> make[3]: Leaving directory `/root/Xen/xen-4.2-unstable/tools/blktap2'
> make[2]: *** [subdir-install-blktap2] Error 2
> make[2]: Leaving directory `/root/Xen/xen-4.2-unstable/tools'
> make[1]: *** [subdirs-install] Error 2
> make[1]: Leaving directory `/root/Xen/xen-4.2-unstable/tools'
> make: *** [install-tools] Error 2
> ------
> root/Xen/xen-4.2-unstable/tools/blktap2/drivers/../../../tools/libaio/src  -c -o tapdisk-log.o tapdisk-log.c 
> cc1: warnings being treated as errors
> tapdisk-log.c: In function ‘tlog_flush’:
> tapdisk-log.c:250: error: ignoring return value of ‘write’, declared
> with attribute warn_unused_result
> ------
> /root/Xen/xen-4.2-unstable/tools/blktap2/drivers/../../../tools/libaio/src  -c -o tapdisk2.o tapdisk2.c 
> cc1: warnings being treated as errors
> tapdisk2.c: In function ‘main’:
> tapdisk2.c:82: error: ignoring return value of ‘chdir’, declared with
> attribute warn_unused_result
> ------
> cc1: warnings being treated as errors
> tapdisk-stream.c: In function ‘tapdisk_stream_poll_clear’:
> tapdisk-stream.c:148: error: ignoring return value of ‘read’, declared
> with attribute warn_unused_result
> tapdisk-stream.c: In function ‘tapdisk_stream_poll_set’:
> tapdisk-stream.c:158: error: ignoring return value of ‘write’,
> declared with attribute warn_unused_result
> tapdisk-stream.c: In function ‘tapdisk_stream_print_request’:
> tapdisk-stream.c:206: error: ignoring return value of ‘write’,
> declared with attribute warn_unused_result
> 
> 
> 
> Best Regards,
> Bei Guan
> 



_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Errors of doing "make install-tools" with xen-4.2-unstable?
  2012-05-11 14:08 Errors of doing "make install-tools" with xen-4.2-unstable? Bei Guan
  2012-05-11 14:16 ` Ian Campbell
@ 2012-05-11 14:19 ` Olaf Hering
  2012-05-11 15:26   ` Bei Guan
  1 sibling, 1 reply; 16+ messages in thread
From: Olaf Hering @ 2012-05-11 14:19 UTC (permalink / raw)
  To: xen-devel

On Fri, May 11, Bei Guan wrote:

> Hi,
> 
> When I do the "make install-tools" with xen-4.2-unstable, there are some errors
> about "warn_unused_result".
> Is it the error in code or the error in the compiling environment? Thank you so
> much.

I suggest to remove all -Werror from the Makefiles and introduce a
--disable-Werror/--enable-Werror configure option, similar to what
binutils and other projects have (not sure what the exact configure
option name is in those projects).

Olaf

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Errors of doing "make install-tools" with xen-4.2-unstable?
  2012-05-11 14:16 ` Ian Campbell
@ 2012-05-11 15:12   ` Bei Guan
  2012-05-11 15:47     ` Ian Campbell
  2012-05-11 16:16   ` Keir Fraser
  1 sibling, 1 reply; 16+ messages in thread
From: Bei Guan @ 2012-05-11 15:12 UTC (permalink / raw)
  To: Ian Campbell; +Cc: xen-devel


[-- Attachment #1.1: Type: text/plain, Size: 4375 bytes --]

2012/5/11 Ian Campbell <Ian.Campbell@citrix.com>

> On Fri, 2012-05-11 at 15:08 +0100, Bei Guan wrote:
> > When I do the "make install-tools" with xen-4.2-unstable, there are
> > some errors about "warn_unused_result".
> > Is it the error in code or the error in the compiling environment?
> > Thank you so much.
>
> This commit
>        changeset:   25275:27d63b9f111a
>        user:        Keir Fraser <keir@xen.org>
>        date:        Thu May 10 11:22:18 2012 +0100
>        summary:     blktap2: Do not build with -O0
> has caused more warnings to be generated by the compiler, which in turn
> leads to build failures. Since this is a compiler specific thing we are
> still tracking them all down.
>
> Can you confirm which versionof xen-unstable.hg you are using -- there
> have been several fixup patches since the above. If you are completely
> up to date and you still see errors we can dig into whatever is left.
>

Thank you for your reply. I have used "hg pull; hg update" to update to the
latest Xen and it is the version info:

root@gavin-desktop:~/Xen/xen-4.2-unstable# hg tip
changeset:   25287:54c8c9eaee92
tag:         tip
user:        Dietmar Hahn <dietmar.hahn@ts.fujitsu.com>
date:        Fri Apr 27 11:09:26 2012 +0200
summary:     docs: add vpmu description to xen-command-line.markdown

But, it still has the same errors.


Thanks,
Bei Guan



>
> Ian. (starting to think that this change wasn't suitable during a
> feature freeze....)
>
> >
> >
> > gcc  -O1 -fno-omit-frame-pointer -m64 -g -fno-strict-aliasing
> > -std=gnu99 -Wall -Wstrict-prototypes -Wdeclaration-after-statement
> > -D__XEN_TOOLS__ -MMD -MF .tapdisk-queue.o.d  -D_LARGEFILE_SOURCE
> > -D_LARGEFILE64_SOURCE -fno-optimize-sibling-calls -Werror -g
> > -Wno-unused -fno-strict-aliasing -I../include -I../drivers
> > -I/root/Xen/xen-4.2-unstable/tools/blktap2/drivers/../../../tools/libxc
> -I/root/Xen/xen-4.2-unstable/tools/blktap2/drivers/../../../tools/include
> -D_GNU_SOURCE -DUSE_NFS_LOCKS -fPIC -I
> /root/Xen/xen-4.2-unstable/tools/blktap2/drivers/../../../tools/libaio/src
>  -c -o tapdisk-queue.o tapdisk-queue.c
> > cc1: warnings being treated as errors
> > tapdisk-queue.c: In function ‘tapdisk_lio_ack_event’:
> > tapdisk-queue.c:438: error: ignoring return value of ‘read’, declared
> > with attribute warn_unused_result
> > make[5]: *** [tapdisk-queue.o] Error 1
> > make[5]: Leaving directory
> > `/root/Xen/xen-4.2-unstable/tools/blktap2/drivers'
> > make[4]: *** [subdir-install-drivers] Error 2
> > make[4]: Leaving directory `/root/Xen/xen-4.2-unstable/tools/blktap2'
> > make[3]: *** [subdirs-install] Error 2
> > make[3]: Leaving directory `/root/Xen/xen-4.2-unstable/tools/blktap2'
> > make[2]: *** [subdir-install-blktap2] Error 2
> > make[2]: Leaving directory `/root/Xen/xen-4.2-unstable/tools'
> > make[1]: *** [subdirs-install] Error 2
> > make[1]: Leaving directory `/root/Xen/xen-4.2-unstable/tools'
> > make: *** [install-tools] Error 2
> > ------
> >
> root/Xen/xen-4.2-unstable/tools/blktap2/drivers/../../../tools/libaio/src
>  -c -o tapdisk-log.o tapdisk-log.c
> > cc1: warnings being treated as errors
> > tapdisk-log.c: In function ‘tlog_flush’:
> > tapdisk-log.c:250: error: ignoring return value of ‘write’, declared
> > with attribute warn_unused_result
> > ------
> >
> /root/Xen/xen-4.2-unstable/tools/blktap2/drivers/../../../tools/libaio/src
>  -c -o tapdisk2.o tapdisk2.c
> > cc1: warnings being treated as errors
> > tapdisk2.c: In function ‘main’:
> > tapdisk2.c:82: error: ignoring return value of ‘chdir’, declared with
> > attribute warn_unused_result
> > ------
> > cc1: warnings being treated as errors
> > tapdisk-stream.c: In function ‘tapdisk_stream_poll_clear’:
> > tapdisk-stream.c:148: error: ignoring return value of ‘read’, declared
> > with attribute warn_unused_result
> > tapdisk-stream.c: In function ‘tapdisk_stream_poll_set’:
> > tapdisk-stream.c:158: error: ignoring return value of ‘write’,
> > declared with attribute warn_unused_result
> > tapdisk-stream.c: In function ‘tapdisk_stream_print_request’:
> > tapdisk-stream.c:206: error: ignoring return value of ‘write’,
> > declared with attribute warn_unused_result
> >
> >
> >
> > Best Regards,
> > Bei Guan
> >
>
>
>


-- 
Best Regards,
Bei Guan

[-- Attachment #1.2: Type: text/html, Size: 5376 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Errors of doing "make install-tools" with xen-4.2-unstable?
  2012-05-11 14:19 ` Olaf Hering
@ 2012-05-11 15:26   ` Bei Guan
  0 siblings, 0 replies; 16+ messages in thread
From: Bei Guan @ 2012-05-11 15:26 UTC (permalink / raw)
  To: Olaf Hering; +Cc: xen-devel


[-- Attachment #1.1: Type: text/plain, Size: 911 bytes --]

2012/5/11 Olaf Hering <olaf@aepfle.de>

> On Fri, May 11, Bei Guan wrote:
>
> > Hi,
> >
> > When I do the "make install-tools" with xen-4.2-unstable, there are some
> errors
> > about "warn_unused_result".
> > Is it the error in code or the error in the compiling environment? Thank
> you so
> > much.
>
> I suggest to remove all -Werror from the Makefiles and introduce a
> --disable-Werror/--enable-Werror configure option, similar to what
> binutils and other projects have (not sure what the exact configure
> option name is in those projects).
>
Thank you so much for your reply too.
It is better to have such as a choice to enable or disable -Werror option.
But, now it doesn't have in the configure file.


Thanks,
Bei Guan



>
> Olaf
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
>



-- 
Best Regards,
Bei Guan

[-- Attachment #1.2: Type: text/html, Size: 1601 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Errors of doing "make install-tools" with xen-4.2-unstable?
  2012-05-11 15:12   ` Bei Guan
@ 2012-05-11 15:47     ` Ian Campbell
  2012-05-11 16:10       ` Bei Guan
  0 siblings, 1 reply; 16+ messages in thread
From: Ian Campbell @ 2012-05-11 15:47 UTC (permalink / raw)
  To: Bei Guan, Keir Fraser; +Cc: xen-devel

On Fri, 2012-05-11 at 16:12 +0100, Bei Guan wrote:
> 
> 2012/5/11 Ian Campbell <Ian.Campbell@citrix.com>
>         On Fri, 2012-05-11 at 15:08 +0100, Bei Guan wrote:
>         > When I do the "make install-tools" with xen-4.2-unstable,
>         there are
>         > some errors about "warn_unused_result".
>         > Is it the error in code or the error in the compiling
>         environment?
>         > Thank you so much.
>         
>         
>         This commit
>                changeset:   25275:27d63b9f111a
>                user:        Keir Fraser <keir@xen.org>
>                date:        Thu May 10 11:22:18 2012 +0100
>                summary:     blktap2: Do not build with -O0
>         has caused more warnings to be generated by the compiler,
>         which in turn
>         leads to build failures. Since this is a compiler specific
>         thing we are
>         still tracking them all down.
>         
>         Can you confirm which versionof xen-unstable.hg you are using
>         -- there
>         have been several fixup patches since the above. If you are
>         completely
>         up to date and you still see errors we can dig into whatever
>         is left.
> 
> Thank you for your reply. I have used "hg pull; hg update" to update
> to the latest Xen and it is the version info:
> 
> root@gavin-desktop:~/Xen/xen-4.2-unstable# hg tip
> changeset:   25287:54c8c9eaee92
> tag:         tip
> user:        Dietmar Hahn <dietmar.hahn@ts.fujitsu.com>
> date:        Fri Apr 27 11:09:26 2012 +0200
> summary:     docs: add vpmu description to xen-command-line.markdown
> 
> But, it still has the same errors.

Thanks, looks like we still need to fix these errors then.

I'm not really happy with the following, but it's no worse than things
are today...

Bei, I don't see these build failures, does this work for you?

8<------------------------------------------------------

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1336751175 -3600
# Node ID 15ed8f45c4e57a1e206af020e0ff17b792108e99
# Parent  adc74e492edfee6cf44e433e3e93743a3cf71999
blktap: avoid attribute warn_unused_result build failures.

I'm not proud of this, but since none of these callers of read/write have any
other error handling and return void themselves (for several links up the call
chain AFAICT) and because I don't really want to get into a massive reworking
of blktap2 I suppose it is at least pragmatic

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>

diff -r adc74e492edf -r 15ed8f45c4e5 tools/blktap2/drivers/tapdisk-log.c
--- a/tools/blktap2/drivers/tapdisk-log.c	Fri May 11 16:19:16 2012 +0100
+++ b/tools/blktap2/drivers/tapdisk-log.c	Fri May 11 16:46:15 2012 +0100
@@ -247,7 +247,7 @@ tlog_flush(void)
 	wsize = ((size + 511) & (~511));
 
 	memset(tapdisk_log.buf + size, '\n', wsize - size);
-	write(fd, tapdisk_log.buf, wsize);
+	(void)write(fd, tapdisk_log.buf, wsize);
 
 	tapdisk_log.p = tapdisk_log.buf;
 
diff -r adc74e492edf -r 15ed8f45c4e5 tools/blktap2/drivers/tapdisk-queue.c
--- a/tools/blktap2/drivers/tapdisk-queue.c	Fri May 11 16:19:16 2012 +0100
+++ b/tools/blktap2/drivers/tapdisk-queue.c	Fri May 11 16:46:15 2012 +0100
@@ -435,7 +435,7 @@ tapdisk_lio_ack_event(struct tqueue *que
 	uint64_t val;
 
 	if (lio->flags & LIO_FLAG_EVENTFD)
-		read(lio->event_fd, &val, sizeof(val));
+		(void)read(lio->event_fd, &val, sizeof(val));
 }
 
 static void
diff -r adc74e492edf -r 15ed8f45c4e5 tools/blktap2/drivers/tapdisk-stream.c
--- a/tools/blktap2/drivers/tapdisk-stream.c	Fri May 11 16:19:16 2012 +0100
+++ b/tools/blktap2/drivers/tapdisk-stream.c	Fri May 11 16:46:15 2012 +0100
@@ -145,7 +145,7 @@ tapdisk_stream_poll_clear(struct tapdisk
 {
 	int dummy;
 
-	read(p->pipe[POLL_READ], &dummy, sizeof(dummy));
+	(void)read(p->pipe[POLL_READ], &dummy, sizeof(dummy));
 	p->set = 0;
 }
 
@@ -155,7 +155,7 @@ tapdisk_stream_poll_set(struct tapdisk_s
 	int dummy = 0;
 
 	if (!p->set) {
-		write(p->pipe[POLL_WRITE], &dummy, sizeof(dummy));
+		(void)write(p->pipe[POLL_WRITE], &dummy, sizeof(dummy));
 		p->set = 1;
 	}
 }
@@ -203,7 +203,7 @@ tapdisk_stream_print_request(struct tapd
 {
 	unsigned long idx = (unsigned long)tapdisk_stream_request_idx(s, sreq);
 	char *buf = (char *)MMAP_VADDR(s->vbd->ring.vstart, idx, 0);
-	write(s->out_fd, buf, sreq->secs << SECTOR_SHIFT);
+	(void)write(s->out_fd, buf, sreq->secs << SECTOR_SHIFT);
 }
 
 static void
diff -r adc74e492edf -r 15ed8f45c4e5 tools/blktap2/drivers/tapdisk2.c
--- a/tools/blktap2/drivers/tapdisk2.c	Fri May 11 16:19:16 2012 +0100
+++ b/tools/blktap2/drivers/tapdisk2.c	Fri May 11 16:46:15 2012 +0100
@@ -79,7 +79,12 @@ main(int argc, char *argv[])
 	if (optind != argc)
 		usage(argv[0], EINVAL);
 
-	chdir("/");
+	if (chdir("/")) {
+		DPRINTF("failed to chdir(/): %d\n", errno);
+		err = 1;
+		goto out;
+	}
+
 	tapdisk_start_logging("tapdisk2");
 
 	err = tapdisk_server_init();

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Errors of doing "make install-tools" with xen-4.2-unstable?
  2012-05-11 15:47     ` Ian Campbell
@ 2012-05-11 16:10       ` Bei Guan
  2012-05-11 16:18         ` Keir Fraser
  2012-05-11 16:24         ` Ian Campbell
  0 siblings, 2 replies; 16+ messages in thread
From: Bei Guan @ 2012-05-11 16:10 UTC (permalink / raw)
  To: Ian Campbell; +Cc: Keir Fraser, xen-devel


[-- Attachment #1.1: Type: text/plain, Size: 6557 bytes --]

2012/5/11 Ian Campbell <Ian.Campbell@citrix.com>

> On Fri, 2012-05-11 at 16:12 +0100, Bei Guan wrote:
> >
> > 2012/5/11 Ian Campbell <Ian.Campbell@citrix.com>
> >         On Fri, 2012-05-11 at 15:08 +0100, Bei Guan wrote:
> >         > When I do the "make install-tools" with xen-4.2-unstable,
> >         there are
> >         > some errors about "warn_unused_result".
> >         > Is it the error in code or the error in the compiling
> >         environment?
> >         > Thank you so much.
> >
> >
> >         This commit
> >                changeset:   25275:27d63b9f111a
> >                user:        Keir Fraser <keir@xen.org>
> >                date:        Thu May 10 11:22:18 2012 +0100
> >                summary:     blktap2: Do not build with -O0
> >         has caused more warnings to be generated by the compiler,
> >         which in turn
> >         leads to build failures. Since this is a compiler specific
> >         thing we are
> >         still tracking them all down.
> >
> >         Can you confirm which versionof xen-unstable.hg you are using
> >         -- there
> >         have been several fixup patches since the above. If you are
> >         completely
> >         up to date and you still see errors we can dig into whatever
> >         is left.
> >
> > Thank you for your reply. I have used "hg pull; hg update" to update
> > to the latest Xen and it is the version info:
> >
> > root@gavin-desktop:~/Xen/xen-4.2-unstable# hg tip
> > changeset:   25287:54c8c9eaee92
> > tag:         tip
> > user:        Dietmar Hahn <dietmar.hahn@ts.fujitsu.com>
> > date:        Fri Apr 27 11:09:26 2012 +0200
> > summary:     docs: add vpmu description to xen-command-line.markdown
> >
> > But, it still has the same errors.
>
> Thanks, looks like we still need to fix these errors then.
>
> I'm not really happy with the following, but it's no worse than things
> are today...
>
> Bei, I don't see these build failures, does this work for you?
>

No, it doesn't work for me. There is the same error.
My environment and gcc version are like this:

root@gavin-desktop:~# uname -a
Linux gavin-desktop 2.6.32-5-xen-amd64 #1 SMP Thu May 19 01:16:47 UTC 2011
x86_64 GNU/Linux

root@gavin-desktop:~# gcc -v
Using built-in specs.
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu
4.4.3-4ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared
--enable-multiarch --enable-linker-build-id --with-system-zlib
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.4 --program-suffix=-4.4
--enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-plugin
--enable-objc-gc --disable-werror --with-arch-32=i486 --with-tune=generic
--enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu
--target=x86_64-linux-gnu
Thread model: posix
gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5)




Thanks,
Bei Guan





>
> 8<------------------------------------------------------
>
> # HG changeset patch
> # User Ian Campbell <ian.campbell@citrix.com>
> # Date 1336751175 -3600
> # Node ID 15ed8f45c4e57a1e206af020e0ff17b792108e99
> # Parent  adc74e492edfee6cf44e433e3e93743a3cf71999
> blktap: avoid attribute warn_unused_result build failures.
>
> I'm not proud of this, but since none of these callers of read/write have
> any
> other error handling and return void themselves (for several links up the
> call
> chain AFAICT) and because I don't really want to get into a massive
> reworking
> of blktap2 I suppose it is at least pragmatic
>
> Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
>
> diff -r adc74e492edf -r 15ed8f45c4e5 tools/blktap2/drivers/tapdisk-log.c
> --- a/tools/blktap2/drivers/tapdisk-log.c       Fri May 11 16:19:16 2012
> +0100
> +++ b/tools/blktap2/drivers/tapdisk-log.c       Fri May 11 16:46:15 2012
> +0100
> @@ -247,7 +247,7 @@ tlog_flush(void)
>        wsize = ((size + 511) & (~511));
>
>        memset(tapdisk_log.buf + size, '\n', wsize - size);
> -       write(fd, tapdisk_log.buf, wsize);
> +       (void)write(fd, tapdisk_log.buf, wsize);
>
>        tapdisk_log.p = tapdisk_log.buf;
>
> diff -r adc74e492edf -r 15ed8f45c4e5 tools/blktap2/drivers/tapdisk-queue.c
> --- a/tools/blktap2/drivers/tapdisk-queue.c     Fri May 11 16:19:16 2012
> +0100
> +++ b/tools/blktap2/drivers/tapdisk-queue.c     Fri May 11 16:46:15 2012
> +0100
> @@ -435,7 +435,7 @@ tapdisk_lio_ack_event(struct tqueue *que
>        uint64_t val;
>
>        if (lio->flags & LIO_FLAG_EVENTFD)
> -               read(lio->event_fd, &val, sizeof(val));
> +               (void)read(lio->event_fd, &val, sizeof(val));
>  }
>
>  static void
> diff -r adc74e492edf -r 15ed8f45c4e5 tools/blktap2/drivers/tapdisk-stream.c
> --- a/tools/blktap2/drivers/tapdisk-stream.c    Fri May 11 16:19:16 2012
> +0100
> +++ b/tools/blktap2/drivers/tapdisk-stream.c    Fri May 11 16:46:15 2012
> +0100
> @@ -145,7 +145,7 @@ tapdisk_stream_poll_clear(struct tapdisk
>  {
>        int dummy;
>
> -       read(p->pipe[POLL_READ], &dummy, sizeof(dummy));
> +       (void)read(p->pipe[POLL_READ], &dummy, sizeof(dummy));
>        p->set = 0;
>  }
>
> @@ -155,7 +155,7 @@ tapdisk_stream_poll_set(struct tapdisk_s
>        int dummy = 0;
>
>        if (!p->set) {
> -               write(p->pipe[POLL_WRITE], &dummy, sizeof(dummy));
> +               (void)write(p->pipe[POLL_WRITE], &dummy, sizeof(dummy));
>                p->set = 1;
>        }
>  }
> @@ -203,7 +203,7 @@ tapdisk_stream_print_request(struct tapd
>  {
>        unsigned long idx = (unsigned long)tapdisk_stream_request_idx(s,
> sreq);
>        char *buf = (char *)MMAP_VADDR(s->vbd->ring.vstart, idx, 0);
> -       write(s->out_fd, buf, sreq->secs << SECTOR_SHIFT);
> +       (void)write(s->out_fd, buf, sreq->secs << SECTOR_SHIFT);
>  }
>
>  static void
> diff -r adc74e492edf -r 15ed8f45c4e5 tools/blktap2/drivers/tapdisk2.c
> --- a/tools/blktap2/drivers/tapdisk2.c  Fri May 11 16:19:16 2012 +0100
> +++ b/tools/blktap2/drivers/tapdisk2.c  Fri May 11 16:46:15 2012 +0100
> @@ -79,7 +79,12 @@ main(int argc, char *argv[])
>        if (optind != argc)
>                usage(argv[0], EINVAL);
>
> -       chdir("/");
> +       if (chdir("/")) {
> +               DPRINTF("failed to chdir(/): %d\n", errno);
> +               err = 1;
> +               goto out;
> +       }
> +
>        tapdisk_start_logging("tapdisk2");
>
>        err = tapdisk_server_init();
>
>
>


-- 
Best Regards,
Bei Guan

[-- Attachment #1.2: Type: text/html, Size: 8142 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Errors of doing "make install-tools" with xen-4.2-unstable?
  2012-05-11 14:16 ` Ian Campbell
  2012-05-11 15:12   ` Bei Guan
@ 2012-05-11 16:16   ` Keir Fraser
  1 sibling, 0 replies; 16+ messages in thread
From: Keir Fraser @ 2012-05-11 16:16 UTC (permalink / raw)
  To: Ian Campbell, Bei Guan; +Cc: xen-devel

On 11/05/2012 15:16, "Ian Campbell" <Ian.Campbell@citrix.com> wrote:

> On Fri, 2012-05-11 at 15:08 +0100, Bei Guan wrote:
> When I do the "make
> install-tools" with xen-4.2-unstable, there are
> some errors about
> "warn_unused_result".
> Is it the error in code or the error in the compiling
> environment?
> Thank you so much.

This commit
        changeset:
> 25275:27d63b9f111a
        user:        Keir Fraser <keir@xen.org>

> date:        Thu May 10 11:22:18 2012 +0100
        summary:     blktap2: Do
> not build with -O0
has caused more warnings to be generated by the compiler,
> which in turn
leads to build failures. Since this is a compiler specific thing
> we are
still tracking them all down.

Can you confirm which versionof
> xen-unstable.hg you are using -- there
have been several fixup patches since
> the above. If you are completely
up to date and you still see errors we can
> dig into whatever is left.

Ian. (starting to think that this change wasn't
> suitable during a
feature freeze....)

The original reason for making this fix now was build failure on Fedora 17,
due to -O0 implying -D_FORTIFY_SOURCE=2, and some kind of fall-out from
that. A simpler feature-freeze fix might be to simply disable -Werror for
subtrees that are using -O0. Since this needs backport for 4.0 and 4.1 as
well. Or perhaps we are nearly at the end of the bug tail. ;-)

 -- Keir

> 
> 
> gcc  -O1 
> -fno-omit-frame-pointer -m64 -g -fno-strict-aliasing
> -std=gnu99 -Wall
> -Wstrict-prototypes -Wdeclaration-after-statement
> -D__XEN_TOOLS__ -MMD -MF
> .tapdisk-queue.o.d  -D_LARGEFILE_SOURCE
> -D_LARGEFILE64_SOURCE
> -fno-optimize-sibling-calls -Werror -g
> -Wno-unused -fno-strict-aliasing
> -I../include -I../drivers
>
> -I/root/Xen/xen-4.2-unstable/tools/blktap2/drivers/../../../tools/libxc
> -I/root/Xen/xen-4.2-unstable/tools/blktap2/drivers/../../../tools/include
> -D_GNU_SOURCE -DUSE_NFS_LOCKS -fPIC -I
> /root/Xen/xen-4.2-unstable/tools/blktap2/drivers/../../../tools/libaio/src  -c
> -o tapdisk-queue.o tapdisk-queue.c 
> cc1: warnings being treated as errors
>
> tapdisk-queue.c: In function Œtapdisk_lio_ack_event¹:
> tapdisk-queue.c:438:
> error: ignoring return value of Œread¹, declared
> with attribute
> warn_unused_result
> make[5]: *** [tapdisk-queue.o] Error 1
> make[5]: Leaving
> directory
> `/root/Xen/xen-4.2-unstable/tools/blktap2/drivers'
> make[4]: ***
> [subdir-install-drivers] Error 2
> make[4]: Leaving directory
> `/root/Xen/xen-4.2-unstable/tools/blktap2'
> make[3]: *** [subdirs-install]
> Error 2
> make[3]: Leaving directory
> `/root/Xen/xen-4.2-unstable/tools/blktap2'
> make[2]: ***
> [subdir-install-blktap2] Error 2
> make[2]: Leaving directory
> `/root/Xen/xen-4.2-unstable/tools'
> make[1]: *** [subdirs-install] Error 2
>
> make[1]: Leaving directory `/root/Xen/xen-4.2-unstable/tools'
> make: ***
> [install-tools] Error 2
> ------
>
> root/Xen/xen-4.2-unstable/tools/blktap2/drivers/../../../tools/libaio/src  -c
> -o tapdisk-log.o tapdisk-log.c 
> cc1: warnings being treated as errors
>
> tapdisk-log.c: In function Œtlog_flush¹:
> tapdisk-log.c:250: error: ignoring
> return value of Œwrite¹, declared
> with attribute warn_unused_result
>
> ------
> 
> /root/Xen/xen-4.2-unstable/tools/blktap2/drivers/../../../tools/libaio/src  -c
> -o tapdisk2.o tapdisk2.c 
> cc1: warnings being treated as errors
>
> tapdisk2.c: In function Œmain¹:
> tapdisk2.c:82: error: ignoring return value
> of Œchdir¹, declared with
> attribute warn_unused_result
> ------
> cc1:
> warnings being treated as errors
> tapdisk-stream.c: In function
> Œtapdisk_stream_poll_clear¹:
> tapdisk-stream.c:148: error: ignoring return
> value of Œread¹, declared
> with attribute warn_unused_result
>
> tapdisk-stream.c: In function Œtapdisk_stream_poll_set¹:
>
> tapdisk-stream.c:158: error: ignoring return value of Œwrite¹,
> declared with
> attribute warn_unused_result
> tapdisk-stream.c: In function
> Œtapdisk_stream_print_request¹:
> tapdisk-stream.c:206: error: ignoring return
> value of Œwrite¹,
> declared with attribute warn_unused_result
> 
> 
> 
> Best
> Regards,
> Bei Guan
>
> 



_______________________________________________
Xen-devel mailing
> list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Errors of doing "make install-tools" with xen-4.2-unstable?
  2012-05-11 16:10       ` Bei Guan
@ 2012-05-11 16:18         ` Keir Fraser
  2012-05-11 16:24         ` Ian Campbell
  1 sibling, 0 replies; 16+ messages in thread
From: Keir Fraser @ 2012-05-11 16:18 UTC (permalink / raw)
  To: Bei Guan, Ian Campbell; +Cc: xen-devel

On 11/05/2012 17:10, "Bei Guan" <gbtju85@gmail.com> wrote:

> 2012/5/11 Ian Campbell <Ian.Campbell@citrix.com>
>> On Fri, 2012-05-11 at 16:12 +0100, Bei Guan wrote:
>>> 
>>> 2012/5/11 Ian Campbell <Ian.Campbell@citrix.com>

>>> 
>>> Thank you for your reply. I have used "hg pull; hg update" to update
>>> to the latest Xen and it is the version info:
>>> 
>>> root@gavin-desktop:~/Xen/xen-4.2-unstable# hg tip
>>> changeset:   25287:54c8c9eaee92
>>> tag:         tip
>>> user:        Dietmar Hahn <dietmar.hahn@ts.fujitsu.com>
>>> date:        Fri Apr 27 11:09:26 2012 +0200
>>> summary:     docs: add vpmu description to xen-command-line.markdown
>>> 
>>> But, it still has the same errors.
>> 
>> Thanks, looks like we still need to fix these errors then.
>> 
>> I'm not really happy with the following, but it's no worse than things
>> are today...
>> 
>> Bei, I don't see these build failures, does this work for you?
> 
> No, it doesn't work for me. There is the same error.
> My environment and gcc version are like this:

I think the problem is that casting the function result to void doesn't work
around this warning. You actually have to do something with the return code.
:-(

 -- Keir

> root@gavin-desktop:~# uname -a
> Linux gavin-desktop 2.6.32-5-xen-amd64 #1 SMP Thu May 19 01:16:47 UTC 2011
> x86_64 GNU/Linux
> 
> root@gavin-desktop:~# gcc -v
> Using built-in specs.
> Target: x86_64-linux-gnu
> Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.4.3-4ubuntu5'
> --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs
> --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared
> --enable-multiarch --enable-linker-build-id --with-system-zlib
> --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
> --with-gxx-include-dir=/usr/include/c++/4.4 --program-suffix=-4.4 --enable-nls
> --enable-clocale=gnu --enable-libstdcxx-debug --enable-plugin --enable-objc-gc
> --disable-werror --with-arch-32=i486 --with-tune=generic
> --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu
> --target=x86_64-linux-gnu
> Thread model: posix
> gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5)
> 
> 
> 
> 
> Thanks,
> Bei Guan
> 
> 
> 
>  
>> 
>> 8<------------------------------------------------------
>> 
>> # HG changeset patch
>> # User Ian Campbell <ian.campbell@citrix.com>
>> # Date 1336751175 -3600
>> # Node ID 15ed8f45c4e57a1e206af020e0ff17b792108e99
>> # Parent  adc74e492edfee6cf44e433e3e93743a3cf71999
>> blktap: avoid attribute warn_unused_result build failures.
>> 
>> I'm not proud of this, but since none of these callers of read/write have any
>> other error handling and return void themselves (for several links up the
>> call
>> chain AFAICT) and because I don't really want to get into a massive reworking
>> of blktap2 I suppose it is at least pragmatic
>> 
>> Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
>> 
>> diff -r adc74e492edf -r 15ed8f45c4e5 tools/blktap2/drivers/tapdisk-log.c
>> --- a/tools/blktap2/drivers/tapdisk-log.c       Fri May 11 16:19:16 2012
>> +0100
>> +++ b/tools/blktap2/drivers/tapdisk-log.c       Fri May 11 16:46:15 2012
>> +0100
>> @@ -247,7 +247,7 @@ tlog_flush(void)
>>         wsize = ((size + 511) & (~511));
>> 
>>         memset(tapdisk_log.buf + size, '\n', wsize - size);
>> -       write(fd, tapdisk_log.buf, wsize);
>> +       (void)write(fd, tapdisk_log.buf, wsize);
>> 
>>         tapdisk_log.p = tapdisk_log.buf;
>> 
>> diff -r adc74e492edf -r 15ed8f45c4e5 tools/blktap2/drivers/tapdisk-queue.c
>> --- a/tools/blktap2/drivers/tapdisk-queue.c     Fri May 11 16:19:16 2012
>> +0100
>> +++ b/tools/blktap2/drivers/tapdisk-queue.c     Fri May 11 16:46:15 2012
>> +0100
>> @@ -435,7 +435,7 @@ tapdisk_lio_ack_event(struct tqueue *que
>>         uint64_t val;
>> 
>>         if (lio->flags & LIO_FLAG_EVENTFD)
>> -               read(lio->event_fd, &val, sizeof(val));
>> +               (void)read(lio->event_fd, &val, sizeof(val));
>>  }
>> 
>>  static void
>> diff -r adc74e492edf -r 15ed8f45c4e5 tools/blktap2/drivers/tapdisk-stream.c
>> --- a/tools/blktap2/drivers/tapdisk-stream.c    Fri May 11 16:19:16 2012
>> +0100
>> +++ b/tools/blktap2/drivers/tapdisk-stream.c    Fri May 11 16:46:15 2012
>> +0100
>> @@ -145,7 +145,7 @@ tapdisk_stream_poll_clear(struct tapdisk
>>  {
>>         int dummy;
>> 
>> -       read(p->pipe[POLL_READ], &dummy, sizeof(dummy));
>> +       (void)read(p->pipe[POLL_READ], &dummy, sizeof(dummy));
>>         p->set = 0;
>>  }
>> 
>> @@ -155,7 +155,7 @@ tapdisk_stream_poll_set(struct tapdisk_s
>>         int dummy = 0;
>> 
>>         if (!p->set) {
>> -               write(p->pipe[POLL_WRITE], &dummy, sizeof(dummy));
>> +               (void)write(p->pipe[POLL_WRITE], &dummy, sizeof(dummy));
>>                 p->set = 1;
>>         }
>>  }
>> @@ -203,7 +203,7 @@ tapdisk_stream_print_request(struct tapd
>>  {
>>         unsigned long idx = (unsigned long)tapdisk_stream_request_idx(s,
>> sreq);
>>         char *buf = (char *)MMAP_VADDR(s->vbd->ring.vstart, idx, 0);
>> -       write(s->out_fd, buf, sreq->secs << SECTOR_SHIFT);
>> +       (void)write(s->out_fd, buf, sreq->secs << SECTOR_SHIFT);
>>  }
>> 
>>  static void
>> diff -r adc74e492edf -r 15ed8f45c4e5 tools/blktap2/drivers/tapdisk2.c
>> --- a/tools/blktap2/drivers/tapdisk2.c  Fri May 11 16:19:16 2012 +0100
>> +++ b/tools/blktap2/drivers/tapdisk2.c  Fri May 11 16:46:15 2012 +0100
>> @@ -79,7 +79,12 @@ main(int argc, char *argv[])
>>         if (optind != argc)
>>                 usage(argv[0], EINVAL);
>> 
>> -       chdir("/");
>> +       if (chdir("/")) {
>> +               DPRINTF("failed to chdir(/): %d\n", errno);
>> +               err = 1;
>> +               goto out;
>> +       }
>> +
>>         tapdisk_start_logging("tapdisk2");
>> 
>>         err = tapdisk_server_init();
>> 
>> 
> 
> 

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Errors of doing "make install-tools" with xen-4.2-unstable?
  2012-05-11 16:10       ` Bei Guan
  2012-05-11 16:18         ` Keir Fraser
@ 2012-05-11 16:24         ` Ian Campbell
  2012-05-11 16:33           ` Bei Guan
  2012-05-11 16:44           ` Keir Fraser
  1 sibling, 2 replies; 16+ messages in thread
From: Ian Campbell @ 2012-05-11 16:24 UTC (permalink / raw)
  To: Bei Guan; +Cc: Keir (Xen.org), xen-devel

On Fri, 2012-05-11 at 17:10 +0100, Bei Guan wrote:


> No, it doesn't work for me. There is the same error.

Hrm. Since you can reproduce would you mind experimenting a bit to
figure out the correct fix for this?

Perhaps adding -Wno-unused-result to C flags helps (google suggests it
may not)?

Or maybe just assigning to a dummy variable.

Ian.

> My environment and gcc version are like this:
> 
> root@gavin-desktop:~# uname -a
> Linux gavin-desktop 2.6.32-5-xen-amd64 #1 SMP Thu May 19 01:16:47 UTC
> 2011 x86_64 GNU/Linux
> 
> root@gavin-desktop:~# gcc -v
> Using built-in specs.
> Target: x86_64-linux-gnu
> Configured with: ../src/configure -v --with-pkgversion='Ubuntu
> 4.4.3-4ubuntu5'
> --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs
> --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr
> --enable-shared --enable-multiarch --enable-linker-build-id
> --with-system-zlib --libexecdir=/usr/lib --without-included-gettext
> --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4
> --program-suffix=-4.4 --enable-nls --enable-clocale=gnu
> --enable-libstdcxx-debug --enable-plugin --enable-objc-gc
> --disable-werror --with-arch-32=i486 --with-tune=generic
> --enable-checking=release --build=x86_64-linux-gnu
> --host=x86_64-linux-gnu --target=x86_64-linux-gnu
> Thread model: posix
> gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5) 
> 
> 
> 
> 
> Thanks,
> Bei Guan
> 
> 
> 
>  
>         
>         8<------------------------------------------------------
>         
>         # HG changeset patch
>         # User Ian Campbell <ian.campbell@citrix.com>
>         # Date 1336751175 -3600
>         # Node ID 15ed8f45c4e57a1e206af020e0ff17b792108e99
>         # Parent  adc74e492edfee6cf44e433e3e93743a3cf71999
>         blktap: avoid attribute warn_unused_result build failures.
>         
>         I'm not proud of this, but since none of these callers of
>         read/write have any
>         other error handling and return void themselves (for several
>         links up the call
>         chain AFAICT) and because I don't really want to get into a
>         massive reworking
>         of blktap2 I suppose it is at least pragmatic
>         
>         Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
>         
>         diff -r adc74e492edf -r 15ed8f45c4e5
>         tools/blktap2/drivers/tapdisk-log.c
>         --- a/tools/blktap2/drivers/tapdisk-log.c       Fri May 11
>         16:19:16 2012 +0100
>         +++ b/tools/blktap2/drivers/tapdisk-log.c       Fri May 11
>         16:46:15 2012 +0100
>         @@ -247,7 +247,7 @@ tlog_flush(void)
>                wsize = ((size + 511) & (~511));
>         
>                memset(tapdisk_log.buf + size, '\n', wsize - size);
>         -       write(fd, tapdisk_log.buf, wsize);
>         +       (void)write(fd, tapdisk_log.buf, wsize);
>         
>                tapdisk_log.p = tapdisk_log.buf;
>         
>         diff -r adc74e492edf -r 15ed8f45c4e5
>         tools/blktap2/drivers/tapdisk-queue.c
>         --- a/tools/blktap2/drivers/tapdisk-queue.c     Fri May 11
>         16:19:16 2012 +0100
>         +++ b/tools/blktap2/drivers/tapdisk-queue.c     Fri May 11
>         16:46:15 2012 +0100
>         @@ -435,7 +435,7 @@ tapdisk_lio_ack_event(struct tqueue *que
>                uint64_t val;
>         
>                if (lio->flags & LIO_FLAG_EVENTFD)
>         -               read(lio->event_fd, &val, sizeof(val));
>         +               (void)read(lio->event_fd, &val, sizeof(val));
>          }
>         
>          static void
>         diff -r adc74e492edf -r 15ed8f45c4e5
>         tools/blktap2/drivers/tapdisk-stream.c
>         --- a/tools/blktap2/drivers/tapdisk-stream.c    Fri May 11
>         16:19:16 2012 +0100
>         +++ b/tools/blktap2/drivers/tapdisk-stream.c    Fri May 11
>         16:46:15 2012 +0100
>         @@ -145,7 +145,7 @@ tapdisk_stream_poll_clear(struct tapdisk
>          {
>                int dummy;
>         
>         -       read(p->pipe[POLL_READ], &dummy, sizeof(dummy));
>         +       (void)read(p->pipe[POLL_READ], &dummy, sizeof(dummy));
>                p->set = 0;
>          }
>         
>         @@ -155,7 +155,7 @@ tapdisk_stream_poll_set(struct tapdisk_s
>                int dummy = 0;
>         
>                if (!p->set) {
>         -               write(p->pipe[POLL_WRITE], &dummy,
>         sizeof(dummy));
>         +               (void)write(p->pipe[POLL_WRITE], &dummy,
>         sizeof(dummy));
>                        p->set = 1;
>                }
>          }
>         @@ -203,7 +203,7 @@ tapdisk_stream_print_request(struct tapd
>          {
>                unsigned long idx = (unsigned
>         long)tapdisk_stream_request_idx(s, sreq);
>                char *buf = (char *)MMAP_VADDR(s->vbd->ring.vstart,
>         idx, 0);
>         -       write(s->out_fd, buf, sreq->secs << SECTOR_SHIFT);
>         +       (void)write(s->out_fd, buf, sreq->secs <<
>         SECTOR_SHIFT);
>          }
>         
>          static void
>         diff -r adc74e492edf -r 15ed8f45c4e5
>         tools/blktap2/drivers/tapdisk2.c
>         --- a/tools/blktap2/drivers/tapdisk2.c  Fri May 11 16:19:16
>         2012 +0100
>         +++ b/tools/blktap2/drivers/tapdisk2.c  Fri May 11 16:46:15
>         2012 +0100
>         @@ -79,7 +79,12 @@ main(int argc, char *argv[])
>                if (optind != argc)
>                        usage(argv[0], EINVAL);
>         
>         -       chdir("/");
>         +       if (chdir("/")) {
>         +               DPRINTF("failed to chdir(/): %d\n", errno);
>         +               err = 1;
>         +               goto out;
>         +       }
>         +
>                tapdisk_start_logging("tapdisk2");
>         
>                err = tapdisk_server_init();
>         
>         
> 
> 
> 
> -- 
> Best Regards,
> Bei Guan
> 

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Errors of doing "make install-tools" with xen-4.2-unstable?
  2012-05-11 16:24         ` Ian Campbell
@ 2012-05-11 16:33           ` Bei Guan
  2012-05-11 16:47             ` Keir Fraser
  2012-05-11 16:44           ` Keir Fraser
  1 sibling, 1 reply; 16+ messages in thread
From: Bei Guan @ 2012-05-11 16:33 UTC (permalink / raw)
  To: Ian Campbell; +Cc: Keir (Xen.org), xen-devel


[-- Attachment #1.1: Type: text/plain, Size: 6676 bytes --]

2012/5/12 Ian Campbell <Ian.Campbell@citrix.com>

> On Fri, 2012-05-11 at 17:10 +0100, Bei Guan wrote:
>
>
> > No, it doesn't work for me. There is the same error.
>
> Hrm. Since you can reproduce would you mind experimenting a bit to
> figure out the correct fix for this?
>
> Perhaps adding -Wno-unused-result to C flags helps (google suggests it
> may not)?
>
Yes, I add this option to Makefile. And now it works well. The patch is as
the following. Thank you very much.


diff -r 54c8c9eaee92 tools/blktap2/drivers/Makefile
--- a/tools/blktap2/drivers/Makefile    Fri Apr 27 11:09:26 2012 +0200
+++ b/tools/blktap2/drivers/Makefile    Sat May 12 00:31:12 2012 +0800
@@ -11,6 +11,7 @@

 CFLAGS    += -Werror -g
 CFLAGS    += -Wno-unused
+CFLAGS    += -Wno-unused-result
 CFLAGS    += -fno-strict-aliasing
 CFLAGS    += -I$(BLKTAP_ROOT)/include -I$(BLKTAP_ROOT)/drivers
 CFLAGS    += $(CFLAGS_libxenctrl)




Thanks,
Bei Guan





>
> Or maybe just assigning to a dummy variable.
>
> Ian.
>
> > My environment and gcc version are like this:
> >
> > root@gavin-desktop:~# uname -a
> > Linux gavin-desktop 2.6.32-5-xen-amd64 #1 SMP Thu May 19 01:16:47 UTC
> > 2011 x86_64 GNU/Linux
> >
> > root@gavin-desktop:~# gcc -v
> > Using built-in specs.
> > Target: x86_64-linux-gnu
> > Configured with: ../src/configure -v --with-pkgversion='Ubuntu
> > 4.4.3-4ubuntu5'
> > --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs
> > --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr
> > --enable-shared --enable-multiarch --enable-linker-build-id
> > --with-system-zlib --libexecdir=/usr/lib --without-included-gettext
> > --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4
> > --program-suffix=-4.4 --enable-nls --enable-clocale=gnu
> > --enable-libstdcxx-debug --enable-plugin --enable-objc-gc
> > --disable-werror --with-arch-32=i486 --with-tune=generic
> > --enable-checking=release --build=x86_64-linux-gnu
> > --host=x86_64-linux-gnu --target=x86_64-linux-gnu
> > Thread model: posix
> > gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5)
> >
> >
> >
> >
> > Thanks,
> > Bei Guan
> >
> >
> >
> >
> >
> >         8<------------------------------------------------------
> >
> >         # HG changeset patch
> >         # User Ian Campbell <ian.campbell@citrix.com>
> >         # Date 1336751175 -3600
> >         # Node ID 15ed8f45c4e57a1e206af020e0ff17b792108e99
> >         # Parent  adc74e492edfee6cf44e433e3e93743a3cf71999
> >         blktap: avoid attribute warn_unused_result build failures.
> >
> >         I'm not proud of this, but since none of these callers of
> >         read/write have any
> >         other error handling and return void themselves (for several
> >         links up the call
> >         chain AFAICT) and because I don't really want to get into a
> >         massive reworking
> >         of blktap2 I suppose it is at least pragmatic
> >
> >         Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
> >
> >         diff -r adc74e492edf -r 15ed8f45c4e5
> >         tools/blktap2/drivers/tapdisk-log.c
> >         --- a/tools/blktap2/drivers/tapdisk-log.c       Fri May 11
> >         16:19:16 2012 +0100
> >         +++ b/tools/blktap2/drivers/tapdisk-log.c       Fri May 11
> >         16:46:15 2012 +0100
> >         @@ -247,7 +247,7 @@ tlog_flush(void)
> >                wsize = ((size + 511) & (~511));
> >
> >                memset(tapdisk_log.buf + size, '\n', wsize - size);
> >         -       write(fd, tapdisk_log.buf, wsize);
> >         +       (void)write(fd, tapdisk_log.buf, wsize);
> >
> >                tapdisk_log.p = tapdisk_log.buf;
> >
> >         diff -r adc74e492edf -r 15ed8f45c4e5
> >         tools/blktap2/drivers/tapdisk-queue.c
> >         --- a/tools/blktap2/drivers/tapdisk-queue.c     Fri May 11
> >         16:19:16 2012 +0100
> >         +++ b/tools/blktap2/drivers/tapdisk-queue.c     Fri May 11
> >         16:46:15 2012 +0100
> >         @@ -435,7 +435,7 @@ tapdisk_lio_ack_event(struct tqueue *que
> >                uint64_t val;
> >
> >                if (lio->flags & LIO_FLAG_EVENTFD)
> >         -               read(lio->event_fd, &val, sizeof(val));
> >         +               (void)read(lio->event_fd, &val, sizeof(val));
> >          }
> >
> >          static void
> >         diff -r adc74e492edf -r 15ed8f45c4e5
> >         tools/blktap2/drivers/tapdisk-stream.c
> >         --- a/tools/blktap2/drivers/tapdisk-stream.c    Fri May 11
> >         16:19:16 2012 +0100
> >         +++ b/tools/blktap2/drivers/tapdisk-stream.c    Fri May 11
> >         16:46:15 2012 +0100
> >         @@ -145,7 +145,7 @@ tapdisk_stream_poll_clear(struct tapdisk
> >          {
> >                int dummy;
> >
> >         -       read(p->pipe[POLL_READ], &dummy, sizeof(dummy));
> >         +       (void)read(p->pipe[POLL_READ], &dummy, sizeof(dummy));
> >                p->set = 0;
> >          }
> >
> >         @@ -155,7 +155,7 @@ tapdisk_stream_poll_set(struct tapdisk_s
> >                int dummy = 0;
> >
> >                if (!p->set) {
> >         -               write(p->pipe[POLL_WRITE], &dummy,
> >         sizeof(dummy));
> >         +               (void)write(p->pipe[POLL_WRITE], &dummy,
> >         sizeof(dummy));
> >                        p->set = 1;
> >                }
> >          }
> >         @@ -203,7 +203,7 @@ tapdisk_stream_print_request(struct tapd
> >          {
> >                unsigned long idx = (unsigned
> >         long)tapdisk_stream_request_idx(s, sreq);
> >                char *buf = (char *)MMAP_VADDR(s->vbd->ring.vstart,
> >         idx, 0);
> >         -       write(s->out_fd, buf, sreq->secs << SECTOR_SHIFT);
> >         +       (void)write(s->out_fd, buf, sreq->secs <<
> >         SECTOR_SHIFT);
> >          }
> >
> >          static void
> >         diff -r adc74e492edf -r 15ed8f45c4e5
> >         tools/blktap2/drivers/tapdisk2.c
> >         --- a/tools/blktap2/drivers/tapdisk2.c  Fri May 11 16:19:16
> >         2012 +0100
> >         +++ b/tools/blktap2/drivers/tapdisk2.c  Fri May 11 16:46:15
> >         2012 +0100
> >         @@ -79,7 +79,12 @@ main(int argc, char *argv[])
> >                if (optind != argc)
> >                        usage(argv[0], EINVAL);
> >
> >         -       chdir("/");
> >         +       if (chdir("/")) {
> >         +               DPRINTF("failed to chdir(/): %d\n", errno);
> >         +               err = 1;
> >         +               goto out;
> >         +       }
> >         +
> >                tapdisk_start_logging("tapdisk2");
> >
> >                err = tapdisk_server_init();
> >
> >
> >
> >
> >
> > --
> > Best Regards,
> > Bei Guan
> >
>
>
>


-- 
Best Regards,
Bei Guan

[-- Attachment #1.2: Type: text/html, Size: 8554 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Errors of doing "make install-tools" with xen-4.2-unstable?
  2012-05-11 16:24         ` Ian Campbell
  2012-05-11 16:33           ` Bei Guan
@ 2012-05-11 16:44           ` Keir Fraser
  2012-05-11 16:57             ` Bei Guan
  1 sibling, 1 reply; 16+ messages in thread
From: Keir Fraser @ 2012-05-11 16:44 UTC (permalink / raw)
  To: Ian Campbell, Bei Guan; +Cc: xen-devel

[-- Attachment #1: Type: text/plain, Size: 6175 bytes --]

On 11/05/2012 17:24, "Ian Campbell" <Ian.Campbell@citrix.com> wrote:

> On Fri, 2012-05-11 at 17:10 +0100, Bei Guan wrote:
> 
> 
>> No, it doesn't work for me. There is the same error.
> 
> Hrm. Since you can reproduce would you mind experimenting a bit to
> figure out the correct fix for this?
> 
> Perhaps adding -Wno-unused-result to C flags helps (google suggests it
> may not)?
> 
> Or maybe just assigning to a dummy variable.

Bei, Please try the attached patch.

 -- Keir

> Ian.
> 
>> My environment and gcc version are like this:
>> 
>> root@gavin-desktop:~# uname -a
>> Linux gavin-desktop 2.6.32-5-xen-amd64 #1 SMP Thu May 19 01:16:47 UTC
>> 2011 x86_64 GNU/Linux
>> 
>> root@gavin-desktop:~# gcc -v
>> Using built-in specs.
>> Target: x86_64-linux-gnu
>> Configured with: ../src/configure -v --with-pkgversion='Ubuntu
>> 4.4.3-4ubuntu5'
>> --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs
>> --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr
>> --enable-shared --enable-multiarch --enable-linker-build-id
>> --with-system-zlib --libexecdir=/usr/lib --without-included-gettext
>> --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4
>> --program-suffix=-4.4 --enable-nls --enable-clocale=gnu
>> --enable-libstdcxx-debug --enable-plugin --enable-objc-gc
>> --disable-werror --with-arch-32=i486 --with-tune=generic
>> --enable-checking=release --build=x86_64-linux-gnu
>> --host=x86_64-linux-gnu --target=x86_64-linux-gnu
>> Thread model: posix
>> gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5)
>> 
>> 
>> 
>> 
>> Thanks,
>> Bei Guan
>> 
>> 
>> 
>>  
>>         
>>         8<------------------------------------------------------
>>         
>>         # HG changeset patch
>>         # User Ian Campbell <ian.campbell@citrix.com>
>>         # Date 1336751175 -3600
>>         # Node ID 15ed8f45c4e57a1e206af020e0ff17b792108e99
>>         # Parent  adc74e492edfee6cf44e433e3e93743a3cf71999
>>         blktap: avoid attribute warn_unused_result build failures.
>>         
>>         I'm not proud of this, but since none of these callers of
>>         read/write have any
>>         other error handling and return void themselves (for several
>>         links up the call
>>         chain AFAICT) and because I don't really want to get into a
>>         massive reworking
>>         of blktap2 I suppose it is at least pragmatic
>>         
>>         Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
>>         
>>         diff -r adc74e492edf -r 15ed8f45c4e5
>>         tools/blktap2/drivers/tapdisk-log.c
>>         --- a/tools/blktap2/drivers/tapdisk-log.c       Fri May 11
>>         16:19:16 2012 +0100
>>         +++ b/tools/blktap2/drivers/tapdisk-log.c       Fri May 11
>>         16:46:15 2012 +0100
>>         @@ -247,7 +247,7 @@ tlog_flush(void)
>>                wsize = ((size + 511) & (~511));
>>         
>>                memset(tapdisk_log.buf + size, '\n', wsize - size);
>>         -       write(fd, tapdisk_log.buf, wsize);
>>         +       (void)write(fd, tapdisk_log.buf, wsize);
>>         
>>                tapdisk_log.p = tapdisk_log.buf;
>>         
>>         diff -r adc74e492edf -r 15ed8f45c4e5
>>         tools/blktap2/drivers/tapdisk-queue.c
>>         --- a/tools/blktap2/drivers/tapdisk-queue.c     Fri May 11
>>         16:19:16 2012 +0100
>>         +++ b/tools/blktap2/drivers/tapdisk-queue.c     Fri May 11
>>         16:46:15 2012 +0100
>>         @@ -435,7 +435,7 @@ tapdisk_lio_ack_event(struct tqueue *que
>>                uint64_t val;
>>         
>>                if (lio->flags & LIO_FLAG_EVENTFD)
>>         -               read(lio->event_fd, &val, sizeof(val));
>>         +               (void)read(lio->event_fd, &val, sizeof(val));
>>          }
>>         
>>          static void
>>         diff -r adc74e492edf -r 15ed8f45c4e5
>>         tools/blktap2/drivers/tapdisk-stream.c
>>         --- a/tools/blktap2/drivers/tapdisk-stream.c    Fri May 11
>>         16:19:16 2012 +0100
>>         +++ b/tools/blktap2/drivers/tapdisk-stream.c    Fri May 11
>>         16:46:15 2012 +0100
>>         @@ -145,7 +145,7 @@ tapdisk_stream_poll_clear(struct tapdisk
>>          {
>>                int dummy;
>>         
>>         -       read(p->pipe[POLL_READ], &dummy, sizeof(dummy));
>>         +       (void)read(p->pipe[POLL_READ], &dummy, sizeof(dummy));
>>                p->set = 0;
>>          }
>>         
>>         @@ -155,7 +155,7 @@ tapdisk_stream_poll_set(struct tapdisk_s
>>                int dummy = 0;
>>         
>>                if (!p->set) {
>>         -               write(p->pipe[POLL_WRITE], &dummy,
>>         sizeof(dummy));
>>         +               (void)write(p->pipe[POLL_WRITE], &dummy,
>>         sizeof(dummy));
>>                        p->set = 1;
>>                }
>>          }
>>         @@ -203,7 +203,7 @@ tapdisk_stream_print_request(struct tapd
>>          {
>>                unsigned long idx = (unsigned
>>         long)tapdisk_stream_request_idx(s, sreq);
>>                char *buf = (char *)MMAP_VADDR(s->vbd->ring.vstart,
>>         idx, 0);
>>         -       write(s->out_fd, buf, sreq->secs << SECTOR_SHIFT);
>>         +       (void)write(s->out_fd, buf, sreq->secs <<
>>         SECTOR_SHIFT);
>>          }
>>         
>>          static void
>>         diff -r adc74e492edf -r 15ed8f45c4e5
>>         tools/blktap2/drivers/tapdisk2.c
>>         --- a/tools/blktap2/drivers/tapdisk2.c  Fri May 11 16:19:16
>>         2012 +0100
>>         +++ b/tools/blktap2/drivers/tapdisk2.c  Fri May 11 16:46:15
>>         2012 +0100
>>         @@ -79,7 +79,12 @@ main(int argc, char *argv[])
>>                if (optind != argc)
>>                        usage(argv[0], EINVAL);
>>         
>>         -       chdir("/");
>>         +       if (chdir("/")) {
>>         +               DPRINTF("failed to chdir(/): %d\n", errno);
>>         +               err = 1;
>>         +               goto out;
>>         +       }
>>         +
>>                tapdisk_start_logging("tapdisk2");
>>         
>>                err = tapdisk_server_init();
>>         
>>         
>> 
>> 
>> 
>> -- 
>> Best Regards,
>> Bei Guan
>> 
> 
> 


[-- Attachment #2: 00-tapdisk-check-io-result --]
[-- Type: application/octet-stream, Size: 5146 bytes --]

diff -r af6d24d47b56 tools/blktap2/drivers/tapdisk-diff.c
--- a/tools/blktap2/drivers/tapdisk-diff.c	Fri May 11 12:20:43 2012 +0100
+++ b/tools/blktap2/drivers/tapdisk-diff.c	Fri May 11 17:43:47 2012 +0100
@@ -39,6 +39,7 @@
 #include "tapdisk-vbd.h"
 #include "tapdisk-server.h"
 #include "tapdisk-disktype.h"
+#include "tapdisk-utils.h"
 #include "libvhd.h"
 
 #define POLL_READ                        0
@@ -170,7 +171,7 @@ tapdisk_stream_poll_clear(struct tapdisk
 {
 	int dummy;
 
-	read(p->pipe[POLL_READ], &dummy, sizeof(dummy));
+	read_exact(p->pipe[POLL_READ], &dummy, sizeof(dummy));
 	p->set = 0;
 }
 
@@ -180,7 +181,7 @@ tapdisk_stream_poll_set(struct tapdisk_s
 	int dummy = 0;
 
 	if (!p->set) {
-		write(p->pipe[POLL_WRITE], &dummy, sizeof(dummy));
+		write_exact(p->pipe[POLL_WRITE], &dummy, sizeof(dummy));
 		p->set = 1;
 	}
 }
diff -r af6d24d47b56 tools/blktap2/drivers/tapdisk-log.c
--- a/tools/blktap2/drivers/tapdisk-log.c	Fri May 11 12:20:43 2012 +0100
+++ b/tools/blktap2/drivers/tapdisk-log.c	Fri May 11 17:43:47 2012 +0100
@@ -37,6 +37,7 @@
 #include <sys/time.h>
 
 #include "tapdisk-log.h"
+#include "tapdisk-utils.h"
 
 #define MAX_ENTRY_LEN      512
 #define MAX_ERROR_MESSAGES 16
@@ -247,7 +248,7 @@ tlog_flush(void)
 	wsize = ((size + 511) & (~511));
 
 	memset(tapdisk_log.buf + size, '\n', wsize - size);
-	write(fd, tapdisk_log.buf, wsize);
+	write_exact(fd, tapdisk_log.buf, wsize);
 
 	tapdisk_log.p = tapdisk_log.buf;
 
diff -r af6d24d47b56 tools/blktap2/drivers/tapdisk-queue.c
--- a/tools/blktap2/drivers/tapdisk-queue.c	Fri May 11 12:20:43 2012 +0100
+++ b/tools/blktap2/drivers/tapdisk-queue.c	Fri May 11 17:43:47 2012 +0100
@@ -435,7 +435,7 @@ tapdisk_lio_ack_event(struct tqueue *que
 	uint64_t val;
 
 	if (lio->flags & LIO_FLAG_EVENTFD)
-		read(lio->event_fd, &val, sizeof(val));
+		read_exact(lio->event_fd, &val, sizeof(val));
 }
 
 static void
diff -r af6d24d47b56 tools/blktap2/drivers/tapdisk-stream.c
--- a/tools/blktap2/drivers/tapdisk-stream.c	Fri May 11 12:20:43 2012 +0100
+++ b/tools/blktap2/drivers/tapdisk-stream.c	Fri May 11 17:43:47 2012 +0100
@@ -38,6 +38,7 @@
 #include "tapdisk-vbd.h"
 #include "tapdisk-server.h"
 #include "tapdisk-disktype.h"
+#include "tapdisk-utils.h"
 
 #define POLL_READ                        0
 #define POLL_WRITE                       1
@@ -145,7 +146,7 @@ tapdisk_stream_poll_clear(struct tapdisk
 {
 	int dummy;
 
-	read(p->pipe[POLL_READ], &dummy, sizeof(dummy));
+	read_exact(p->pipe[POLL_READ], &dummy, sizeof(dummy));
 	p->set = 0;
 }
 
@@ -155,7 +156,7 @@ tapdisk_stream_poll_set(struct tapdisk_s
 	int dummy = 0;
 
 	if (!p->set) {
-		write(p->pipe[POLL_WRITE], &dummy, sizeof(dummy));
+		write_exact(p->pipe[POLL_WRITE], &dummy, sizeof(dummy));
 		p->set = 1;
 	}
 }
@@ -203,7 +204,7 @@ tapdisk_stream_print_request(struct tapd
 {
 	unsigned long idx = (unsigned long)tapdisk_stream_request_idx(s, sreq);
 	char *buf = (char *)MMAP_VADDR(s->vbd->ring.vstart, idx, 0);
-	write(s->out_fd, buf, sreq->secs << SECTOR_SHIFT);
+	write_exact(s->out_fd, buf, sreq->secs << SECTOR_SHIFT);
 }
 
 static void
diff -r af6d24d47b56 tools/blktap2/drivers/tapdisk-utils.c
--- a/tools/blktap2/drivers/tapdisk-utils.c	Fri May 11 12:20:43 2012 +0100
+++ b/tools/blktap2/drivers/tapdisk-utils.c	Fri May 11 17:43:47 2012 +0100
@@ -175,3 +175,40 @@ int tapdisk_linux_version(void)
 }
 
 #endif
+int read_exact(int fd, void *data, size_t size)
+{
+    size_t offset = 0;
+    ssize_t len;
+
+    while ( offset < size )
+    {
+        len = read(fd, (char *)data + offset, size - offset);
+        if ( (len == -1) && (errno == EINTR) )
+            continue;
+        if ( len == 0 )
+            errno = 0;
+        if ( len <= 0 )
+            return -1;
+        offset += len;
+    }
+
+    return 0;
+}
+
+int write_exact(int fd, const void *data, size_t size)
+{
+    size_t offset = 0;
+    ssize_t len;
+
+    while ( offset < size )
+    {
+        len = write(fd, (const char *)data + offset, size - offset);
+        if ( (len == -1) && (errno == EINTR) )
+            continue;
+        if ( len <= 0 )
+            return -1;
+        offset += len;
+    }
+
+    return 0;
+}
diff -r af6d24d47b56 tools/blktap2/drivers/tapdisk-utils.h
--- a/tools/blktap2/drivers/tapdisk-utils.h	Fri May 11 12:20:43 2012 +0100
+++ b/tools/blktap2/drivers/tapdisk-utils.h	Fri May 11 17:43:47 2012 +0100
@@ -39,4 +39,7 @@ int tapdisk_namedup(char **, const char 
 int tapdisk_get_image_size(int, uint64_t *, uint32_t *);
 int tapdisk_linux_version(void);
 
+int read_exact(int fd, void *data, size_t size); /* EOF => -1, errno=0 */
+int write_exact(int fd, const void *data, size_t size);
+
 #endif
diff -r af6d24d47b56 tools/blktap2/drivers/tapdisk2.c
--- a/tools/blktap2/drivers/tapdisk2.c	Fri May 11 12:20:43 2012 +0100
+++ b/tools/blktap2/drivers/tapdisk2.c	Fri May 11 17:43:47 2012 +0100
@@ -79,7 +79,12 @@ main(int argc, char *argv[])
 	if (optind != argc)
 		usage(argv[0], EINVAL);
 
-	chdir("/");
+	if (chdir("/")) {
+		DPRINTF("failed to chdir(/): %d\n", errno);
+		err = 1;
+		goto out;
+	}
+
 	tapdisk_start_logging("tapdisk2");
 
 	err = tapdisk_server_init();

[-- Attachment #3: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Errors of doing "make install-tools" with xen-4.2-unstable?
  2012-05-11 16:33           ` Bei Guan
@ 2012-05-11 16:47             ` Keir Fraser
  2012-05-11 17:01               ` Ian Jackson
  2012-05-12  5:50               ` Ian Campbell
  0 siblings, 2 replies; 16+ messages in thread
From: Keir Fraser @ 2012-05-11 16:47 UTC (permalink / raw)
  To: Bei Guan, Ian Campbell; +Cc: xen-devel

On 11/05/2012 17:33, "Bei Guan" <gbtju85@gmail.com> wrote:

> 2012/5/12 Ian Campbell <Ian.Campbell@citrix.com>
>> On Fri, 2012-05-11 at 17:10 +0100, Bei Guan wrote:
>> 
>> 
>>> No, it doesn't work for me. There is the same error.
>> 
>> Hrm. Since you can reproduce would you mind experimenting a bit to
>> figure out the correct fix for this?
>> 
>> Perhaps adding -Wno-unused-result to C flags helps (google suggests it
>> may not)?
> Yes, I add this option to Makefile. And now it works well. The patch is as the
> following. Thank you very much.

I'd be worried about more command-line meddling causing even more fallout.
Particularly because we haven't used that option anywhere else so far, so
it's untested by us. E.g., do all gcc support -Wno-unused-result?

 -- Keir

> 
> diff -r 54c8c9eaee92 tools/blktap2/drivers/Makefile
> --- a/tools/blktap2/drivers/Makefile    Fri Apr 27 11:09:26 2012 +0200
> +++ b/tools/blktap2/drivers/Makefile    Sat May 12 00:31:12 2012 +0800
> @@ -11,6 +11,7 @@
>  
>  CFLAGS    += -Werror -g
>  CFLAGS    += -Wno-unused
> +CFLAGS    += -Wno-unused-result
>  CFLAGS    += -fno-strict-aliasing
>  CFLAGS    += -I$(BLKTAP_ROOT)/include -I$(BLKTAP_ROOT)/drivers
>  CFLAGS    += $(CFLAGS_libxenctrl)
> 
> 
> 
> 
> Thanks,
> Bei Guan
> 
> 
> 
>  
>> 
>> Or maybe just assigning to a dummy variable.
>> 
>> Ian.
>> 
>>> My environment and gcc version are like this:
>>> 
>>> root@gavin-desktop:~# uname -a
>>> Linux gavin-desktop 2.6.32-5-xen-amd64 #1 SMP Thu May 19 01:16:47 UTC
>>> 2011 x86_64 GNU/Linux
>>> 
>>> root@gavin-desktop:~# gcc -v
>>> Using built-in specs.
>>> Target: x86_64-linux-gnu
>>> Configured with: ../src/configure -v --with-pkgversion='Ubuntu
>>> 4.4.3-4ubuntu5'
>>> --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs
>>> --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr
>>> --enable-shared --enable-multiarch --enable-linker-build-id
>>> --with-system-zlib --libexecdir=/usr/lib --without-included-gettext
>>> --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4
>>> --program-suffix=-4.4 --enable-nls --enable-clocale=gnu
>>> --enable-libstdcxx-debug --enable-plugin --enable-objc-gc
>>> --disable-werror --with-arch-32=i486 --with-tune=generic
>>> --enable-checking=release --build=x86_64-linux-gnu
>>> --host=x86_64-linux-gnu --target=x86_64-linux-gnu
>>> Thread model: posix
>>> gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5)
>>> 
>>> 
>>> 
>>> 
>>> Thanks,
>>> Bei Guan
>>> 
>>> 
>>> 
>>> 
>>> 
>>>         8<------------------------------------------------------
>>> 
>>>         # HG changeset patch
>>>         # User Ian Campbell <ian.campbell@citrix.com>
>>>         # Date 1336751175 -3600
>>>         # Node ID 15ed8f45c4e57a1e206af020e0ff17b792108e99
>>>         # Parent  adc74e492edfee6cf44e433e3e93743a3cf71999
>>>         blktap: avoid attribute warn_unused_result build failures.
>>> 
>>>         I'm not proud of this, but since none of these callers of
>>>         read/write have any
>>>         other error handling and return void themselves (for several
>>>         links up the call
>>>         chain AFAICT) and because I don't really want to get into a
>>>         massive reworking
>>>         of blktap2 I suppose it is at least pragmatic
>>> 
>>>         Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
>>> 
>>>         diff -r adc74e492edf -r 15ed8f45c4e5
>>>         tools/blktap2/drivers/tapdisk-log.c
>>>         --- a/tools/blktap2/drivers/tapdisk-log.c       Fri May 11
>>>         16:19:16 2012 +0100
>>>         +++ b/tools/blktap2/drivers/tapdisk-log.c       Fri May 11
>>>         16:46:15 2012 +0100
>>>         @@ -247,7 +247,7 @@ tlog_flush(void)
>>>                wsize = ((size + 511) & (~511));
>>> 
>>>                memset(tapdisk_log.buf + size, '\n', wsize - size);
>>>         -       write(fd, tapdisk_log.buf, wsize);
>>>         +       (void)write(fd, tapdisk_log.buf, wsize);
>>> 
>>>                tapdisk_log.p = tapdisk_log.buf;
>>> 
>>>         diff -r adc74e492edf -r 15ed8f45c4e5
>>>         tools/blktap2/drivers/tapdisk-queue.c
>>>         --- a/tools/blktap2/drivers/tapdisk-queue.c     Fri May 11
>>>         16:19:16 2012 +0100
>>>         +++ b/tools/blktap2/drivers/tapdisk-queue.c     Fri May 11
>>>         16:46:15 2012 +0100
>>>         @@ -435,7 +435,7 @@ tapdisk_lio_ack_event(struct tqueue *que
>>>                uint64_t val;
>>> 
>>>                if (lio->flags & LIO_FLAG_EVENTFD)
>>>         -               read(lio->event_fd, &val, sizeof(val));
>>>         +               (void)read(lio->event_fd, &val, sizeof(val));
>>>          }
>>> 
>>>          static void
>>>         diff -r adc74e492edf -r 15ed8f45c4e5
>>>         tools/blktap2/drivers/tapdisk-stream.c
>>>         --- a/tools/blktap2/drivers/tapdisk-stream.c    Fri May 11
>>>         16:19:16 2012 +0100
>>>         +++ b/tools/blktap2/drivers/tapdisk-stream.c    Fri May 11
>>>         16:46:15 2012 +0100
>>>         @@ -145,7 +145,7 @@ tapdisk_stream_poll_clear(struct tapdisk
>>>          {
>>>                int dummy;
>>> 
>>>         -       read(p->pipe[POLL_READ], &dummy, sizeof(dummy));
>>>         +       (void)read(p->pipe[POLL_READ], &dummy, sizeof(dummy));
>>>                p->set = 0;
>>>          }
>>> 
>>>         @@ -155,7 +155,7 @@ tapdisk_stream_poll_set(struct tapdisk_s
>>>                int dummy = 0;
>>> 
>>>                if (!p->set) {
>>>         -               write(p->pipe[POLL_WRITE], &dummy,
>>>         sizeof(dummy));
>>>         +               (void)write(p->pipe[POLL_WRITE], &dummy,
>>>         sizeof(dummy));
>>>                        p->set = 1;
>>>                }
>>>          }
>>>         @@ -203,7 +203,7 @@ tapdisk_stream_print_request(struct tapd
>>>          {
>>>                unsigned long idx = (unsigned
>>>         long)tapdisk_stream_request_idx(s, sreq);
>>>                char *buf = (char *)MMAP_VADDR(s->vbd->ring.vstart,
>>>         idx, 0);
>>>         -       write(s->out_fd, buf, sreq->secs << SECTOR_SHIFT);
>>>         +       (void)write(s->out_fd, buf, sreq->secs <<
>>>         SECTOR_SHIFT);
>>>          }
>>> 
>>>          static void
>>>         diff -r adc74e492edf -r 15ed8f45c4e5
>>>         tools/blktap2/drivers/tapdisk2.c
>>>         --- a/tools/blktap2/drivers/tapdisk2.c  Fri May 11 16:19:16
>>>         2012 +0100
>>>         +++ b/tools/blktap2/drivers/tapdisk2.c  Fri May 11 16:46:15
>>>         2012 +0100
>>>         @@ -79,7 +79,12 @@ main(int argc, char *argv[])
>>>                if (optind != argc)
>>>                        usage(argv[0], EINVAL);
>>> 
>>>         -       chdir("/");
>>>         +       if (chdir("/")) {
>>>         +               DPRINTF("failed to chdir(/): %d\n", errno);
>>>         +               err = 1;
>>>         +               goto out;
>>>         +       }
>>>         +
>>>                tapdisk_start_logging("tapdisk2");
>>> 
>>>                err = tapdisk_server_init();
>>> 
>>> 
>>> 
>>> 
>>> 
>>> --
>>> Best Regards,
>>> Bei Guan
>>> 
>> 
>> 
> 
> 

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Errors of doing "make install-tools" with xen-4.2-unstable?
  2012-05-11 16:44           ` Keir Fraser
@ 2012-05-11 16:57             ` Bei Guan
  0 siblings, 0 replies; 16+ messages in thread
From: Bei Guan @ 2012-05-11 16:57 UTC (permalink / raw)
  To: Keir Fraser; +Cc: Ian Campbell, xen-devel


[-- Attachment #1.1: Type: text/plain, Size: 6449 bytes --]

2012/5/12 Keir Fraser <keir@xen.org>

> On 11/05/2012 17:24, "Ian Campbell" <Ian.Campbell@citrix.com> wrote:
>
> > On Fri, 2012-05-11 at 17:10 +0100, Bei Guan wrote:
> >
> >
> >> No, it doesn't work for me. There is the same error.
> >
> > Hrm. Since you can reproduce would you mind experimenting a bit to
> > figure out the correct fix for this?
> >
> > Perhaps adding -Wno-unused-result to C flags helps (google suggests it
> > may not)?
> >
> > Or maybe just assigning to a dummy variable.
>
> Bei, Please try the attached patch.
>
It works now. Thank you.


Thanks,
Bei Guan


>
>  -- Keir
>
> > Ian.
> >
> >> My environment and gcc version are like this:
> >>
> >> root@gavin-desktop:~# uname -a
> >> Linux gavin-desktop 2.6.32-5-xen-amd64 #1 SMP Thu May 19 01:16:47 UTC
> >> 2011 x86_64 GNU/Linux
> >>
> >> root@gavin-desktop:~# gcc -v
> >> Using built-in specs.
> >> Target: x86_64-linux-gnu
> >> Configured with: ../src/configure -v --with-pkgversion='Ubuntu
> >> 4.4.3-4ubuntu5'
> >> --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs
> >> --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr
> >> --enable-shared --enable-multiarch --enable-linker-build-id
> >> --with-system-zlib --libexecdir=/usr/lib --without-included-gettext
> >> --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4
> >> --program-suffix=-4.4 --enable-nls --enable-clocale=gnu
> >> --enable-libstdcxx-debug --enable-plugin --enable-objc-gc
> >> --disable-werror --with-arch-32=i486 --with-tune=generic
> >> --enable-checking=release --build=x86_64-linux-gnu
> >> --host=x86_64-linux-gnu --target=x86_64-linux-gnu
> >> Thread model: posix
> >> gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5)
> >>
> >>
> >>
> >>
> >> Thanks,
> >> Bei Guan
> >>
> >>
> >>
> >>
> >>
> >>         8<------------------------------------------------------
> >>
> >>         # HG changeset patch
> >>         # User Ian Campbell <ian.campbell@citrix.com>
> >>         # Date 1336751175 -3600
> >>         # Node ID 15ed8f45c4e57a1e206af020e0ff17b792108e99
> >>         # Parent  adc74e492edfee6cf44e433e3e93743a3cf71999
> >>         blktap: avoid attribute warn_unused_result build failures.
> >>
> >>         I'm not proud of this, but since none of these callers of
> >>         read/write have any
> >>         other error handling and return void themselves (for several
> >>         links up the call
> >>         chain AFAICT) and because I don't really want to get into a
> >>         massive reworking
> >>         of blktap2 I suppose it is at least pragmatic
> >>
> >>         Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
> >>
> >>         diff -r adc74e492edf -r 15ed8f45c4e5
> >>         tools/blktap2/drivers/tapdisk-log.c
> >>         --- a/tools/blktap2/drivers/tapdisk-log.c       Fri May 11
> >>         16:19:16 2012 +0100
> >>         +++ b/tools/blktap2/drivers/tapdisk-log.c       Fri May 11
> >>         16:46:15 2012 +0100
> >>         @@ -247,7 +247,7 @@ tlog_flush(void)
> >>                wsize = ((size + 511) & (~511));
> >>
> >>                memset(tapdisk_log.buf + size, '\n', wsize - size);
> >>         -       write(fd, tapdisk_log.buf, wsize);
> >>         +       (void)write(fd, tapdisk_log.buf, wsize);
> >>
> >>                tapdisk_log.p = tapdisk_log.buf;
> >>
> >>         diff -r adc74e492edf -r 15ed8f45c4e5
> >>         tools/blktap2/drivers/tapdisk-queue.c
> >>         --- a/tools/blktap2/drivers/tapdisk-queue.c     Fri May 11
> >>         16:19:16 2012 +0100
> >>         +++ b/tools/blktap2/drivers/tapdisk-queue.c     Fri May 11
> >>         16:46:15 2012 +0100
> >>         @@ -435,7 +435,7 @@ tapdisk_lio_ack_event(struct tqueue *que
> >>                uint64_t val;
> >>
> >>                if (lio->flags & LIO_FLAG_EVENTFD)
> >>         -               read(lio->event_fd, &val, sizeof(val));
> >>         +               (void)read(lio->event_fd, &val, sizeof(val));
> >>          }
> >>
> >>          static void
> >>         diff -r adc74e492edf -r 15ed8f45c4e5
> >>         tools/blktap2/drivers/tapdisk-stream.c
> >>         --- a/tools/blktap2/drivers/tapdisk-stream.c    Fri May 11
> >>         16:19:16 2012 +0100
> >>         +++ b/tools/blktap2/drivers/tapdisk-stream.c    Fri May 11
> >>         16:46:15 2012 +0100
> >>         @@ -145,7 +145,7 @@ tapdisk_stream_poll_clear(struct tapdisk
> >>          {
> >>                int dummy;
> >>
> >>         -       read(p->pipe[POLL_READ], &dummy, sizeof(dummy));
> >>         +       (void)read(p->pipe[POLL_READ], &dummy, sizeof(dummy));
> >>                p->set = 0;
> >>          }
> >>
> >>         @@ -155,7 +155,7 @@ tapdisk_stream_poll_set(struct tapdisk_s
> >>                int dummy = 0;
> >>
> >>                if (!p->set) {
> >>         -               write(p->pipe[POLL_WRITE], &dummy,
> >>         sizeof(dummy));
> >>         +               (void)write(p->pipe[POLL_WRITE], &dummy,
> >>         sizeof(dummy));
> >>                        p->set = 1;
> >>                }
> >>          }
> >>         @@ -203,7 +203,7 @@ tapdisk_stream_print_request(struct tapd
> >>          {
> >>                unsigned long idx = (unsigned
> >>         long)tapdisk_stream_request_idx(s, sreq);
> >>                char *buf = (char *)MMAP_VADDR(s->vbd->ring.vstart,
> >>         idx, 0);
> >>         -       write(s->out_fd, buf, sreq->secs << SECTOR_SHIFT);
> >>         +       (void)write(s->out_fd, buf, sreq->secs <<
> >>         SECTOR_SHIFT);
> >>          }
> >>
> >>          static void
> >>         diff -r adc74e492edf -r 15ed8f45c4e5
> >>         tools/blktap2/drivers/tapdisk2.c
> >>         --- a/tools/blktap2/drivers/tapdisk2.c  Fri May 11 16:19:16
> >>         2012 +0100
> >>         +++ b/tools/blktap2/drivers/tapdisk2.c  Fri May 11 16:46:15
> >>         2012 +0100
> >>         @@ -79,7 +79,12 @@ main(int argc, char *argv[])
> >>                if (optind != argc)
> >>                        usage(argv[0], EINVAL);
> >>
> >>         -       chdir("/");
> >>         +       if (chdir("/")) {
> >>         +               DPRINTF("failed to chdir(/): %d\n", errno);
> >>         +               err = 1;
> >>         +               goto out;
> >>         +       }
> >>         +
> >>                tapdisk_start_logging("tapdisk2");
> >>
> >>                err = tapdisk_server_init();
> >>
> >>
> >>
> >>
> >>
> >> --
> >> Best Regards,
> >> Bei Guan
> >>
> >
> >
>
>


-- 
Best Regards,
Bei Guan

[-- Attachment #1.2: Type: text/html, Size: 8833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Errors of doing "make install-tools" with xen-4.2-unstable?
  2012-05-11 16:47             ` Keir Fraser
@ 2012-05-11 17:01               ` Ian Jackson
  2012-05-12  5:50               ` Ian Campbell
  1 sibling, 0 replies; 16+ messages in thread
From: Ian Jackson @ 2012-05-11 17:01 UTC (permalink / raw)
  To: Keir Fraser; +Cc: xen-devel, Bei Guan, Ian Campbell

~Keir Fraser writes ("Re: [Xen-devel] Errors of doing "make install-tools" with xen-4.2-unstable?"):
> On 11/05/2012 17:33, "Bei Guan" <gbtju85@gmail.com> wrote:
 > Yes, I add this option to Makefile. And now it works well. The patch is as the
> > following. Thank you very much.
> 
> I'd be worried about more command-line meddling causing even more fallout.
> Particularly because we haven't used that option anywhere else so far, so
> it's untested by us. E.g., do all gcc support -Wno-unused-result?

Checking the manuals (which are all online), gcc 4.0 doesn't support
it.  So no, relevant gccs don't.

However the tools build now uses autoconf.  I would accept a patch
which used autoconf to determine whether gcc accepts
-Wno-unused-result and to supply it in the blktap2 Makefile if it
does.

Ian.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Errors of doing "make install-tools" with xen-4.2-unstable?
  2012-05-11 16:47             ` Keir Fraser
  2012-05-11 17:01               ` Ian Jackson
@ 2012-05-12  5:50               ` Ian Campbell
  1 sibling, 0 replies; 16+ messages in thread
From: Ian Campbell @ 2012-05-12  5:50 UTC (permalink / raw)
  To: Keir Fraser; +Cc: Bei Guan, xen-devel

On Fri, 2012-05-11 at 17:47 +0100, Keir Fraser wrote:
> On 11/05/2012 17:33, "Bei Guan" <gbtju85@gmail.com> wrote:
> 
> > 2012/5/12 Ian Campbell <Ian.Campbell@citrix.com>
> >> On Fri, 2012-05-11 at 17:10 +0100, Bei Guan wrote:
> >> 
> >> 
> >>> No, it doesn't work for me. There is the same error.
> >> 
> >> Hrm. Since you can reproduce would you mind experimenting a bit to
> >> figure out the correct fix for this?
> >> 
> >> Perhaps adding -Wno-unused-result to C flags helps (google suggests it
> >> may not)?
> > Yes, I add this option to Makefile. And now it works well. The patch is as the
> > following. Thank you very much.
> 
> I'd be worried about more command-line meddling causing even more fallout.
> Particularly because we haven't used that option anywhere else so far, so
> it's untested by us. E.g., do all gcc support -Wno-unused-result?

We could have used cc-option, but your {read,write}_exact patch looks
like a better fix anyway.

Ian.

> 
>  -- Keir
> 
> > 
> > diff -r 54c8c9eaee92 tools/blktap2/drivers/Makefile
> > --- a/tools/blktap2/drivers/Makefile    Fri Apr 27 11:09:26 2012 +0200
> > +++ b/tools/blktap2/drivers/Makefile    Sat May 12 00:31:12 2012 +0800
> > @@ -11,6 +11,7 @@
> >  
> >  CFLAGS    += -Werror -g
> >  CFLAGS    += -Wno-unused
> > +CFLAGS    += -Wno-unused-result
> >  CFLAGS    += -fno-strict-aliasing
> >  CFLAGS    += -I$(BLKTAP_ROOT)/include -I$(BLKTAP_ROOT)/drivers
> >  CFLAGS    += $(CFLAGS_libxenctrl)
> > 
> > 
> > 
> > 
> > Thanks,
> > Bei Guan
> > 
> > 
> > 
> >  
> >> 
> >> Or maybe just assigning to a dummy variable.
> >> 
> >> Ian.
> >> 
> >>> My environment and gcc version are like this:
> >>> 
> >>> root@gavin-desktop:~# uname -a
> >>> Linux gavin-desktop 2.6.32-5-xen-amd64 #1 SMP Thu May 19 01:16:47 UTC
> >>> 2011 x86_64 GNU/Linux
> >>> 
> >>> root@gavin-desktop:~# gcc -v
> >>> Using built-in specs.
> >>> Target: x86_64-linux-gnu
> >>> Configured with: ../src/configure -v --with-pkgversion='Ubuntu
> >>> 4.4.3-4ubuntu5'
> >>> --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs
> >>> --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr
> >>> --enable-shared --enable-multiarch --enable-linker-build-id
> >>> --with-system-zlib --libexecdir=/usr/lib --without-included-gettext
> >>> --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4
> >>> --program-suffix=-4.4 --enable-nls --enable-clocale=gnu
> >>> --enable-libstdcxx-debug --enable-plugin --enable-objc-gc
> >>> --disable-werror --with-arch-32=i486 --with-tune=generic
> >>> --enable-checking=release --build=x86_64-linux-gnu
> >>> --host=x86_64-linux-gnu --target=x86_64-linux-gnu
> >>> Thread model: posix
> >>> gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5)
> >>> 
> >>> 
> >>> 
> >>> 
> >>> Thanks,
> >>> Bei Guan
> >>> 
> >>> 
> >>> 
> >>> 
> >>> 
> >>>         8<------------------------------------------------------
> >>> 
> >>>         # HG changeset patch
> >>>         # User Ian Campbell <ian.campbell@citrix.com>
> >>>         # Date 1336751175 -3600
> >>>         # Node ID 15ed8f45c4e57a1e206af020e0ff17b792108e99
> >>>         # Parent  adc74e492edfee6cf44e433e3e93743a3cf71999
> >>>         blktap: avoid attribute warn_unused_result build failures.
> >>> 
> >>>         I'm not proud of this, but since none of these callers of
> >>>         read/write have any
> >>>         other error handling and return void themselves (for several
> >>>         links up the call
> >>>         chain AFAICT) and because I don't really want to get into a
> >>>         massive reworking
> >>>         of blktap2 I suppose it is at least pragmatic
> >>> 
> >>>         Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
> >>> 
> >>>         diff -r adc74e492edf -r 15ed8f45c4e5
> >>>         tools/blktap2/drivers/tapdisk-log.c
> >>>         --- a/tools/blktap2/drivers/tapdisk-log.c       Fri May 11
> >>>         16:19:16 2012 +0100
> >>>         +++ b/tools/blktap2/drivers/tapdisk-log.c       Fri May 11
> >>>         16:46:15 2012 +0100
> >>>         @@ -247,7 +247,7 @@ tlog_flush(void)
> >>>                wsize = ((size + 511) & (~511));
> >>> 
> >>>                memset(tapdisk_log.buf + size, '\n', wsize - size);
> >>>         -       write(fd, tapdisk_log.buf, wsize);
> >>>         +       (void)write(fd, tapdisk_log.buf, wsize);
> >>> 
> >>>                tapdisk_log.p = tapdisk_log.buf;
> >>> 
> >>>         diff -r adc74e492edf -r 15ed8f45c4e5
> >>>         tools/blktap2/drivers/tapdisk-queue.c
> >>>         --- a/tools/blktap2/drivers/tapdisk-queue.c     Fri May 11
> >>>         16:19:16 2012 +0100
> >>>         +++ b/tools/blktap2/drivers/tapdisk-queue.c     Fri May 11
> >>>         16:46:15 2012 +0100
> >>>         @@ -435,7 +435,7 @@ tapdisk_lio_ack_event(struct tqueue *que
> >>>                uint64_t val;
> >>> 
> >>>                if (lio->flags & LIO_FLAG_EVENTFD)
> >>>         -               read(lio->event_fd, &val, sizeof(val));
> >>>         +               (void)read(lio->event_fd, &val, sizeof(val));
> >>>          }
> >>> 
> >>>          static void
> >>>         diff -r adc74e492edf -r 15ed8f45c4e5
> >>>         tools/blktap2/drivers/tapdisk-stream.c
> >>>         --- a/tools/blktap2/drivers/tapdisk-stream.c    Fri May 11
> >>>         16:19:16 2012 +0100
> >>>         +++ b/tools/blktap2/drivers/tapdisk-stream.c    Fri May 11
> >>>         16:46:15 2012 +0100
> >>>         @@ -145,7 +145,7 @@ tapdisk_stream_poll_clear(struct tapdisk
> >>>          {
> >>>                int dummy;
> >>> 
> >>>         -       read(p->pipe[POLL_READ], &dummy, sizeof(dummy));
> >>>         +       (void)read(p->pipe[POLL_READ], &dummy, sizeof(dummy));
> >>>                p->set = 0;
> >>>          }
> >>> 
> >>>         @@ -155,7 +155,7 @@ tapdisk_stream_poll_set(struct tapdisk_s
> >>>                int dummy = 0;
> >>> 
> >>>                if (!p->set) {
> >>>         -               write(p->pipe[POLL_WRITE], &dummy,
> >>>         sizeof(dummy));
> >>>         +               (void)write(p->pipe[POLL_WRITE], &dummy,
> >>>         sizeof(dummy));
> >>>                        p->set = 1;
> >>>                }
> >>>          }
> >>>         @@ -203,7 +203,7 @@ tapdisk_stream_print_request(struct tapd
> >>>          {
> >>>                unsigned long idx = (unsigned
> >>>         long)tapdisk_stream_request_idx(s, sreq);
> >>>                char *buf = (char *)MMAP_VADDR(s->vbd->ring.vstart,
> >>>         idx, 0);
> >>>         -       write(s->out_fd, buf, sreq->secs << SECTOR_SHIFT);
> >>>         +       (void)write(s->out_fd, buf, sreq->secs <<
> >>>         SECTOR_SHIFT);
> >>>          }
> >>> 
> >>>          static void
> >>>         diff -r adc74e492edf -r 15ed8f45c4e5
> >>>         tools/blktap2/drivers/tapdisk2.c
> >>>         --- a/tools/blktap2/drivers/tapdisk2.c  Fri May 11 16:19:16
> >>>         2012 +0100
> >>>         +++ b/tools/blktap2/drivers/tapdisk2.c  Fri May 11 16:46:15
> >>>         2012 +0100
> >>>         @@ -79,7 +79,12 @@ main(int argc, char *argv[])
> >>>                if (optind != argc)
> >>>                        usage(argv[0], EINVAL);
> >>> 
> >>>         -       chdir("/");
> >>>         +       if (chdir("/")) {
> >>>         +               DPRINTF("failed to chdir(/): %d\n", errno);
> >>>         +               err = 1;
> >>>         +               goto out;
> >>>         +       }
> >>>         +
> >>>                tapdisk_start_logging("tapdisk2");
> >>> 
> >>>                err = tapdisk_server_init();
> >>> 
> >>> 
> >>> 
> >>> 
> >>> 
> >>> --
> >>> Best Regards,
> >>> Bei Guan
> >>> 
> >> 
> >> 
> > 
> > 
> 
> 

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2012-05-12  5:50 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-11 14:08 Errors of doing "make install-tools" with xen-4.2-unstable? Bei Guan
2012-05-11 14:16 ` Ian Campbell
2012-05-11 15:12   ` Bei Guan
2012-05-11 15:47     ` Ian Campbell
2012-05-11 16:10       ` Bei Guan
2012-05-11 16:18         ` Keir Fraser
2012-05-11 16:24         ` Ian Campbell
2012-05-11 16:33           ` Bei Guan
2012-05-11 16:47             ` Keir Fraser
2012-05-11 17:01               ` Ian Jackson
2012-05-12  5:50               ` Ian Campbell
2012-05-11 16:44           ` Keir Fraser
2012-05-11 16:57             ` Bei Guan
2012-05-11 16:16   ` Keir Fraser
2012-05-11 14:19 ` Olaf Hering
2012-05-11 15:26   ` Bei Guan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.