Skip to content

Commit

Permalink
Fix macOS build
Browse files Browse the repository at this point in the history
  • Loading branch information
0blu committed Aug 29, 2024
1 parent 692be45 commit 9310ef4
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 7 deletions.
4 changes: 4 additions & 0 deletions src/mangosd/CliRunnable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
#include "CliRunnable.h"
#include "Database/DatabaseEnv.h"

#if PLATFORM == PLATFORM_APPLE
#include <sys/select.h>
#endif

void utf8print(void* /*arg*/, const char* str)
{
#if PLATFORM == PLATFORM_WINDOWS
Expand Down
2 changes: 1 addition & 1 deletion src/shared/IO/Filesystem/impl/unix/FileHandle.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include "IO/Filesystem/FileHandle.h"
#include "Log.h"
#include "IO/SystemErrorToString.h"
#include <sys/param.h>
#include <sys/stat.h>
#include <unistd.h>

IO::Filesystem::FileHandle::~FileHandle()
{
Expand Down
1 change: 1 addition & 0 deletions src/shared/IO/Networking/AsyncSocket_posix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <sys/epoll.h>
#elif defined(__APPLE__)
#include <sys/event.h>
#include <unistd.h>
#endif
#include <netinet/in.h>
#include <netinet/tcp.h>
Expand Down
1 change: 1 addition & 0 deletions src/shared/IO/Networking/DNS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <ws2tcpip.h>
#elif defined(__linux__) || defined(__APPLE__)
#include <netdb.h>
#include <unistd.h>
#endif

std::string IO::Networking::DNS::GetOwnHostname()
Expand Down
2 changes: 1 addition & 1 deletion src/shared/IO/Networking/Internal.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "Errors.h"
#include "./Internal.h"

#if defined(__linux__)
#if defined(__linux__) || defined(__APPLE__)
#include <arpa/inet.h>
#endif

Expand Down
8 changes: 6 additions & 2 deletions src/shared/IO/Networking/impl/unix/AsyncServerListener_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,17 @@
#include "IO/Networking/Internal.h"
#include "IO/SystemErrorToString.h"

#if defined(__linux__)
#if defined(__linux__) || defined(__APPLE__)
#include <sys/socket.h>
#include <sys/epoll.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#endif

#if defined(__linux__)
#include <sys/epoll.h>
#elif defined(__APPLE__)
#include <sys/event.h>
#include <unistd.h>
#endif

template<typename TClientSocket>
Expand Down
6 changes: 3 additions & 3 deletions src/shared/PosixDaemon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@
#include <cstdio>
#include <iostream>
#include <fstream>
#include <unistd.h>
#include <sys/stat.h>

pid_t parent_pid = 0, sid = 0;

void daemonSignal(int s)
{

if (getpid() != parent_pid)
if (::getpid() != parent_pid)
{
return;
}
Expand All @@ -48,7 +48,7 @@ void daemonSignal(int s)

void startDaemon(uint32_t timeout)
{
parent_pid = getpid();
parent_pid = ::getpid();
pid_t pid;

signal(SIGUSR1, daemonSignal);
Expand Down

0 comments on commit 9310ef4

Please sign in to comment.