]> granicus.if.org Git - strace/blob - mmap_notify.c
Add PAF_ARRAY_TRUNCATED flag for print_array_ex
[strace] / mmap_notify.c
1 /*
2  * Copyright (c) 2018 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         struct mmap_notify_client *client;
31
32         for (client = clients; client; client = client->next)
33                 client->fn(tcp, client->data);
34 }