> On 18 Nov 2014, at 11:39, Ted Unangst <t...@tedunangst.com> wrote: > > On Tue, Nov 18, 2014 at 11:06, David Gwynne wrote: > >> +#include <dev/rndvar.h> > > Sorry to interrupt :), but I think it's become clear that rndvar.h is > the wrong header for arc4random() to live in.
agreed. > The diff below moves it to systm.h and fixes the two files that didn't > compile. if this is quickly oked, i think it should go in first so i can update the hash diff. the hash diff needs more time for scrutiny and testing which would only hold up your simpler header change. > > Index: dev/rndvar.h > =================================================================== > RCS file: /cvs/src/sys/dev/rndvar.h,v > retrieving revision 1.33 > diff -u -p -r1.33 rndvar.h > --- dev/rndvar.h 19 Jan 2014 23:52:54 -0000 1.33 > +++ dev/rndvar.h 18 Nov 2014 01:31:17 -0000 > @@ -72,9 +72,6 @@ extern struct rndstats rndstats; > void random_start(void); > > void enqueue_randomness(int, int); > -void arc4random_buf(void *, size_t); > -u_int32_t arc4random(void); > -u_int32_t arc4random_uniform(u_int32_t); > > #endif /* _KERNEL */ > > Index: sys/systm.h > =================================================================== > RCS file: /cvs/src/sys/sys/systm.h,v > retrieving revision 1.102 > diff -u -p -r1.102 systm.h > --- sys/systm.h 9 Oct 2014 04:04:27 -0000 1.102 > +++ sys/systm.h 18 Nov 2014 01:31:28 -0000 > @@ -215,6 +215,10 @@ int copyin(const void *, void *, size_t) > __attribute__ ((__bounded__(__buffer__,2,3))); > int copyout(const void *, void *, size_t); > > +void arc4random_buf(void *, size_t); > +u_int32_t arc4random(void); > +u_int32_t arc4random_uniform(u_int32_t); > + > struct timeval; > struct timespec; > int hzto(const struct timeval *); > Index: netinet/ip_id.c > =================================================================== > RCS file: /cvs/src/sys/netinet/ip_id.c,v > retrieving revision 1.23 > diff -u -p -r1.23 ip_id.c > --- netinet/ip_id.c 31 Mar 2011 10:36:42 -0000 1.23 > +++ netinet/ip_id.c 18 Nov 2014 01:35:18 -0000 > @@ -26,7 +26,7 @@ > * be reused for at least 32768 calls. > */ > #include <sys/param.h> > -#include <dev/rndvar.h> > +#include <sys/systm.h> > > static u_int16_t ip_shuffle[65536]; > static int isindex = 0; > Index: netinet6/ip6_id.c > =================================================================== > RCS file: /cvs/src/sys/netinet6/ip6_id.c,v > retrieving revision 1.8 > diff -u -p -r1.8 ip6_id.c > --- netinet6/ip6_id.c 8 Feb 2010 12:16:02 -0000 1.8 > +++ netinet6/ip6_id.c 18 Nov 2014 01:36:12 -0000 > @@ -85,13 +85,12 @@ > #include <sys/param.h> > #include <sys/kernel.h> > #include <sys/socket.h> > +#include <sys/systm.h> > > #include <net/if.h> > #include <netinet/in.h> > #include <netinet/ip6.h> > #include <netinet6/ip6_var.h> > - > -#include <dev/rndvar.h> > > struct randomtab { > const int ru_bits; /* resulting bits */