From: Paul Floyd Date: Sun, 2 Apr 2023 09:06:18 +0000 (+0200) Subject: Darwin: add support for setting errno from alloc wrappers X-Git-Tag: VALGRIND_3_21_0~78 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=421693f4327e783fe12bda8453752a38a19ec886;p=thirdparty%2Fvalgrind.git Darwin: add support for setting errno from alloc wrappers --- diff --git a/coregrind/m_replacemalloc/vg_replace_malloc.c b/coregrind/m_replacemalloc/vg_replace_malloc.c index 5977fa317b..64d9b67c1e 100644 --- a/coregrind/m_replacemalloc/vg_replace_malloc.c +++ b/coregrind/m_replacemalloc/vg_replace_malloc.c @@ -234,6 +234,13 @@ extern int *___errno (void) __attribute__((weak)); (*___errno ()) = VKI_ENOMEM; #define SET_ERRNO_EINVAL if (___errno) \ (*___errno ()) = VKI_EINVAL; +#elif defined(VGO_darwin) +extern int * __error(void) __attribute__((weak)); +#define SET_ERRNO_ENOMEM if (__error) \ + (*__error ()) = VKI_ENOMEM; +#define SET_ERRNO_EINVAL if (__error) \ + (*__error ()) = VKI_EINVAL; + #else #define SET_ERRNO_ENOMEM {} #define SET_ERRNO_EINVAL {}