Skip to content

Instantly share code, notes, and snippets.

@macbre
Forked from tomatolog/master_freebsd_fix3.patch
Created March 9, 2017 22:15
Show Gist options
  • Save macbre/769c3ccd6825c1a784017d887c9937ff to your computer and use it in GitHub Desktop.
Save macbre/769c3ccd6825c1a784017d887c9937ff to your computer and use it in GitHub Desktop.
src/searchdha.cpp | 3 +++
src/sphinx.cpp | 4 ++--
src/sphinxstd.cpp | 2 ++
3 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/searchdha.cpp b/src/searchdha.cpp
index 27bc01e..2af933d 100644
--- a/src/searchdha.cpp
+++ b/src/searchdha.cpp
@@ -21,6 +21,9 @@
#include "searchdaemon.h"
#include "searchdha.h"
+#if !USE_WINDOWS
+ #include <netinet/in.h>
+#endif
int g_iPingInterval = 0; // by default ping HA agents every 1 second
DWORD g_uHAPeriodKarma = 60; // by default use the last 1 minute statistic to determine the best HA agent
diff --git a/src/sphinx.cpp b/src/sphinx.cpp
index 5eb8d79..6b65967 100644
--- a/src/sphinx.cpp
+++ b/src/sphinx.cpp
@@ -14629,7 +14629,7 @@ public:
#if USE_WINDOWS
if ( !SetThreadPriority ( GetCurrentThread(), THREAD_PRIORITY_IDLE ) )
return;
-#else
+#elif !__FreeBSD__
struct sched_param p;
p.sched_priority = 0;
if ( pthread_setschedparam ( pthread_self(), SCHED_IDLE, &p ) )
@@ -14647,7 +14647,7 @@ public:
#if USE_WINDOWS
if ( !SetThreadPriority ( GetCurrentThread(), THREAD_PRIORITY_NORMAL ) )
return;
-#else
+#elif !__FreeBSD__
struct sched_param p;
p.sched_priority = 0;
if ( pthread_setschedparam ( pthread_self(), SCHED_OTHER, &p ) )
diff --git a/src/sphinxstd.cpp b/src/sphinxstd.cpp
index a9f196d..e1cb989 100644
--- a/src/sphinxstd.cpp
+++ b/src/sphinxstd.cpp
@@ -1476,6 +1476,7 @@ bool CSphRwlock::Init ( bool bPreferWriter )
pthread_rwlockattr_t tAttr;
pthread_rwlockattr_t * pAttr = NULL;
+#if !__FreeBSD__
while ( bPreferWriter )
{
bool bOk = ( pthread_rwlockattr_init ( &tAttr )==0 );
@@ -1494,6 +1495,7 @@ bool CSphRwlock::Init ( bool bPreferWriter )
pAttr = &tAttr;
break;
}
+#endif
m_bInitialized = ( pthread_rwlock_init ( &m_tLock, pAttr )==0 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment