--- crypt/osconfig.h.orig	2024-10-31 00:53:32.911075000 -0400
+++ crypt/osconfig.h	2024-10-31 00:55:38.632254000 -0400
@@ -310,7 +310,7 @@
    identical, even if they differ at a higher level */
 #elif defined( __FreeBSD__ ) || defined( __bsdi__ ) || \
 	  defined( __OpenBSD__ ) || defined( __NetBSD__ ) || \
-	  defined( __linux__ )
+	  defined( __linux__ ) || defined( __HAIKU__ )
   #if defined( __x86_64__ ) || defined( __amd64__ )
 	/* 64-bit x86 has both 'long' and 'long long' as 64 bits.  In addition
 	   we use DES_INT since int's are 64-bit.  We have to check for the
--- io/file.c.orig	2024-10-31 00:53:35.106314000 -0400
+++ io/file.c	2024-10-31 00:53:35.251907000 -0400
@@ -4419,7 +4419,7 @@
   #if defined( __FreeBSD__ )
 	struct timeval timeVals[ 2 ];
   #elif !( defined( __APPLE__ ) || defined( __FreeBSD__ ) || \
-		   defined( __linux__ ) )
+		   defined( __linux__ ) || defined( __HAIKU__ ) )
 	struct utimbuf timeStamp;
   #endif /* OS-specific variable declarations */
 #endif /* USE_EMBEDDED_OS */
@@ -4482,7 +4482,7 @@
 	   generic DoS that they could perform anyway if they have the user's
 	   rights */
 #ifndef USE_EMBEDDED_OS /* Embedded systems have no file timestamps */
-  #if defined( __Android__ )
+  #if defined( __Android__ ) || defined( __HAIKU__ )
 	sFileClose( &stream );
 	utimes( fileName, NULL );	/* Android's Linux doesn't have futimes() */
   #elif defined( __APPLE__ )
--- kernel/thread.h.orig	2024-10-31 00:53:35.043387000 -0400
+++ kernel/thread.h	2024-10-31 00:53:35.257697000 -0400
@@ -3184,7 +3184,8 @@
   #endif /* Slowaris 5.7 / 7.x or newer */
 #elif defined( _AIX ) || defined( __Android__ ) || defined( __CYGWIN__ ) || \
 	  ( defined( __hpux ) && ( OSVERSION >= 11 ) ) || \
-	  defined( __NetBSD__ ) || defined( __QNX__ ) || defined( __UCLIBC__ )
+	  defined( __NetBSD__ ) || defined( __QNX__ ) || \
+	  defined( __UCLIBC__ ) || defined( __HAIKU__ )
   #define THREAD_YIELD()		sched_yield()
 #elif defined( __XMK__ )
   /* The XMK underlying scheduling object is the process context, for which
--- random/unix.c.orig	2024-10-31 00:53:34.685713000 -0400
+++ random/unix.c	2024-10-31 00:53:35.264083000 -0400
@@ -66,7 +66,8 @@
    memory-based polling with a stub the prints an error message for the
    caller */
 
-#if defined( __Android__ ) || ( defined( __QNX__ ) && OSVERSION <= 4 )
+#if defined( __Android__ ) || ( defined( __QNX__ ) && OSVERSION <= 4 ) || \
+	defined( __HAIKU__ )
   #define NO_SYSV_SHAREDMEM
 #endif /* Android || QNX <= 4.x */
 
@@ -122,7 +123,7 @@
   #include <sys/sem.h>
   #include <sys/shm.h>
 #endif /* CYGWIN */
-#if !( defined( __Android__ ) || defined( __CYGWIN__ ) || defined( __QNX__ ) )
+#if !( defined( __Android__ ) || defined( __CYGWIN__ ) || defined( __QNX__ ) || defined( __HAIKU__) )
   #include <sys/shm.h>
 #endif /* !( __Android__  || Cygwin || QNX ) */
 #if defined( __linux__ ) && ( defined(__i386__) || defined(__x86_64__) )
@@ -1950,7 +1951,12 @@
 *																			*
 ****************************************************************************/
 
-#ifndef NO_SYSV_SHAREDMEM
+#ifdef NO_SYSV_SHAREDMEM
+#ifdef USE_THREADS
+  static pthread_mutex_t gathererMutex;	/* Mutex to protect the polling */
+#endif /* USE_THREADS */
+static pid_t gathererProcess = 0;/* The child process that fills the buffer */
+#else
 
 /* The structure containing information on random-data sources.  Each record 
    contains the source and a relative estimate of its usefulness (weighting) 
