File: mmap_notify.c

package info (click to toggle)
strace 5.10-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 49,332 kB
  • sloc: ansic: 113,177; sh: 8,831; makefile: 3,108; awk: 364; perl: 267; sed: 9
file content (34 lines) | stat: -rw-r--r-- 657 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/*
 * 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);
}