From b22e515a71651718e86687f29cf28cdb5d525db1 Mon Sep 17 00:00:00 2001 From: cosmicpsyop Date: Tue, 24 Oct 2023 03:31:54 -0700 Subject: [PATCH] feature/freebsd-support-one: main freebsd adjustments --- src/PluginEventSifter.h | 5 +++++ src/WSConnection.h | 2 +- src/apps/mesh/cmd_router.cpp | 2 +- src/apps/relay/RelayWebsocket.cpp | 2 +- src/misc.cpp | 4 ++++ src/onAppStartup.cpp | 5 +++++ 6 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/PluginEventSifter.h b/src/PluginEventSifter.h index c923245..f04e445 100644 --- a/src/PluginEventSifter.h +++ b/src/PluginEventSifter.h @@ -17,6 +17,11 @@ #include "events.h" +#ifdef __FreeBSD__ +extern char **environ; +#endif + + enum class PluginEventSifterResult { Accept, diff --git a/src/WSConnection.h b/src/WSConnection.h index c9e109f..2da7f3a 100644 --- a/src/WSConnection.h +++ b/src/WSConnection.h @@ -143,7 +143,7 @@ class WSConnection : NonCopyable { hubTrigger->setData(&asyncCb); hubTrigger->start([](uS::Async *a){ - auto *r = static_cast *>(a->data); + auto *r = static_cast *>(a->getData()); (*r)(); }); diff --git a/src/apps/mesh/cmd_router.cpp b/src/apps/mesh/cmd_router.cpp index 45203f3..248b3ef 100644 --- a/src/apps/mesh/cmd_router.cpp +++ b/src/apps/mesh/cmd_router.cpp @@ -391,7 +391,7 @@ struct Router { hubTrigger->setData(&asyncCb); hubTrigger->start([](uS::Async *a){ - auto *r = static_cast *>(a->data); + auto *r = static_cast *>(a->getData()); (*r)(); }); diff --git a/src/apps/relay/RelayWebsocket.cpp b/src/apps/relay/RelayWebsocket.cpp index cf4d16b..23bec51 100644 --- a/src/apps/relay/RelayWebsocket.cpp +++ b/src/apps/relay/RelayWebsocket.cpp @@ -223,7 +223,7 @@ void RelayServer::runWebsocket(ThreadPool::Thread &thr) { hubTrigger->setData(&asyncCb); hubTrigger->start([](uS::Async *a){ - auto *r = static_cast *>(a->data); + auto *r = static_cast *>(a->getData()); (*r)(); }); diff --git a/src/misc.cpp b/src/misc.cpp index 8ce9f23..04829ce 100644 --- a/src/misc.cpp +++ b/src/misc.cpp @@ -1,4 +1,8 @@ #include +#ifdef __FreeBSD__ +#include +#include +#endif #include #include diff --git a/src/onAppStartup.cpp b/src/onAppStartup.cpp index 55fcef4..65214f8 100644 --- a/src/onAppStartup.cpp +++ b/src/onAppStartup.cpp @@ -69,5 +69,10 @@ static void setRLimits() { void onAppStartup(lmdb::txn &txn, const std::string &cmd) { dbCheck(txn, cmd); +#ifndef __FreeBSD__ + // XXX - strfry error: Unable to set NOFILES limit to 1000000, exceeds max of 116991 + // XXX - warning: comparison of integer expressions of different signedness: + // XXX 'const uint64_t' {aka 'const long unsigned int'} and 'rlim_t' {aka 'long int'} [-Wsign-compare] setRLimits(); +#endif }