Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ISC Open Source Projects
BIND
Commits
a24d253a
Commit
a24d253a
authored
Sep 06, 2001
by
Mark Andrews
Browse files
982. [func] If "memstatistics-file" is set in options the memory
statistics will be written to it.
parent
eb70ba21
Changes
7
Hide whitespace changes
Inline
Side-by-side
CHANGES
View file @
a24d253a
982. [func] If "memstatistics-file" is set in options the memory
statistics will be written to it.
981. [func] The dnssec tools can now take multiple '-r randomfile'
arguments.
...
...
bin/named/main.c
View file @
a24d253a
...
...
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: main.c,v 1.1
19
2001/0
8
/0
8 22:54:20 gson
Exp $ */
/* $Id: main.c,v 1.1
20
2001/0
9
/0
6 02:13:48 marka
Exp $ */
#include
<config.h>
...
...
@@ -31,6 +31,7 @@
#include
<isc/os.h>
#include
<isc/platform.h>
#include
<isc/resource.h>
#include
<isc/stdio.h>
#include
<isc/task.h>
#include
<isc/timer.h>
#include
<isc/util.h>
...
...
@@ -532,6 +533,7 @@ cleanup(void) {
int
main
(
int
argc
,
char
*
argv
[])
{
isc_result_t
result
;
static
const
char
*
memstats
;
result
=
isc_file_progname
(
*
argv
,
program_name
,
sizeof
(
program_name
));
if
(
result
!=
ISC_R_SUCCESS
)
...
...
@@ -590,6 +592,16 @@ main(int argc, char *argv[]) {
isc_mem_stats
(
ns_g_mctx
,
stdout
);
isc_mutex_stats
(
stdout
);
}
memstats
=
ns_os_getmemstats
();
if
(
memstats
)
{
FILE
*
fp
=
NULL
;
result
=
isc_stdio_open
(
memstats
,
"w"
,
&
fp
);
if
(
result
==
ISC_R_SUCCESS
)
{
isc_mem_stats
(
ns_g_mctx
,
fp
);
isc_mutex_stats
(
fp
);
isc_stdio_close
(
fp
);
}
}
isc_mem_destroy
(
&
ns_g_mctx
);
isc_app_finish
();
...
...
bin/named/server.c
View file @
a24d253a
...
...
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: server.c,v 1.34
0
2001/0
8/30 05:52:12
marka Exp $ */
/* $Id: server.c,v 1.34
1
2001/0
9/06 02:13:50
marka Exp $ */
#include
<config.h>
...
...
@@ -2043,6 +2043,13 @@ load_configuration(const char *filename, ns_server_t *server,
ns_os_writepidfile
(
lwresd_g_defaultpidfile
);
else
ns_os_writepidfile
(
ns_g_defaultpidfile
);
obj
=
NULL
;
if
(
options
!=
NULL
&&
cfg_map_get
(
options
,
"memstatistics-file"
,
&
obj
)
==
ISC_R_SUCCESS
)
ns_os_setmemstats
(
cfg_obj_asstring
(
obj
));
else
ns_os_setmemstats
(
NULL
);
obj
=
NULL
;
result
=
ns_config_get
(
maps
,
"statistics-file"
,
&
obj
);
...
...
bin/named/unix/include/named/os.h
View file @
a24d253a
...
...
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: os.h,v 1.1
4
2001/0
1
/0
9 21:40:39 bwelling
Exp $ */
/* $Id: os.h,v 1.1
5
2001/0
9
/0
6 02:13:52 marka
Exp $ */
#ifndef NS_OS_H
#define NS_OS_H 1
...
...
@@ -43,6 +43,12 @@ ns_os_minprivs(void);
void
ns_os_writepidfile
(
const
char
*
filename
);
void
ns_os_setmemstats
(
const
char
*
filename
);
const
char
*
ns_os_getmemstats
(
void
);
void
ns_os_shutdown
(
void
);
...
...
bin/named/unix/os.c
View file @
a24d253a
...
...
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: os.c,v 1.4
7
2001/0
8/31 05:57:45
marka Exp $ */
/* $Id: os.c,v 1.4
8
2001/0
9/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
();
}
bin/named/win32/include/named/os.h
View file @
a24d253a
...
...
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: os.h,v 1.
1
2001/0
7/18 03:43:18 mayer
Exp $ */
/* $Id: os.h,v 1.
2
2001/0
9/06 02:13:55 marka
Exp $ */
#ifndef NS_OS_H
#define NS_OS_H 1
...
...
@@ -43,6 +43,12 @@ ns_os_minprivs(void);
void
ns_os_writepidfile
(
const
char
*
filename
);
void
ns_os_setmemstats
(
const
char
*
filename
);
const
char
*
ns_os_getmemstats
(
void
);
void
ns_os_shutdown
(
void
);
...
...
bin/named/win32/os.c
View file @
a24d253a
...
...
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: os.c,v 1.
5
2001/0
8
/0
9 23:44:13 mayer
Exp $ */
/* $Id: os.c,v 1.
6
2001/0
9
/0
6 02:13:54 marka
Exp $ */
#include
<config.h>
#include
<stdarg.h>
...
...
@@ -43,6 +43,7 @@
static
char
*
pidfile
=
NULL
;
static
char
*
memstats
=
NULL
;
static
BOOL
Initialized
=
FALSE
;
...
...
@@ -198,9 +199,32 @@ ns_os_writepidfile(const char *filename) {
(
void
)
fclose
(
lockfile
);
}
static
inline
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
!=
NULL
)
strcpy
(
memstats
,
filename
);
}
const
char
*
ns_os_getmemstats
(
void
)
{
return
(
memstats
);
}
void
ns_os_shutdown
(
void
)
{
closelog
();
cleanup_pidfile
();
cleanup_memstats
();
ntservice_shutdown
();
/* This MUST be the last thing done */
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment