Skip to contentSkip to conversation

linux-user: Add RNDGETENTCNT ioctl

PATCH In review Marco A L Barbosa 2 participants 3 messages Oct 5, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 linux-user: Add RNDGETENTCNT ioctl

I'm using qemu with this patch (and another one) to run android ndk applications.

---
 linux-user/ioctls.h       | 2 ++
 linux-user/syscall.c      | 1 +
 linux-user/syscall_defs.h | 4 ++++
 3 files changed, 7 insertions(+)
linux-user/ioctls.h +2 -0
index e6997ff230..18127288cc 100644
@@ -173,6 +173,8 @@
   IOCTL(SIOCGSTAMP, IOC_R, MK_PTR(MK_STRUCT(STRUCT_timeval)))
   IOCTL(SIOCGSTAMPNS, IOC_R, MK_PTR(MK_STRUCT(STRUCT_timespec)))
 
+  IOCTL(RNDGETENTCNT, IOC_R, MK_PTR(TYPE_INT))
+
   IOCTL(CDROMPAUSE, 0, TYPE_NULL)
   IOCTL(CDROMSTART, 0, TYPE_NULL)
   IOCTL(CDROMSTOP, 0, TYPE_NULL)
linux-user/syscall.c +1 -0
index 9b6364a266..d4c21a557c 100644
@@ -59,6 +59,7 @@ int __clone2(int (*fn)(void *), void *child_stack_base,
 #include <linux/icmp.h>
 #include <linux/icmpv6.h>
 #include <linux/errqueue.h>
+#include <linux/random.h>
 #include "qemu-common.h"
 #ifdef CONFIG_TIMERFD
 #include <sys/timerfd.h>
linux-user/syscall_defs.h +4 -0
index 40c5027e93..2b27786dae 100644
@@ -1060,6 +1060,10 @@ struct target_pollfd {
 
 #define TARGET_SIOCGIWNAME     0x8B01          /* get name == wireless protocol */
 
+/* From <linux/random.h> */
+
+#define TARGET_RNDGETENTCNT    TARGET_IOR('R', 0x00, int)
+
 /* From <linux/fs.h> */
 
 #define TARGET_BLKROSET   TARGET_IO(0x12,93) /* set device read-only (0 = read-write) */
Signature · 1 line
2.11.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 41 lines · Marco A L Barbosa

I'm using qemu with this patch (and another one) to run android ndk applications.

---
 linux-user/ioctls.h       | 2 ++
 linux-user/syscall.c      | 1 +
 linux-user/syscall_defs.h | 4 ++++
 3 files changed, 7 insertions(+)
linux-user/ioctls.h +2 -0
index e6997ff230..18127288cc 100644
@@ -173,6 +173,8 @@
   IOCTL(SIOCGSTAMP, IOC_R, MK_PTR(MK_STRUCT(STRUCT_timeval)))
   IOCTL(SIOCGSTAMPNS, IOC_R, MK_PTR(MK_STRUCT(STRUCT_timespec)))
 
+  IOCTL(RNDGETENTCNT, IOC_R, MK_PTR(TYPE_INT))
+
   IOCTL(CDROMPAUSE, 0, TYPE_NULL)
   IOCTL(CDROMSTART, 0, TYPE_NULL)
   IOCTL(CDROMSTOP, 0, TYPE_NULL)
linux-user/syscall.c +1 -0
index 9b6364a266..d4c21a557c 100644
@@ -59,6 +59,7 @@ int __clone2(int (*fn)(void *), void *child_stack_base,
 #include <linux/icmp.h>
 #include <linux/icmpv6.h>
 #include <linux/errqueue.h>
+#include <linux/random.h>
 #include "qemu-common.h"
 #ifdef CONFIG_TIMERFD
 #include <sys/timerfd.h>
linux-user/syscall_defs.h +0 -0
index 40c5027e93..2b27786dae 100644

linux-user/syscall_defs.h struct target_pollfd { · line 1069

Quoted 10 lines
linux-user/syscall_defs.h +4 -0
@@ -1060,6 +1060,10 @@ struct target_pollfd {
 
 #define TARGET_SIOCGIWNAME     0x8B01          /* get name == wireless protocol */
 
+/* From <linux/random.h> */
+
+#define TARGET_RNDGETENTCNT    TARGET_IOR('R', 0x00, int)
+
 /* From <linux/fs.h> */
 
 #define TARGET_BLKROSET   TARGET_IO(0x12,93) /* set device read-only (0 = read-write) */

It would be better to keep RNDADDTOENTCNT, RNDZAPENTCNT and RNDCLEARPOOL as the changes are trivial too.

Anyway:

#2 lore raw

Ok, I sent another patch. Thanks.

Quoted 63 lines · Laurent Vivier
Quoted 40 lines · Marco A L Barbosa

I'm using qemu with this patch (and another one) to run android ndk applications.

---
 linux-user/ioctls.h       | 2 ++
 linux-user/syscall.c      | 1 +
 linux-user/syscall_defs.h | 4 ++++
 3 files changed, 7 insertions(+)
linux-user/ioctls.h +2 -0
index e6997ff230..18127288cc 100644
@@ -173,6 +173,8 @@
   IOCTL(SIOCGSTAMP, IOC_R, MK_PTR(MK_STRUCT(STRUCT_timeval)))
   IOCTL(SIOCGSTAMPNS, IOC_R, MK_PTR(MK_STRUCT(STRUCT_timespec)))
 
+  IOCTL(RNDGETENTCNT, IOC_R, MK_PTR(TYPE_INT))
+
   IOCTL(CDROMPAUSE, 0, TYPE_NULL)
   IOCTL(CDROMSTART, 0, TYPE_NULL)
   IOCTL(CDROMSTOP, 0, TYPE_NULL)
linux-user/syscall.c +1 -0
index 9b6364a266..d4c21a557c 100644
@@ -59,6 +59,7 @@ int __clone2(int (*fn)(void *), void *child_stack_base,
 #include <linux/icmp.h>
 #include <linux/icmpv6.h>
 #include <linux/errqueue.h>
+#include <linux/random.h>
 #include "qemu-common.h"
 #ifdef CONFIG_TIMERFD
 #include <sys/timerfd.h>
linux-user/syscall_defs.h +0 -0
index 40c5027e93..2b27786dae 100644

linux-user/syscall_defs.h struct target_pollfd { · line 1061

Quoted 2 lines
linux-user/syscall_defs.h +0 -0
@@ -1060,6 +1060,10 @@ struct target_pollfd {
 
 #define TARGET_SIOCGIWNAME     0x8B01          /* get name == wireless

protocol */

linux-user/syscall_defs.h struct target_pollfd {

Quoted 8 lines
linux-user/syscall_defs.h +4 -0
+/* From <linux/random.h> */
+
+#define TARGET_RNDGETENTCNT    TARGET_IOR('R', 0x00, int)
+
 /* From <linux/fs.h> */
 
 #define TARGET_BLKROSET   TARGET_IO(0x12,93) /* set device read-only (0

= read-write) */

Quoted 1 line

It would be better to keep RNDADDTOENTCNT, RNDZAPENTCNT and RNDCLEARPOOL as the changes are trivial too.

Anyway:

Signature · 3 lines
Marco A L Barbosa
http://malbarbo.pro.br
--