gm2
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [Gm2] Problem with urandom


From: Breeden, Thomas (tmb)
Subject: RE: [Gm2] Problem with urandom
Date: Thu, 22 Oct 2009 09:06:21 -0400

> -----Original Message-----
> From: address@hidden [mailto:gm2-
> address@hidden On Behalf Of Martin Kalbfuß
> Sent: October 22, 2009 6:49 AM
> To: Andreas Fischlin
> Cc: GNU Modula-2
> Subject: Re: [Gm2] Problem with urandom
> 
> Thank you for your answers. But /dev/urandom or dev/random aren't
> normal
> files. They are device files on unixoid systems. When you read from
> them, you get a random number. But I don't. Works fine with C. I never
> used file access with Modula-2 so I think I do something wrong here.

FWIW

I suspect the problem is that the /dev/urandom really isn't a normal file.
ie, it can't be considered a SeqFile or StreamFile (or RndFile or TermFile).

What you could do is create your own ChanId type and once that is done
you could use the ISO Read/Write routines to access it.

Unfortunately, I don't know of any real instructions on how to do this,
but if you are interested I made an attempt to create an in-memory flavor
of ChanId (similar to what you would use for sread() swrite()) that you
can check out at http://www.modula2.org/projects/tbchans.php

Alternatively, the urandom man pages reference file /proc/sys/kernel/uuid
which looks as if it could be processed as a StreamFile, since it is a
normal Unix file, but it returns a new random uuid type string on each
read. I don't have gm2, but if you do an "insert file" op in Emacs you
get a new uuid string each time. If you do an "insert file" op on
/dev/urandom, it crashes Emacs.

Tom



reply via email to

[Prev in Thread] Current Thread [Next in Thread]