fixup malloc replacement on 64-bit systems; was missing a configure check.
This commit is contained in:
parent
1a747468dc
commit
01ce31068d
3 changed files with 39 additions and 3 deletions
|
@ -10,7 +10,7 @@ umem_test2_SOURCES = umem_test2.c
|
|||
umem_test2_LDADD = -lumem
|
||||
|
||||
umem_test3_SOURCES = umem_test3.c
|
||||
umem_test3_LDADD = -lumem
|
||||
umem_test3_LDADD = -lumem -lumem_malloc
|
||||
|
||||
libumem_la_SOURCES = init_lib.c \
|
||||
umem_agent_support.c \
|
||||
|
|
19
configure.ac
19
configure.ac
|
@ -7,8 +7,23 @@ AC_PROG_LIBTOOL
|
|||
|
||||
AC_C_INLINE
|
||||
|
||||
AC_CHECK_HEADERS([sys/mman.h sys/sysmacros.h sys/time.h])
|
||||
AC_CHECK_FUNCS([issetugid])
|
||||
AC_MSG_CHECKING([whether pthread_mutex_t is larger than 24 bytes])
|
||||
AC_TRY_RUN(
|
||||
[
|
||||
#include <pthread.h>
|
||||
int main(void){return (sizeof(pthread_mutex_t) > 24);}
|
||||
],
|
||||
[AC_MSG_RESULT(yes)],
|
||||
[
|
||||
AC_MSG_RESULT(no)
|
||||
AC_DEFINE(UMEM_PTHREAD_MUTEX_TOO_BIG, [1], [need bigger cache])
|
||||
AC_MSG_WARN([*** increasing umem cpu cache size to compensate.])
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
AC_CHECK_HEADERS([sys/mman.h sys/sysmacros.h sys/time.h malloc.h])
|
||||
AC_CHECK_FUNCS([issetugid mallinfo malloc_stats])
|
||||
|
||||
AC_CONFIG_HEADERS([config.h])
|
||||
AC_CONFIG_FILES([Makefile Doxyfile umem.spec])
|
||||
|
|
21
umem_test3.c
21
umem_test3.c
|
@ -1,14 +1,35 @@
|
|||
#include "config.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#if defined(HAVE_MALLOC_H) && defined(HAVE_MALLINFO)
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
|
||||
static void minfo(void)
|
||||
{
|
||||
#if defined(HAVE_MALLOC_H) && defined(HAVE_MALLINFO)
|
||||
struct mallinfo mi;
|
||||
mi = mallinfo();
|
||||
printf(" fordblks = %d\n", mi.fordblks);
|
||||
malloc_stats();
|
||||
printf("\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
char *p;
|
||||
|
||||
minfo();
|
||||
p = malloc(10);
|
||||
free(p);
|
||||
minfo();
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
/* vim:ts=2:sw=2:et:
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue