mirror of
https://github.com/official-stockfish/Stockfish.git
synced 2026-07-22 12:47:08 +00:00
Fix compilation on BSD/macOS
fixes github.com/official-stockfish/Stockfish/issues/6571 closes https://github.com/official-stockfish/Stockfish/pull/6572 No functional change
This commit is contained in:
@@ -36,7 +36,7 @@
|
|||||||
#include <utility>
|
#include <utility>
|
||||||
#include <variant>
|
#include <variant>
|
||||||
|
|
||||||
#if !defined(_WIN32) && !defined(__ANDROID__)
|
#if defined(__linux__) && !defined(__ANDROID__)
|
||||||
#include "shm_linux.h"
|
#include "shm_linux.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -60,7 +60,7 @@
|
|||||||
#define NOMINMAX
|
#define NOMINMAX
|
||||||
#endif
|
#endif
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#else
|
#elif defined(__linux__)
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
@@ -407,7 +407,7 @@ class SharedMemoryBackend {
|
|||||||
std::string last_error_message;
|
std::string last_error_message;
|
||||||
};
|
};
|
||||||
|
|
||||||
#elif !defined(__ANDROID__)
|
#elif defined(__linux__) && !defined(__ANDROID__)
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
class SharedMemoryBackend {
|
class SharedMemoryBackend {
|
||||||
@@ -538,7 +538,7 @@ struct SystemWideSharedConstant {
|
|||||||
std::snprintf(buf, sizeof(buf), "Local\\sf_%zu$%zu$%zu", content_hash, executable_hash, discriminator);
|
std::snprintf(buf, sizeof(buf), "Local\\sf_%zu$%zu$%zu", content_hash, executable_hash, discriminator);
|
||||||
std::string shm_name = buf;
|
std::string shm_name = buf;
|
||||||
|
|
||||||
#if !defined(_WIN32)
|
#if defined(__linux__) && !defined(__ANDROID__)
|
||||||
// POSIX shared memory names must start with a slash
|
// POSIX shared memory names must start with a slash
|
||||||
shm_name = "/sf_" + createHashString(shm_name);
|
shm_name = "/sf_" + createHashString(shm_name);
|
||||||
|
|
||||||
|
|||||||
+6
-9
@@ -19,6 +19,10 @@
|
|||||||
#ifndef SHM_LINUX_H_INCLUDED
|
#ifndef SHM_LINUX_H_INCLUDED
|
||||||
#define SHM_LINUX_H_INCLUDED
|
#define SHM_LINUX_H_INCLUDED
|
||||||
|
|
||||||
|
#if !defined(__linux__) || defined(__ANDROID__)
|
||||||
|
#error shm_linux.h should not be included on this platform.
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <cerrno>
|
#include <cerrno>
|
||||||
@@ -40,15 +44,8 @@
|
|||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <limits.h>
|
||||||
#if defined(__NetBSD__) || defined(__DragonFly__) || defined(__linux__)
|
#define SF_MAX_SEM_NAME_LEN NAME_MAX
|
||||||
#include <limits.h>
|
|
||||||
#define SF_MAX_SEM_NAME_LEN NAME_MAX
|
|
||||||
#elif defined(__APPLE__)
|
|
||||||
#define SF_MAX_SEM_NAME_LEN 31
|
|
||||||
#else
|
|
||||||
#define SF_MAX_SEM_NAME_LEN 255
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user