Skip to contentSkip to conversation

linux-user: Support the accept4 socketcall

PATCH Superseded André Hentschel 2 participants 2 messages Dec 23, 2013

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 linux-user: Support the accept4 socketcall

From: André Hentschel <[email protected]>

Cc Riku Voipio <[email protected]>
Cc Alexander Graf <[email protected]>

---
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...
PS: I hit send to early on the last attempt, sry.

 linux-user/syscall.c      | 15 +++++++++++++++
 linux-user/syscall_defs.h |  3 +++
 2 files changed, 18 insertions(+)
linux-user/syscall.c +15 -0
index efd1453..475fb8c 100644
@@ -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;
linux-user/syscall_defs.h +3 -0
index cf08db5..b36f99c 100644
@@ -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
Signature · 1 line
1.8.1.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · André Hentschel

From: André Hentschel <[email protected]>

Cc Riku Voipio <[email protected]>
Cc Alexander Graf <[email protected]>

---
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...
PS: I hit send to early on the last attempt, sry.

The patch appears to be okay, but I'm not sure why you're sending it to -trivial, linux-user has an active maintainer (Riku, who has been Cc'ed too). If he agrees I can apply this to -trivial.

/mjt