Enable profiling / leak detection in FreeBSD

* Assumes procfs is mounted at /proc, cf.
  <http://www.freebsd.org/doc/en/articles/linux-users/procfs.html>
This commit is contained in:
Harald Weppner
2014-03-17 23:53:00 -07:00
parent 9e20df163c
commit bf543df20c
2 changed files with 27 additions and 3 deletions

View File

@@ -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) {