1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2025-07-07 00:04:57 +03:00

Several Tunings for OS X

This commit is contained in:
nattoheaven
2014-03-12 08:06:21 +09:00
parent 14e8693421
commit 4c48388b12
4 changed files with 71 additions and 15 deletions

View File

@ -106,9 +106,11 @@
#include <errno.h>
#include <Mayaqua/Mayaqua.h>
// Struct statfs for MacOS X
#ifdef UNIX_MACOS
#include <mach/clock.h>
#include <mach/mach.h>
#ifdef NO_VLAN
// Struct statfs for MacOS X
typedef struct fsid { int32_t val[2]; } fsid_t;
struct statfs {
short f_otype; /* TEMPORARY SHADOW COPY OF f_type */
@ -2057,8 +2059,19 @@ UINT64 UnixGetTick64()
return ret;
#else
#ifdef UNIX_MACOS
static clock_serv_t clock_serv = 0;
mach_timespec_t t;
UINT64 ret;
if (clock_serv == 0) {
host_get_clock_service(mach_host_self(), SYSTEM_CLOCK, &clock_serv);
}
clock_get_time(clock_serv, &t);
ret = (UINT64)t.tv_sec * 1000LL + (UINT64)t.tv_nsec / 1000000LL;
return ret;
#else
return TickRealtimeManual();
#endif
#endif
}
@ -2553,16 +2566,16 @@ void UnixExecService(char *name, SERVICE_FUNCTION *start, SERVICE_FUNCTION *stop
signal(SIGTERM, &UnixSigTermHandler);
while (unix_svc_terminate == false)
{
#ifndef UNIX_BSD
#if !(defined(UNIX_BSD) || defined(UNIX_MACOS))
pause();
#else // UNIX_BSD
#else // defined(UNIX_BSD) || defined(UNIX_MACOS)
if (UnixReadCtlFile() != saved_ctl)
{
break;
}
SleepThread(1394);
#endif // UNIX_BSD
#endif // defined(UNIX_BSD) || defined(UNIX_MACOS)
}
// Stop