map_anon.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. /* Copyright (c) 2003-2004, Roger Dingledine
  2. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
  3. * Copyright (c) 2007-2019, The Tor Project, Inc. */
  4. /* See LICENSE for licensing information */
  5. /**
  6. * \file map_anon.h
  7. * \brief Headers for map_anon.c
  8. **/
  9. #ifndef TOR_MAP_ANON_H
  10. #define TOR_MAP_ANON_H
  11. #include "lib/malloc/malloc.h"
  12. #include <stddef.h>
  13. /**
  14. * When this flag is specified, try to prevent the mapping from being
  15. * swapped or dumped.
  16. *
  17. * In some operating systems, this flag is not implemented.
  18. */
  19. #define ANONMAP_PRIVATE (1u<<0)
  20. /**
  21. * When this flag is specified, try to prevent the mapping from being
  22. * inherited after a fork(). In some operating systems, trying to access it
  23. * afterwards will cause its contents to be zero. In others, trying to access
  24. * it afterwards will cause a crash.
  25. *
  26. * In some operating systems, this flag is not implemented at all.
  27. */
  28. #define ANONMAP_NOINHERIT (1u<<1)
  29. void *tor_mmap_anonymous(size_t sz, unsigned flags);
  30. void tor_munmap_anonymous(void *mapping, size_t sz);
  31. #endif /* !defined(TOR_MAP_ANON_H) */