Ultralinux archive on lore.kernel.org
 help / color / mirror / Atom feed
* Re: [RNDGETENTCNT ioctl]
@ 2002-02-07 12:41 Eric
  2002-02-08 14:07 ` Marco Colombo
  2002-02-08 14:10 ` David S. Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Eric @ 2002-02-07 12:41 UTC (permalink / raw)
  To: ultralinux

Add a COMPATIBLE_IOCTL entry for RNDGETENTCNT into ioctl32.c
and you may wish to modify the type of avail_entropy to one
that is explicitly sized (int32_t or somesuch) for cross-platform
friendliness.

Probably something similar to the following as a starting point:

--- ioctl32.c	Fri Feb  1 18:18:21 2002
+++ ioctl32.c.new	Thu Feb  7 12:33:56 2002
@@ -96,6 +96,7 @@
 #include <linux/usb.h>
 #include <linux/usbdevice_fs.h>
 #include <linux/nbd.h>
+#include <linux/random.h>
 
 /* Use this to get at 32-bit user passed pointers. 
    See sys_sparc32.c for description about these. */
@@ -4529,6 +4530,8 @@
 COMPATIBLE_IOCTL(WIOCSTART)
 COMPATIBLE_IOCTL(WIOCSTOP)
 COMPATIBLE_IOCTL(WIOCGSTAT)
+/* Big R */
+COMPATIBLE_IOCTL(RNDGETENTCNT)
 /* Bluetooth ioctls */
 COMPATIBLE_IOCTL(HCIDEVUP)
 COMPATIBLE_IOCTL(HCIDEVDOWN)

E

Marco Colombo <marco@esi.it> wrote:
> Hi, I'd like to read the entropy count via the RNDGETENTCNT
> ioctl, as in the following code:
> 
> 	int     rfd, res;
> 	int     avail_entropy;
> 
> 	...
> 	rfd = open("/dev/random", O_RDONLY);
> 	...
> 	res = ioctl(rfd, RNDGETENTCNT, &avail_entropy);
> 
> this happens to work on ix86, but fails on sparc64, with EINVAL.
> I think I've tracked this down to:
> 
> arch/sparc64/kernel/ioctl32.c
> 
> where RNDGETENTCNT isn't even mentioned. Is there a patch to add support
> for these "big R" ioctls to ioctl32.c?  Can RNDGETENTCNT simply be 
> added to the list of those that get passed to sys_ioctl() without any
> 32->64bit translation? (I'm sorry but I can only vaguely understand the
> issues behind than, so if some hacking is needed, more than just adding
> #includes and case RNDGETENTCNT:, I won't be able to do it myself)
> 
> I'm currently running RH 2.2.19-6.2.12 (sparc64) kernel, please flame me
> if I need to switch to the latest vanilla 2.2.x before further reporting.
> 
> The HW is Ultra 1 145Mhz.
> 
> TIA,
> .TM.
> 
> -
> To unsubscribe from this list: send the line "unsubscribe ultralinux" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


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

* Re: [RNDGETENTCNT ioctl]
  2002-02-07 12:41 [RNDGETENTCNT ioctl] Eric
@ 2002-02-08 14:07 ` Marco Colombo
  2002-02-08 14:10 ` David S. Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Marco Colombo @ 2002-02-08 14:07 UTC (permalink / raw)
  To: ultralinux

On 7 Feb 2002, Eric wrote:

> Add a COMPATIBLE_IOCTL entry for RNDGETENTCNT into ioctl32.c
> and you may wish to modify the type of avail_entropy to one
> that is explicitly sized (int32_t or somesuch) for cross-platform
> friendliness.
> 
> Probably something similar to the following as a starting point:
> 
> --- ioctl32.c	Fri Feb  1 18:18:21 2002
> +++ ioctl32.c.new	Thu Feb  7 12:33:56 2002
> @@ -96,6 +96,7 @@
>  #include <linux/usb.h>
>  #include <linux/usbdevice_fs.h>
>  #include <linux/nbd.h>
> +#include <linux/random.h>
>  
>  /* Use this to get at 32-bit user passed pointers. 
>     See sys_sparc32.c for description about these. */
> @@ -4529,6 +4530,8 @@
>  COMPATIBLE_IOCTL(WIOCSTART)
>  COMPATIBLE_IOCTL(WIOCSTOP)
>  COMPATIBLE_IOCTL(WIOCGSTAT)
> +/* Big R */
> +COMPATIBLE_IOCTL(RNDGETENTCNT)
>  /* Bluetooth ioctls */
>  COMPATIBLE_IOCTL(HCIDEVUP)
>  COMPATIBLE_IOCTL(HCIDEVDOWN)

Eric, thanks for your answer.

I'm aware that vendor-patched trees are quite unsupported on general
kernel lists, but, please, bear with me a little... to which kernel tree
does the above apply? I'm asking because:

# find /usr/src/linux/. -type f | xargs fgrep COMPATIBLE_IOCTL
<no results>

# rpm -q kernel-source
kernel-source-2.2.19-6.2.12

that's the Red Hat kernel tree.

I'm pretty willing to grab another tree and compile it, but I'd like to
know which one in advance instead of going on by trial & error. The system
is Red Hat 6.2 so I need a 2.2.x kernel.

.TM.
-- 
      ____/  ____/   /
     /      /       /			Marco Colombo
    ___/  ___  /   /		      Technical Manager
   /          /   /			 ESI s.r.l.
 _____/ _____/  _/		       Colombo@ESI.it


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

* Re: [RNDGETENTCNT ioctl]
  2002-02-07 12:41 [RNDGETENTCNT ioctl] Eric
  2002-02-08 14:07 ` Marco Colombo
@ 2002-02-08 14:10 ` David S. Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David S. Miller @ 2002-02-08 14:10 UTC (permalink / raw)
  To: ultralinux

   From: Marco Colombo <marco@esi.it>
   Date: Fri, 8 Feb 2002 15:07:11 +0100 (CET)
   
   I'm pretty willing to grab another tree and compile it, but I'd like to
   know which one in advance instead of going on by trial & error. The system
   is Red Hat 6.2 so I need a 2.2.x kernel.

He's referring to 2.4.x sources.

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

end of thread, other threads:[~2002-02-08 14:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-02-07 12:41 [RNDGETENTCNT ioctl] Eric
2002-02-08 14:07 ` Marco Colombo
2002-02-08 14:10 ` David S. Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox