113 lines
3.4 KiB
Diff
113 lines
3.4 KiB
Diff
diff -urN upstart-0.3.9-old/compat/sysv/telinit.c upstart-0.3.9/compat/sysv/telinit.c
|
|
--- upstart-0.3.9-old/compat/sysv/telinit.c 2008-04-09 00:52:06.000000000 -0400
|
|
+++ upstart-0.3.9/compat/sysv/telinit.c 2008-04-09 01:02:39.000000000 -0400
|
|
@@ -113,9 +113,11 @@
|
|
NULL, UPSTART_INIT_DAEMON,
|
|
UPSTART_EVENT_EMIT, "runlevel", args, NULL));
|
|
break;
|
|
- case 'u':
|
|
- kill (UPSTART_INIT_DAEMON, SIGTERM);
|
|
- exit (0);
|
|
+ case 'u':
|
|
+ NIH_MUST (message = upstart_message_new (
|
|
+ NULL, UPSTART_INIT_DAEMON,
|
|
+ UPSTART_RESTART, NULL));
|
|
+ break;
|
|
default:
|
|
/* Ignore other arguments */
|
|
exit (0);
|
|
diff -urN upstart-0.3.9-old/init/control.c upstart-0.3.9/init/control.c
|
|
--- upstart-0.3.9-old/init/control.c 2008-04-09 00:52:06.000000000 -0400
|
|
+++ upstart-0.3.9/init/control.c 2008-04-09 01:01:41.000000000 -0400
|
|
@@ -29,6 +29,7 @@
|
|
|
|
#include <errno.h>
|
|
#include <unistd.h>
|
|
+#include <signal.h>
|
|
#include <fnmatch.h>
|
|
|
|
#include <nih/macros.h>
|
|
@@ -52,6 +53,8 @@
|
|
static void control_error_handler (void *data, NihIo *io);
|
|
static int control_version_query (void *data, pid_t pid,
|
|
UpstartMessageType type);
|
|
+static int control_restart (void *data, pid_t pid,
|
|
+ UpstartMessageType type);
|
|
static int control_log_priority (void *data, pid_t pid,
|
|
UpstartMessageType type,
|
|
NihLogLevel priority);
|
|
@@ -102,6 +105,8 @@
|
|
static UpstartMessage message_handlers[] = {
|
|
{ -1, UPSTART_VERSION_QUERY,
|
|
(UpstartMessageHandler)control_version_query },
|
|
+ { -1, UPSTART_RESTART,
|
|
+ (UpstartMessageHandler)control_restart },
|
|
{ -1, UPSTART_PUSH_TTY,
|
|
(UpstartMessageHandler)control_push_tty },
|
|
{ -1, UPSTART_POP_TTY,
|
|
@@ -319,6 +324,32 @@
|
|
}
|
|
|
|
/**
|
|
+ * control_restart:
|
|
+ * @data: data pointer,
|
|
+ * @pid: origin process id,
|
|
+ * @type: message type received.
|
|
+ *
|
|
+ * This function is called when another process on the system asks us to
|
|
+ * re-execute
|
|
+ *
|
|
+ * Returns: zero on success, negative value on raised error.
|
|
+ **/
|
|
+static int
|
|
+control_restart (void *data,
|
|
+ pid_t pid,
|
|
+ UpstartMessageType type)
|
|
+{
|
|
+ nih_assert (pid > 0);
|
|
+ nih_assert (type == UPSTART_RESTART);
|
|
+
|
|
+ nih_info (_("Control request to restart daemon"));
|
|
+
|
|
+ kill(getpid(), SIGTERM);
|
|
+
|
|
+ return 0;
|
|
+}
|
|
+
|
|
+/**
|
|
* control_push_tty:
|
|
* @data: data pointer,
|
|
* @pid: origin process id,
|
|
diff -urN upstart-0.3.9-old/upstart/message.c upstart-0.3.9/upstart/message.c
|
|
--- upstart-0.3.9-old/upstart/message.c 2008-04-09 00:52:06.000000000 -0400
|
|
+++ upstart-0.3.9/upstart/message.c 2008-04-09 00:55:03.000000000 -0400
|
|
@@ -259,6 +259,8 @@
|
|
switch (type) {
|
|
case UPSTART_NO_OP:
|
|
break;
|
|
+ case UPSTART_RESTART:
|
|
+ break;
|
|
case UPSTART_VERSION_QUERY:
|
|
break;
|
|
case UPSTART_POP_TTY:
|
|
@@ -564,6 +566,9 @@
|
|
case UPSTART_VERSION_QUERY:
|
|
ret = handler (data, cred.pid, type);
|
|
break;
|
|
+ case UPSTART_RESTART:
|
|
+ ret = handler (data, cred.pid, type);
|
|
+ break;
|
|
case UPSTART_POP_TTY:
|
|
ret = handler (data, cred.pid, type);
|
|
break;
|
|
diff -urN upstart-0.3.9-old/upstart/message.h upstart-0.3.9/upstart/message.h
|
|
--- upstart-0.3.9-old/upstart/message.h 2008-04-09 00:52:06.000000000 -0400
|
|
+++ upstart-0.3.9/upstart/message.h 2008-04-09 00:55:58.000000000 -0400
|
|
@@ -67,6 +67,7 @@
|
|
UPSTART_NO_OP = 0x0000,
|
|
UPSTART_VERSION_QUERY = 0x0001,
|
|
UPSTART_LOG_PRIORITY = 0x0002,
|
|
+ UPSTART_RESTART = 0x0005,
|
|
UPSTART_VERSION = 0x0010,
|
|
UPSTART_PUSH_TTY = 0x0011,
|
|
UPSTART_POP_TTY = 0x0012,
|