/* * ISA 563, Spring 2011 * Copyleft by Muhammad Abdulla */ #include #define __USE_GNU #include /* * imalloc.c -- demonstrates library interposition of malloc function */ void *malloc(size_t size) { static void * (*func)(); if(!func) { func = (void *(*)()) dlsym(RTLD_NEXT, "malloc"); } printf("malloc is called with size %d\n", size); return(func(size)); }