mirror of
https://github.com/Ylianst/MeshAgent
synced 2025-12-20 18:23:21 +00:00
Initial modifications to support FreeBSD
This commit is contained in:
@@ -28,7 +28,7 @@ limitations under the License.
|
||||
#if defined(WIN32) || defined(_WIN32_WCE)
|
||||
#include <STDDEF.H>
|
||||
#elif defined(_POSIX)
|
||||
#if !defined(__APPLE__) && !defined(_VX_CPU)
|
||||
#if !defined(__APPLE__) && !defined(_VX_CPU) && !defined(_FREEBSD)
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -28,7 +28,7 @@ limitations under the License.
|
||||
#if defined(WIN32) || defined(_WIN32_WCE)
|
||||
#include <STDDEF.H>
|
||||
#elif defined(_POSIX)
|
||||
#if !defined(__APPLE__) && !defined(_VX_CPU)
|
||||
#if !defined(__APPLE__) && !defined(_VX_CPU) && !defined(_FREEBSD)
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -28,7 +28,7 @@ limitations under the License.
|
||||
#if defined(WIN32) || defined(_WIN32_WCE)
|
||||
#include <STDDEF.H>
|
||||
#elif defined(_POSIX)
|
||||
#if !defined(__APPLE__) && !defined(_VX_CPU)
|
||||
#if !defined(__APPLE__) && !defined(_VX_CPU) && !defined(_FREEBSD)
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -28,7 +28,7 @@ limitations under the License.
|
||||
|
||||
#include "ILibParsers.h"
|
||||
|
||||
#if defined(_POSIX) && !defined(__APPLE__) && !defined(NO_IPADDR_MONITOR)
|
||||
#if defined(_POSIX) && !defined(__APPLE__) && !defined(NO_IPADDR_MONITOR) && !defined(_FREEBSD)
|
||||
#include <netinet/in.h>
|
||||
#include <linux/netlink.h>
|
||||
#include <linux/rtnetlink.h>
|
||||
@@ -47,7 +47,7 @@ typedef struct _ILibIPAddressMonitor
|
||||
SOCKET mSocket;
|
||||
DWORD bytesReturned;
|
||||
OVERLAPPED *reserved;
|
||||
#elif defined (_POSIX) && !defined(__APPLE__)
|
||||
#elif defined (_POSIX) && !defined(__APPLE__) && !defined(_FREEBSD)
|
||||
int mSocket;
|
||||
struct sockaddr_nl addr;
|
||||
#endif
|
||||
@@ -96,13 +96,13 @@ void ILibIPAddressMonitor_Destroy(void *object)
|
||||
obj->reserved->hEvent = NULL;
|
||||
closesocket(obj->mSocket);
|
||||
obj->mSocket = INVALID_SOCKET;
|
||||
#elif defined(_POSIX) && !defined(__APPLE__)
|
||||
#elif defined(_POSIX) && !defined(__APPLE__) && !defined(_FREEBSD)
|
||||
close(obj->mSocket);
|
||||
obj->mSocket = -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(_POSIX) && !defined(__APPLE__)
|
||||
#if defined(_POSIX) && !defined(__APPLE__) && !defined(_FREEBSD)
|
||||
void ILibIPAddressMonitor_PreSelect(void* object, fd_set *readset, fd_set *writeset, fd_set *errorset, int* blocktime)
|
||||
{
|
||||
_ILibIPAddressMonitor *obj = (_ILibIPAddressMonitor*)object;
|
||||
@@ -148,7 +148,7 @@ ILibIPAddressMonitor ILibIPAddressMonitor_Create(void *chain, ILibIPAddressMonit
|
||||
obj->reserved->hEvent = (HANDLE)obj;
|
||||
obj->mSocket = socket(AF_INET, SOCK_DGRAM, 0);
|
||||
WSAIoctl(obj->mSocket, SIO_ADDRESS_LIST_CHANGE, NULL, 0, NULL, 0, &(obj->bytesReturned), obj->reserved, ILibIPAddressMonitor_dispatch);
|
||||
#elif defined (_POSIX) && !defined(__APPLE__)
|
||||
#elif defined (_POSIX) && !defined(__APPLE__) && !defined(_FREEBSD)
|
||||
obj->mSocket = socket(AF_NETLINK, SOCK_DGRAM, NETLINK_ROUTE);
|
||||
int flags = fcntl(obj->mSocket, F_GETFL, 0);
|
||||
fcntl(obj->mSocket, F_SETFL, O_NONBLOCK | flags);
|
||||
|
||||
@@ -25,8 +25,12 @@ limitations under the License.
|
||||
#include "chrome/nacl.h"
|
||||
#endif
|
||||
#if defined(_POSIX)
|
||||
#ifndef _VX_CPU
|
||||
#include <sys/statfs.h>
|
||||
#if !defined(_VX_CPU) && !defined(_FREEBSD)
|
||||
#include <sys/statfs.h>
|
||||
#endif
|
||||
#ifdef _FREEBSD
|
||||
#include <sys/param.h>
|
||||
#include <sys/mount.h>
|
||||
#endif
|
||||
#include <pthread.h>
|
||||
#ifndef _NOILIBSTACKDEBUG
|
||||
@@ -8117,7 +8121,7 @@ int ILibGetCurrentTimezoneOffset_Minutes()
|
||||
{
|
||||
return(-1*(int)((u.QuadPart - l.QuadPart ) / 10000000 / 60));
|
||||
}
|
||||
#elif defined(_ANDROID)
|
||||
#elif defined(_ANDROID) || defined(_FREEBSD)
|
||||
return 0; // TODO
|
||||
#else
|
||||
int offset;
|
||||
@@ -8144,8 +8148,12 @@ int ILibIsDaylightSavingsTime()
|
||||
#elif defined(_ANDROID)
|
||||
return 0; // TODO
|
||||
#else
|
||||
tzset();
|
||||
return daylight;
|
||||
#ifdef _FREEBSD
|
||||
return(0);
|
||||
#else
|
||||
tzset();
|
||||
return daylight;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ struct sockaddr_in6;
|
||||
#ifndef __APPLE__
|
||||
#include <semaphore.h>
|
||||
#endif
|
||||
#if !defined(__APPLE__) && !defined(_VX_CPU)
|
||||
#if !defined(__APPLE__) && !defined(_VX_CPU) && !defined(_FREEBSD)
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
#include <fcntl.h>
|
||||
@@ -95,7 +95,7 @@ struct sockaddr_in6;
|
||||
#define UNREFERENCED_PARAMETER(P)
|
||||
#endif
|
||||
|
||||
#if defined(_POSIX) && !defined(__APPLE__)
|
||||
#if defined(_POSIX) && !defined(__APPLE__) && !defined(_FREEBSD)
|
||||
#include <linux/limits.h>
|
||||
#endif
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ limitations under the License.
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
#ifndef __APPLE__
|
||||
#if !defined( __APPLE__) && !defined(_FREEBSD)
|
||||
#include <pty.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -47,7 +47,7 @@ extern "C" {
|
||||
#if defined(WIN32) || defined(_WIN32_WCE)
|
||||
#include <STDDEF.h>
|
||||
#elif defined(_POSIX)
|
||||
#if !defined(__APPLE__) && !defined(_VX_CPU)
|
||||
#if !defined(__APPLE__) && !defined(_VX_CPU) && !defined(_FREEBSD)
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user