I am New at OSDev.
Implementing a device driver for a random number generator and wondering if lseek / tell should be implemented? It is possible to record the state of the generator which may allow an lseek to work. Seems kind of contrary to the idea of random numbers though.
The RNG uses George Marsaglia's multiply method.
lseek for /dev/random
Re: lseek for /dev/random
Not every device is seekable, and the error code ESPIPE exists for that reason. Linux doesn't support seeking it, so I shouldn't think any application expects it to be seekable.
Carpe diem!
Re: lseek for /dev/random
I can't imagine why you would want to seek on /dev/random but I also don't see that it makes the generated numbers any less random than they are. For example, you wouldn't expect a SEEK_END to give the same results every time you called it, or indeed a predictable result.
I'm curious as to why you would consider implementing it.
I'm curious as to why you would consider implementing it.