summaryrefslogtreecommitdiff
path: root/src/lib/malloc/map_anon.h
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2019-04-03 10:57:06 -0400
committerNick Mathewson <nickm@torproject.org>2019-04-04 12:56:52 -0400
commit76912bf140ec61856c0bb0d25354283d024229f5 (patch)
tree7cc9b92ec6f4a041a2d9385bc263a929dcf273c4 /src/lib/malloc/map_anon.h
parent8c06f02c94067d7ad1bf39982e7238b7fafae0e0 (diff)
downloadtor-76912bf140ec61856c0bb0d25354283d024229f5.tar.gz
tor-76912bf140ec61856c0bb0d25354283d024229f5.zip
Use an enum for inherit_result_out.
Diffstat (limited to 'src/lib/malloc/map_anon.h')
-rw-r--r--src/lib/malloc/map_anon.h22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/lib/malloc/map_anon.h b/src/lib/malloc/map_anon.h
index f101654eb8..6c02cd6c16 100644
--- a/src/lib/malloc/map_anon.h
+++ b/src/lib/malloc/map_anon.h
@@ -31,15 +31,17 @@
*/
#define ANONMAP_NOINHERIT (1u<<1)
-/** Possible value for inherit_result_out: the memory will be kept
- * by any child process. */
-#define INHERIT_RES_KEEP 0
-/** Possible value for inherit_result_out: the memory will be dropped in
- * the child process. Attempting to access it will likely cause a segfault. */
-#define INHERIT_RES_DROP 1
-/** Possible value for inherit_result_out: the memory will be cleared in
- * the child process. */
-#define INHERIT_RES_ZERO 2
+typedef enum {
+ /** Possible value for inherit_result_out: the memory will be kept
+ * by any child process. */
+ INHERIT_RES_KEEP=0,
+ /** Possible value for inherit_result_out: the memory will be dropped in the
+ * child process. Attempting to access it will likely cause a segfault. */
+ INHERIT_RES_DROP,
+ /** Possible value for inherit_result_out: the memory will be cleared in
+ * the child process. */
+ INHERIT_RES_ZERO
+} inherit_res_t;
/* Here we define the NOINHERIT_CAN_FAIL macro if and only if
* it's possible that ANONMAP_NOINHERIT might yield inheritable memory.
@@ -63,7 +65,7 @@
#endif
void *tor_mmap_anonymous(size_t sz, unsigned flags,
- unsigned *inherit_result_out);
+ inherit_res_t *inherit_result_out);
void tor_munmap_anonymous(void *mapping, size_t sz);
#endif /* !defined(TOR_MAP_ANON_H) */