qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2] linux-user: Support the accept4 socketcall
@ 2014-01-06 16:15 André Hentschel
  2014-01-06 17:07 ` Laurent Vivier
  2014-01-08 14:52 ` Riku Voipio
  0 siblings, 2 replies; 4+ messages in thread
From: André Hentschel @ 2014-01-06 16:15 UTC (permalink / raw)
  To: QEMU Developers; +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 value.

 linux-user/syscall.c      | 16 ++++++++++++++++
 linux-user/syscall_defs.h |  1 +
 2 files changed, 17 insertions(+)

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index efd1453..1a848a6 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -2245,6 +2245,22 @@ 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;
+            int 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..ae30476 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -27,6 +27,7 @@
 #define SOCKOP_getsockopt       15
 #define SOCKOP_sendmsg          16
 #define SOCKOP_recvmsg          17
+#define SOCKOP_accept4          18
 
 #define IPCOP_semop		1
 #define IPCOP_semget		2
-- 
1.8.1.2

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

* Re: [Qemu-devel] [PATCH v2] linux-user: Support the accept4 socketcall
  2014-01-06 16:15 [Qemu-devel] [PATCH v2] linux-user: Support the accept4 socketcall André Hentschel
@ 2014-01-06 17:07 ` Laurent Vivier
  2014-01-06 17:19   ` Peter Maydell
  2014-01-08 14:52 ` Riku Voipio
  1 sibling, 1 reply; 4+ messages in thread
From: Laurent Vivier @ 2014-01-06 17:07 UTC (permalink / raw)
  To: QEMU Developers, André Hentschel; +Cc: Riku Voipio

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


> Le 6 janvier 2014 à 17:15, 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>
> ---
> See
> https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux/net.h
> for the value.
>
> linux-user/syscall.c | 16 ++++++++++++++++
> linux-user/syscall_defs.h | 1 +
> 2 files changed, 17 insertions(+)
>
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index efd1453..1a848a6 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -2245,6 +2245,22 @@ 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;
> + int 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)) {

I'm not sure, but I think as get_user_ual() get an abi_ulong, flags should be an
abi_ulong. Peter ?

> + 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..ae30476 100644
> --- a/linux-user/syscall_defs.h
> +++ b/linux-user/syscall_defs.h
> @@ -27,6 +27,7 @@
> #define SOCKOP_getsockopt 15
> #define SOCKOP_sendmsg 16
> #define SOCKOP_recvmsg 17
> +#define SOCKOP_accept4 18
>
> #define IPCOP_semop 1
> #define IPCOP_semget 2
> --
> 1.8.1.2
>
>

[-- Attachment #2: Type: text/html, Size: 3220 bytes --]

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

* Re: [Qemu-devel] [PATCH v2] linux-user: Support the accept4 socketcall
  2014-01-06 17:07 ` Laurent Vivier
@ 2014-01-06 17:19   ` Peter Maydell
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Maydell @ 2014-01-06 17:19 UTC (permalink / raw)
  To: Laurent Vivier; +Cc: André Hentschel, Riku Voipio, QEMU Developers

On 6 January 2014 17:07, Laurent Vivier <laurent@vivier.eu> wrote:
>
>> Le 6 janvier 2014 à 17:15, 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>
>> ---
>> See
>> https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux/net.h
>> for the value.
>>
>> linux-user/syscall.c | 16 ++++++++++++++++
>> linux-user/syscall_defs.h | 1 +
>> 2 files changed, 17 insertions(+)
>>
>> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
>> index efd1453..1a848a6 100644
>> --- a/linux-user/syscall.c
>> +++ b/linux-user/syscall.c
>> @@ -2245,6 +2245,22 @@ 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;
>> + int 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)) {
>
> I'm not sure, but I think as get_user_ual() get an abi_ulong, flags should
> be an abi_ulong.

It's not required for correctness (since get_user_ual
always does an abi_ulong sized access of guest memory
regardless of the size of its first argument) but I
think it would be clearer, yes.

thanks
-- PMM

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

* Re: [Qemu-devel] [PATCH v2] linux-user: Support the accept4 socketcall
  2014-01-06 16:15 [Qemu-devel] [PATCH v2] linux-user: Support the accept4 socketcall André Hentschel
  2014-01-06 17:07 ` Laurent Vivier
@ 2014-01-08 14:52 ` Riku Voipio
  1 sibling, 0 replies; 4+ messages in thread
From: Riku Voipio @ 2014-01-08 14:52 UTC (permalink / raw)
  To: André Hentschel; +Cc: QEMU Developers

Hi,

On Mon, Jan 06, 2014 at 05:15:50PM +0100, André Hentschel wrote:
> 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 value.

Thanks, applied to the linux-user branch. I'm still checking if there
are other linux-user patches that need submitting upstream before
sending a pull request.

Riku

> 
>  linux-user/syscall.c      | 16 ++++++++++++++++
>  linux-user/syscall_defs.h |  1 +
>  2 files changed, 17 insertions(+)
> 
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index efd1453..1a848a6 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -2245,6 +2245,22 @@ 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;
> +            int 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..ae30476 100644
> --- a/linux-user/syscall_defs.h
> +++ b/linux-user/syscall_defs.h
> @@ -27,6 +27,7 @@
>  #define SOCKOP_getsockopt       15
>  #define SOCKOP_sendmsg          16
>  #define SOCKOP_recvmsg          17
> +#define SOCKOP_accept4          18
>  
>  #define IPCOP_semop		1
>  #define IPCOP_semget		2
> -- 
> 1.8.1.2
> 

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

end of thread, other threads:[~2014-01-08 14:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-06 16:15 [Qemu-devel] [PATCH v2] linux-user: Support the accept4 socketcall André Hentschel
2014-01-06 17:07 ` Laurent Vivier
2014-01-06 17:19   ` Peter Maydell
2014-01-08 14:52 ` Riku Voipio

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).