This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 1/4] Add framework for tunables


On Dez 30 2016, Siddhesh Poyarekar <siddhesh@sourceware.org> wrote:

> diff --git a/malloc/arena.c b/malloc/arena.c
> index eed4247..234035f 100644
> --- a/malloc/arena.c
> +++ b/malloc/arena.c
> @@ -19,6 +19,11 @@
>  
>  #include <stdbool.h>
>  
> +#if HAVE_TUNABLES
> +# define TUNABLE_NAMESPACE malloc
> +#endif
> +#include <elf/dl-tunables.h>
> +
>  /* Compile-time constants.  */
>  
>  #define HEAP_MIN_SIZE (32 * 1024)
> @@ -204,6 +209,34 @@ __malloc_fork_unlock_child (void)
>    __libc_lock_init (list_lock);
>  }
>  
> +#if HAVE_TUNABLES
> +static inline int do_set_mallopt_check (int32_t value);
> +void
> +DL_TUNABLE_CALLBACK (set_mallopt_check) (void *valp)
> +{
> +  int32_t value = *(int32_t *) valp;

This is wrong.  The callback receives a pointer to tunable_val_t.

> +  do_set_mallopt_check (value);
> +  if (check_action != 0)
> +    __malloc_check_init ();
> +}
> +
> +# define DL_TUNABLE_CALLBACK_FNDECL(__name, __type) \
> +static inline int do_ ## __name (__type value);				      \
> +void									      \
> +DL_TUNABLE_CALLBACK (__name) (void *valp)				      \
> +{									      \
> +  __type value = *(__type *) valp;					      \

Likewise.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]