chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
timedated: move sources to subdirectory
[elogind.git]
/
src
/
initctl.c
diff --git
a/src/initctl.c
b/src/initctl.c
index f36f1cc704fd49417004dd5593fcf5271c13149a..097c85fdd4c8c897a8912c95954c2a89d7d97ded 100644
(file)
--- a/
src/initctl.c
+++ b/
src/initctl.c
@@
-56,6
+56,8
@@
typedef struct Server {
unsigned n_fifos;
DBusConnection *bus;
unsigned n_fifos;
DBusConnection *bus;
+
+ bool quit;
} Server;
struct Fifo {
} Server;
struct Fifo {
@@
-93,6
+95,8
@@
static const char *translate_runlevel(int runlevel, bool *isolate) {
for (i = 0; i < ELEMENTSOF(table); i++)
if (table[i].runlevel == runlevel) {
*isolate = table[i].isolate;
for (i = 0; i < ELEMENTSOF(table); i++)
if (table[i].runlevel == runlevel) {
*isolate = table[i].isolate;
+ if (runlevel == '6' && kexec_loaded())
+ return SPECIAL_KEXEC_TARGET;
return table[i].special;
}
return table[i].special;
}
@@
-172,6
+176,13
@@
static void request_process(Server *s, const struct init_request *req) {
case 'U':
if (kill(1, SIGTERM) < 0)
log_error("kill() failed: %m");
case 'U':
if (kill(1, SIGTERM) < 0)
log_error("kill() failed: %m");
+
+ /* The bus connection will be
+ * terminated if PID 1 is reexecuted,
+ * hence let's just exit here, and
+ * rely on that we'll be restarted on
+ * the next request */
+ s->quit = true;
break;
case 'q':
break;
case 'q':
@@
-402,7
+413,7
@@
int main(int argc, char *argv[]) {
"READY=1\n"
"STATUS=Processing requests...");
"READY=1\n"
"STATUS=Processing requests...");
-
for (;;
) {
+
while (!server.quit
) {
struct epoll_event event;
int k;
struct epoll_event event;
int k;