summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHarald Weppner <harald.weppner@tidalscale.com>2014-03-18 06:53:00 (GMT)
committerHarald Weppner <harald.weppner@tidalscale.com>2014-03-18 06:53:00 (GMT)
commitbf543df20ccd9e2c422751908cabf073bc7f5d4b (patch)
treede8cdd4edcddb50d79f33c0c519d2eb57a018a21 /src
parent9e20df163c0c608026498b8fb5beab35e8a049c6 (diff)
downloadjemalloc-bf543df20ccd9e2c422751908cabf073bc7f5d4b.zip
jemalloc-bf543df20ccd9e2c422751908cabf073bc7f5d4b.tar.gz
jemalloc-bf543df20ccd9e2c422751908cabf073bc7f5d4b.tar.bz2
Enable profiling / leak detection in FreeBSD
* Assumes procfs is mounted at /proc, cf. <http://www.freebsd.org/doc/en/articles/linux-users/procfs.html>
Diffstat (limited to 'src')
-rw-r--r--src/prof.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/prof.c b/src/prof.c
index 1d8ccbd..ede89a7 100644
--- a/src/prof.c
+++ b/src/prof.c
@@ -11,6 +11,12 @@
#include <unwind.h>
#endif
+#ifdef __FreeBSD__
+#define PROCESS_VMEM_MAP "/proc/curproc/map"
+#else
+#define PROCESS_VMEM_MAP "/proc/%d/maps"
+#endif
+
/******************************************************************************/
/* Data. */
@@ -936,7 +942,7 @@ prof_dump_maps(bool propagate_err)
cassert(config_prof);
- malloc_snprintf(filename, sizeof(filename), "/proc/%d/maps",
+ malloc_snprintf(filename, sizeof(filename), PROCESS_VMEM_MAP,
(int)getpid());
mfd = open(filename, O_RDONLY);
if (mfd != -1) {