Changeset View
Changeset View
Standalone View
Standalone View
head/lang/beignet/files/patch-src_cl__alloc.c
--- src/cl_alloc.c.orig 2015-01-16 11:24:13.000000000 +0100 | --- src/cl_alloc.c.orig 2017-01-20 10:40:51 UTC | ||||
+++ src/cl_alloc.c 2015-02-03 15:31:13.983452000 +0100 | +++ src/cl_alloc.c | ||||
@@ -22,7 +22,7 @@ | @@ -22,7 +22,7 @@ | ||||
#include <stdlib.h> | #include <stdlib.h> | ||||
#include <assert.h> | #include <assert.h> | ||||
-#include <malloc.h> | -#include <malloc.h> | ||||
+#include <sys/types.h> | +#include <sys/types.h> | ||||
static volatile int32_t cl_alloc_n = 0; | static volatile int32_t cl_alloc_n = 0; | ||||
@@ -41,8 +41,13 @@ | @@ -41,8 +41,13 @@ cl_aligned_malloc(size_t sz, size_t alig | ||||
{ | { | ||||
void * p = NULL; | void * p = NULL; | ||||
atomic_inc(&cl_alloc_n); | atomic_inc(&cl_alloc_n); | ||||
+#ifndef __FreeBSD__ | +#ifndef __FreeBSD__ | ||||
p = memalign(align, sz); | p = memalign(align, sz); | ||||
assert(p); | assert(p); | ||||
+#else | +#else | ||||
+ const int err = posix_memalign(&p,align,sz); | + const int err = posix_memalign(&p,align,sz); | ||||
+ assert(err==0); | + assert(err==0); | ||||
+#endif | +#endif | ||||
return p; | return p; | ||||
} | } | ||||