diff --git a/configure.ac b/configure.ac index 87f27b7..8242430 100644 --- a/configure.ac +++ b/configure.ac @@ -284,6 +284,7 @@ AC_CHECK_DECLS([cfree, valloc, pvalloc],,, [#define _XOPEN_SOURCE 600 + #define _QNX_SOURCE 1 #include #include ]) diff --git a/src/libc_override_gcc_and_weak.h b/src/libc_override_gcc_and_weak.h index 9c4d6a1..80ac4b7 100644 --- a/src/libc_override_gcc_and_weak.h +++ b/src/libc_override_gcc_and_weak.h @@ -212,7 +212,12 @@ extern "C" { void free(void* ptr) __THROW ALIAS(tc_free); void* realloc(void* ptr, size_t size) __THROW ALIAS(tc_realloc); void* calloc(size_t n, size_t size) __THROW ALIAS(tc_calloc); +#if __QNXNTO__ + // QNX has crazy cfree declaration + int cfree(void* ptr) { tc_cfree(ptr); return 0; } +#else void cfree(void* ptr) __THROW ALIAS(tc_cfree); +#endif void* memalign(size_t align, size_t s) __THROW ALIAS(tc_memalign); void* aligned_alloc(size_t align, size_t s) __THROW ALIAS(tc_memalign); void* valloc(size_t size) __THROW ALIAS(tc_valloc); @@ -222,7 +227,11 @@ extern "C" { #ifndef __UCLIBC__ void malloc_stats(void) __THROW ALIAS(tc_malloc_stats); #endif +#if __QNXNTO__ + int mallopt(int, intptr_t) ALIAS(tc_mallopt); +#else int mallopt(int cmd, int value) __THROW ALIAS(tc_mallopt); +#endif #ifdef HAVE_STRUCT_MALLINFO struct mallinfo mallinfo(void) __THROW ALIAS(tc_mallinfo); #endif