Mirror of strace – the linux syscall tracer
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

mmap_notify.c 657B

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