svn commit: r280955 - in head/sys: modules/notrandom dev/notrandom

Mateusz Guzik mjguzik at gmail.com
Wed Apr 1 11:52:10 UTC 2015


On Wed, Apr 01, 2015 at 02:43:13PM +0300, Gleb Smirnoff wrote:
> On Wed, Apr 01, 2015 at 01:36:28PM +0200, Mateusz Guzik wrote:
> M> Author: mjg
> M> Date: Wed Apr  1 13:37:00 2015
> M> New Revision: 280955
> M> URL: https://svnweb.freebsd.org/changeset/base/280955
> M> 
> M> Log:
> M>   Add /dev/notrandom
> M> 
> M>   notrandom provides fast and reliable not random numbers.
> M> 
> M>   This was added in an effort to increase feature-compatiblity with
> M>   Solaris 10.
> M> 
> M>   See http://www.brendangregg.com/Specials/notrandom.c for Solaris
> M>   implementation.
> M> 
> M>   Reviewed-by: Bruce Schneier (ok, not really)
> M>   MFC after:	1 week
> 
> What is the difference of this implementation with /dev/zero?
> 

/dev/zero returns 0s, while notrandom was implemented to return 7s.

We could e.g. symlink /dev/notrandom to /dev/zero, but that would break
compatiblity with Solaris apps depending on this functionality.

It could also introduce hard-to-debug problems. After all, readers get a
different value than they expect.

Given that we have some parts of Solaris merged (zfs, dtrace) and work
with open source forks on these technologies, I think we should diverge
only when necessary.

As a side note I'm surprised with the choice of 7.

I would expect 3, no more, no less. 3 would be the number returned, and
the number readers receive would be 3.

-- 
Mateusz Guzik <mjguzik gmail.com>


More information about the svn-src-head mailing list