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

[Condor-users] Reading /dev/random



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello!

I'm running MC simulations using condor. and I encountered the following
problem.

Condor runs on two Linux cluster running SUSE Linux, one using SUSE 7.0
(yes, I know it's old) and Condor 6.4.1, the other SUSE 9.0 and Condor
6.6.3.

I want to seed the random number generator via the /dev/random device.
For that I'm basically using the following code:
- ---------------------------------------------
unsigned long int seed;
FILE *devrandom = fopen("/dev/random", "r");
fread(&seed, sizeof(seed), 1 , devrandom);
- ---------------------------------------------
(for people that would like to try I've attached a .C-file that wraps
all the necessary code around these two calls)

Running this code in the condor standard universe yields in the
following behaviour:
1. the fopen() call succeeds
2. the fread() call returns 0 and does NOT set seed.
3. feof() is set.

This is highly confusing. In theory, reading /dev/random should either
return a random number, or it should block until enough entropy is
available (see random(4) manpage).

My questions:
1. Is it possible to access /dev/random from a standard universe job?
2. Is the described behaviour a bug or a feature?

Olaf
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCGuZntQ3riQ3oo/oRAh1XAJwOk/4ZlrIXjaLc+4Dq47//nQZVygCfUu+T
pX1zhh9bVCxE1b4f7+G85yo=
=Ksa6
-----END PGP SIGNATURE-----