summaryrefslogtreecommitdiffstats
path: root/init.c
diff options
context:
space:
mode:
Diffstat (limited to 'init.c')
-rw-r--r--init.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/init.c b/init.c
index 82c1000..a225c26 100644
--- a/init.c
+++ b/init.c
@@ -36,6 +36,7 @@
#include "ps.h"
#include "lladdr.h"
#include "ping.h"
+#include "mstats.h"
#include "memdbg.h"
@@ -815,6 +816,22 @@ init_static (void)
}
#endif
+#ifdef MSTATS_TEST
+ {
+ int i;
+ mstats_open("/dev/shm/mstats.dat");
+ for (i = 0; i < 30; ++i)
+ {
+ mmap_stats->n_clients += 1;
+ mmap_stats->link_write_bytes += 8;
+ mmap_stats->link_read_bytes += 16;
+ sleep(1);
+ }
+ mstats_close();
+ return false;
+ }
+#endif
+
return true;
}
@@ -1014,6 +1031,11 @@ do_uid_gid_chroot (struct context *c, bool no_delay)
msg (M_INFO, "NOTE: UID/GID downgrade %s", why_not);
}
+#ifdef ENABLE_MEMSTATS
+ if (c->options.memstats_fn)
+ mstats_open(c->options.memstats_fn);
+#endif
+
#ifdef HAVE_SETCON
/* Apply a SELinux context in order to restrict what OpenVPN can do
* to _only_ what it is supposed to do after initialization is complete