6 void *mmap(void *start, size_t length, int prot, int flags, int fd, off_t offset)
9 static void *(*mmap_orig)(void *, size_t , int , int , int, off_t );
16 h = dlopen("/lib/libc.so.6", RTLD_LAZY);
17 mmap_orig = dlsym(h, "mmap");
18 log_fd = open("/tmp/mmap.log", O_WRONLY|O_CREAT|O_APPEND, 0666);
21 ret = mmap_orig(start, length, prot, flags, fd, offset);
23 n = snprintf(buf, sizeof(buf), "mmap(%p, 0x%x, 0x%x, 0x%x, %d, 0x%x) = %p\n",
24 start, length, prot, flags, fd, offset, ret);
26 write(log_fd, buf, n);