mirror of
https://github.com/isc-projects/bind9.git
synced 2026-04-15 22:09:31 -04:00
1153. [func] 'rndc {stop|halt} -p' now reports the process id
of the instance of named being shutdown.
This commit is contained in:
parent
439a2f855b
commit
cf300e03de
7 changed files with 73 additions and 6 deletions
3
CHANGES
3
CHANGES
|
|
@ -1,3 +1,6 @@
|
|||
1153. [func] 'rndc {stop|halt} -p' now reports the process id
|
||||
of the instance of named being shutdown.
|
||||
|
||||
1152. [bug] libbind: read buffer overflows.
|
||||
|
||||
1151. [bug] nslookup failed to check that the arguments to
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: control.c,v 1.9 2001/11/27 04:06:08 marka Exp $ */
|
||||
/* $Id: control.c,v 1.10 2001/12/01 00:34:22 marka Exp $ */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
|
|
@ -32,6 +32,7 @@
|
|||
|
||||
#include <named/control.h>
|
||||
#include <named/log.h>
|
||||
#include <named/os.h>
|
||||
#include <named/server.h>
|
||||
|
||||
static isc_boolean_t
|
||||
|
|
@ -89,10 +90,12 @@ ns_control_docommand(isccc_sexpr_t *message, isc_buffer_t *text) {
|
|||
result = ns_server_retransfercommand(ns_g_server, command);
|
||||
} else if (command_compare(command, NS_COMMAND_HALT)) {
|
||||
ns_server_flushonshutdown(ns_g_server, ISC_FALSE);
|
||||
ns_os_shutdownmsg(command, text);
|
||||
isc_app_shutdown();
|
||||
result = ISC_R_SUCCESS;
|
||||
} else if (command_compare(command, NS_COMMAND_STOP)) {
|
||||
ns_server_flushonshutdown(ns_g_server, ISC_TRUE);
|
||||
ns_os_shutdownmsg(command, text);
|
||||
isc_app_shutdown();
|
||||
result = ISC_R_SUCCESS;
|
||||
} else if (command_compare(command, NS_COMMAND_DUMPSTATS)) {
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: os.h,v 1.17 2001/10/08 07:46:08 marka Exp $ */
|
||||
/* $Id: os.h,v 1.18 2001/12/01 00:34:24 marka Exp $ */
|
||||
|
||||
#ifndef NS_OS_H
|
||||
#define NS_OS_H 1
|
||||
|
|
@ -49,4 +49,7 @@ ns_os_shutdown(void);
|
|||
isc_result_t
|
||||
ns_os_gethostname(char *buf, size_t len);
|
||||
|
||||
void
|
||||
ns_os_shutdownmsg(char *command, isc_buffer_t *text);
|
||||
|
||||
#endif /* NS_OS_H */
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: os.c,v 1.56 2001/11/30 01:58:54 gson Exp $ */
|
||||
/* $Id: os.c,v 1.57 2001/12/01 00:34:23 marka Exp $ */
|
||||
|
||||
#include <config.h>
|
||||
#include <stdarg.h>
|
||||
|
|
@ -33,6 +33,7 @@
|
|||
#include <syslog.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <isc/buffer.h>
|
||||
#include <isc/file.h>
|
||||
#include <isc/print.h>
|
||||
#include <isc/result.h>
|
||||
|
|
@ -535,3 +536,48 @@ ns_os_gethostname(char *buf, size_t len) {
|
|||
return ((n == 0) ? ISC_R_SUCCESS : ISC_R_FAILURE);
|
||||
}
|
||||
|
||||
static char *
|
||||
next_token(char **stringp, const char *delim) {
|
||||
char *res;
|
||||
|
||||
do {
|
||||
res = strsep(stringp, delim);
|
||||
if (res == NULL)
|
||||
break;
|
||||
} while (*res == '\0');
|
||||
return (res);
|
||||
}
|
||||
|
||||
void
|
||||
ns_os_shutdownmsg(char *command, isc_buffer_t *text) {
|
||||
char *input, *ptr;
|
||||
unsigned int n;
|
||||
pid_t pid;
|
||||
|
||||
input = command;
|
||||
|
||||
/* Skip the command name. */
|
||||
ptr = next_token(&input, " \t");
|
||||
if (ptr == NULL)
|
||||
return;
|
||||
|
||||
ptr = next_token(&input, " \t");
|
||||
if (ptr == NULL)
|
||||
return;
|
||||
|
||||
if (strcmp(ptr, "-p") != 0)
|
||||
return;
|
||||
|
||||
#ifdef HAVE_LINUXTHREADS
|
||||
pid = mainpid;
|
||||
#else
|
||||
pid = getpid();
|
||||
#endif
|
||||
|
||||
n = snprintf((char *)isc_buffer_used(text),
|
||||
isc_buffer_availablelength(text),
|
||||
"pid: %d", pid);
|
||||
/* Only send a message if it is complete. */
|
||||
if (n < isc_buffer_availablelength(text))
|
||||
isc_buffer_add(text, n);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: os.h,v 1.4 2001/10/08 07:46:11 marka Exp $ */
|
||||
/* $Id: os.h,v 1.5 2001/12/01 00:34:27 marka Exp $ */
|
||||
|
||||
#ifndef NS_OS_H
|
||||
#define NS_OS_H 1
|
||||
|
|
@ -49,4 +49,7 @@ ns_os_shutdown(void);
|
|||
isc_result_t
|
||||
ns_os_gethostname(char *buf, size_t len);
|
||||
|
||||
void
|
||||
ns_os_shutdownmsg(char *command, isc_buffer_t *text);
|
||||
|
||||
#endif /* NS_OS_H */
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: os.c,v 1.12 2001/11/22 03:11:01 mayer Exp $ */
|
||||
/* $Id: os.c,v 1.13 2001/12/01 00:34:26 marka Exp $ */
|
||||
|
||||
#include <config.h>
|
||||
#include <stdarg.h>
|
||||
|
|
@ -223,3 +223,8 @@ ns_os_gethostname(char *buf, size_t len) {
|
|||
return ((n == 0) ? ISC_R_SUCCESS : ISC_R_FAILURE);
|
||||
}
|
||||
|
||||
void
|
||||
ns_os_shutdownmsg(char *command, isc_buffer_t *text) {
|
||||
UNUSED(command);
|
||||
UNUSED(text);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: rndc.c,v 1.88 2001/11/30 02:09:48 gson Exp $ */
|
||||
/* $Id: rndc.c,v 1.89 2001/12/01 00:34:20 marka Exp $ */
|
||||
|
||||
/*
|
||||
* Principal Author: DCL
|
||||
|
|
@ -100,7 +100,11 @@ command is one of the following:\n\
|
|||
querylog Toggle query logging.\n\
|
||||
dumpdb Dump cache(s) to the dump file (named_dump.db).\n\
|
||||
stop Save pending updates to master files and stop the server.\n\
|
||||
stop -p Save pending updates to master files and stop the server\n\
|
||||
reporting process id.\n\
|
||||
halt Stop the server without saving pending updates.\n\
|
||||
halt -p Stop the server without saving pending updates reporting\n\
|
||||
process id.\n\
|
||||
trace Increment debugging level by one.\n\
|
||||
trace level Change the debugging level.\n\
|
||||
notrace Set debugging level to 0.\n\
|
||||
|
|
|
|||
Loading…
Reference in a new issue