* [Qemu-devel] [PATCH resend] linux-user: Support the accept4 socketcall
@ 2014-01-06 1:57 André Hentschel
2014-01-06 3:37 ` Erik de Castro Lopo
2014-01-06 8:45 ` Laurent Vivier
0 siblings, 2 replies; 7+ messages in thread
From: André Hentschel @ 2014-01-06 1:57 UTC (permalink / raw)
To: qemu-devel; +Cc: Riku Voipio
From: André Hentschel <nerv@dawncrow.de>
Cc: Riku Voipio <riku.voipio@iki.fi>
Signed-off-by: André Hentschel <nerv@dawncrow.de>
---
See https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux/net.h for the values.
Not entirely sure how to implement recvmmsg and sendmmsg...
linux-user/syscall.c | 15 +++++++++++++++
linux-user/syscall_defs.h | 3 +++
2 files changed, 18 insertions(+)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index efd1453..475fb8c 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -2245,6 +2245,21 @@ static abi_long do_socketcall(int num, abi_ulong vptr)
ret = do_accept4(sockfd, target_addr, target_addrlen, 0);
}
break;
+ case SOCKOP_accept4:
+ {
+ abi_ulong sockfd;
+ abi_ulong target_addr, target_addrlen;
+ abi_ulong flags;
+
+ if (get_user_ual(sockfd, vptr)
+ || get_user_ual(target_addr, vptr + n)
+ || get_user_ual(target_addrlen, vptr + 2 * n)
+ || get_user_ual(flags, vptr + 3 * n))
+ return -TARGET_EFAULT;
+
+ ret = do_accept4(sockfd, target_addr, target_addrlen, flags);
+ }
+ break;
case SOCKOP_getsockname:
{
abi_ulong sockfd;
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index cf08db5..b36f99c 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -27,6 +27,9 @@
#define SOCKOP_getsockopt 15
#define SOCKOP_sendmsg 16
#define SOCKOP_recvmsg 17
+#define SOCKOP_accept4 18
+#define SOCKOP_recvmmsg 19
+#define SOCKOP_sendmmsg 20
#define IPCOP_semop 1
#define IPCOP_semget 2
--
1.8.1.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH resend] linux-user: Support the accept4 socketcall
2014-01-06 1:57 [Qemu-devel] [PATCH resend] linux-user: Support the accept4 socketcall André Hentschel
@ 2014-01-06 3:37 ` Erik de Castro Lopo
2014-01-06 8:45 ` Laurent Vivier
1 sibling, 0 replies; 7+ messages in thread
From: Erik de Castro Lopo @ 2014-01-06 3:37 UTC (permalink / raw)
To: qemu-devel
Hi André,
This looks ok, except that scripts/checkpatch.pl says:
WARNING: braces {} are necessary for all arms of this statement
#36: FILE: linux-user/syscall.c:2254:
+ if (get_user_ual(sockfd, vptr)
[...]
total: 0 errors, 1 warnings, 30 lines checked
Fix that and I'll be happy to slap a "reviewed-by" sticker on it. Be sure
to CC me on the fixed version of the patch.
Cheers,
Erik
--
----------------------------------------------------------------------
Erik de Castro Lopo
http://www.mega-nerd.com/
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH resend] linux-user: Support the accept4 socketcall
2014-01-06 1:57 [Qemu-devel] [PATCH resend] linux-user: Support the accept4 socketcall André Hentschel
2014-01-06 3:37 ` Erik de Castro Lopo
@ 2014-01-06 8:45 ` Laurent Vivier
2014-01-06 9:14 ` Peter Maydell
1 sibling, 1 reply; 7+ messages in thread
From: Laurent Vivier @ 2014-01-06 8:45 UTC (permalink / raw)
To: qemu-devel, André Hentschel; +Cc: Riku Voipio
[-- Attachment #1: Type: text/plain, Size: 700 bytes --]
> Le 6 janvier 2014 à 02:57, André Hentschel <nerv@dawncrow.de> a écrit :
>
>
> From: André Hentschel <nerv@dawncrow.de>
> Cc: Riku Voipio <riku.voipio@iki.fi>
> Signed-off-by: André Hentschel <nerv@dawncrow.de>
[...]
> diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
> index cf08db5..b36f99c 100644
> --- a/linux-user/syscall_defs.h
> +++ b/linux-user/syscall_defs.h
> @@ -27,6 +27,9 @@
> #define SOCKOP_getsockopt 15
> #define SOCKOP_sendmsg 16
> #define SOCKOP_recvmsg 17
> +#define SOCKOP_accept4 18
> +#define SOCKOP_recvmmsg 19
> +#define SOCKOP_sendmmsg 20
Don't add these both defines here as they are not used in this patch.
Regards,
Laurent
[-- Attachment #2: Type: text/html, Size: 1738 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH resend] linux-user: Support the accept4 socketcall
2014-01-06 8:45 ` Laurent Vivier
@ 2014-01-06 9:14 ` Peter Maydell
2014-01-06 10:21 ` Laurent Vivier
0 siblings, 1 reply; 7+ messages in thread
From: Peter Maydell @ 2014-01-06 9:14 UTC (permalink / raw)
To: Laurent Vivier; +Cc: André Hentschel, Riku Voipio, QEMU Developers
On 6 January 2014 08:45, Laurent Vivier <laurent@vivier.eu> wrote:
>
>> Le 6 janvier 2014 à 02:57, André Hentschel <nerv@dawncrow.de> a écrit :
>> diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
>> index cf08db5..b36f99c 100644
>> --- a/linux-user/syscall_defs.h
>> +++ b/linux-user/syscall_defs.h
>> @@ -27,6 +27,9 @@
>> #define SOCKOP_getsockopt 15
>> #define SOCKOP_sendmsg 16
>> #define SOCKOP_recvmsg 17
>> +#define SOCKOP_accept4 18
>> +#define SOCKOP_recvmmsg 19
>> +#define SOCKOP_sendmmsg 20
>
> Don't add these both defines here as they are not used in this patch.
It doesn't seem that unreasonable to add them. We add things
to the main syscall number #define list even if we aren't
actually implementing them, for example.
thanks
-- PMM
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH resend] linux-user: Support the accept4 socketcall
2014-01-06 9:14 ` Peter Maydell
@ 2014-01-06 10:21 ` Laurent Vivier
2014-01-06 15:38 ` André Hentschel
0 siblings, 1 reply; 7+ messages in thread
From: Laurent Vivier @ 2014-01-06 10:21 UTC (permalink / raw)
To: Peter Maydell; +Cc: André Hentschel, Riku Voipio, QEMU Developers
[-- Attachment #1: Type: text/plain, Size: 1125 bytes --]
> Le 6 janvier 2014 à 10:14, Peter Maydell <peter.maydell@linaro.org> a écrit :
>
>
> On 6 January 2014 08:45, Laurent Vivier <laurent@vivier.eu> wrote:
> >
> >> Le 6 janvier 2014 à 02:57, André Hentschel <nerv@dawncrow.de> a écrit :
> >> diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
> >> index cf08db5..b36f99c 100644
> >> --- a/linux-user/syscall_defs.h
> >> +++ b/linux-user/syscall_defs.h
> >> @@ -27,6 +27,9 @@
> >> #define SOCKOP_getsockopt 15
> >> #define SOCKOP_sendmsg 16
> >> #define SOCKOP_recvmsg 17
> >> +#define SOCKOP_accept4 18
> >> +#define SOCKOP_recvmmsg 19
> >> +#define SOCKOP_sendmmsg 20
> >
> > Don't add these both defines here as they are not used in this patch.
>
> It doesn't seem that unreasonable to add them. We add things
> to the main syscall number #define list even if we aren't
> actually implementing them, for example.
IMHO, you should not : if you implement these syscalls and then revert this
patch (because it is broken, for instance), you will break the build. The
defines must come with the implementation.
Regards,
Laurent
[-- Attachment #2: Type: text/html, Size: 2334 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH resend] linux-user: Support the accept4 socketcall
2014-01-06 10:21 ` Laurent Vivier
@ 2014-01-06 15:38 ` André Hentschel
2014-01-06 16:03 ` Peter Maydell
0 siblings, 1 reply; 7+ messages in thread
From: André Hentschel @ 2014-01-06 15:38 UTC (permalink / raw)
To: QEMU Developers; +Cc: Riku Voipio
> This looks ok, except that scripts/checkpatch.pl says:
>
> WARNING: braces {} are necessary for all arms of this statement
> #36: FILE: linux-user/syscall.c:2254:
> + if (get_user_ual(sockfd, vptr)
> [...]
>
> total: 0 errors, 1 warnings, 30 lines checked
>
> Fix that and I'll be happy to slap a "reviewed-by" sticker on it. Be sure
> to CC me on the fixed version of the patch.
>
>
> Cheers,
> Erik
This warning seems wrong:
- the if statement has no braces and only one arm
- the if statement looks like the others around it, i just try to keep the same style
Am 06.01.2014 11:21, schrieb Laurent Vivier:
>
>> Le 6 janvier 2014 à 10:14, Peter Maydell <peter.maydell@linaro.org> a écrit :
>>
>>
>> On 6 January 2014 08:45, Laurent Vivier <laurent@vivier.eu> wrote:
>> >
>> >> Le 6 janvier 2014 à 02:57, André Hentschel <nerv@dawncrow.de> a écrit :
>> >> diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
>> >> index cf08db5..b36f99c 100644
>> >> --- a/linux-user/syscall_defs.h
>> >> +++ b/linux-user/syscall_defs.h
>> >> @@ -27,6 +27,9 @@
>> >> #define SOCKOP_getsockopt 15
>> >> #define SOCKOP_sendmsg 16
>> >> #define SOCKOP_recvmsg 17
>> >> +#define SOCKOP_accept4 18
>> >> +#define SOCKOP_recvmmsg 19
>> >> +#define SOCKOP_sendmmsg 20
>> >
>> > Don't add these both defines here as they are not used in this patch.
>>
>> It doesn't seem that unreasonable to add them. We add things
>> to the main syscall number #define list even if we aren't
>> actually implementing them, for example.
>
> IMHO, you should not : if you implement these syscalls and then revert this patch (because it is broken, for instance), you will break the build. The defines must come with the implementation.
good point for removing them and add them separatly.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH resend] linux-user: Support the accept4 socketcall
2014-01-06 15:38 ` André Hentschel
@ 2014-01-06 16:03 ` Peter Maydell
0 siblings, 0 replies; 7+ messages in thread
From: Peter Maydell @ 2014-01-06 16:03 UTC (permalink / raw)
To: André Hentschel; +Cc: Riku Voipio, QEMU Developers
On 6 January 2014 15:38, André Hentschel <nerv@dawncrow.de> wrote:
> This warning seems wrong:
> - the if statement has no braces and only one arm
> - the if statement looks like the others around it, i just try to keep the same style
The warning is saying that you need braces. "all arms" for an
if() with only one arm means "on that one arm". See the
CODING_STYLE file's section on 'block structure'.
QEMU includes a fair amount of legacy code which doesn't
follow our coding standards. Our general policy on this is that
new code follows the standards, and when a patch touches
old code it updates it (at least sufficiently to get checkpatch
to be happy). We don't generally do large-scale "update whole
file to new standard" patches as this breaks git blame and
can cause unnecessary patch conflicts.
thanks
-- PMM
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2014-01-06 16:04 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-06 1:57 [Qemu-devel] [PATCH resend] linux-user: Support the accept4 socketcall André Hentschel
2014-01-06 3:37 ` Erik de Castro Lopo
2014-01-06 8:45 ` Laurent Vivier
2014-01-06 9:14 ` Peter Maydell
2014-01-06 10:21 ` Laurent Vivier
2014-01-06 15:38 ` André Hentschel
2014-01-06 16:03 ` Peter Maydell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).