Merge pull request #1826 from Hobby-Student/master

fix FreeBSD compile errors
This commit is contained in:
Marc-André Moreau 2014-05-21 10:53:47 -04:00
commit 472c231876
5 changed files with 25 additions and 3 deletions

View File

@ -40,6 +40,12 @@
#include <netinet/tcp.h>
#include <net/if.h>
#ifdef __FreeBSD__
#ifndef SOL_TCP
#define SOL_TCP IPPROTO_TCP
#endif
#endif
#ifdef __APPLE__
#ifndef SOL_TCP
#define SOL_TCP IPPROTO_TCP

View File

@ -1663,7 +1663,12 @@ void freerdp_time_zone_detect(TIME_ZONE_INFO* clientTimeZone)
local_time = localtime(&t);
#ifdef HAVE_TM_GMTOFF
#if defined(__FreeBSD__)
/*not the best solution, but could not get the right tyepcast*/
clientTimeZone->bias = 0;
#else
clientTimeZone->bias = timezone / 60;
#endif
DEBUG_TIMEZONE("tzname[std]: %s, tzname[dst]: %s, timezone: %ld, Daylight: %d", tzname[0], tzname[1], timezone, daylight);
#elif defined(sun)
if (local_time->tm_isdst > 0)

View File

@ -31,6 +31,8 @@
#ifdef __APPLE__
#include <malloc/malloc.h>
#elif __FreeBSD__
#include <stdlib.h>
#else
#include <malloc.h>
#endif

View File

@ -124,7 +124,12 @@ static int pthread_timedjoin_np(pthread_t td, void **res,
return ETIMEDOUT;
}
#if defined(__FreeBSD__)
/*the only way to get it work is to remove the static*/
int pthread_mutex_timedlock(pthread_mutex_t *mutex, const struct timespec *timeout)
#else
static int pthread_mutex_timedlock(pthread_mutex_t *mutex, const struct timespec *timeout)
#endif
{
struct timespec timenow;
struct timespec sleepytime;

View File

@ -129,7 +129,11 @@ static DWORD GetNumberOfProcessors()
size_t length = sizeof(numCPUs);
mib[0] = CTL_HW;
#if defined(__FreeBSD__)
mib[1] = HW_NCPU;
#else
mib[1] = HW_AVAILCPU;
#endif
sysctl(mib, 2, &numCPUs, &length, NULL, 0);