From 03315cebe85dc42590cc62c49c5b02ce7c3369e4 Mon Sep 17 00:00:00 2001 From: Hobby-Student Date: Thu, 1 May 2014 15:09:35 +0200 Subject: [PATCH 1/7] FreeBSD compile errors --- libfreerdp/core/tcp.c | 6 ++++++ libfreerdp/locale/timezone.c | 6 +++++- winpr/libwinpr/crt/alignment.c | 2 ++ winpr/libwinpr/synch/wait.c | 6 +++++- winpr/libwinpr/sysinfo/sysinfo.c | 6 +++++- 5 files changed, 23 insertions(+), 3 deletions(-) diff --git a/libfreerdp/core/tcp.c b/libfreerdp/core/tcp.c index d75091266..15c417616 100644 --- a/libfreerdp/core/tcp.c +++ b/libfreerdp/core/tcp.c @@ -40,6 +40,12 @@ #include #include +#ifdef __FreeBSD__ +#ifndef SOL_TCP +#define SOL_TCP IPPROTO_TCP +#endif +#endif + #ifdef __APPLE__ #ifndef SOL_TCP #define SOL_TCP IPPROTO_TCP diff --git a/libfreerdp/locale/timezone.c b/libfreerdp/locale/timezone.c index 3070f1fa6..724fd35d4 100644 --- a/libfreerdp/locale/timezone.c +++ b/libfreerdp/locale/timezone.c @@ -1663,7 +1663,11 @@ void freerdp_time_zone_detect(TIME_ZONE_INFO* clientTimeZone) local_time = localtime(&t); #ifdef HAVE_TM_GMTOFF - clientTimeZone->bias = timezone / 60; + #if defined(___FreeBSD__) + clientTimeZone->bias = timezone; + #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) diff --git a/winpr/libwinpr/crt/alignment.c b/winpr/libwinpr/crt/alignment.c index bf01e6ba6..a172cad9c 100644 --- a/winpr/libwinpr/crt/alignment.c +++ b/winpr/libwinpr/crt/alignment.c @@ -31,6 +31,8 @@ #ifdef __APPLE__ #include +#elif __FreeBSD__ +#include #else #include #endif diff --git a/winpr/libwinpr/synch/wait.c b/winpr/libwinpr/synch/wait.c index f3a6a9510..4000fabc2 100644 --- a/winpr/libwinpr/synch/wait.c +++ b/winpr/libwinpr/synch/wait.c @@ -124,7 +124,11 @@ static int pthread_timedjoin_np(pthread_t td, void **res, return ETIMEDOUT; } -static int pthread_mutex_timedlock(pthread_mutex_t *mutex, const struct timespec *timeout) +#if defined(__FreeBSD__) + 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; diff --git a/winpr/libwinpr/sysinfo/sysinfo.c b/winpr/libwinpr/sysinfo/sysinfo.c index e93de0bff..fa0af5c15 100644 --- a/winpr/libwinpr/sysinfo/sysinfo.c +++ b/winpr/libwinpr/sysinfo/sysinfo.c @@ -129,7 +129,11 @@ static DWORD GetNumberOfProcessors() size_t length = sizeof(numCPUs); mib[0] = CTL_HW; - mib[1] = HW_AVAILCPU; + #if defined(__FreeBSD__) + mib[1] = HW_NCPU; + #else + mid[1] = HW_AVAILCPU; + #endif sysctl(mib, 2, &numCPUs, &length, NULL, 0); From 7c8e1681ccd38a1395aad26891cfaeb51142f750 Mon Sep 17 00:00:00 2001 From: Hobby-Student Date: Thu, 1 May 2014 15:17:54 +0200 Subject: [PATCH 2/7] FreeBSD compile errors - fix typo --- winpr/libwinpr/synch/wait.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/winpr/libwinpr/synch/wait.c b/winpr/libwinpr/synch/wait.c index 4000fabc2..0de171444 100644 --- a/winpr/libwinpr/synch/wait.c +++ b/winpr/libwinpr/synch/wait.c @@ -125,7 +125,7 @@ static int pthread_timedjoin_np(pthread_t td, void **res, } #if defined(__FreeBSD__) - static int pthread_mutex_timedlock(pthread_mutex_t *mutex, const struct timespec *timeout) + 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 From b0ab566d6197e22f4c603de96706884845dff3f0 Mon Sep 17 00:00:00 2001 From: Hobby-Student Date: Thu, 1 May 2014 15:19:09 +0200 Subject: [PATCH 3/7] FreeBSD compile errors - fix typo #2 --- libfreerdp/locale/timezone.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libfreerdp/locale/timezone.c b/libfreerdp/locale/timezone.c index 724fd35d4..74b5f6802 100644 --- a/libfreerdp/locale/timezone.c +++ b/libfreerdp/locale/timezone.c @@ -1663,7 +1663,7 @@ void freerdp_time_zone_detect(TIME_ZONE_INFO* clientTimeZone) local_time = localtime(&t); #ifdef HAVE_TM_GMTOFF - #if defined(___FreeBSD__) + #if defined(__FreeBSD__) clientTimeZone->bias = timezone; #else clientTimeZone->bias = timezone / 60; From 18d70c6cda2dc7fe405a9eed14fdd62cc7776072 Mon Sep 17 00:00:00 2001 From: Hobby-Student Date: Thu, 1 May 2014 15:24:11 +0200 Subject: [PATCH 4/7] FreeBSD compile errors - add comments --- libfreerdp/locale/timezone.c | 1 + winpr/libwinpr/synch/wait.c | 1 + 2 files changed, 2 insertions(+) diff --git a/libfreerdp/locale/timezone.c b/libfreerdp/locale/timezone.c index 74b5f6802..e60397021 100644 --- a/libfreerdp/locale/timezone.c +++ b/libfreerdp/locale/timezone.c @@ -1664,6 +1664,7 @@ void freerdp_time_zone_detect(TIME_ZONE_INFO* clientTimeZone) #ifdef HAVE_TM_GMTOFF #if defined(__FreeBSD__) + /*not the best solution, but could not get the right tyepcast*/ clientTimeZone->bias = timezone; #else clientTimeZone->bias = timezone / 60; diff --git a/winpr/libwinpr/synch/wait.c b/winpr/libwinpr/synch/wait.c index 0de171444..34ca3e1c5 100644 --- a/winpr/libwinpr/synch/wait.c +++ b/winpr/libwinpr/synch/wait.c @@ -125,6 +125,7 @@ static int pthread_timedjoin_np(pthread_t td, void **res, } #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) From 923d9d6365a5291ab3258149c7dcbaa7f90e6146 Mon Sep 17 00:00:00 2001 From: Hobby-Student Date: Thu, 1 May 2014 19:47:58 +0200 Subject: [PATCH 5/7] FreeBSD compile errors - fix typo #3 --- winpr/libwinpr/sysinfo/sysinfo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/winpr/libwinpr/sysinfo/sysinfo.c b/winpr/libwinpr/sysinfo/sysinfo.c index fa0af5c15..4de21f062 100644 --- a/winpr/libwinpr/sysinfo/sysinfo.c +++ b/winpr/libwinpr/sysinfo/sysinfo.c @@ -132,7 +132,7 @@ static DWORD GetNumberOfProcessors() #if defined(__FreeBSD__) mib[1] = HW_NCPU; #else - mid[1] = HW_AVAILCPU; + mib[1] = HW_AVAILCPU; #endif sysctl(mib, 2, &numCPUs, &length, NULL, 0); From 5d816027dfebe12ca63f10f2de464153bacb0eab Mon Sep 17 00:00:00 2001 From: Hobby-Student Date: Thu, 1 May 2014 21:25:33 +0200 Subject: [PATCH 6/7] FreeBSD compile errors - fix typecast --- libfreerdp/locale/timezone.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libfreerdp/locale/timezone.c b/libfreerdp/locale/timezone.c index e60397021..88dddac0e 100644 --- a/libfreerdp/locale/timezone.c +++ b/libfreerdp/locale/timezone.c @@ -1665,7 +1665,7 @@ void freerdp_time_zone_detect(TIME_ZONE_INFO* clientTimeZone) #ifdef HAVE_TM_GMTOFF #if defined(__FreeBSD__) /*not the best solution, but could not get the right tyepcast*/ - clientTimeZone->bias = timezone; + clientTimeZone->bias = (int) timezone / 60; #else clientTimeZone->bias = timezone / 60; #endif From 04ae1c8c76ebc90ea02bfe806b709f7c81aac52e Mon Sep 17 00:00:00 2001 From: Hobby-Student Date: Fri, 2 May 2014 18:27:03 +0200 Subject: [PATCH 7/7] FreeBSD compile errors - fix timezone --- libfreerdp/locale/timezone.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libfreerdp/locale/timezone.c b/libfreerdp/locale/timezone.c index 88dddac0e..b83471a82 100644 --- a/libfreerdp/locale/timezone.c +++ b/libfreerdp/locale/timezone.c @@ -1665,7 +1665,7 @@ void freerdp_time_zone_detect(TIME_ZONE_INFO* clientTimeZone) #ifdef HAVE_TM_GMTOFF #if defined(__FreeBSD__) /*not the best solution, but could not get the right tyepcast*/ - clientTimeZone->bias = (int) timezone / 60; + clientTimeZone->bias = 0; #else clientTimeZone->bias = timezone / 60; #endif