2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 14:35:26 +00:00

982. [func] If "memstatistics-file" is set in options the memory

statistics will be written to it.
This commit is contained in:
Mark Andrews
2001-09-06 02:13:55 +00:00
parent eb70ba210b
commit a24d253a3f
7 changed files with 88 additions and 6 deletions

View File

@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: os.c,v 1.47 2001/08/31 05:57:45 marka Exp $ */
/* $Id: os.c,v 1.48 2001/09/06 02:13:51 marka Exp $ */
#include <config.h>
#include <stdarg.h>
@@ -43,6 +43,7 @@
#include <named/os.h>
static char *pidfile = NULL;
static char *memstats = NULL;
/*
* If there's no <linux/capability.h>, we don't care about <sys/prctl.h>
@@ -515,8 +516,32 @@ ns_os_writepidfile(const char *filename) {
(void)fclose(lockfile);
}
static inline void
cleanup_memstats(void) {
if (memstats != NULL)
free(memstats);
memstats = NULL;
}
void
ns_os_setmemstats(const char *filename) {
cleanup_memstats();
if (filename == NULL)
return;
memstats = malloc(strlen(filename) + 1);
if (memstats)
strcpy(memstats, filename);
}
const char *
ns_os_getmemstats(void) {
return (memstats);
}
void
ns_os_shutdown(void) {
closelog();
cleanup_pidfile();
cleanup_memstats();
}