OSX has /dev/random

We aren't defining BSD for OSX but we probably should be.  This doesn't
go that far, just changes a couple of __APPLE__ for MACOSX (set up in
config1.h) and defines DEV_RANDOM as "/dev/random".
This commit is contained in:
PatR
2019-02-18 15:34:09 -08:00
parent b516b5fd9e
commit 01c400a200

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 unixconf.h $NHDT-Date: 1548372343 2019/01/24 23:25:43 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.33 $ */ /* NetHack 3.6 unixconf.h $NHDT-Date: 1550532737 2019/02/18 23:32:17 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.39 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Pasi Kallinen, 2018. */ /*-Copyright (c) Pasi Kallinen, 2018. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -350,7 +350,7 @@
/* the high quality random number routines */ /* the high quality random number routines */
#ifndef USE_ISAAC64 #ifndef USE_ISAAC64
# if defined(BSD) || defined(LINUX) || defined(ULTRIX) || defined(CYGWIN32) \ # if defined(BSD) || defined(LINUX) || defined(ULTRIX) || defined(CYGWIN32) \
|| defined(RANDOM) || defined(__APPLE__) || defined(RANDOM) || defined(MACOSX)
# define Rand() random() # define Rand() random()
# else # else
# define Rand() lrand48() # define Rand() lrand48()
@@ -407,7 +407,7 @@
#endif /* LINUX */ #endif /* LINUX */
#endif /* GNOME_GRAPHICS */ #endif /* GNOME_GRAPHICS */
#ifdef __APPLE__ #ifdef MACOSX
# define RUNTIME_PASTEBUF_SUPPORT # define RUNTIME_PASTEBUF_SUPPORT
#endif #endif
@@ -415,11 +415,12 @@
* /dev/random is blocking on Linux, so there we default to /dev/urandom which * /dev/random is blocking on Linux, so there we default to /dev/urandom which
* should still be good enough. * should still be good enough.
* BSD systems usually have /dev/random that is supposed to be used. * BSD systems usually have /dev/random that is supposed to be used.
* OSX is based on NetBSD kernel and has both /dev/random and /dev/urandom.
*/ */
#ifdef LINUX #ifdef LINUX
# define DEV_RANDOM "/dev/urandom" # define DEV_RANDOM "/dev/urandom"
#else #else
# ifdef BSD # if defined(BSD) || defined(MACOSX)
# define DEV_RANDOM "/dev/random" # define DEV_RANDOM "/dev/random"
# endif # endif
#endif #endif