Dmitry V. Levin
b93d52fe3d
strace is now provided under the terms of the GNU Lesser General Public License version 2.1 or later, see COPYING for more details. strace test suite is now provided under the terms of the GNU General Public License version 2 or later, see tests/COPYING for more details.
35 lines
657 B
C
35 lines
657 B
C
/*
|
|
* Copyright (c) 2018 The strace developers.
|
|
*
|
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
|
*/
|
|
|
|
#include "mmap_notify.h"
|
|
|
|
struct mmap_notify_client {
|
|
mmap_notify_fn fn;
|
|
void *data;
|
|
struct mmap_notify_client *next;
|
|
};
|
|
|
|
static struct mmap_notify_client *clients;
|
|
|
|
void
|
|
mmap_notify_register_client(mmap_notify_fn fn, void *data)
|
|
{
|
|
struct mmap_notify_client *client = xmalloc(sizeof(*client));
|
|
client->fn = fn;
|
|
client->data = data;
|
|
client->next = clients;
|
|
clients = client;
|
|
}
|
|
|
|
void
|
|
mmap_notify_report(struct tcb *tcp)
|
|
{
|
|
struct mmap_notify_client *client;
|
|
|
|
for (client = clients; client; client = client->next)
|
|
client->fn(tcp, client->data);
|
|
}
|