This commit is contained in:
Erik Fröjdh
2025-05-30 16:57:16 +02:00
parent e14d307a42
commit 5093472aa1
5 changed files with 36 additions and 31 deletions

View File

@ -29,7 +29,6 @@ target_link_libraries(slsDetectorObject
slsProjectOptions
slsSupportStatic
pthread
rt
PRIVATE
slsProjectWarnings
)
@ -98,9 +97,7 @@ if(SLS_USE_TEXTCLIENT)
add_executable(${val1} src/CmdApp.cpp)
target_link_libraries(${val1}
slsDetectorStatic
pthread
rt
slsDetectorStatic
)
SET_SOURCE_FILES_PROPERTIES( src/Caller.cpp PROPERTIES COMPILE_FLAGS "-Wno-unused-variable -Wno-unused-but-set-variable")

View File

@ -1203,7 +1203,7 @@ void Module::setDestinationUDPIP(const IpAddr ip) {
}
sendToDetector(F_SET_DEST_UDP_IP, ip, nullptr);
if (shm()->useReceiverFlag) {
MacAddr retval(0LU);
MacAddr retval{uint64_t(0)};
sendToReceiver(F_SET_RECEIVER_UDP_IP, ip, retval);
LOG(logINFO) << "Setting destination udp mac of Module " << moduleIndex
<< " to " << retval;
@ -1226,7 +1226,7 @@ void Module::setDestinationUDPIP2(const IpAddr ip) {
}
sendToDetector(F_SET_DEST_UDP_IP2, ip, nullptr);
if (shm()->useReceiverFlag) {
MacAddr retval(0LU);
MacAddr retval{uint64_t(0)};
sendToReceiver(F_SET_RECEIVER_UDP_IP2, ip, retval);
LOG(logINFO) << "Setting destination udp mac2 of Module " << moduleIndex
<< " to " << retval;

View File

@ -25,8 +25,12 @@
#include <unistd.h>
namespace sls {
#define SHM_DETECTOR_PREFIX "/slsDetectorPackage_detector_"
#ifdef __APPLE__
// On macOS SHM_NAME_MAX is 31 so we need the shortest possible prefix
#define SHM_DETECTOR_PREFIX "/sls_"
#else
#define SHM_DETECTOR_PREFIX "/slsDetectorPackage_detector_"
#endif
#define SHM_MODULE_PREFIX "_module_"
#define SHM_ENV_NAME "SLSDETNAME"
@ -203,6 +207,11 @@ template <typename T> class SharedMemory {
throw SharedMemoryError(msg);
}
#ifdef __APPLE__
// On macOS, fstat returns the allocated size and not the requested size.
// This means we can't check for size since we always get for example 16384 bytes.
return;
#endif
auto actual_size = static_cast<size_t>(sb.st_size);
auto expected_size = sizeof(T);
if (actual_size != expected_size) {