(root)/
strace-6.5/
src/
mmap_notify.c
       1  /*
       2   * Copyright (c) 2018-2021 The strace developers.
       3   *
       4   * SPDX-License-Identifier: LGPL-2.1-or-later
       5   */
       6  
       7  #include "mmap_notify.h"
       8  
       9  struct mmap_notify_client {
      10  	mmap_notify_fn fn;
      11  	void *data;
      12  	struct mmap_notify_client *next;
      13  };
      14  
      15  static struct mmap_notify_client *clients;
      16  
      17  void
      18  mmap_notify_register_client(mmap_notify_fn fn, void *data)
      19  {
      20  	struct mmap_notify_client *client = xmalloc(sizeof(*client));
      21  	client->fn = fn;
      22  	client->data = data;
      23  	client->next = clients;
      24  	clients = client;
      25  }
      26  
      27  void
      28  mmap_notify_report(struct tcb *tcp)
      29  {
      30  	for (struct mmap_notify_client *client = clients;
      31  	     client; client = client->next)
      32  		client->fn(tcp, client->data);
      33  }