Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 1 Apr 2015 13:52:04 +0200
From:      Mateusz Guzik <mjguzik@gmail.com>
To:        Gleb Smirnoff <glebius@FreeBSD.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r280955 - in head/sys: modules/notrandom dev/notrandom
Message-ID:  <20150401115204.GB16649@dft-labs.eu>
In-Reply-To: <20150401114313.GZ64665@FreeBSD.org>
References:  <20150401113628.GA16649@dft-labs.eu> <20150401114313.GZ64665@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20150401115204.GB16649>