malloc_hook.3: SYNOPSIS: Use 'volatile' in prototypes

glibc uses 'volatile' in __malloc_hook, __realloc_hook,
__memalign_hook, __free_hook, and __after_morecore_hook.
Let's use it here too.

.../glibc$ find * -type f \
  |grep '\.h$' \
  |xargs pcregrep -Mn '(?s)\b__malloc_hook\b.*?;';
malloc/malloc.h:168:
extern void *(*__MALLOC_HOOK_VOLATILE __malloc_hook)(size_t __size,
                                                     const void *)
__MALLOC_DEPRECATED;
.../glibc$ find * -type f \
  |grep '\.h$' \
  |xargs pcregrep -Mn '(?s)\b__realloc_hook\b.*?;';
malloc/malloc.h:171:
extern void *(*__MALLOC_HOOK_VOLATILE __realloc_hook)(void *__ptr,
                                                      size_t __size,
                                                      const void *)
__MALLOC_DEPRECATED;
.../glibc$ find * -type f \
 |grep '\.h$' \
 |xargs pcregrep -Mn '(?s)\b__memalign_hook\b.*?;';
malloc/malloc.h:175:
extern void *(*__MALLOC_HOOK_VOLATILE __memalign_hook)(size_t __alignment,
                                                       size_t __size,
                                                       const void *)
__MALLOC_DEPRECATED;
.../glibc$ find * -type f \
  |grep '\.h$' \
  |xargs pcregrep -Mn '(?s)\b__free_hook\b.*?;';
malloc/malloc.h:165:
extern void (*__MALLOC_HOOK_VOLATILE __free_hook) (void *__ptr,
                                                   const void *)
__MALLOC_DEPRECATED;
.../glibc$ find * -type f \
  |grep '\.h$' \
  |xargs pcregrep -Mn '(?s)\*\w*\s*\b__malloc_initialize_hook\b.*?;';
malloc/malloc-hooks.h:22:
void (*__malloc_initialize_hook) (void);
.../glibc$ find * -type f \
  |grep '\.h$' \
  |xargs pcregrep -Mn '(?s)\*\w*\s*\b__after_morecore_hook\b.*?;';
malloc/malloc.h:179:
extern void (*__MALLOC_HOOK_VOLATILE __after_morecore_hook) (void)
  __MALLOC_DEPRECATED;
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Alejandro Colomar 2021-03-06 00:50:53 +01:00 committed by Michael Kerrisk
parent e64e5812b3
commit ca2eb1e614
1 changed files with 5 additions and 5 deletions

View File

@ -16,19 +16,19 @@ __after_morecore_hook \- malloc debugging variables
.nf
.B "#include <malloc.h>"
.PP
.BI "void *(*__malloc_hook)(size_t " size ", const void *" caller );
.BI "void *(*volatile __malloc_hook)(size_t " size ", const void *" caller );
.PP
.BI "void *(*__realloc_hook)(void *" ptr ", size_t " size \
.BI "void *(*volatile __realloc_hook)(void *" ptr ", size_t " size \
", const void *" caller );
.PP
.BI "void *(*__memalign_hook)(size_t " alignment ", size_t " size ,
.BI "void *(*volatile __memalign_hook)(size_t " alignment ", size_t " size ,
.BI " const void *" caller );
.PP
.BI "void (*__free_hook)(void *" ptr ", const void *" caller );
.BI "void (*volatile __free_hook)(void *" ptr ", const void *" caller );
.PP
.B "void (*__malloc_initialize_hook)(void);"
.PP
.B "void (*__after_morecore_hook)(void);"
.B "void (*volatile __after_morecore_hook)(void);"
.fi
.SH DESCRIPTION
The GNU C library lets you modify the behavior of