[PATCH 1/4] mmap_cache: add customizable search function

Dmitry V. Levin ldv at altlinux.org
Mon May 14 11:34:11 UTC 2018


On Mon, May 07, 2018 at 08:26:01PM +0900, Masatake YAMATO wrote:
> * 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 at redhat.com>
> ---
>  mmap_cache.c | 12 ++++++++++++
>  mmap_cache.h |  5 +++++
>  2 files changed, 17 insertions(+)
> 
> diff --git a/mmap_cache.c b/mmap_cache.c
> index 631133b5..3ac1853e 100644
> --- a/mmap_cache.c
> +++ b/mmap_cache.c
> @@ -235,3 +235,15 @@ mmap_cache_search(struct tcb *tcp, unsigned long ip)
>  	}
>  	return NULL;
>  }
> +
> +struct mmap_cache_entry_t *
> +mmap_cache_search_custom(struct tcb *tcp, mmap_cache_search_fn search_fn, void *data)
> +{
> +	unsigned int i;
> +
> +	for (i = 0; i <= tcp->mmap_cache->size; i++) {

Did you mean "i < tcp->mmap_cache->size"?

Also, we use loop initial declarations in new code.


-- 
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20180514/c6bf3f26/attachment.bin>


More information about the Strace-devel mailing list