From: Lei Li <lilei@linux.vnet.ibm.com>
To: Stefan Hajnoczi <stefanha@gmail.com>
Cc: mdroh@linux.vnet.ibm.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] osdep: pass const char pointer to setsockopt
Date: Wed, 06 Mar 2013 21:07:25 +0800 [thread overview]
Message-ID: <51373F8D.90909@linux.vnet.ibm.com> (raw)
In-Reply-To: <20130306095625.GB1954@stefanha-thinkpad.muc.redhat.com>
On 03/06/2013 05:56 PM, Stefan Hajnoczi wrote:
> On Tue, Mar 05, 2013 at 05:51:21PM +0800, Lei Li wrote:
>> Pass the right type for setsockopt(), and this will also
>> fix the compiler warning when cross build for qemu-ga.exe:
>>
>> util/osdep.c: In function 'socket_set_nodelay':
>> util/osdep.c:69:5: warning: passing argument 4 of 'setsockopt' from
>> incompatible pointer type [enabled by default]
>> In file included from /home/lei/qemu_b/include/sysemu/os-win32.h:30:0,
>> from /home/lei/qemu_b/include/qemu-common.h:46,
>> from util/osdep.c:48:
>> /usr/i686-w64-mingw32/sys-root/mingw/include/winsock2.h:990:63: note:
>> expected 'const char *' but argument is of type 'int *'
>>
>> Signed-off-by: Lei Li <lilei@linux.vnet.ibm.com>
>> ---
>> util/osdep.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/util/osdep.c b/util/osdep.c
>> index c408261..ce472a9 100644
>> --- a/util/osdep.c
>> +++ b/util/osdep.c
>> @@ -57,7 +57,7 @@ static const char *qemu_version = QEMU_VERSION;
>> int socket_set_cork(int fd, int v)
>> {
>> #if defined(SOL_TCP) && defined(TCP_CORK)
>> - return setsockopt(fd, SOL_TCP, TCP_CORK, &v, sizeof(v));
>> + return setsockopt(fd, SOL_TCP, TCP_CORK, (char *)&v, sizeof(v));
>> #else
>> return 0;
>> #endif
>> @@ -66,7 +66,7 @@ int socket_set_cork(int fd, int v)
>> int socket_set_nodelay(int fd)
>> {
>> int v = 1;
>> - return setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &v, sizeof(v));
>> + return setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, (char *)&v, sizeof(v));
> Please use qemu_setsockopt() instead of open-coding this.
>
> Stefan
>
Hi Stefan,
This compiler warning just shows up without any hacking
when cross build qemu-ga for windows by:
./configure --enable-guest-agent --cross-prefix=i686-w64-mingw32-
make qemu-ga.exe
--
Lei
next prev parent reply other threads:[~2013-03-06 13:07 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-05 9:51 [Qemu-devel] [PATCH] osdep: pass const char pointer to setsockopt Lei Li
2013-03-06 8:59 ` Markus Armbruster
2013-03-06 13:09 ` Lei Li
2013-03-06 9:56 ` Stefan Hajnoczi
2013-03-06 13:07 ` Lei Li [this message]
2013-03-06 13:16 ` Stefan Hajnoczi
2013-03-06 13:25 ` Lei Li
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=51373F8D.90909@linux.vnet.ibm.com \
--to=lilei@linux.vnet.ibm.com \
--cc=mdroh@linux.vnet.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.