diff --git a/src/direct/direct-export-buf.c b/src/direct/direct-export-buf.c index 0347d29..3db44ac 100644 --- a/src/direct/direct-export-buf.c +++ b/src/direct/direct-export-buf.c @@ -7,7 +7,9 @@ #include #include #include +#ifdef __linux__ #include +#endif #include #include "../backend-common.h" diff --git a/src/direct/nv-driver.c b/src/direct/nv-driver.c index 5ff79d6..1bab2de 100644 --- a/src/direct/nv-driver.c +++ b/src/direct/nv-driver.c @@ -17,6 +17,14 @@ #include "../vabackend.h" +#if !defined(_IOC_READ) && defined(IOC_OUT) +#define _IOC_READ IOC_OUT +#endif + +#if !defined(_IOC_WRITE) && defined(IOC_IN) +#define _IOC_WRITE IOC_IN +#endif + //Technically these can vary per architecture, but all the ones we support have the same values #define GOB_WIDTH_IN_BYTES 64 #define GOB_HEIGHT_IN_BYTES 8 diff --git a/src/export-buf.c b/src/export-buf.c index b707985..c355726 100644 --- a/src/export-buf.c +++ b/src/export-buf.c @@ -8,7 +8,9 @@ #include #include #include +#ifdef __linux__ #include +#endif #include #include diff --git a/src/hevc.c b/src/hevc.c index a1db0a3..3b3a831 100644 --- a/src/hevc.c +++ b/src/hevc.c @@ -3,7 +3,13 @@ #include "vabackend.h" #include -#if !defined(__GLIBC__) +#if defined(__FreeBSD__) && __FreeBSD__ < 14 +// https://github.com/freebsd/freebsd-src/commit/af3c78886fd8 +typedef int (*__old_compar_d_fn_t) (void *, const void *, const void *); +#define qsort_r(base, nmemb, size, compar, thunk) \ + qsort_r(base, nmemb, size, thunk, (__old_compar_d_fn_t)compar) + +#elif !defined(__GLIBC__) typedef int (*__compar_d_fn_t) (const void *, const void *, void *); #endif diff --git a/src/vabackend.c b/src/vabackend.c index 991dbf6..77648af 100644 --- a/src/vabackend.c +++ b/src/vabackend.c @@ -29,6 +29,15 @@ #define __has_builtin(x) 0 #endif +#ifndef __has_include +#define __has_include(x) 0 +#endif + +#if __has_include() +#include +#define gettid pthread_getthreadid_np +#endif + static pthread_mutex_t concurrency_mutex = PTHREAD_MUTEX_INITIALIZER; static uint32_t instances; static uint32_t max_instances; @@ -167,7 +176,7 @@ void logger(const char *filename, const char *function, int line, const char *ms struct timespec tp; clock_gettime(CLOCK_MONOTONIC, &tp); - fprintf(LOG_OUTPUT, "%10ld.%09ld [%d-%d] %s:%4d %24s %s\n", tp.tv_sec, tp.tv_nsec, getpid(), gettid(), filename, line, function, formattedMessage); + fprintf(LOG_OUTPUT, "%10ld.%09ld [%d-%d] %s:%4d %24s %s\n", (long)tp.tv_sec, tp.tv_nsec, getpid(), gettid(), filename, line, function, formattedMessage); fflush(LOG_OUTPUT); }