|
From: Paul F. <pa...@so...> - 2023-04-02 09:07:21
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=421693f4327e783fe12bda8453752a38a19ec886 commit 421693f4327e783fe12bda8453752a38a19ec886 Author: Paul Floyd <pj...@wa...> Date: Sun Apr 2 11:06:18 2023 +0200 Darwin: add support for setting errno from alloc wrappers Diff: --- coregrind/m_replacemalloc/vg_replace_malloc.c | 7 +++++++ 1 file changed, 7 insertions(+) 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 {} |