* mmap_cache.c (mmap_cache_search_custom): New function.
* mmap_cache.h (mmap_cache_search_fn): New type.
(mmap_cache_search_custom): New function prototype.
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
}
return NULL;
}
+
+struct mmap_cache_entry_t *
+mmap_cache_search_custom(struct tcb *tcp, mmap_cache_search_fn fn, void *data)
+{
+ for (unsigned int i = 0; i < tcp->mmap_cache->size; i++) {
+ if (fn(tcp->mmap_cache->entry + i, data))
+ return tcp->mmap_cache->entry + i;
+ }
+ return NULL;
+}
MMAP_CACHE_REBUILD_RENEWED,
};
+typedef bool (*mmap_cache_search_fn)(struct mmap_cache_entry_t *, void *);
+
extern void
mmap_cache_enable(void);
extern struct mmap_cache_entry_t *
mmap_cache_search(struct tcb *, unsigned long ip);
+extern struct mmap_cache_entry_t *
+mmap_cache_search_custom(struct tcb *, mmap_cache_search_fn, void *);
+
#endif /* !STRACE_MMAP_CACHE_H */